static void render_slice(Vp3DecodeContext *s, int slice)

{

    int x, y;

    int m, n;

    int i;  /* indicates current fragment */

    int16_t *dequantizer;

    DCTELEM __align16 block[64];

    unsigned char *output_plane;

    unsigned char *last_plane;

    unsigned char *golden_plane;

    int stride;

    int motion_x = 0xdeadbeef, motion_y = 0xdeadbeef;

    int upper_motion_limit, lower_motion_limit;

    int motion_halfpel_index;

    uint8_t *motion_source;

    int plane;

    int plane_width;

    int plane_height;

    int slice_height;

    int current_macroblock_entry = slice * s->macroblock_width * 6;



    if (slice >= s->macroblock_height)

        return;



    for (plane = 0; plane < 3; plane++) {



        /* set up plane-specific parameters */

        if (plane == 0) {

            output_plane = s->current_frame.data[0];

            last_plane = s->last_frame.data[0];

            golden_plane = s->golden_frame.data[0];

            stride = s->current_frame.linesize[0];

            if (!s->flipped_image) stride = -stride;

            upper_motion_limit = 7 * s->current_frame.linesize[0];

            lower_motion_limit = s->height * s->current_frame.linesize[0] + s->width - 8;

            y = slice * FRAGMENT_PIXELS * 2;

            plane_width = s->width;

            plane_height = s->height;

            slice_height = y + FRAGMENT_PIXELS * 2;

            i = s->macroblock_fragments[current_macroblock_entry + 0];

        } else if (plane == 1) {

            output_plane = s->current_frame.data[1];

            last_plane = s->last_frame.data[1];

            golden_plane = s->golden_frame.data[1];

            stride = s->current_frame.linesize[1];

            if (!s->flipped_image) stride = -stride;

            upper_motion_limit = 7 * s->current_frame.linesize[1];

            lower_motion_limit = (s->height / 2) * s->current_frame.linesize[1] + (s->width / 2) - 8;

            y = slice * FRAGMENT_PIXELS;

            plane_width = s->width / 2;

            plane_height = s->height / 2;

            slice_height = y + FRAGMENT_PIXELS;

            i = s->macroblock_fragments[current_macroblock_entry + 4];

        } else {

            output_plane = s->current_frame.data[2];

            last_plane = s->last_frame.data[2];

            golden_plane = s->golden_frame.data[2];

            stride = s->current_frame.linesize[2];

            if (!s->flipped_image) stride = -stride;

            upper_motion_limit = 7 * s->current_frame.linesize[2];

            lower_motion_limit = (s->height / 2) * s->current_frame.linesize[2] + (s->width / 2) - 8;

            y = slice * FRAGMENT_PIXELS;

            plane_width = s->width / 2;

            plane_height = s->height / 2;

            slice_height = y + FRAGMENT_PIXELS;

            i = s->macroblock_fragments[current_macroblock_entry + 5];

        }

    

        if(ABS(stride) > 2048)

            return; //various tables are fixed size



        /* for each fragment row in the slice (both of them)... */

        for (; y < slice_height; y += 8) {



            /* for each fragment in a row... */

            for (x = 0; x < plane_width; x += 8, i++) {



                if ((i < 0) || (i >= s->fragment_count)) {

                    av_log(s->avctx, AV_LOG_ERROR, "  vp3:render_slice(): bad fragment number (%d)\n", i);

                    return;

                }



                /* transform if this block was coded */

                if ((s->all_fragments[i].coding_method != MODE_COPY) &&

                    !((s->avctx->flags & CODEC_FLAG_GRAY) && plane)) {



                    if ((s->all_fragments[i].coding_method == MODE_USING_GOLDEN) ||

                        (s->all_fragments[i].coding_method == MODE_GOLDEN_MV))

                        motion_source= golden_plane;

                    else 

                        motion_source= last_plane;



                    motion_source += s->all_fragments[i].first_pixel;

                    motion_halfpel_index = 0;



                    /* sort out the motion vector if this fragment is coded

                     * using a motion vector method */

                    if ((s->all_fragments[i].coding_method > MODE_INTRA) &&

                        (s->all_fragments[i].coding_method != MODE_USING_GOLDEN)) {

                        int src_x, src_y;

                        motion_x = s->all_fragments[i].motion_x;

                        motion_y = s->all_fragments[i].motion_y;

                        if(plane){

                            motion_x= (motion_x>>1) | (motion_x&1);

                            motion_y= (motion_y>>1) | (motion_y&1);

                        }



                        src_x= (motion_x>>1) + x;

                        src_y= (motion_y>>1) + y;

                        if ((motion_x == 127) || (motion_y == 127))

                            av_log(s->avctx, AV_LOG_ERROR, " help! got invalid motion vector! (%X, %X)\n", motion_x, motion_y);



                        motion_halfpel_index = motion_x & 0x01;

                        motion_source += (motion_x >> 1);



                        motion_halfpel_index |= (motion_y & 0x01) << 1;

                        motion_source += ((motion_y >> 1) * stride);



                        if(src_x<0 || src_y<0 || src_x + 9 >= plane_width || src_y + 9 >= plane_height){

                            uint8_t *temp= s->edge_emu_buffer;

                            if(stride<0) temp -= 9*stride;

                            else temp += 9*stride;



                            ff_emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height);

                            motion_source= temp;

                        }

                    }

                



                    /* first, take care of copying a block from either the

                     * previous or the golden frame */

                    if (s->all_fragments[i].coding_method != MODE_INTRA) {

                        /* Note, it is possible to implement all MC cases with 

                           put_no_rnd_pixels_l2 which would look more like the 

                           VP3 source but this would be slower as 

                           put_no_rnd_pixels_tab is better optimzed */

                        if(motion_halfpel_index != 3){

                            s->dsp.put_no_rnd_pixels_tab[1][motion_halfpel_index](

                                output_plane + s->all_fragments[i].first_pixel,

                                motion_source, stride, 8);

                        }else{

                            int d= (motion_x ^ motion_y)>>31; // d is 0 if motion_x and _y have the same sign, else -1

                            s->dsp.put_no_rnd_pixels_l2[1](

                                output_plane + s->all_fragments[i].first_pixel,

                                motion_source - d, 

                                motion_source + stride + 1 + d, 

                                stride, 8);

                        }

                        dequantizer = s->inter_dequant;

                    }else{

                        if (plane == 0)

                            dequantizer = s->intra_y_dequant;

                        else

                            dequantizer = s->intra_c_dequant;

                    }



                    /* dequantize the DCT coefficients */

                    debug_idct("fragment %d, coding mode %d, DC = %d, dequant = %d:\n", 

                        i, s->all_fragments[i].coding_method, 

                        DC_COEFF(i), dequantizer[0]);



                    if(s->avctx->idct_algo==FF_IDCT_VP3){

                        Coeff *coeff= s->coeffs + i;

                        memset(block, 0, sizeof(block));

                        while(coeff->next){

                            block[coeff->index]= coeff->coeff * dequantizer[coeff->index];

                            coeff= coeff->next;

                        }

                    }else{

                        Coeff *coeff= s->coeffs + i;

                        memset(block, 0, sizeof(block));

                        while(coeff->next){

                            block[coeff->index]= (coeff->coeff * dequantizer[coeff->index] + 2)>>2;

                            coeff= coeff->next;

                        }

                    }



                    /* invert DCT and place (or add) in final output */

                

                    if (s->all_fragments[i].coding_method == MODE_INTRA) {

                        if(s->avctx->idct_algo!=FF_IDCT_VP3)

                            block[0] += 128<<3;

                        s->dsp.idct_put(

                            output_plane + s->all_fragments[i].first_pixel,

                            stride,

                            block);

                    } else {

                        s->dsp.idct_add(

                            output_plane + s->all_fragments[i].first_pixel,

                            stride,

                            block);

                    }



                    debug_idct("block after idct_%s():\n",

                        (s->all_fragments[i].coding_method == MODE_INTRA)?

                        "put" : "add");

                    for (m = 0; m < 8; m++) {

                        for (n = 0; n < 8; n++) {

                            debug_idct(" %3d", *(output_plane + 

                                s->all_fragments[i].first_pixel + (m * stride + n)));

                        }

                        debug_idct("\n");

                    }

                    debug_idct("\n");



                } else {



                    /* copy directly from the previous frame */

                    s->dsp.put_pixels_tab[1][0](

                        output_plane + s->all_fragments[i].first_pixel,

                        last_plane + s->all_fragments[i].first_pixel,

                        stride, 8);



                }

            }

        }

    }



    /* future loop filter logic goes here... */

    /* algorithm: 

     *   if (slice != 0) 

     *     run filter on 1st row of Y slice

     *     run filter on U slice

     *     run filter on V slice

     *   run filter on 2nd row of Y slice

     */



     /* this looks like a good place for slice dispatch... */

     /* algorithm:

      *   if (slice > 0)

      *     dispatch (slice - 1);

      *   if (slice == s->macroblock_height - 1)

      *     dispatch (slice);  // handle last slice

      */



    emms_c();

}

