38 #define ZMBV_KEYFRAME 1
39 #define ZMBV_DELTAPAL 2
87 int d, dx, dy, bw2, bh2;
96 for (i = 0; i < 768; i++)
101 src += ((c->
bx * c->
by * 2 + 3) & ~3);
104 for (y = 0; y < c->
height; y += c->
bh) {
106 for (x = 0; x < c->
width; x += c->
bw) {
110 dx = mvec[
block] >> 1;
111 dy = mvec[block + 1] >> 1;
118 tprev = prev + x + dx + dy * c->
width;
121 for (j = 0; j < bh2; j++) {
122 if (my + j < 0 || my + j >= c->
height) {
125 for (i = 0; i < bw2; i++) {
126 if (mx + i < 0 || mx + i >= c->
width)
138 for (j = 0; j < bh2; j++) {
139 for (i = 0; i < bw2; i++)
161 uint16_t *output, *
prev;
164 int d, dx, dy, bw2, bh2;
169 output = (uint16_t*)c->
cur;
170 prev = (uint16_t*)c->
prev;
173 src += ((c->
bx * c->
by * 2 + 3) & ~3);
176 for (y = 0; y < c->
height; y += c->
bh) {
178 for (x = 0; x < c->
width; x += c->
bw) {
179 uint16_t *
out, *tprev;
182 dx = mvec[
block] >> 1;
183 dy = mvec[block + 1] >> 1;
190 tprev = prev + x + dx + dy * c->
width;
193 for (j = 0; j < bh2; j++) {
194 if (my + j < 0 || my + j >= c->
height) {
195 memset(out, 0, bw2 * 2);
197 for (i = 0; i < bw2; i++) {
198 if (mx + i < 0 || mx + i >= c->
width)
210 for (j = 0; j < bh2; j++){
211 for (i = 0; i < bw2; i++) {
212 out[i] ^= *((uint16_t*)src);
228 #ifdef ZMBV_ENABLE_24BPP
239 int d, dx, dy, bw2, bh2;
248 stride = c->
width * 3;
250 src += ((c->
bx * c->
by * 2 + 3) & ~3);
253 for (y = 0; y < c->
height; y += c->
bh) {
255 for (x = 0; x < c->
width; x += c->
bw) {
259 dx = mvec[
block] >> 1;
260 dy = mvec[block + 1] >> 1;
266 out = output + x * 3;
267 tprev = prev + (x + dx) * 3 + dy * stride;
270 for (j = 0; j < bh2; j++) {
271 if (my + j < 0 || my + j >= c->
height) {
272 memset(out, 0, bw2 * 3);
274 for (i = 0; i < bw2; i++){
275 if (mx + i < 0 || mx + i >= c->
width) {
280 out[i * 3 + 0] = tprev[i * 3 + 0];
281 out[i * 3 + 1] = tprev[i * 3 + 1];
282 out[i * 3 + 2] = tprev[i * 3 + 2];
291 out = output + x * 3;
292 for (j = 0; j < bh2; j++) {
293 for (i = 0; i < bw2; i++) {
294 out[i * 3 + 0] ^= *src++;
295 out[i * 3 + 1] ^= *src++;
296 out[i * 3 + 2] ^= *src++;
302 output += stride * c->
bh;
303 prev += stride * c->
bh;
310 #endif //ZMBV_ENABLE_24BPP
319 uint32_t *output, *
prev;
322 int d, dx, dy, bw2, bh2;
327 output = (uint32_t*)c->
cur;
328 prev = (uint32_t*)c->
prev;
331 src += ((c->
bx * c->
by * 2 + 3) & ~3);
334 for (y = 0; y < c->
height; y += c->
bh) {
336 for (x = 0; x < c->
width; x += c->
bw) {
337 uint32_t *
out, *tprev;
340 dx = mvec[
block] >> 1;
341 dy = mvec[block + 1] >> 1;
348 tprev = prev + x + dx + dy * c->
width;
351 for (j = 0; j < bh2; j++) {
352 if (my + j < 0 || my + j >= c->
height) {
353 memset(out, 0, bw2 * 4);
355 for (i = 0; i < bw2; i++){
356 if (mx + i < 0 || mx + i >= c->
width)
368 for (j = 0; j < bh2; j++){
369 for (i = 0; i < bw2; i++) {
370 out[i] ^= *((uint32_t *) src);
395 memcpy(c->
pal, src, 768);
407 int buf_size = avpkt->
size;
411 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) {
443 if (c->
bw == 0 || c->
bh == 0) {
471 #ifdef ZMBV_ENABLE_24BPP
479 #endif //ZMBV_ENABLE_24BPP
493 zret = inflateReset(&c->
zstream);
517 expected_size = (c->
bx * c->
by * 2 + 3) & ~3;
521 expected_size += 768;
545 if (zret != Z_OK && zret != Z_STREAM_END) {
574 out = frame->
data[0];
578 for (j = 0; j < 256; j++)
582 #ifdef ZMBV_ENABLE_24BPP
613 memset(&c->
zstream, 0,
sizeof(z_stream));
616 av_log(avctx,
AV_LOG_ERROR,
"Internal buffer (decomp_size) larger than max_pixels or too large\n");
626 "Can't allocate decompression buffer.\n");
633 zret = inflateInit(&c->
zstream);
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
int(* decode_xor)(struct ZmbvContext *c)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define av_realloc_f(p, o, n)
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
packed RGB 8:8:8, 24bpp, RGBRGB...
static av_cold int init(AVCodecContext *avctx)
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)
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined ...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
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
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
8 bits with AV_PIX_FMT_RGB32 palette
static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord)
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.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define PTRDIFF_SPECIFIER
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
const char * name
Name of the codec implementation.
static av_cold int decode_end(AVCodecContext *avctx)
int64_t max_pixels
The number of pixels per image to maximally accept.
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Libavcodec external API header.
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
static int zmbv_decode_xor_16(ZmbvContext *c)
Decode XOR'ed frame - 15bpp and 16bpp version.
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.
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
common internal and external API header
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
int key_frame
1 -> keyframe, 0-> not
int(* decode_intra)(struct ZmbvContext *c)
static int zmbv_decode_intra(ZmbvContext *c)
Decode intraframe.
#define FFSWAP(type, a, b)
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.
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame)