put_dct(s, block[4], 4, dest_cb, uvlinesize); put_dct(s, block[5], 5, dest_cr, uvlinesize);
put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]){    int mb_x, mb_y;    const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;#ifdef HAVE_XVMC    if(s->avctx->xvmc_acceleration){        XVMC_decode_mb(s);//xvmc uses pblocks        return;    }#endif    mb_x = s->mb_x;    mb_y = s->mb_y;    s->current_picture.qscale_table[mb_xy]= s->qscale;    /* update DC predictors for P macroblocks */    if (!s->mb_intra) {        if (s->h263_pred || s->h263_aic) {            if(s->mbintra_table[mb_xy])                ff_clean_intra_table_entries(s);        } else {            s->last_dc[0] =            s->last_dc[1] =            s->last_dc[2] = 128 << s->intra_dc_precision;        }    }    else if (s->h263_pred || s->h263_aic)        s->mbintra_table[mb_xy]=1;    if ((s->flags&CODEC_FLAG_PSNR) || !(s->encoding && (s->intra_only || s->pict_type==B_TYPE))) { //FIXME precalc        uint8_t *dest_y, *dest_cb, *dest_cr;        int dct_linesize, dct_offset;        op_pixels_func (*op_pix)[4];        qpel_mc_func (*op_qpix)[16];        const int linesize= s->current_picture.linesize[0]; //not s->linesize as this woulnd be wrong for field pics        const int uvlinesize= s->current_picture.linesize[1];        const int readable= s->pict_type != B_TYPE || s->encoding || s->avctx->draw_horiz_band;        /* avoid copy if macroblock skipped in last frame too */        /* skip only during decoding as we might trash the buffers during encoding a bit */        if(!s->encoding){            uint8_t *mbskip_ptr = &s->mbskip_table[mb_xy];            const int age= s->current_picture.age;            assert(age);            if (s->mb_skiped) {                s->mb_skiped= 0;                assert(s->pict_type!=I_TYPE);                 (*mbskip_ptr) ++; /* indicate that this time we skiped it */                if(*mbskip_ptr >99) *mbskip_ptr= 99;                /* if previous was skipped too, then nothing to do !  */                if (*mbskip_ptr >= age && s->current_picture.reference){                    return;                }            } else if(!s->current_picture.reference){                (*mbskip_ptr) ++; /* increase counter so the age can be compared cleanly */                if(*mbskip_ptr >99) *mbskip_ptr= 99;            } else{                *mbskip_ptr = 0; /* not skipped */            }        }        if (s->interlaced_dct) {            dct_linesize = linesize * 2;            dct_offset = linesize;        } else {            dct_linesize = linesize;            dct_offset = linesize * 8;        }        if(readable){            dest_y=  s->dest[0];            dest_cb= s->dest[1];            dest_cr= s->dest[2];        }else{            dest_y = s->edge_emu_buffer+32; //FIXME cleanup scratchpad pointers            dest_cb= s->edge_emu_buffer+48;            dest_cr= s->edge_emu_buffer+56;        }        if (!s->mb_intra) {            /* motion handling */            /* decoding or more than one mb_type (MC was allready done otherwise) */            if(!s->encoding){                if ((!s->no_rounding) || s->pict_type==B_TYPE){                		    op_pix = s->dsp.put_pixels_tab;                    op_qpix= s->dsp.put_qpel_pixels_tab;                }else{                    op_pix = s->dsp.put_no_rnd_pixels_tab;                    op_qpix= s->dsp.put_no_rnd_qpel_pixels_tab;                }                if (s->mv_dir & MV_DIR_FORWARD) {                    MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix);		    op_pix = s->dsp.avg_pixels_tab;                    op_qpix= s->dsp.avg_qpel_pixels_tab;                }                if (s->mv_dir & MV_DIR_BACKWARD) {                    MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix);                }            }            /* skip dequant / idct if we are really late ;) */            if(s->hurry_up>1) return;            /* add dct residue */            if(s->encoding || !(   s->h263_msmpeg4 || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO                                || (s->codec_id==CODEC_ID_MPEG4 && !s->mpeg_quant))){                add_dequant_dct(s, block[0], 0, dest_y, dct_linesize, s->qscale);                add_dequant_dct(s, block[1], 1, dest_y + 8, dct_linesize, s->qscale);                add_dequant_dct(s, block[2], 2, dest_y + dct_offset, dct_linesize, s->qscale);                add_dequant_dct(s, block[3], 3, dest_y + dct_offset + 8, dct_linesize, s->qscale);                if(!(s->flags&CODEC_FLAG_GRAY)){                    add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);                    add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);                }            } else if(s->codec_id != CODEC_ID_WMV2){                add_dct(s, block[0], 0, dest_y, dct_linesize);                add_dct(s, block[1], 1, dest_y + 8, dct_linesize);                add_dct(s, block[2], 2, dest_y + dct_offset, dct_linesize);                add_dct(s, block[3], 3, dest_y + dct_offset + 8, dct_linesize);                if(!(s->flags&CODEC_FLAG_GRAY)){                    add_dct(s, block[4], 4, dest_cb, uvlinesize);                    add_dct(s, block[5], 5, dest_cr, uvlinesize);                }            } #ifdef CONFIG_RISKY            else{                ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr);            }#endif        } else {            /* dct only in intra block */            if(s->encoding || !(s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO)){                put_dct(s, block[0], 0, dest_y, dct_linesize);                put_dct(s, block[1], 1, dest_y + 8, dct_linesize);                put_dct(s, block[2], 2, dest_y + dct_offset, dct_linesize);                put_dct(s, block[3], 3, dest_y + dct_offset + 8, dct_linesize);                if(!(s->flags&CODEC_FLAG_GRAY)){                    put_dct(s, block[4], 4, dest_cb, uvlinesize);                    put_dct(s, block[5], 5, dest_cr, uvlinesize);                }            }else{                s->dsp.idct_put(dest_y                 , dct_linesize, block[0]);                s->dsp.idct_put(dest_y              + 8, dct_linesize, block[1]);                s->dsp.idct_put(dest_y + dct_offset    , dct_linesize, block[2]);                s->dsp.idct_put(dest_y + dct_offset + 8, dct_linesize, block[3]);                if(!(s->flags&CODEC_FLAG_GRAY)){                    s->dsp.idct_put(dest_cb, uvlinesize, block[4]);                    s->dsp.idct_put(dest_cr, uvlinesize, block[5]);                }            }        }        if(!readable){            s->dsp.put_pixels_tab[0][0](s->dest[0], dest_y ,   linesize,16);            s->dsp.put_pixels_tab[1][0](s->dest[1], dest_cb, uvlinesize, 8);            s->dsp.put_pixels_tab[1][0](s->dest[2], dest_cr, uvlinesize, 8);        }    }}