static void render_slice(Vp3DecodeContext *s, int slice)

{

    int x, y;

    int m, n;

    int i;  

    int16_t *dequantizer;

    DCTELEM __align16 block[64];

    unsigned char *output_plane;

    unsigned char *last_plane;

    unsigned char *golden_plane;

    int stride;

    int motion_x = 0xdeadbeef, motion_y = 0xdeadbeef;

    int upper_motion_limit, lower_motion_limit;

    int motion_halfpel_index;

    uint8_t *motion_source;

    int plane;

    int plane_width;

    int plane_height;

    int slice_height;

    int current_macroblock_entry = slice * s->macroblock_width * 6;



    if (slice >= s->macroblock_height)

        return;



    for (plane = 0; plane < 3; plane++) {



        

        if (plane == 0) {

            output_plane = s->current_frame.data[0];

            last_plane = s->last_frame.data[0];

            golden_plane = s->golden_frame.data[0];

            stride = s->current_frame.linesize[0];

            if (!s->flipped_image) stride = -stride;

            upper_motion_limit = 7 * s->current_frame.linesize[0];

            lower_motion_limit = s->height * s->current_frame.linesize[0] + s->width - 8;

            y = slice * FRAGMENT_PIXELS * 2;

            plane_width = s->width;

            plane_height = s->height;

            slice_height = y + FRAGMENT_PIXELS * 2;

            i = s->macroblock_fragments[current_macroblock_entry + 0];

        } else if (plane == 1) {

            output_plane = s->current_frame.data[1];

            last_plane = s->last_frame.data[1];

            golden_plane = s->golden_frame.data[1];

            stride = s->current_frame.linesize[1];

            if (!s->flipped_image) stride = -stride;

            upper_motion_limit = 7 * s->current_frame.linesize[1];

            lower_motion_limit = (s->height / 2) * s->current_frame.linesize[1] + (s->width / 2) - 8;

            y = slice * FRAGMENT_PIXELS;

            plane_width = s->width / 2;

            plane_height = s->height / 2;

            slice_height = y + FRAGMENT_PIXELS;

            i = s->macroblock_fragments[current_macroblock_entry + 4];

        } else {

            output_plane = s->current_frame.data[2];

            last_plane = s->last_frame.data[2];

            golden_plane = s->golden_frame.data[2];

            stride = s->current_frame.linesize[2];

            if (!s->flipped_image) stride = -stride;

            upper_motion_limit = 7 * s->current_frame.linesize[2];

            lower_motion_limit = (s->height / 2) * s->current_frame.linesize[2] + (s->width / 2) - 8;

            y = slice * FRAGMENT_PIXELS;

            plane_width = s->width / 2;

            plane_height = s->height / 2;

            slice_height = y + FRAGMENT_PIXELS;

            i = s->macroblock_fragments[current_macroblock_entry + 5];

        }

    

        if(ABS(stride) > 2048)

            return; 



        

        for (; y < slice_height; y += 8) {



            

            for (x = 0; x < plane_width; x += 8, i++) {



                if ((i < 0) || (i >= s->fragment_count)) {

                    av_log(s->avctx, AV_LOG_ERROR, "  vp3:render_slice(): bad fragment number (%d)\n", i);

                    return;

                }



                

                if ((s->all_fragments[i].coding_method != MODE_COPY) &&

                    !((s->avctx->flags & CODEC_FLAG_GRAY) && plane)) {



                    if ((s->all_fragments[i].coding_method == MODE_USING_GOLDEN) ||

                        (s->all_fragments[i].coding_method == MODE_GOLDEN_MV))

                        motion_source= golden_plane;

                    else 

                        motion_source= last_plane;



                    motion_source += s->all_fragments[i].first_pixel;

                    motion_halfpel_index = 0;



                    



                    if ((s->all_fragments[i].coding_method > MODE_INTRA) &&

                        (s->all_fragments[i].coding_method != MODE_USING_GOLDEN)) {

                        int src_x, src_y;

                        motion_x = s->all_fragments[i].motion_x;

                        motion_y = s->all_fragments[i].motion_y;

                        if(plane){

                            motion_x= (motion_x>>1) | (motion_x&1);

                            motion_y= (motion_y>>1) | (motion_y&1);

                        }



                        src_x= (motion_x>>1) + x;

                        src_y= (motion_y>>1) + y;

                        if ((motion_x == 127) || (motion_y == 127))

                            av_log(s->avctx, AV_LOG_ERROR, " help! got invalid motion vector! (%X, %X)\n", motion_x, motion_y);



                        motion_halfpel_index = motion_x & 0x01;

                        motion_source += (motion_x >> 1);



                        motion_halfpel_index |= (motion_y & 0x01) << 1;

                        motion_source += ((motion_y >> 1) * stride);



                        if(src_x<0 || src_y<0 || src_x + 9 >= plane_width || src_y + 9 >= plane_height){

                            uint8_t *temp= s->edge_emu_buffer;

                            if(stride<0) temp -= 9*stride;

                            else temp += 9*stride;



                            ff_emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height);

                            motion_source= temp;

                        }

                    }

                



                    



                    if (s->all_fragments[i].coding_method != MODE_INTRA) {

                        







                        if(motion_halfpel_index != 3){

                            s->dsp.put_no_rnd_pixels_tab[1][motion_halfpel_index](

                                output_plane + s->all_fragments[i].first_pixel,

                                motion_source, stride, 8);

                        }else{

                            int d= (motion_x ^ motion_y)>>31; 

                            s->dsp.put_no_rnd_pixels_l2[1](

                                output_plane + s->all_fragments[i].first_pixel,

                                motion_source - d, 

                                motion_source + stride + 1 + d, 

                                stride, 8);

                        }

                        dequantizer = s->inter_dequant;

                    }else{

                        if (plane == 0)

                            dequantizer = s->intra_y_dequant;

                        else

                            dequantizer = s->intra_c_dequant;

                    }



                    

                    debug_idct("fragment %d, coding mode %d, DC = %d, dequant = %d:\n", 

                        i, s->all_fragments[i].coding_method, 

                        DC_COEFF(i), dequantizer[0]);



                    if(s->avctx->idct_algo==FF_IDCT_VP3){

                        Coeff *coeff= s->coeffs + i;

                        memset(block, 0, sizeof(block));

                        while(coeff->next){

                            block[coeff->index]= coeff->coeff * dequantizer[coeff->index];

                            coeff= coeff->next;

                        }

                    }else{

                        Coeff *coeff= s->coeffs + i;

                        memset(block, 0, sizeof(block));

                        while(coeff->next){

                            block[coeff->index]= (coeff->coeff * dequantizer[coeff->index] + 2)>>2;

                            coeff= coeff->next;

                        }

                    }



                    

                

                    if (s->all_fragments[i].coding_method == MODE_INTRA) {

                        if(s->avctx->idct_algo!=FF_IDCT_VP3)

                            block[0] += 128<<3;

                        s->dsp.idct_put(

                            output_plane + s->all_fragments[i].first_pixel,

                            stride,

                            block);

                    } else {

                        s->dsp.idct_add(

                            output_plane + s->all_fragments[i].first_pixel,

                            stride,

                            block);

                    }



                    debug_idct("block after idct_%s():\n",

                        (s->all_fragments[i].coding_method == MODE_INTRA)?

                        "put" : "add");

                    for (m = 0; m < 8; m++) {

                        for (n = 0; n < 8; n++) {

                            debug_idct(" %3d", *(output_plane + 

                                s->all_fragments[i].first_pixel + (m * stride + n)));

                        }

                        debug_idct("\n");

                    }

                    debug_idct("\n");



                } else {



                    

                    s->dsp.put_pixels_tab[1][0](

                        output_plane + s->all_fragments[i].first_pixel,

                        last_plane + s->all_fragments[i].first_pixel,

                        stride, 8);



                }

            }

        }

    }



    

    















     

     













    emms_c();

}

