38 #define ZMBV_KEYFRAME 1 
   39 #define ZMBV_DELTAPAL 2 
   86     int d, dx, dy, bw2, bh2;
 
   95         for (i = 0; i < 768; i++)
 
  100     src += ((c->
bx * c->
by * 2 + 3) & ~3);
 
  103     for (y = 0; y < c->
height; y += c->
bh) {
 
  105         for (x = 0; x < c->
width; x += c->
bw) {
 
  109             dx = mvec[
block] >> 1;
 
  110             dy = mvec[block + 1] >> 1;
 
  117             tprev = prev + x + dx + dy * c->
width;
 
  120             for (j = 0; j < bh2; j++) {
 
  121                 if (my + j < 0 || my + j >= c->
height) {
 
  124                     for (i = 0; i < bw2; i++) {
 
  125                         if (mx + i < 0 || mx + i >= c->
width)
 
  137                 for (j = 0; j < bh2; j++) {
 
  138                     for (i = 0; i < bw2; i++)
 
  160     uint16_t *output, *
prev;
 
  163     int d, dx, dy, bw2, bh2;
 
  168     output = (uint16_t*)c->
cur;
 
  169     prev = (uint16_t*)c->
prev;
 
  172     src += ((c->
bx * c->
by * 2 + 3) & ~3);
 
  175     for (y = 0; y < c->
height; y += c->
bh) {
 
  177         for (x = 0; x < c->
width; x += c->
bw) {
 
  178             uint16_t *
out, *tprev;
 
  181             dx = mvec[
block] >> 1;
 
  182             dy = mvec[block + 1] >> 1;
 
  189             tprev = prev + x + dx + dy * c->
width;
 
  192             for (j = 0; j < bh2; j++) {
 
  193                 if (my + j < 0 || my + j >= c->
height) {
 
  194                     memset(out, 0, bw2 * 2);
 
  196                     for (i = 0; i < bw2; i++) {
 
  197                         if (mx + i < 0 || mx + i >= c->
width)
 
  209                 for (j = 0; j < bh2; j++){
 
  210                     for (i = 0; i < bw2; i++) {
 
  211                         out[i] ^= *((uint16_t*)src);
 
  227 #ifdef ZMBV_ENABLE_24BPP 
  238     int d, dx, dy, bw2, bh2;
 
  247     stride = c->
width * 3;
 
  249     src += ((c->
bx * c->
by * 2 + 3) & ~3);
 
  252     for (y = 0; y < c->
height; y += c->
bh) {
 
  254         for (x = 0; x < c->
width; x += c->
bw) {
 
  258             dx = mvec[
block] >> 1;
 
  259             dy = mvec[block + 1] >> 1;
 
  265             out = output + x * 3;
 
  266             tprev = prev + (x + dx) * 3 + dy * stride;
 
  269             for (j = 0; j < bh2; j++) {
 
  270                 if (my + j < 0 || my + j >= c->
height) {
 
  271                     memset(out, 0, bw2 * 3);
 
  273                     for (i = 0; i < bw2; i++){
 
  274                         if (mx + i < 0 || mx + i >= c->
width) {
 
  279                             out[i * 3 + 0] = tprev[i * 3 + 0];
 
  280                             out[i * 3 + 1] = tprev[i * 3 + 1];
 
  281                             out[i * 3 + 2] = tprev[i * 3 + 2];
 
  290                 out = output + x * 3;
 
  291                 for (j = 0; j < bh2; j++) {
 
  292                     for (i = 0; i < bw2; i++) {
 
  293                         out[i * 3 + 0] ^= *src++;
 
  294                         out[i * 3 + 1] ^= *src++;
 
  295                         out[i * 3 + 2] ^= *src++;
 
  301         output += stride * c->
bh;
 
  302         prev += stride * c->
bh;
 
  309 #endif //ZMBV_ENABLE_24BPP 
  318     uint32_t *output, *
prev;
 
  321     int d, dx, dy, bw2, bh2;
 
  326     output = (uint32_t*)c->
cur;
 
  327     prev = (uint32_t*)c->
prev;
 
  330     src += ((c->
bx * c->
by * 2 + 3) & ~3);
 
  333     for (y = 0; y < c->
height; y += c->
bh) {
 
  335         for (x = 0; x < c->
width; x += c->
bw) {
 
  336             uint32_t *
out, *tprev;
 
  339             dx = mvec[
block] >> 1;
 
  340             dy = mvec[block + 1] >> 1;
 
  347             tprev = prev + x + dx + dy * c->
width;
 
  350             for (j = 0; j < bh2; j++) {
 
  351                 if (my + j < 0 || my + j >= c->
height) {
 
  352                     memset(out, 0, bw2 * 4);
 
  354                     for (i = 0; i < bw2; i++){
 
  355                         if (mx + i < 0 || mx + i >= c->
width)
 
  367                 for (j = 0; j < bh2; j++){
 
  368                     for (i = 0; i < bw2; i++) {
 
  369                         out[i] ^= *((uint32_t *) src);
 
  394         memcpy(c->
pal, src, 768);
 
  406     int buf_size = avpkt->
size;
 
  410     int hi_ver, lo_ver, 
ret;
 
  430                "Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",
 
  432         if (hi_ver != 0 || lo_ver != 1) {
 
  436         if (c->
bw == 0 || c->
bh == 0) {
 
  464 #ifdef ZMBV_ENABLE_24BPP 
  472 #endif //ZMBV_ENABLE_24BPP 
  486         zret = inflateReset(&c->
zstream);
 
  523         zret = inflate(&c->
zstream, Z_SYNC_FLUSH);
 
  524         if (zret != Z_OK && zret != Z_STREAM_END) {
 
  546         out = frame->
data[0];
 
  550             for (j = 0; j < 256; j++)
 
  554 #ifdef ZMBV_ENABLE_24BPP 
  585     memset(&c->
zstream, 0, 
sizeof(z_stream));
 
  593                    "Can't allocate decompression buffer.\n");
 
  601     zret = inflateInit(&c->
zstream);