static void cmv_decode_inter(CmvContext * s, const uint8_t *buf, const uint8_t *buf_end){

    const uint8_t *raw = buf + (s->avctx->width*s->avctx->height/16);

    int x,y,i;



    i = 0;

    for(y=0; y<s->avctx->height/4; y++)

    for(x=0; x<s->avctx->width/4 && buf+i<buf_end; x++) {

        if (buf[i]==0xFF) {

            unsigned char *dst = s->frame.data[0] + (y*4)*s->frame.linesize[0] + x*4;

            if (raw+16<buf_end && *raw==0xFF) { /* intra */

                raw++;

                memcpy(dst, raw, 4);

                memcpy(dst+s->frame.linesize[0], raw+4, 4);

                memcpy(dst+2*s->frame.linesize[0], raw+8, 4);

                memcpy(dst+3*s->frame.linesize[0], raw+12, 4);

                raw+=16;

            }else if(raw<buf_end) {  /* inter using second-last frame as reference */

                int xoffset = (*raw & 0xF) - 7;

                int yoffset = ((*raw >> 4)) - 7;

                if (s->last2_frame.data[0])

                    cmv_motcomp(s->frame.data[0], s->frame.linesize[0],

                                s->last2_frame.data[0], s->last2_frame.linesize[0],

                                x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);

                raw++;

            }

        }else{  /* inter using last frame as reference */

            int xoffset = (buf[i] & 0xF) - 7;

            int yoffset = ((buf[i] >> 4)) - 7;

            cmv_motcomp(s->frame.data[0], s->frame.linesize[0],

                      s->last_frame.data[0], s->last_frame.linesize[0],

                      x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);

        }

        i++;

    }

}

