static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length){

    int x, y, x2, y2;

    const int width= f->avctx->width;

    const int height= f->avctx->height;

    uint16_t *dst= (uint16_t*)f->current_picture.data[0];

    const int stride= f->current_picture.linesize[0]>>1;



    for(y=0; y<height; y+=16){

        for(x=0; x<width; x+=16){

            unsigned int color[4], bits;

            memset(color, 0, sizeof(color));

//warning following is purely guessed ...

            color[0]= bytestream_get_le16(&buf);

            color[1]= bytestream_get_le16(&buf);



            if(color[0]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 1\n");

            if(color[1]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 2\n");



            color[2]= mix(color[0], color[1]);

            color[3]= mix(color[1], color[0]);



            bits= bytestream_get_le32(&buf);

            for(y2=0; y2<16; y2++){

                for(x2=0; x2<16; x2++){

                    int index= 2*(x2>>2) + 8*(y2>>2);

                    dst[y2*stride+x2]= color[(bits>>index)&3];

                }

            }

            dst+=16;

        }

        dst += 16 * stride - x;

    }



    return 0;

}

static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length){

    int x, y, x2, y2;

    const int width= f->avctx->width;

    const int height= f->avctx->height;

    uint16_t *dst= (uint16_t*)f->current_picture.data[0];

    const int stride= f->current_picture.linesize[0]>>1;



    for(y=0; y<height; y+=16){

        for(x=0; x<width; x+=16){

            unsigned int color[4], bits;

            memset(color, 0, sizeof(color));



            color[0]= bytestream_get_le16(&buf);

            color[1]= bytestream_get_le16(&buf);



            if(color[0]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 1\n");

            if(color[1]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 2\n");



            color[2]= mix(color[0], color[1]);

            color[3]= mix(color[1], color[0]);



            bits= bytestream_get_le32(&buf);

            for(y2=0; y2<16; y2++){

                for(x2=0; x2<16; x2++){

                    int index= 2*(x2>>2) + 8*(y2>>2);

                    dst[y2*stride+x2]= color[(bits>>index)&3];

                }

            }

            dst+=16;

        }

        dst += 16 * stride - x;

    }



    return 0;

}

            color[0]= bytestream_get_le16(&buf);             color[1]= bytestream_get_le16(&buf);             bits= bytestream_get_le32(&buf);
static int FUNC_0(FourXContext *VAR_0, const uint8_t *VAR_1, int VAR_2){

    int VAR_3, VAR_4, VAR_5, VAR_6;

    const int VAR_7= VAR_0->avctx->VAR_7;

    const int VAR_8= VAR_0->avctx->VAR_8;

    uint16_t *dst= (uint16_t*)VAR_0->current_picture.data[0];

    const int VAR_9= VAR_0->current_picture.linesize[0]>>1;



    for(VAR_4=0; VAR_4<VAR_8; VAR_4+=16){

        for(VAR_3=0; VAR_3<VAR_7; VAR_3+=16){

            unsigned int VAR_10[4], VAR_11;

            memset(VAR_10, 0, sizeof(VAR_10));



            VAR_10[0]= bytestream_get_le16(&VAR_1);

            VAR_10[1]= bytestream_get_le16(&VAR_1);



            if(VAR_10[0]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 1\n");

            if(VAR_10[1]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 2\n");



            VAR_10[2]= mix(VAR_10[0], VAR_10[1]);

            VAR_10[3]= mix(VAR_10[1], VAR_10[0]);



            VAR_11= bytestream_get_le32(&VAR_1);

            for(VAR_6=0; VAR_6<16; VAR_6++){

                for(VAR_5=0; VAR_5<16; VAR_5++){

                    int VAR_12= 2*(VAR_5>>2) + 8*(VAR_6>>2);

                    dst[VAR_6*VAR_9+VAR_5]= VAR_10[(VAR_11>>VAR_12)&3];

                }

            }

            dst+=16;

        }

        dst += 16 * VAR_9 - VAR_3;

    }



    return 0;

}

static int FUNC_0(FourXContext *VAR_0, const uint8_t *VAR_1, int VAR_2){ int VAR_3, VAR_4, VAR_5, VAR_6; const int VAR_7= VAR_0->avctx->VAR_7; const int VAR_8= VAR_0->avctx->VAR_8; uint16_t *dst= (uint16_t*)VAR_0->current_picture.data[0]; const int VAR_9= VAR_0->current_picture.linesize[0]>>1; for(VAR_4=0; VAR_4<VAR_8; VAR_4+=16){ for(VAR_3=0; VAR_3<VAR_7; VAR_3+=16){ unsigned int VAR_10[4], VAR_11; memset(VAR_10, 0, sizeof(VAR_10)); VAR_10[0]= bytestream_get_le16(&VAR_1); VAR_10[1]= bytestream_get_le16(&VAR_1); if(VAR_10[0]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 1\n"); if(VAR_10[1]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 2\n"); VAR_10[2]= mix(VAR_10[0], VAR_10[1]); VAR_10[3]= mix(VAR_10[1], VAR_10[0]); VAR_11= bytestream_get_le32(&VAR_1); for(VAR_6=0; VAR_6<16; VAR_6++){ for(VAR_5=0; VAR_5<16; VAR_5++){ int VAR_12= 2*(VAR_5>>2) + 8*(VAR_6>>2); dst[VAR_6*VAR_9+VAR_5]= VAR_10[(VAR_11>>VAR_12)&3]; } } dst+=16; } dst += 16 * VAR_9 - VAR_3; } return 0; }