37 #define ZMBV_KEYFRAME 1
38 #define ZMBV_DELTAPAL 2
85 int d, dx, dy, bw2, bh2;
94 for (i = 0; i < 768; i++)
99 src += ((c->
bx * c->
by * 2 + 3) & ~3);
102 for (y = 0; y < c->
height; y += c->
bh) {
104 for (x = 0; x < c->
width; x += c->
bw) {
108 dx = mvec[
block] >> 1;
109 dy = mvec[block + 1] >> 1;
116 tprev = prev + x + dx + dy * c->
width;
119 for (j = 0; j < bh2; j++) {
120 if (my + j < 0 || my + j >= c->
height) {
123 for (i = 0; i < bw2; i++) {
124 if (mx + i < 0 || mx + i >= c->
width)
136 for (j = 0; j < bh2; j++) {
137 for (i = 0; i < bw2; i++)
159 uint16_t *output, *
prev;
162 int d, dx, dy, bw2, bh2;
167 output = (uint16_t*)c->
cur;
168 prev = (uint16_t*)c->
prev;
171 src += ((c->
bx * c->
by * 2 + 3) & ~3);
174 for (y = 0; y < c->
height; y += c->
bh) {
176 for (x = 0; x < c->
width; x += c->
bw) {
177 uint16_t *out, *tprev;
180 dx = mvec[
block] >> 1;
181 dy = mvec[block + 1] >> 1;
188 tprev = prev + x + dx + dy * c->
width;
191 for (j = 0; j < bh2; j++) {
192 if (my + j < 0 || my + j >= c->
height) {
193 memset(out, 0, bw2 * 2);
195 for (i = 0; i < bw2; i++) {
196 if (mx + i < 0 || mx + i >= c->
width)
208 for (j = 0; j < bh2; j++){
209 for (i = 0; i < bw2; i++) {
210 out[i] ^= *((uint16_t*)src);
226 #ifdef ZMBV_ENABLE_24BPP
237 int d, dx, dy, bw2, bh2;
246 stride = c->
width * 3;
248 src += ((c->
bx * c->
by * 2 + 3) & ~3);
251 for (y = 0; y < c->
height; y += c->
bh) {
253 for (x = 0; x < c->
width; x += c->
bw) {
257 dx = mvec[
block] >> 1;
258 dy = mvec[block + 1] >> 1;
264 out = output + x * 3;
265 tprev = prev + (x + dx) * 3 + dy * stride;
268 for (j = 0; j < bh2; j++) {
269 if (my + j < 0 || my + j >= c->
height) {
270 memset(out, 0, bw2 * 3);
272 for (i = 0; i < bw2; i++){
273 if (mx + i < 0 || mx + i >= c->
width) {
278 out[i * 3 + 0] = tprev[i * 3 + 0];
279 out[i * 3 + 1] = tprev[i * 3 + 1];
280 out[i * 3 + 2] = tprev[i * 3 + 2];
289 out = output + x * 3;
290 for (j = 0; j < bh2; j++) {
291 for (i = 0; i < bw2; i++) {
292 out[i * 3 + 0] ^= *src++;
293 out[i * 3 + 1] ^= *src++;
294 out[i * 3 + 2] ^= *src++;
300 output += stride * c->
bh;
301 prev += stride * c->
bh;
308 #endif //ZMBV_ENABLE_24BPP
317 uint32_t *output, *
prev;
320 int d, dx, dy, bw2, bh2;
325 output = (uint32_t*)c->
cur;
326 prev = (uint32_t*)c->
prev;
329 src += ((c->
bx * c->
by * 2 + 3) & ~3);
332 for (y = 0; y < c->
height; y += c->
bh) {
334 for (x = 0; x < c->
width; x += c->
bw) {
335 uint32_t *out, *tprev;
338 dx = mvec[
block] >> 1;
339 dy = mvec[block + 1] >> 1;
346 tprev = prev + x + dx + dy * c->
width;
349 for (j = 0; j < bh2; j++) {
350 if (my + j < 0 || my + j >= c->
height) {
351 memset(out, 0, bw2 * 4);
353 for (i = 0; i < bw2; i++){
354 if (mx + i < 0 || mx + i >= c->
width)
366 for (j = 0; j < bh2; j++){
367 for (i = 0; i < bw2; i++) {
368 out[i] ^= *((uint32_t *) src);
393 memcpy(c->
pal, src, 768);
404 int buf_size = avpkt->
size;
408 int hi_ver, lo_ver, ret;
437 "Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",
439 if (hi_ver != 0 || lo_ver != 1) {
444 if (c->
bw == 0 || c->
bh == 0) {
467 #ifdef ZMBV_ENABLE_24BPP
473 #endif //ZMBV_ENABLE_24BPP
487 zret = inflateReset(&c->
zstream);
522 zret = inflate(&c->
zstream, Z_SYNC_FLUSH);
523 if (zret != Z_OK && zret != Z_STREAM_END) {
549 for (j = 0; j < c->
height; j++) {
550 for (i = 0; i < c->
width; i++) {
551 out[i * 3 + 0] = c->
pal[(*src) * 3 + 0];
552 out[i * 3 + 1] = c->
pal[(*src) * 3 + 1];
553 out[i * 3 + 2] = c->
pal[(*src) * 3 + 2];
560 for (j = 0; j < c->
height; j++) {
561 for (i = 0; i < c->
width; i++) {
564 out[i * 3 + 0] = (tmp & 0x7C00) >> 7;
565 out[i * 3 + 1] = (tmp & 0x03E0) >> 2;
566 out[i * 3 + 2] = (tmp & 0x001F) << 3;
572 for (j = 0; j < c->
height; j++) {
573 for (i = 0; i < c->
width; i++) {
576 out[i * 3 + 0] = (tmp & 0xF800) >> 8;
577 out[i * 3 + 1] = (tmp & 0x07E0) >> 3;
578 out[i * 3 + 2] = (tmp & 0x001F) << 3;
583 #ifdef ZMBV_ENABLE_24BPP
585 for (j = 0; j < c->
height; j++) {
586 memcpy(out, src, c->
width * 3);
591 #endif //ZMBV_ENABLE_24BPP
593 for (j = 0; j < c->
height; j++) {
594 for (i = 0; i < c->
width; i++) {
627 memset(&c->
zstream, 0,
sizeof(z_stream));
636 "Can't allocate decompression buffer.\n");
644 zret = inflateInit(&c->
zstream);
int(* decode_xor)(struct ZmbvContext *c)
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
This structure describes decoded (raw) audio or video data.
int buffer_hints
codec suggestion on buffer type if != 0
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
packed RGB 8:8:8, 24bpp, RGBRGB...
static int zmbv_decode_xor_32(ZmbvContext *c)
Decode XOR'ed frame - 32bpp version.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
struct ZmbvContext ZmbvContext
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
#define FFSWAP(type, a, b)
static av_cold int decode_init(AVCodecContext *avctx)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static int zmbv_decode_xor_8(ZmbvContext *c)
Decode XOR'ed frame - 8bpp version.
static int init(AVCodecParserContext *s)
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static av_cold int decode_end(AVCodecContext *avctx)
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int width
picture width / height.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
static int zmbv_decode_xor_16(ZmbvContext *c)
Decode XOR'ed frame - 15bpp and 16bpp version.
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
static void close(AVCodecParserContext *s)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
common internal and external API header
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
#define AVERROR_INVALIDDATA
#define AVERROR_PATCHWELCOME
int key_frame
1 -> keyframe, 0-> not
int(* decode_intra)(struct ZmbvContext *c)
static int zmbv_decode_intra(ZmbvContext *c)
Decode intraframe.
#define FF_BUFFER_HINTS_VALID
This structure stores compressed data.