FFmpeg
zmbvenc.c
Go to the documentation of this file.
1 /*
2  * Zip Motion Blocks Video (ZMBV) encoder
3  * Copyright (c) 2006 Konstantin Shishkov
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * Zip Motion Blocks Video encoder
25  */
26 
27 #include <stddef.h>
28 
29 #include "libavutil/intreadwrite.h"
30 #include "libavutil/mem.h"
31 #include "avcodec.h"
32 #include "codec_internal.h"
33 #include "encode.h"
34 #include "zlib_wrapper.h"
35 
36 #include <zlib.h>
37 
38 /* Frame header flags */
39 #define ZMBV_KEYFRAME 1
40 #define ZMBV_DELTAPAL 2
41 
42 /* Motion block width/height (maximum allowed value is 255)
43  * Note: histogram datatype in block_cmp() must be big enough to hold values
44  * up to (4 * ZMBV_BLOCK * ZMBV_BLOCK)
45  */
46 #define ZMBV_BLOCK 16
47 
48 /* Keyframe header format values */
49 enum ZmbvFormat {
59 };
60 
61 /**
62  * Encoder context
63  */
64 typedef struct ZmbvEncContext {
66 
67  int lrange, urange;
68  uint8_t *comp_buf, *work_buf;
69  uint8_t pal[768];
70  uint32_t pal2[256]; //for quick comparisons
71  uint8_t *prev, *prev_buf;
72  int pstride;
73  int comp_size;
74  int keyint, curfrm;
75  int bypp;
78 
81 
82 
83 /** Block comparing function
84  * XXX should be optimized and moved to DSPContext
85  */
86 static inline int block_cmp(ZmbvEncContext *c, const uint8_t *src, int stride,
87  const uint8_t *src2, int stride2, int bw, int bh,
88  int *xored)
89 {
90  int sum = 0;
91  int i, j;
92  uint16_t histogram[256] = {0};
93  int bw_bytes = bw * c->bypp;
94 
95  /* Build frequency histogram of byte values for src[] ^ src2[] */
96  for(j = 0; j < bh; j++){
97  for(i = 0; i < bw_bytes; i++){
98  int t = src[i] ^ src2[i];
99  histogram[t]++;
100  }
101  src += stride;
102  src2 += stride2;
103  }
104 
105  /* If not all the xored values were 0, then the blocks are different */
106  *xored = (histogram[0] < bw_bytes * bh);
107 
108  /* Exit early if blocks are equal */
109  if (!*xored) return 0;
110 
111  /* Sum the entropy of all values */
112  for(i = 0; i < 256; i++)
113  sum += c->score_tab[histogram[i]];
114 
115  return sum;
116 }
117 
118 /** Motion estimation function
119  * TODO make better ME decisions
120  */
121 static int zmbv_me(ZmbvEncContext *c, const uint8_t *src, int sstride, const uint8_t *prev,
122  int pstride, int x, int y, int *mx, int *my, int *xored)
123 {
124  int dx, dy, txored, tv, bv, bw, bh;
125  int mx0, my0;
126 
127  mx0 = *mx;
128  my0 = *my;
129  bw = FFMIN(ZMBV_BLOCK, c->avctx->width - x);
130  bh = FFMIN(ZMBV_BLOCK, c->avctx->height - y);
131 
132  /* Try (0,0) */
133  bv = block_cmp(c, src, sstride, prev, pstride, bw, bh, xored);
134  *mx = *my = 0;
135  if(!bv) return 0;
136 
137  /* Try previous block's MV (if not 0,0) */
138  if (mx0 || my0){
139  tv = block_cmp(c, src, sstride, prev + mx0 * c->bypp + my0 * pstride, pstride, bw, bh, &txored);
140  if(tv < bv){
141  bv = tv;
142  *mx = mx0;
143  *my = my0;
144  *xored = txored;
145  if(!bv) return 0;
146  }
147  }
148 
149  /* Try other MVs from top-to-bottom, left-to-right */
150  for(dy = -c->lrange; dy <= c->urange; dy++){
151  for(dx = -c->lrange; dx <= c->urange; dx++){
152  if(!dx && !dy) continue; // we already tested this block
153  if(dx == mx0 && dy == my0) continue; // this one too
154  tv = block_cmp(c, src, sstride, prev + dx * c->bypp + dy * pstride, pstride, bw, bh, &txored);
155  if(tv < bv){
156  bv = tv;
157  *mx = dx;
158  *my = dy;
159  *xored = txored;
160  if(!bv) return 0;
161  }
162  }
163  }
164  return bv;
165 }
166 
168  const AVFrame *pict, int *got_packet)
169 {
170  ZmbvEncContext * const c = avctx->priv_data;
171  z_stream *const zstream = &c->zstream.zstream;
172  const AVFrame * const p = pict;
173  const uint8_t *src;
174  uint8_t *prev, *buf;
175  uint32_t *palptr;
176  int keyframe, chpal;
177  int fl;
178  int work_size = 0, pkt_size;
179  int bw, bh;
180  int i, j, ret;
181 
182  keyframe = !c->curfrm;
183  c->curfrm++;
184  if(c->curfrm == c->keyint)
185  c->curfrm = 0;
186 
187  palptr = (avctx->pix_fmt == AV_PIX_FMT_PAL8) ? (uint32_t *)p->data[1] : NULL;
188  chpal = !keyframe && palptr && memcmp(palptr, c->pal2, 1024);
189 
190  src = p->data[0];
191  prev = c->prev;
192  if(chpal){
193  uint8_t tpal[3];
194  for(i = 0; i < 256; i++){
195  AV_WB24(tpal, palptr[i]);
196  c->work_buf[work_size++] = tpal[0] ^ c->pal[i * 3 + 0];
197  c->work_buf[work_size++] = tpal[1] ^ c->pal[i * 3 + 1];
198  c->work_buf[work_size++] = tpal[2] ^ c->pal[i * 3 + 2];
199  c->pal[i * 3 + 0] = tpal[0];
200  c->pal[i * 3 + 1] = tpal[1];
201  c->pal[i * 3 + 2] = tpal[2];
202  }
203  memcpy(c->pal2, palptr, 1024);
204  }
205  if(keyframe){
206  if (palptr){
207  for(i = 0; i < 256; i++){
208  AV_WB24(c->pal+(i*3), palptr[i]);
209  }
210  memcpy(c->work_buf, c->pal, 768);
211  memcpy(c->pal2, palptr, 1024);
212  work_size = 768;
213  }
214  for(i = 0; i < avctx->height; i++){
215  memcpy(c->work_buf + work_size, src, avctx->width * c->bypp);
216  src += p->linesize[0];
217  work_size += avctx->width * c->bypp;
218  }
219  }else{
220  int x, y, bh2, bw2, xored;
221  const uint8_t *tsrc, *tprev;
222  uint8_t *mv;
223  int mx = 0, my = 0;
224 
225  bw = (avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK;
226  bh = (avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK;
227  mv = c->work_buf + work_size;
228  memset(c->work_buf + work_size, 0, (bw * bh * 2 + 3) & ~3);
229  work_size += (bw * bh * 2 + 3) & ~3;
230  /* for now just XOR'ing */
231  for(y = 0; y < avctx->height; y += ZMBV_BLOCK) {
232  bh2 = FFMIN(avctx->height - y, ZMBV_BLOCK);
233  for(x = 0; x < avctx->width; x += ZMBV_BLOCK, mv += 2) {
234  bw2 = FFMIN(avctx->width - x, ZMBV_BLOCK);
235 
236  tsrc = src + x * c->bypp;
237  tprev = prev + x * c->bypp;
238 
239  zmbv_me(c, tsrc, p->linesize[0], tprev, c->pstride, x, y, &mx, &my, &xored);
240  mv[0] = (mx * 2) | !!xored;
241  mv[1] = my * 2;
242  tprev += mx * c->bypp + my * c->pstride;
243  if(xored){
244  for(j = 0; j < bh2; j++){
245  for(i = 0; i < bw2 * c->bypp; i++)
246  c->work_buf[work_size++] = tsrc[i] ^ tprev[i];
247  tsrc += p->linesize[0];
248  tprev += c->pstride;
249  }
250  }
251  }
252  src += p->linesize[0] * ZMBV_BLOCK;
253  prev += c->pstride * ZMBV_BLOCK;
254  }
255  }
256  /* save the previous frame */
257  src = p->data[0];
258  prev = c->prev;
259  for(i = 0; i < avctx->height; i++){
260  memcpy(prev, src, avctx->width * c->bypp);
261  prev += c->pstride;
262  src += p->linesize[0];
263  }
264 
265  if (keyframe)
266  deflateReset(zstream);
267 
268  zstream->next_in = c->work_buf;
269  zstream->avail_in = work_size;
270  zstream->total_in = 0;
271 
272  zstream->next_out = c->comp_buf;
273  zstream->avail_out = c->comp_size;
274  zstream->total_out = 0;
275  if (deflate(zstream, Z_SYNC_FLUSH) != Z_OK) {
276  av_log(avctx, AV_LOG_ERROR, "Error compressing data\n");
277  return -1;
278  }
279 
280  pkt_size = zstream->total_out + 1 + 6 * keyframe;
281  if ((ret = ff_get_encode_buffer(avctx, pkt, pkt_size, 0)) < 0)
282  return ret;
283  buf = pkt->data;
284 
285  fl = (keyframe ? ZMBV_KEYFRAME : 0) | (chpal ? ZMBV_DELTAPAL : 0);
286  *buf++ = fl;
287  if (keyframe) {
288  *buf++ = 0; // hi ver
289  *buf++ = 1; // lo ver
290  *buf++ = 1; // comp
291  *buf++ = c->fmt; // format
292  *buf++ = ZMBV_BLOCK; // block width
293  *buf++ = ZMBV_BLOCK; // block height
295  }
296  memcpy(buf, c->comp_buf, zstream->total_out);
297 
298  *got_packet = 1;
299 
300  return 0;
301 }
302 
304 {
305  ZmbvEncContext * const c = avctx->priv_data;
306 
307  av_freep(&c->comp_buf);
308  av_freep(&c->work_buf);
309 
310  av_freep(&c->prev_buf);
311  ff_deflate_end(&c->zstream);
312 
313  return 0;
314 }
315 
316 /**
317  * Init zmbv encoder
318  */
320 {
321  ZmbvEncContext * const c = avctx->priv_data;
322  int i;
323  int lvl = 9;
324  int prev_size, prev_offset;
325 
326  switch (avctx->pix_fmt) {
327  case AV_PIX_FMT_PAL8:
328  c->fmt = ZMBV_FMT_8BPP;
329  c->bypp = 1;
330  break;
331  case AV_PIX_FMT_RGB555LE:
332  c->fmt = ZMBV_FMT_15BPP;
333  c->bypp = 2;
334  break;
335  case AV_PIX_FMT_RGB565LE:
336  c->fmt = ZMBV_FMT_16BPP;
337  c->bypp = 2;
338  break;
339 #ifdef ZMBV_ENABLE_24BPP
340  case AV_PIX_FMT_BGR24:
341  c->fmt = ZMBV_FMT_24BPP;
342  c->bypp = 3;
343  break;
344 #endif //ZMBV_ENABLE_24BPP
345  case AV_PIX_FMT_BGR0:
346  c->fmt = ZMBV_FMT_32BPP;
347  c->bypp = 4;
348  break;
349  }
350 
351  /* Entropy-based score tables for comparing blocks.
352  * Suitable for blocks up to (ZMBV_BLOCK * ZMBV_BLOCK) bytes.
353  * Scores are nonnegative, lower is better.
354  */
355  for(i = 1; i <= ZMBV_BLOCK * ZMBV_BLOCK * c->bypp; i++)
356  c->score_tab[i] = -i * log2(i / (double)(ZMBV_BLOCK * ZMBV_BLOCK * c->bypp)) * 256;
357 
358  c->avctx = avctx;
359 
360  c->curfrm = 0;
361  c->keyint = avctx->keyint_min;
362 
363  /* Motion estimation range: maximum distance is -64..63 */
364  c->lrange = c->urange = 8;
365  if(avctx->me_range > 0){
366  c->lrange = FFMIN(avctx->me_range, 64);
367  c->urange = FFMIN(avctx->me_range, 63);
368  }
369 
370  if(avctx->compression_level >= 0)
371  lvl = avctx->compression_level;
372  if(lvl < 0 || lvl > 9){
373  av_log(avctx, AV_LOG_ERROR, "Compression level should be 0-9, not %i\n", lvl);
374  return AVERROR(EINVAL);
375  }
376 
377  c->comp_size = avctx->width * c->bypp * avctx->height + 1024 +
378  ((avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4;
379  if (!(c->work_buf = av_malloc(c->comp_size))) {
380  av_log(avctx, AV_LOG_ERROR, "Can't allocate work buffer.\n");
381  return AVERROR(ENOMEM);
382  }
383  /* Conservative upper bound taken from zlib v1.2.1 source via lcl.c */
384  c->comp_size = c->comp_size + ((c->comp_size + 7) >> 3) +
385  ((c->comp_size + 63) >> 6) + 11;
386 
387  /* Allocate compression buffer */
388  if (!(c->comp_buf = av_malloc(c->comp_size))) {
389  av_log(avctx, AV_LOG_ERROR, "Can't allocate compression buffer.\n");
390  return AVERROR(ENOMEM);
391  }
392 
393  /* Allocate prev buffer - pad around the image to allow out-of-edge ME:
394  * - The image should be padded with `lrange` rows before and `urange` rows
395  * after.
396  * - The stride should be padded with `lrange` pixels, then rounded up to a
397  * multiple of 16 bytes.
398  * - The first row should also be padded with `lrange` pixels before, then
399  * aligned up to a multiple of 16 bytes.
400  */
401  c->pstride = FFALIGN((avctx->width + c->lrange) * c->bypp, 16);
402  prev_size = FFALIGN(c->lrange * c->bypp, 16) + c->pstride * (c->lrange + avctx->height + c->urange);
403  prev_offset = FFALIGN(c->lrange * c->bypp, 16) + c->pstride * c->lrange;
404  if (!(c->prev_buf = av_mallocz(prev_size))) {
405  av_log(avctx, AV_LOG_ERROR, "Can't allocate picture.\n");
406  return AVERROR(ENOMEM);
407  }
408  c->prev = c->prev_buf + prev_offset;
409 
410  return ff_deflate_init(&c->zstream, lvl, avctx);
411 }
412 
414  .p.name = "zmbv",
415  CODEC_LONG_NAME("Zip Motion Blocks Video"),
416  .p.type = AVMEDIA_TYPE_VIDEO,
417  .p.id = AV_CODEC_ID_ZMBV,
419  .priv_data_size = sizeof(ZmbvEncContext),
420  .init = encode_init,
422  .close = encode_end,
423  .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_PAL8,
426 #ifdef ZMBV_ENABLE_24BPP
428 #endif //ZMBV_ENABLE_24BPP
430  AV_PIX_FMT_NONE },
431  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
432 };
ZmbvEncContext::work_buf
uint8_t * work_buf
Definition: zmbvenc.c:68
ZmbvEncContext::comp_buf
uint8_t * comp_buf
Definition: zmbvenc.c:68
zmbv_me
static int zmbv_me(ZmbvEncContext *c, const uint8_t *src, int sstride, const uint8_t *prev, int pstride, int x, int y, int *mx, int *my, int *xored)
Motion estimation function TODO make better ME decisions.
Definition: zmbvenc.c:121
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
AVCodecContext::keyint_min
int keyint_min
minimum GOP size
Definition: avcodec.h:1024
AVERROR
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
AV_CODEC_ID_ZMBV
@ AV_CODEC_ID_ZMBV
Definition: codec_id.h:133
mv
static const int8_t mv[256][2]
Definition: 4xm.c:81
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:374
AVPacket::data
uint8_t * data
Definition: packet.h:524
ZmbvEncContext::prev_buf
uint8_t * prev_buf
Definition: zmbvenc.c:71
encode.h
ZMBV_FMT_15BPP
@ ZMBV_FMT_15BPP
Definition: zmbvenc.c:55
FFCodec
Definition: codec_internal.h:127
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:76
ZMBV_FMT_NONE
@ ZMBV_FMT_NONE
Definition: zmbvenc.c:50
ff_deflate_end
void ff_deflate_end(FFZStream *zstream)
Wrapper around deflateEnd().
ZmbvEncContext::keyint
int keyint
Definition: zmbvenc.c:74
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:579
encode_end
static av_cold int encode_end(AVCodecContext *avctx)
Definition: zmbvenc.c:303
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:395
ZmbvEncContext::zstream
FFZStream zstream
Definition: zmbvenc.c:77
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
ZmbvEncContext::prev
uint8_t * prev
Definition: zmbvenc.c:71
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
ZmbvEncContext::pal2
uint32_t pal2[256]
Definition: zmbvenc.c:70
ZMBV_KEYFRAME
#define ZMBV_KEYFRAME
Definition: zmbvenc.c:39
ZMBV_FMT_8BPP
@ ZMBV_FMT_8BPP
Definition: zmbvenc.c:54
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:296
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
zlib_wrapper.h
av_cold
#define av_cold
Definition: attributes.h:90
encode_init
static av_cold int encode_init(AVCodecContext *avctx)
Init zmbv encoder.
Definition: zmbvenc.c:319
intreadwrite.h
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition: codec.h:159
block_cmp
static int block_cmp(ZmbvEncContext *c, const uint8_t *src, int stride, const uint8_t *src2, int stride2, int bw, int bh, int *xored)
Block comparing function XXX should be optimized and moved to DSPContext.
Definition: zmbvenc.c:86
ZmbvEncContext::comp_size
int comp_size
Definition: zmbvenc.c:73
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
AV_PIX_FMT_RGB565LE
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
Definition: pixfmt.h:113
NULL
#define NULL
Definition: coverity.c:32
ZmbvEncContext
Encoder context.
Definition: zmbvenc.c:64
ff_zmbv_encoder
const FFCodec ff_zmbv_encoder
Definition: zmbvenc.c:413
ZmbvEncContext::fmt
enum ZmbvFormat fmt
Definition: zmbvenc.c:76
deflate
static void deflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
Definition: vf_neighbor.c:161
ZmbvEncContext::pal
uint8_t pal[768]
Definition: zmbvenc.c:69
AV_PIX_FMT_BGR0
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:265
c
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
Definition: undefined.txt:32
ZmbvFormat
ZmbvFormat
Definition: zmbv.c:43
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:366
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
codec_internal.h
AVCodecContext::me_range
int me_range
maximum motion estimation search range in subpel units If 0 then no limit.
Definition: avcodec.h:955
ZmbvEncContext::avctx
AVCodecContext * avctx
Definition: zmbvenc.c:65
AV_WB24
#define AV_WB24(p, d)
Definition: intreadwrite.h:448
ZMBV_FMT_24BPP
@ ZMBV_FMT_24BPP
Definition: zmbvenc.c:57
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:530
ZmbvEncContext::pstride
int pstride
Definition: zmbvenc.c:72
ZMBV_BLOCK
#define ZMBV_BLOCK
Definition: zmbvenc.c:46
ZMBV_FMT_1BPP
@ ZMBV_FMT_1BPP
Definition: zmbvenc.c:51
AV_PIX_FMT_RGB555LE
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:115
ZMBV_DELTAPAL
#define ZMBV_DELTAPAL
Definition: zmbvenc.c:40
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
encode_frame
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
Definition: zmbvenc.c:167
src2
const pixel * src2
Definition: h264pred_template.c:422
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:256
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
ZMBV_FMT_4BPP
@ ZMBV_FMT_4BPP
Definition: zmbvenc.c:53
ZMBV_FMT_2BPP
@ ZMBV_FMT_2BPP
Definition: zmbvenc.c:52
AVCodecContext::height
int height
Definition: avcodec.h:618
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:657
ZmbvEncContext::lrange
int lrange
Definition: zmbvenc.c:67
log2
#define log2(x)
Definition: libm.h:404
avcodec.h
stride
#define stride
Definition: h264pred_template.c:537
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:84
ret
ret
Definition: filter_design.txt:187
ZMBV_FMT_16BPP
@ ZMBV_FMT_16BPP
Definition: zmbvenc.c:56
AVCodecContext
main external API structure.
Definition: avcodec.h:445
ff_get_encode_buffer
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
Definition: encode.c:106
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
ZmbvEncContext::urange
int urange
Definition: zmbvenc.c:67
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FFZStream
Definition: zlib_wrapper.h:27
mem.h
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:472
AVPacket
This structure stores compressed data.
Definition: packet.h:501
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:618
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition: frame.h:419
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
ZmbvEncContext::bypp
int bypp
Definition: zmbvenc.c:75
ZmbvEncContext::curfrm
int curfrm
Definition: zmbvenc.c:74
ZmbvEncContext::score_tab
int score_tab[ZMBV_BLOCK *ZMBV_BLOCK *4+1]
Definition: zmbvenc.c:79
ff_deflate_init
int ff_deflate_init(FFZStream *zstream, int level, void *logctx)
Wrapper around deflateInit().
AVCodecContext::compression_level
int compression_level
Definition: avcodec.h:1245
ZMBV_FMT_32BPP
@ ZMBV_FMT_32BPP
Definition: zmbvenc.c:58