static void FUNC_0(Vp3DecodeContext *VAR_0, int VAR_1)

{

    int VAR_2, VAR_3;

    int VAR_4, VAR_5;

    int VAR_6;  

    int16_t *dequantizer;

    DCTELEM __align16 block[64];

    unsigned char *VAR_7;

    unsigned char *VAR_8;

    unsigned char *VAR_9;

    int VAR_10;

    int VAR_11 = 0xdeadbeef, VAR_12 = 0xdeadbeef;

    int VAR_13, VAR_14;

    int VAR_15;

    uint8_t *motion_source;

    int VAR_16;

    int VAR_17;

    int VAR_18;

    int VAR_19;

    int VAR_20 = VAR_1 * VAR_0->macroblock_width * 6;



    if (VAR_1 >= VAR_0->macroblock_height)

        return;



    for (VAR_16 = 0; VAR_16 < 3; VAR_16++) {



        

        if (VAR_16 == 0) {

            VAR_7 = VAR_0->current_frame.data[0];

            VAR_8 = VAR_0->last_frame.data[0];

            VAR_9 = VAR_0->golden_frame.data[0];

            VAR_10 = VAR_0->current_frame.linesize[0];

            if (!VAR_0->flipped_image) VAR_10 = -VAR_10;

            VAR_13 = 7 * VAR_0->current_frame.linesize[0];

            VAR_14 = VAR_0->height * VAR_0->current_frame.linesize[0] + VAR_0->width - 8;

            VAR_3 = VAR_1 * FRAGMENT_PIXELS * 2;

            VAR_17 = VAR_0->width;

            VAR_18 = VAR_0->height;

            VAR_19 = VAR_3 + FRAGMENT_PIXELS * 2;

            VAR_6 = VAR_0->macroblock_fragments[VAR_20 + 0];

        } else if (VAR_16 == 1) {

            VAR_7 = VAR_0->current_frame.data[1];

            VAR_8 = VAR_0->last_frame.data[1];

            VAR_9 = VAR_0->golden_frame.data[1];

            VAR_10 = VAR_0->current_frame.linesize[1];

            if (!VAR_0->flipped_image) VAR_10 = -VAR_10;

            VAR_13 = 7 * VAR_0->current_frame.linesize[1];

            VAR_14 = (VAR_0->height / 2) * VAR_0->current_frame.linesize[1] + (VAR_0->width / 2) - 8;

            VAR_3 = VAR_1 * FRAGMENT_PIXELS;

            VAR_17 = VAR_0->width / 2;

            VAR_18 = VAR_0->height / 2;

            VAR_19 = VAR_3 + FRAGMENT_PIXELS;

            VAR_6 = VAR_0->macroblock_fragments[VAR_20 + 4];

        } else {

            VAR_7 = VAR_0->current_frame.data[2];

            VAR_8 = VAR_0->last_frame.data[2];

            VAR_9 = VAR_0->golden_frame.data[2];

            VAR_10 = VAR_0->current_frame.linesize[2];

            if (!VAR_0->flipped_image) VAR_10 = -VAR_10;

            VAR_13 = 7 * VAR_0->current_frame.linesize[2];

            VAR_14 = (VAR_0->height / 2) * VAR_0->current_frame.linesize[2] + (VAR_0->width / 2) - 8;

            VAR_3 = VAR_1 * FRAGMENT_PIXELS;

            VAR_17 = VAR_0->width / 2;

            VAR_18 = VAR_0->height / 2;

            VAR_19 = VAR_3 + FRAGMENT_PIXELS;

            VAR_6 = VAR_0->macroblock_fragments[VAR_20 + 5];

        }

    

        if(ABS(VAR_10) > 2048)

            return; 



        

        for (; VAR_3 < VAR_19; VAR_3 += 8) {



            

            for (VAR_2 = 0; VAR_2 < VAR_17; VAR_2 += 8, VAR_6++) {



                if ((VAR_6 < 0) || (VAR_6 >= VAR_0->fragment_count)) {

                    av_log(VAR_0->avctx, AV_LOG_ERROR, "  vp3:FUNC_0(): bad fragment number (%VAR_23)\VAR_5", VAR_6);

                    return;

                }



                

                if ((VAR_0->all_fragments[VAR_6].coding_method != MODE_COPY) &&

                    !((VAR_0->avctx->flags & CODEC_FLAG_GRAY) && VAR_16)) {



                    if ((VAR_0->all_fragments[VAR_6].coding_method == MODE_USING_GOLDEN) ||

                        (VAR_0->all_fragments[VAR_6].coding_method == MODE_GOLDEN_MV))

                        motion_source= VAR_9;

                    else 

                        motion_source= VAR_8;



                    motion_source += VAR_0->all_fragments[VAR_6].first_pixel;

                    VAR_15 = 0;



                    



                    if ((VAR_0->all_fragments[VAR_6].coding_method > MODE_INTRA) &&

                        (VAR_0->all_fragments[VAR_6].coding_method != MODE_USING_GOLDEN)) {

                        int VAR_21, VAR_22;

                        VAR_11 = VAR_0->all_fragments[VAR_6].VAR_11;

                        VAR_12 = VAR_0->all_fragments[VAR_6].VAR_12;

                        if(VAR_16){

                            VAR_11= (VAR_11>>1) | (VAR_11&1);

                            VAR_12= (VAR_12>>1) | (VAR_12&1);

                        }



                        VAR_21= (VAR_11>>1) + VAR_2;

                        VAR_22= (VAR_12>>1) + VAR_3;

                        if ((VAR_11 == 127) || (VAR_12 == 127))

                            av_log(VAR_0->avctx, AV_LOG_ERROR, " help! got invalid motion vector! (%X, %X)\VAR_5", VAR_11, VAR_12);



                        VAR_15 = VAR_11 & 0x01;

                        motion_source += (VAR_11 >> 1);



                        VAR_15 |= (VAR_12 & 0x01) << 1;

                        motion_source += ((VAR_12 >> 1) * VAR_10);



                        if(VAR_21<0 || VAR_22<0 || VAR_21 + 9 >= VAR_17 || VAR_22 + 9 >= VAR_18){

                            uint8_t *temp= VAR_0->edge_emu_buffer;

                            if(VAR_10<0) temp -= 9*VAR_10;

                            else temp += 9*VAR_10;



                            ff_emulated_edge_mc(temp, motion_source, VAR_10, 9, 9, VAR_21, VAR_22, VAR_17, VAR_18);

                            motion_source= temp;

                        }

                    }

                



                    



                    if (VAR_0->all_fragments[VAR_6].coding_method != MODE_INTRA) {

                        







                        if(VAR_15 != 3){

                            VAR_0->dsp.put_no_rnd_pixels_tab[1][VAR_15](

                                VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,

                                motion_source, VAR_10, 8);

                        }else{

                            int VAR_23= (VAR_11 ^ VAR_12)>>31; 

                            VAR_0->dsp.put_no_rnd_pixels_l2[1](

                                VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,

                                motion_source - VAR_23, 

                                motion_source + VAR_10 + 1 + VAR_23, 

                                VAR_10, 8);

                        }

                        dequantizer = VAR_0->inter_dequant;

                    }else{

                        if (VAR_16 == 0)

                            dequantizer = VAR_0->intra_y_dequant;

                        else

                            dequantizer = VAR_0->intra_c_dequant;

                    }



                    

                    debug_idct("fragment %VAR_23, coding mode %VAR_23, DC = %VAR_23, dequant = %VAR_23:\VAR_5", 

                        VAR_6, VAR_0->all_fragments[VAR_6].coding_method, 

                        DC_COEFF(VAR_6), dequantizer[0]);



                    if(VAR_0->avctx->idct_algo==FF_IDCT_VP3){

                        Coeff *coeff= VAR_0->coeffs + VAR_6;

                        memset(block, 0, sizeof(block));

                        while(coeff->next){

                            block[coeff->index]= coeff->coeff * dequantizer[coeff->index];

                            coeff= coeff->next;

                        }

                    }else{

                        Coeff *coeff= VAR_0->coeffs + VAR_6;

                        memset(block, 0, sizeof(block));

                        while(coeff->next){

                            block[coeff->index]= (coeff->coeff * dequantizer[coeff->index] + 2)>>2;

                            coeff= coeff->next;

                        }

                    }



                    

                

                    if (VAR_0->all_fragments[VAR_6].coding_method == MODE_INTRA) {

                        if(VAR_0->avctx->idct_algo!=FF_IDCT_VP3)

                            block[0] += 128<<3;

                        VAR_0->dsp.idct_put(

                            VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,

                            VAR_10,

                            block);

                    } else {

                        VAR_0->dsp.idct_add(

                            VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,

                            VAR_10,

                            block);

                    }



                    debug_idct("block after idct_%VAR_0():\VAR_5",

                        (VAR_0->all_fragments[VAR_6].coding_method == MODE_INTRA)?

                        "put" : "add");

                    for (VAR_4 = 0; VAR_4 < 8; VAR_4++) {

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

                            debug_idct(" %3d", *(VAR_7 + 

                                VAR_0->all_fragments[VAR_6].first_pixel + (VAR_4 * VAR_10 + VAR_5)));

                        }

                        debug_idct("\VAR_5");

                    }

                    debug_idct("\VAR_5");



                } else {



                    

                    VAR_0->dsp.put_pixels_tab[1][0](

                        VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,

                        VAR_8 + VAR_0->all_fragments[VAR_6].first_pixel,

                        VAR_10, 8);



                }

            }

        }

    }



    

    















     

     













    emms_c();

}

