48 int compression, uint8_t **outbuf)
63 uint8_t *image_buf =
NULL;
75 if (bytestream2_get_le32u(gb) !=
VBN_MAGIC ||
82 width = bytestream2_get_le32u(gb);
83 height = bytestream2_get_le32u(gb);
84 components = bytestream2_get_le32u(gb);
85 format = bytestream2_get_le32u(gb);
86 pix_fmt = bytestream2_get_le32u(gb);
87 bytestream2_get_le32u(gb);
88 data_size = bytestream2_get_le32u(gb);
91 compression =
format & 0xffffff00;
111 linesize = avctx->
width * 3;
114 linesize = avctx->
width * 4;
121 av_log(avctx,
AV_LOG_ERROR,
"DXTx compression only supports 4 pixel aligned resolutions\n");
127 ctx->dec.tex_funct =
ctx->texdsp.dxt1_block;
128 ctx->dec.tex_ratio = 8;
131 ctx->dec.tex_funct =
ctx->texdsp.dxt5_block;
132 ctx->dec.tex_ratio = 16;
140 image_len =
decompress(avctx, gb, compression, &image_buf);
144 if (image_len < linesize * avctx->coded_height) {
155 uint8_t *flipped =
frame->data[0] +
frame->linesize[0] * (
frame->height - 1);
159 ctx->dec.tex_data.in = image_buf ? image_buf : gb->
buffer;
160 ctx->dec.raw_ratio = 16;
162 ctx->dec.stride = -
frame->linesize[0];
static const char *const format[]
const FFCodec ff_vbn_decoder
Libavcodec external API header.
static av_always_inline int bytestream2_get_bytes_left(const GetByteContext *g)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
static enum AVPixelFormat pix_fmt
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
Memory handling functions.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
int coded_width
Bitstream width / height, may be different from width/height e.g.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
TextureDSPThreadContext dec
static AVFormatContext * ctx
av_cold void ff_texturedsp_init(TextureDSPContext *c)
Texture block (4x4) module.
int ff_texturedsp_exec_decompress_threads(struct AVCodecContext *avctx, TextureDSPThreadContext *ctx)
#define VBN_COMPRESSION_NONE
static int decompress(AVCodecContext *avctx, GetByteContext *gb, int compression, uint8_t **outbuf)
static av_cold int vbn_init(AVCodecContext *avctx)
static int vbn_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)