37 #define ZMBV_KEYFRAME 1
38 #define ZMBV_DELTAPAL 2
65 int bw,
int bh,
int *xored)
72 for(j = 0; j < bh; j++){
73 for(i = 0; i < bw; i++){
74 int t = src[i] ^ src2[i];
82 for(i = 1; i < 256; i++)
92 int pstride,
int x,
int y,
int *mx,
int *my,
int *xored)
94 int dx, dy, tx, ty, tv, bv, bw, bh;
99 bv =
block_cmp(src, sstride, prev, pstride, bw, bh, xored);
103 if(tx == x && ty == y)
continue;
106 tv =
block_cmp(src, sstride, prev + dx + dy*pstride, pstride, bw, bh, xored);
119 const AVFrame *pict,
int *got_packet)
127 int work_size = 0, pkt_size;
137 chpal = !keyframe && memcmp(p->
data[1], c->
pal2, 1024);
139 palptr = (uint32_t*)p->
data[1];
144 for(i = 0; i < 256; i++){
146 c->
work_buf[work_size++] = tpal[0] ^ c->
pal[i * 3 + 0];
147 c->
work_buf[work_size++] = tpal[1] ^ c->
pal[i * 3 + 1];
148 c->
work_buf[work_size++] = tpal[2] ^ c->
pal[i * 3 + 2];
149 c->
pal[i * 3 + 0] = tpal[0];
150 c->
pal[i * 3 + 1] = tpal[1];
151 c->
pal[i * 3 + 2] = tpal[2];
156 for(i = 0; i < 256; i++){
162 for(i = 0; i < avctx->
height; i++){
165 work_size += avctx->
width;
168 int x,
y, bh2, bw2, xored;
176 memset(c->
work_buf + work_size, 0, (bw * bh * 2 + 3) & ~3);
177 work_size += (bw * bh * 2 + 3) & ~3;
188 mv[0] = (mx << 1) | !!xored;
192 for(j = 0; j < bh2; j++){
193 for(i = 0; i < bw2; i++)
194 c->
work_buf[work_size++] = tsrc[i] ^ tprev[i];
207 for(i = 0; i < avctx->
height; i++){
208 memcpy(prev, src, avctx->
width);
217 c->
zstream.avail_in = work_size;
223 if(deflate(&c->
zstream, Z_SYNC_FLUSH) != Z_OK){
228 pkt_size = c->
zstream.total_out + 1 + 6*keyframe;
275 if(lvl < 0 || lvl > 9){
281 memset(&c->
zstream, 0,
sizeof(z_stream));
283 ((avctx->
width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->
height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4;
306 zret = deflateInit(&c->
zstream, lvl);