Go to the documentation of this file.
39 #define ZMBV_KEYFRAME 1
40 #define ZMBV_DELTAPAL 2
84 uint8_t *
src =
c->decomp_buf;
88 int d, dx, dy, bw2, bh2;
97 for (
i = 0;
i < 768;
i++)
102 src += ((
c->bx *
c->by * 2 + 3) & ~3);
105 for (y = 0; y <
c->height; y +=
c->bh) {
106 bh2 = ((
c->height - y) >
c->bh) ?
c->bh : (
c->height - y);
107 for (x = 0; x <
c->width; x +=
c->bw) {
108 uint8_t *
out, *tprev;
111 dx = mvec[
block] >> 1;
112 dy = mvec[
block + 1] >> 1;
115 bw2 = ((
c->width - x) >
c->bw) ?
c->bw : (
c->width - x);
119 tprev =
prev + x + dx + dy *
c->width;
122 for (j = 0; j < bh2; j++) {
123 if (my + j < 0 || my + j >=
c->height) {
125 }
else if (mx >= 0 && mx + bw2 <= c->
width){
126 memcpy(
out, tprev,
sizeof(*
out) * bw2);
128 for (
i = 0;
i < bw2;
i++) {
129 if (mx + i < 0 || mx + i >=
c->width)
141 for (j = 0; j < bh2; j++) {
142 for (
i = 0;
i < bw2;
i++)
151 if (
src -
c->decomp_buf !=
c->decomp_len)
153 src-
c->decomp_buf,
c->decomp_len);
163 uint8_t *
src =
c->decomp_buf;
167 int d, dx, dy, bw2, bh2;
173 prev = (uint16_t*)
c->prev;
176 src += ((
c->bx *
c->by * 2 + 3) & ~3);
179 for (y = 0; y <
c->height; y +=
c->bh) {
180 bh2 = ((
c->height - y) >
c->bh) ?
c->bh : (
c->height - y);
181 for (x = 0; x <
c->width; x +=
c->bw) {
182 uint16_t *
out, *tprev;
185 dx = mvec[
block] >> 1;
186 dy = mvec[
block + 1] >> 1;
189 bw2 = ((
c->width - x) >
c->bw) ?
c->bw : (
c->width - x);
193 tprev =
prev + x + dx + dy *
c->width;
196 for (j = 0; j < bh2; j++) {
197 if (my + j < 0 || my + j >=
c->height) {
198 memset(
out, 0, bw2 * 2);
199 }
else if (mx >= 0 && mx + bw2 <= c->
width){
200 memcpy(
out, tprev,
sizeof(*
out) * bw2);
202 for (
i = 0;
i < bw2;
i++) {
203 if (mx + i < 0 || mx + i >=
c->width)
215 for (j = 0; j < bh2; j++){
216 for (
i = 0;
i < bw2;
i++) {
227 if (
src -
c->decomp_buf !=
c->decomp_len)
229 src-
c->decomp_buf,
c->decomp_len);
233 #ifdef ZMBV_ENABLE_24BPP
240 uint8_t *
src =
c->decomp_buf;
244 int d, dx, dy, bw2, bh2;
255 src += ((
c->bx *
c->by * 2 + 3) & ~3);
258 for (y = 0; y <
c->height; y +=
c->bh) {
259 bh2 = ((
c->height - y) >
c->bh) ?
c->bh : (
c->height - y);
260 for (x = 0; x <
c->width; x +=
c->bw) {
261 uint8_t *
out, *tprev;
264 dx = mvec[
block] >> 1;
265 dy = mvec[
block + 1] >> 1;
268 bw2 = ((
c->width - x) >
c->bw) ?
c->bw : (
c->width - x);
275 for (j = 0; j < bh2; j++) {
276 if (my + j < 0 || my + j >=
c->height) {
277 memset(
out, 0, bw2 * 3);
278 }
else if (mx >= 0 && mx + bw2 <= c->
width){
279 memcpy(
out, tprev, 3 * bw2);
281 for (
i = 0;
i < bw2;
i++){
282 if (mx + i < 0 || mx + i >=
c->width) {
287 out[
i * 3 + 0] = tprev[
i * 3 + 0];
288 out[
i * 3 + 1] = tprev[
i * 3 + 1];
289 out[
i * 3 + 2] = tprev[
i * 3 + 2];
299 for (j = 0; j < bh2; j++) {
300 for (
i = 0;
i < bw2;
i++) {
312 if (
src -
c->decomp_buf !=
c->decomp_len)
314 src-
c->decomp_buf,
c->decomp_len);
317 #endif //ZMBV_ENABLE_24BPP
325 uint8_t *
src =
c->decomp_buf;
329 int d, dx, dy, bw2, bh2;
335 prev = (uint32_t*)
c->prev;
338 src += ((
c->bx *
c->by * 2 + 3) & ~3);
341 for (y = 0; y <
c->height; y +=
c->bh) {
342 bh2 = ((
c->height - y) >
c->bh) ?
c->bh : (
c->height - y);
343 for (x = 0; x <
c->width; x +=
c->bw) {
344 uint32_t *
out, *tprev;
347 dx = mvec[
block] >> 1;
348 dy = mvec[
block + 1] >> 1;
351 bw2 = ((
c->width - x) >
c->bw) ?
c->bw : (
c->width - x);
355 tprev =
prev + x + dx + dy *
c->width;
358 for (j = 0; j < bh2; j++) {
359 if (my + j < 0 || my + j >=
c->height) {
360 memset(
out, 0, bw2 * 4);
361 }
else if (mx >= 0 && mx + bw2 <= c->
width){
362 memcpy(
out, tprev,
sizeof(*
out) * bw2);
364 for (
i = 0;
i < bw2;
i++){
365 if (mx + i < 0 || mx + i >=
c->width)
377 for (j = 0; j < bh2; j++){
378 for (
i = 0;
i < bw2;
i++) {
389 if (
src -
c->decomp_buf !=
c->decomp_len)
391 src-
c->decomp_buf,
c->decomp_len);
400 uint8_t *
src =
c->decomp_buf;
404 memcpy(
c->pal,
src, 768);
408 memcpy(
c->cur,
src,
c->width *
c->height * (
c->bpp / 8));
415 const uint8_t *buf = avpkt->
data;
416 int buf_size = avpkt->
size;
420 int hi_ver, lo_ver,
ret;
439 c->decode_xor =
NULL;
444 "Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",
445 c->flags,hi_ver,lo_ver,
c->comp,
c->fmt,
c->bw,
c->bh);
446 if (hi_ver != 0 || lo_ver != 1) {
450 if (
c->bw == 0 ||
c->bh == 0) {
454 if (
c->comp != 0 &&
c->comp != 1) {
464 c->stride =
c->width;
474 c->stride =
c->width * 2;
476 #ifdef ZMBV_ENABLE_24BPP
479 c->decode_xor = zmbv_decode_xor_24;
481 c->stride =
c->width * 3;
483 #endif //ZMBV_ENABLE_24BPP
488 c->stride =
c->width * 4;
491 c->decode_xor =
NULL;
496 zret = inflateReset(&
c->zstream.zstream);
502 if (
c->alloc_bpp <
c->bpp) {
505 c->alloc_bpp =
c->bpp;
507 c->bx = (
c->width +
c->bw - 1) /
c->bw;
508 c->by = (
c->height+
c->bh - 1) /
c->bh;
509 if (!
c->cur || !
c->prev) {
520 expected_size = (
c->bx *
c->by * 2 + 3) & ~3;
524 expected_size += 768;
526 if (!
c->got_keyframe) {
532 if (
c->decomp_size <
len) {
536 memcpy(
c->decomp_buf, buf,
len);
539 z_stream *
const zstream = &
c->zstream.zstream;
545 zstream->avail_out =
c->decomp_size;
547 if (zret != Z_OK && zret != Z_STREAM_END) {
553 if (expected_size >
c->decomp_len ||
568 if (
c->decomp_len < 2LL * ((
c->width +
c->bw - 1) /
c->bw) * ((
c->height +
c->bh - 1) /
c->bh))
583 for (j = 0; j < 256; j++)
587 #ifdef ZMBV_ENABLE_24BPP
592 c->stride,
c->height);
625 if (!
c->decomp_buf) {
627 "Can't allocate decompression buffer.\n");
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
This structure describes decoded (raw) audio or video data.
const FFCodec ff_zmbv_decoder
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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.
AVCodec p
The public AVCodec.
static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
static int zmbv_decode_xor_8(ZmbvContext *c)
Decode XOR'ed frame - 8bpp version.
static av_cold int decode_init(AVCodecContext *avctx)
int(* decode_xor)(struct ZmbvContext *c)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
#define FF_CODEC_DECODE_CB(func)
int(* init)(AVBSFContext *ctx)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int64_t max_pixels
The number of pixels per image to maximally accept.
#define CODEC_LONG_NAME(str)
#define av_realloc_f(p, o, n)
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
#define PTRDIFF_SPECIFIER
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
enum AVPictureType pict_type
Picture type of the frame.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
static int zmbv_decode_xor_32(ZmbvContext *c)
Decode XOR'ed frame - 32bpp version.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
#define i(width, name, range_min, range_max)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const char * name
Name of the codec implementation.
void ff_inflate_end(FFZStream *zstream)
Wrapper around inflateEnd().
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
#define FFSWAP(type, a, b)
static av_cold int decode_end(AVCodecContext *avctx)
main external API structure.
@ AV_PICTURE_TYPE_P
Predicted.
#define avpriv_request_sample(...)
static int zmbv_decode_xor_16(ZmbvContext *c)
Decode XOR'ed frame - 15bpp and 16bpp version.
This structure stores compressed data.
int ff_inflate_init(FFZStream *zstream, void *logctx)
Wrapper around inflateInit().
int width
picture width / height.
static int zmbv_decode_intra(ZmbvContext *c)
Decode intraframe.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
The exact code depends on how similar the blocks are and how related they are to the block
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24