static void FUNC_0(Vp3DecodeContext *VAR_0, int VAR_1)
{ int VAR_2, VAR_3; int VAR_4, VAR_5; int VAR_6; int16_t *dequantizer; DCTELEM __align16 block[64]; unsigned char *VAR_7; unsigned char *VAR_8; unsigned char *VAR_9; int VAR_10; int VAR_11 = 0xdeadbeef, VAR_12 = 0xdeadbeef; int VAR_13, VAR_14; int VAR_15; uint8_t *motion_source; int VAR_16; int VAR_17; int VAR_18; int VAR_19; int VAR_20 = VAR_1 * VAR_0->macroblock_width * 6; if (VAR_1 >= VAR_0->macroblock_height)
return; for (VAR_16 = 0; VAR_16 < 3; VAR_16++) { if (VAR_16 == 0) { VAR_7 = VAR_0->current_frame.data[0]; VAR_8 = VAR_0->last_frame.data[0]; VAR_9 = VAR_0->golden_frame.data[0]; VAR_10 = VAR_0->current_frame.linesize[0]; if (!VAR_0->flipped_image) VAR_10 = -VAR_10; VAR_13 = 7 * VAR_0->current_frame.linesize[0]; VAR_14 = VAR_0->height * VAR_0->current_frame.linesize[0] + VAR_0->width - 8; VAR_3 = VAR_1 * FRAGMENT_PIXELS * 2; VAR_17 = VAR_0->width; VAR_18 = VAR_0->height; VAR_19 = VAR_3 + FRAGMENT_PIXELS * 2; VAR_6 = VAR_0->macroblock_fragments[VAR_20 + 0]; } else if (VAR_16 == 1) { VAR_7 = VAR_0->current_frame.data[1]; VAR_8 = VAR_0->last_frame.data[1]; VAR_9 = VAR_0->golden_frame.data[1]; VAR_10 = VAR_0->current_frame.linesize[1]; if (!VAR_0->flipped_image) VAR_10 = -VAR_10; VAR_13 = 7 * VAR_0->current_frame.linesize[1]; VAR_14 = (VAR_0->height / 2) * VAR_0->current_frame.linesize[1] + (VAR_0->width / 2) - 8; VAR_3 = VAR_1 * FRAGMENT_PIXELS; VAR_17 = VAR_0->width / 2; VAR_18 = VAR_0->height / 2; VAR_19 = VAR_3 + FRAGMENT_PIXELS; VAR_6 = VAR_0->macroblock_fragments[VAR_20 + 4]; } else { VAR_7 = VAR_0->current_frame.data[2]; VAR_8 = VAR_0->last_frame.data[2]; VAR_9 = VAR_0->golden_frame.data[2]; VAR_10 = VAR_0->current_frame.linesize[2]; if (!VAR_0->flipped_image) VAR_10 = -VAR_10; VAR_13 = 7 * VAR_0->current_frame.linesize[2]; VAR_14 = (VAR_0->height / 2) * VAR_0->current_frame.linesize[2] + (VAR_0->width / 2) - 8; VAR_3 = VAR_1 * FRAGMENT_PIXELS; VAR_17 = VAR_0->width / 2; VAR_18 = VAR_0->height / 2; VAR_19 = VAR_3 + FRAGMENT_PIXELS; VAR_6 = VAR_0->macroblock_fragments[VAR_20 + 5]; } if(ABS(VAR_10) > 2048)
return; for (; VAR_3 < VAR_19; VAR_3 += 8) { for (VAR_2 = 0; VAR_2 < VAR_17; VAR_2 += 8, VAR_6++) { if ((VAR_6 < 0) || (VAR_6 >= VAR_0->fragment_count)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "  vp3:FUNC_0(): bad fragment number (%VAR_23)\VAR_5", VAR_6); return; } if ((VAR_0->all_fragments[VAR_6].coding_method != MODE_COPY) &&
!((VAR_0->avctx->flags & CODEC_FLAG_GRAY) && VAR_16)) { if ((VAR_0->all_fragments[VAR_6].coding_method == MODE_USING_GOLDEN) ||
(VAR_0->all_fragments[VAR_6].coding_method == MODE_GOLDEN_MV))
motion_source= VAR_9; else
motion_source= VAR_8; motion_source += VAR_0->all_fragments[VAR_6].first_pixel; VAR_15 = 0; if ((VAR_0->all_fragments[VAR_6].coding_method > MODE_INTRA) &&
(VAR_0->all_fragments[VAR_6].coding_method != MODE_USING_GOLDEN)) { int VAR_21, VAR_22; VAR_11 = VAR_0->all_fragments[VAR_6].VAR_11; VAR_12 = VAR_0->all_fragments[VAR_6].VAR_12; if(VAR_16){ VAR_11= (VAR_11>>1) | (VAR_11&1); VAR_12= (VAR_12>>1) | (VAR_12&1); } VAR_21= (VAR_11>>1) + VAR_2; VAR_22= (VAR_12>>1) + VAR_3; if ((VAR_11 == 127) || (VAR_12 == 127))
av_log(VAR_0->avctx, AV_LOG_ERROR, " help! got invalid motion vector! (%X, %X)\VAR_5", VAR_11, VAR_12); VAR_15 = VAR_11 & 0x01; motion_source += (VAR_11 >> 1); VAR_15 |= (VAR_12 & 0x01) << 1; motion_source += ((VAR_12 >> 1) * VAR_10); if(VAR_21<0 || VAR_22<0 || VAR_21 + 9 >= VAR_17 || VAR_22 + 9 >= VAR_18){ uint8_t *temp= VAR_0->edge_emu_buffer; if(VAR_10<0) temp -= 9*VAR_10; else temp += 9*VAR_10; ff_emulated_edge_mc(temp, motion_source, VAR_10, 9, 9, VAR_21, VAR_22, VAR_17, VAR_18); motion_source= temp; } } if (VAR_0->all_fragments[VAR_6].coding_method != MODE_INTRA) { if(VAR_15 != 3){ VAR_0->dsp.put_no_rnd_pixels_tab[1][VAR_15](
VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,
motion_source, VAR_10, 8); }else{ int VAR_23= (VAR_11 ^ VAR_12)>>31; VAR_0->dsp.put_no_rnd_pixels_l2[1](
VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,
motion_source - VAR_23,
motion_source + VAR_10 + 1 + VAR_23,
VAR_10, 8); } dequantizer = VAR_0->inter_dequant; }else{ if (VAR_16 == 0)
dequantizer = VAR_0->intra_y_dequant; else
dequantizer = VAR_0->intra_c_dequant; } debug_idct("fragment %VAR_23, coding mode %VAR_23, DC = %VAR_23, dequant = %VAR_23:\VAR_5",
VAR_6, VAR_0->all_fragments[VAR_6].coding_method,
DC_COEFF(VAR_6), dequantizer[0]); if(VAR_0->avctx->idct_algo==FF_IDCT_VP3){ Coeff *coeff= VAR_0->coeffs + VAR_6; memset(block, 0, sizeof(block)); while(coeff->next){ block[coeff->index]= coeff->coeff * dequantizer[coeff->index]; coeff= coeff->next; } }else{ Coeff *coeff= VAR_0->coeffs + VAR_6; memset(block, 0, sizeof(block)); while(coeff->next){ block[coeff->index]= (coeff->coeff * dequantizer[coeff->index] + 2)>>2; coeff= coeff->next; } } if (VAR_0->all_fragments[VAR_6].coding_method == MODE_INTRA) { if(VAR_0->avctx->idct_algo!=FF_IDCT_VP3)
block[0] += 128<<3; VAR_0->dsp.idct_put(
VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,
VAR_10,
block); } else { VAR_0->dsp.idct_add(
VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,
VAR_10,
block); } debug_idct("block after idct_%VAR_0():\VAR_5",
(VAR_0->all_fragments[VAR_6].coding_method == MODE_INTRA)?
"put" : "add"); for (VAR_4 = 0; VAR_4 < 8; VAR_4++) { for (VAR_5 = 0; VAR_5 < 8; VAR_5++) { debug_idct(" %3d", *(VAR_7 +
VAR_0->all_fragments[VAR_6].first_pixel + (VAR_4 * VAR_10 + VAR_5))); } debug_idct("\VAR_5"); } debug_idct("\VAR_5"); } else { VAR_0->dsp.put_pixels_tab[1][0](
VAR_7 + VAR_0->all_fragments[VAR_6].first_pixel,
VAR_8 + VAR_0->all_fragments[VAR_6].first_pixel,
VAR_10, 8); } } } } emms_c(); }