37 #define ZMBV_KEYFRAME 1 
   38 #define ZMBV_DELTAPAL 2 
   67                             uint8_t *src2, 
int stride2, 
int bw, 
int bh,
 
   75     for(j = 0; j < bh; j++){
 
   76         for(i = 0; i < bw; i++){
 
   77             int t = src[i] ^ src2[i];
 
   85     for(i = 1; i < 256; i++)
 
   95                    int pstride, 
int x, 
int y, 
int *mx, 
int *my, 
int *xored)
 
   97     int dx, dy, tx, ty, tv, bv, bw, bh;
 
  102     bv = 
block_cmp(c, src, sstride, prev, pstride, bw, bh, xored);
 
  106             if(tx == x && ty == y) 
continue; 
 
  109             tv = 
block_cmp(c, src, sstride, prev + dx + dy * pstride, pstride, bw, bh, xored);
 
  122                         const AVFrame *pict, 
int *got_packet)
 
  125     const AVFrame * 
const p = pict;
 
  130     int work_size = 0, pkt_size;
 
  138 #if FF_API_CODED_FRAME 
  144     chpal = !keyframe && memcmp(p->
data[1], c->
pal2, 1024);
 
  146     palptr = (uint32_t*)p->
data[1];
 
  151         for(i = 0; i < 256; i++){
 
  153             c->
work_buf[work_size++] = tpal[0] ^ c->
pal[i * 3 + 0];
 
  154             c->
work_buf[work_size++] = tpal[1] ^ c->
pal[i * 3 + 1];
 
  155             c->
work_buf[work_size++] = tpal[2] ^ c->
pal[i * 3 + 2];
 
  156             c->
pal[i * 3 + 0] = tpal[0];
 
  157             c->
pal[i * 3 + 1] = tpal[1];
 
  158             c->
pal[i * 3 + 2] = tpal[2];
 
  163         for(i = 0; i < 256; i++){
 
  169         for(i = 0; i < avctx->
height; i++){
 
  172             work_size += avctx->
width;
 
  175         int x, y, bh2, bw2, xored;
 
  183         memset(c->
work_buf + work_size, 0, (bw * bh * 2 + 3) & ~3);
 
  184         work_size += (bw * bh * 2 + 3) & ~3;
 
  195                 mv[0] = (mx << 1) | !!xored;
 
  199                     for(j = 0; j < bh2; j++){
 
  200                         for(i = 0; i < bw2; i++)
 
  201                             c->
work_buf[work_size++] = tsrc[i] ^ tprev[i];
 
  214     for(i = 0; i < avctx->
height; i++){
 
  215         memcpy(prev, src, avctx->
width);
 
  224     c->
zstream.avail_in = work_size;
 
  235     pkt_size = c->
zstream.total_out + 1 + 6*keyframe;
 
  294     if(lvl < 0 || lvl > 9){
 
  300     memset(&c->
zstream, 0, 
sizeof(z_stream));
 
  302         ((avctx->
width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->
height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4;
 
  325     zret = deflateInit(&c->
zstream, lvl);
 
This structure describes decoded (raw) audio or video data. 
 
static av_cold int init(AVCodecContext *avctx)
 
static av_cold int encode_end(AVCodecContext *avctx)
 
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data. 
 
8 bits with AV_PIX_FMT_RGB32 palette 
 
int me_range
maximum motion estimation search range in subpel units If 0 then no limit. 
 
static void deflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord)
 
#define AV_PKT_FLAG_KEY
The packet contains a keyframe. 
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
 
static av_cold int encode_init(AVCodecContext *avctx)
Init zmbv encoder. 
 
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
 
const char * name
Name of the codec implementation. 
 
int flags
A combination of AV_PKT_FLAG values. 
 
enum AVPictureType pict_type
Picture type of the frame. 
 
int width
picture width / height. 
 
static const int8_t mv[256][2]
 
Libavcodec external API header. 
 
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line. 
 
static int zmbv_me(ZmbvEncContext *c, uint8_t *src, int sstride, uint8_t *prev, int pstride, int x, int y, int *mx, int *my, int *xored)
Motion estimation function TODO make better ME decisions. 
 
main external API structure. 
 
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
 
static enum AVPixelFormat pix_fmts[]
 
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes. 
 
GLint GLenum GLboolean GLsizei stride
 
#define FF_DISABLE_DEPRECATION_WARNINGS
 
common internal api header. 
 
common internal and external API header 
 
attribute_deprecated AVFrame * coded_frame
the picture in the bitstream 
 
#define FF_ENABLE_DEPRECATION_WARNINGS
 
int key_frame
1 -> keyframe, 0-> not 
 
static int block_cmp(ZmbvEncContext *c, uint8_t *src, int stride, uint8_t *src2, int stride2, int bw, int bh, int *xored)
Block comparing function XXX should be optimized and moved to DSPContext TODO handle out of edge ME...
 
AVPixelFormat
Pixel format. 
 
This structure stores compressed data. 
 
int keyint_min
minimum GOP size