static void cmv_decode_inter(CmvContext * s, const uint8_t *buf, const uint8_t *buf_end){

    const uint8_t *raw = buf + (s->avctx->width*s->avctx->height/16);

    int x,y,i;



    i = 0;

    for(y=0; y<s->avctx->height/4; y++)

    for(x=0; x<s->avctx->width/4 && buf+i<buf_end; x++) {

        if (buf[i]==0xFF) {

            unsigned char *dst = s->frame.data[0] + (y*4)*s->frame.linesize[0] + x*4;

            if (raw+16<buf_end && *raw==0xFF) { 

                raw++;

                memcpy(dst, raw, 4);

                memcpy(dst+s->frame.linesize[0], raw+4, 4);

                memcpy(dst+2*s->frame.linesize[0], raw+8, 4);

                memcpy(dst+3*s->frame.linesize[0], raw+12, 4);

                raw+=16;

            }else if(raw<buf_end) {  

                int xoffset = (*raw & 0xF) - 7;

                int yoffset = ((*raw >> 4)) - 7;

                if (s->last2_frame.data[0])

                    cmv_motcomp(s->frame.data[0], s->frame.linesize[0],

                                s->last2_frame.data[0], s->last2_frame.linesize[0],

                                x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);

                raw++;

            }

        }else{  

            int xoffset = (buf[i] & 0xF) - 7;

            int yoffset = ((buf[i] >> 4)) - 7;

            cmv_motcomp(s->frame.data[0], s->frame.linesize[0],

                      s->last_frame.data[0], s->last_frame.linesize[0],

                      x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);

        }

        i++;

    }

}

    for(x=0; x<s->avctx->width/4 && buf+i<buf_end; x++) {
static void FUNC_0(CmvContext * VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2){

    const uint8_t *VAR_3 = VAR_1 + (VAR_0->avctx->width*VAR_0->avctx->height/16);

    int VAR_4,VAR_5,VAR_6;



    VAR_6 = 0;

    for(VAR_5=0; VAR_5<VAR_0->avctx->height/4; VAR_5++)

    for(VAR_4=0; VAR_4<VAR_0->avctx->width/4 && VAR_1+VAR_6<VAR_2; VAR_4++) {

        if (VAR_1[VAR_6]==0xFF) {

            unsigned char *dst = VAR_0->frame.data[0] + (VAR_5*4)*VAR_0->frame.linesize[0] + VAR_4*4;

            if (VAR_3+16<VAR_2 && *VAR_3==0xFF) { 

                VAR_3++;

                memcpy(dst, VAR_3, 4);

                memcpy(dst+VAR_0->frame.linesize[0], VAR_3+4, 4);

                memcpy(dst+2*VAR_0->frame.linesize[0], VAR_3+8, 4);

                memcpy(dst+3*VAR_0->frame.linesize[0], VAR_3+12, 4);

                VAR_3+=16;

            }else if(VAR_3<VAR_2) {  

                int xoffset = (*VAR_3 & 0xF) - 7;

                int yoffset = ((*VAR_3 >> 4)) - 7;

                if (VAR_0->last2_frame.data[0])

                    cmv_motcomp(VAR_0->frame.data[0], VAR_0->frame.linesize[0],

                                VAR_0->last2_frame.data[0], VAR_0->last2_frame.linesize[0],

                                VAR_4*4, VAR_5*4, xoffset, yoffset, VAR_0->avctx->width, VAR_0->avctx->height);

                VAR_3++;

            }

        }else{  

            int xoffset = (VAR_1[VAR_6] & 0xF) - 7;

            int yoffset = ((VAR_1[VAR_6] >> 4)) - 7;

            cmv_motcomp(VAR_0->frame.data[0], VAR_0->frame.linesize[0],

                      VAR_0->last_frame.data[0], VAR_0->last_frame.linesize[0],

                      VAR_4*4, VAR_5*4, xoffset, yoffset, VAR_0->avctx->width, VAR_0->avctx->height);

        }

        VAR_6++;

    }

}

static void FUNC_0(CmvContext * VAR_0, const uint8_t *VAR_1, const uint8_t *VAR_2){ const uint8_t *VAR_3 = VAR_1 + (VAR_0->avctx->width*VAR_0->avctx->height/16); int VAR_4,VAR_5,VAR_6; VAR_6 = 0; for(VAR_5=0; VAR_5<VAR_0->avctx->height/4; VAR_5++) for(VAR_4=0; VAR_4<VAR_0->avctx->width/4 && VAR_1+VAR_6<VAR_2; VAR_4++) { if (VAR_1[VAR_6]==0xFF) { unsigned char *dst = VAR_0->frame.data[0] + (VAR_5*4)*VAR_0->frame.linesize[0] + VAR_4*4; if (VAR_3+16<VAR_2 && *VAR_3==0xFF) { VAR_3++; memcpy(dst, VAR_3, 4); memcpy(dst+VAR_0->frame.linesize[0], VAR_3+4, 4); memcpy(dst+2*VAR_0->frame.linesize[0], VAR_3+8, 4); memcpy(dst+3*VAR_0->frame.linesize[0], VAR_3+12, 4); VAR_3+=16; }else if(VAR_3<VAR_2) { int xoffset = (*VAR_3 & 0xF) - 7; int yoffset = ((*VAR_3 >> 4)) - 7; if (VAR_0->last2_frame.data[0])
cmv_motcomp(VAR_0->frame.data[0], VAR_0->frame.linesize[0],
VAR_0->last2_frame.data[0], VAR_0->last2_frame.linesize[0],
VAR_4*4, VAR_5*4, xoffset, yoffset, VAR_0->avctx->width, VAR_0->avctx->height); VAR_3++; } }else{ int xoffset = (VAR_1[VAR_6] & 0xF) - 7; int yoffset = ((VAR_1[VAR_6] >> 4)) - 7; cmv_motcomp(VAR_0->frame.data[0], VAR_0->frame.linesize[0],
VAR_0->last_frame.data[0], VAR_0->last_frame.linesize[0],
VAR_4*4, VAR_5*4, xoffset, yoffset, VAR_0->avctx->width, VAR_0->avctx->height); } VAR_6++; } }