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) {
124 }
else if (mx >= 0 && mx + bw2 <= c->
width){
125 memcpy(out, tprev,
sizeof(*out) * bw2);
127 for (i = 0; i < bw2; i++) {
128 if (mx + i < 0 || mx + i >= c->
width)
140 for (j = 0; j < bh2; j++) {
141 for (i = 0; i < bw2; i++)
166 int d, dx, dy, bw2, bh2;
171 output = (uint16_t*)c->
cur;
172 prev = (uint16_t*)c->
prev;
175 src += ((c->
bx * c->
by * 2 + 3) & ~3);
178 for (y = 0; y < c->
height; y += c->
bh) {
180 for (x = 0; x < c->
width; x += c->
bw) {
181 uint16_t *
out, *tprev;
184 dx = mvec[
block] >> 1;
185 dy = mvec[block + 1] >> 1;
192 tprev = prev + x + dx + dy * c->
width;
195 for (j = 0; j < bh2; j++) {
196 if (my + j < 0 || my + j >= c->
height) {
197 memset(out, 0, bw2 * 2);
198 }
else if (mx >= 0 && mx + bw2 <= c->
width){
199 memcpy(out, tprev,
sizeof(*out) * bw2);
201 for (i = 0; i < bw2; i++) {
202 if (mx + i < 0 || mx + i >= c->
width)
214 for (j = 0; j < bh2; j++){
215 for (i = 0; i < bw2; i++) {
216 out[
i] ^= *((uint16_t*)src);
232 #ifdef ZMBV_ENABLE_24BPP 243 int d, dx, dy, bw2, bh2;
252 stride = c->
width * 3;
254 src += ((c->
bx * c->
by * 2 + 3) & ~3);
257 for (y = 0; y < c->
height; y += c->
bh) {
259 for (x = 0; x < c->
width; x += c->
bw) {
263 dx = mvec[
block] >> 1;
264 dy = mvec[block + 1] >> 1;
270 out = output + x * 3;
271 tprev = prev + (x + dx) * 3 + dy * stride;
274 for (j = 0; j < bh2; j++) {
275 if (my + j < 0 || my + j >= c->
height) {
276 memset(out, 0, bw2 * 3);
277 }
else if (mx >= 0 && mx + bw2 <= c->
width){
278 memcpy(out, tprev, 3 * bw2);
280 for (i = 0; i < bw2; i++){
281 if (mx + i < 0 || mx + i >= c->
width) {
286 out[i * 3 + 0] = tprev[i * 3 + 0];
287 out[i * 3 + 1] = tprev[i * 3 + 1];
288 out[i * 3 + 2] = tprev[i * 3 + 2];
297 out = output + x * 3;
298 for (j = 0; j < bh2; j++) {
299 for (i = 0; i < bw2; i++) {
300 out[i * 3 + 0] ^= *src++;
301 out[i * 3 + 1] ^= *src++;
302 out[i * 3 + 2] ^= *src++;
308 output += stride * c->
bh;
309 prev += stride * c->
bh;
316 #endif //ZMBV_ENABLE_24BPP 328 int d, dx, dy, bw2, bh2;
333 output = (uint32_t*)c->
cur;
334 prev = (uint32_t*)c->
prev;
337 src += ((c->
bx * c->
by * 2 + 3) & ~3);
340 for (y = 0; y < c->
height; y += c->
bh) {
342 for (x = 0; x < c->
width; x += c->
bw) {
343 uint32_t *
out, *tprev;
346 dx = mvec[
block] >> 1;
347 dy = mvec[block + 1] >> 1;
354 tprev = prev + x + dx + dy * c->
width;
357 for (j = 0; j < bh2; j++) {
358 if (my + j < 0 || my + j >= c->
height) {
359 memset(out, 0, bw2 * 4);
360 }
else if (mx >= 0 && mx + bw2 <= c->
width){
361 memcpy(out, tprev,
sizeof(*out) * bw2);
363 for (i = 0; i < bw2; i++){
364 if (mx + i < 0 || mx + i >= c->
width)
376 for (j = 0; j < bh2; j++){
377 for (i = 0; i < bw2; i++) {
378 out[
i] ^= *((uint32_t *) src);
403 memcpy(c->
pal, src, 768);
415 int buf_size = avpkt->
size;
419 int hi_ver, lo_ver,
ret;
443 "Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",
445 if (hi_ver != 0 || lo_ver != 1) {
449 if (c->
bw == 0 || c->
bh == 0) {
475 #ifdef ZMBV_ENABLE_24BPP 482 #endif //ZMBV_ENABLE_24BPP 495 zret = inflateReset(&c->
zstream);
519 expected_size = (c->
bx * c->
by * 2 + 3) & ~3;
523 expected_size += 768;
544 if (zret != Z_OK && zret != Z_STREAM_END) {
576 out = frame->
data[0];
580 for (j = 0; j < 256; j++)
584 #ifdef ZMBV_ENABLE_24BPP 615 memset(&c->
zstream, 0,
sizeof(z_stream));
618 av_log(avctx,
AV_LOG_ERROR,
"Internal buffer (decomp_size) larger than max_pixels or too large\n");
628 "Can't allocate decompression buffer.\n");
635 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...
#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
static av_cold int init(AVCodecContext *avctx)
#define avpriv_request_sample(...)
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
int(* decode_xor)(struct ZmbvContext *c)
The exact code depends on how similar the blocks are and how related they are to the block
8 bits with AV_PIX_FMT_RGB32 palette
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
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
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.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
packed RGB 8:8:8, 24bpp, BGRBGR...
#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.
static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
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
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.
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
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.