43 void *
data,
int *got_frame,
48 int skip, blocks, zret, ret, intra = 0, bpp = s->
bpp;
52 ret = inflateReset(&s->
zstream);
68 ptrdiff_t linesize[4] = { frame->
linesize[0], 0, 0, 0 };
73 blocks = bytestream2_get_le16(&gb);
78 if (blocks * 8 >= 0xFFFF)
79 size = bytestream2_get_le24(&gb);
80 else if (blocks * 8 >= 0xFF)
81 size = bytestream2_get_le16(&gb);
83 size = bytestream2_get_byte(&gb);
95 if (zret != Z_STREAM_END) {
97 "Inflate failed with return code: %d.\n", zret);
101 ret = inflateReset(&s->
zstream);
110 for (
int i = 0; i < blocks; i++) {
114 w = bytestream2_get_le16(&bgb);
115 h = bytestream2_get_le16(&bgb);
116 if (x + bpp * (int64_t)w * h > INT_MAX)
139 for (
int i = 0; i < blocks; i++) {
143 w = bytestream2_get_le16(&gb);
144 h = bytestream2_get_le16(&gb);
145 if (x + bpp * (int64_t)w * h > INT_MAX)
168 x = bytestream2_get_le16(&gb);
169 y = bytestream2_get_le16(&gb);
170 w = bytestream2_get_le16(&gb);
171 h = bytestream2_get_le16(&gb);
173 if (blocks == 1 && x == 0 && y == 0 && w == avctx->
width && h == avctx->
height)
183 for (
int i = 0; i <
h; i++) {
185 s->
zstream.avail_out = w * bpp;
188 if (zret != Z_OK && zret != Z_STREAM_END) {
190 "Inflate failed with return code: %d.\n", zret);
229 zret = inflateInit(&s->
zstream);
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static av_cold int init(AVCodecContext *avctx)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
static av_cold int decode_close(AVCodecContext *avctx)
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
uint8_t block_data[65536 *8]
const char * name
Name of the codec implementation.
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
packed RGB 8:8:8, 24bpp, BGRBGR...
static av_cold int decode_init(AVCodecContext *avctx)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static av_always_inline int bytestream2_tell(GetByteContext *g)
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
int av_image_fill_black(uint8_t *dst_data[4], const ptrdiff_t dst_linesize[4], enum AVPixelFormat pix_fmt, enum AVColorRange range, int width, int height)
Overwrite the image data with black.
int key_frame
1 -> keyframe, 0-> not
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
#define AVERROR_EXTERNAL
Generic error in an external library.
This structure stores compressed data.
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.