sg_second_last_plane = s->second_last_frame.data[0];
static void ipvideo_decode_opcodes(IpvideoContext *s){    int x, y;    int index = 0;    unsigned char opcode;    int ret;    int code_counts[16];    static int frame = 0;    debug_interplay("------------------ frame %d\n", frame);    frame++;    for (x = 0; x < 16; x++)        code_counts[x] = 0;    /* this is PAL8, so make the palette available */    if (s->avctx->pix_fmt == PIX_FMT_PAL8)        memcpy(s->current_frame.data[1], s->palette, PALETTE_COUNT * 4);    switch (s->avctx->pix_fmt) {    case PIX_FMT_PAL8:        sg_stride = s->current_frame.linesize[0];        sg_stream_ptr = s->buf + 14;  /* data starts 14 bytes in */        sg_stream_end = s->buf + s->size;        sg_line_inc = sg_stride - 8;        sg_current_plane = s->current_frame.data[0];        sg_last_plane = s->last_frame.data[0];        sg_upper_motion_limit_offset = (s->avctx->height - 8) * sg_stride            + s->avctx->width - 8;        sg_dsp = s->dsp;        for (y = 0; y < (sg_stride * s->avctx->height); y += sg_stride * 8) {            for (x = y; x < y + s->avctx->width; x += 8) {                /* bottom nibble first, then top nibble (which makes it                 * hard to use a GetBitcontext) */                if (index & 1)                    opcode = s->decoding_map[index >> 1] >> 4;                else                    opcode = s->decoding_map[index >> 1] & 0xF;                index++;                debug_interplay("  block @ (%3d, %3d): encoding 0x%X, data ptr @ %p\n",                    x - y, y / sg_stride, opcode, sg_stream_ptr);                code_counts[opcode]++;                sg_output_plane = sg_current_plane + x;                ret = ipvideo_decode_block[opcode]();                if (ret != 0) {                    printf(" Interplay video: decode problem on frame %d, @ block (%d, %d)\n",                        frame, x - y, y / sg_stride);                    return;                }            }        }        if ((sg_stream_ptr != sg_stream_end) &&            (sg_stream_ptr + 1 != sg_stream_end)) {            printf (" Interplay video: decode finished with %d bytes left over\n",                sg_stream_end - sg_stream_ptr);        }        break;    default:        printf ("Interplay video: Unhandled video format\n");        break;    }}