void decoder_pframe(DECODER * dec, Bitstream * bs, int rounding,int reduced_ resolution, int quant,int fcode,int intra_dc_threshold) { uint32_t x, y; uint32_t bound; VECTOR mv; const VECTOR zerovec={0,0}; uint32_t mb_width = dec->mb_width; uint32_t mb_height = dec->mb_height; uint32_t width = dec->width; uint32_t edged_width = dec->edged_width; /*循环所有宏块*/ for (y=0; yfor (x = 0; x < mb_width; x++) { MACROBLOCK *mb; mb = &dec->mbs[y * dec->mb_width + x]; if (!(BitstreamGetBit(bs))) /*当前宏块已经被编码*/ { uint32_t mcbpc, cbpc, cbpy, cbp; uint32_t intra, acpred_flag = 0; mcbpc = get_mcbpc_inter(bs); /*解码得到mcbpc*/ mb->mode = mcbpc & 7; cbpc = (mcbpc >> 4); /*组合得到cbpc*/ intra = (mb->mode == MODE_INTRA); /*是否Intra宏块*/ if (intra) acpred_flag = BitstreamGetBit(bs); /*Intra块的AC预测*/ cbpy = get_cbpy_asm_dm642(bs,intra); /*解码得到cbpy*/ cbp = (cbpy << 2) | cbpc; /*组合得到CBP*/ mb->quant = quant; /*量化初始化*/ if (mb->mode == MODE_INTER){ /*编码模式是MODE_INTER*/ get_motion_vector(dec, bs, x, y, 0,&mv, fcode, bound); /*解码得到MV.x , MV.y*/ mb->mvs[0] = mb->mvs[1] = mb->mvs[2] = mb->mvs[3] = mv; /*初始化MVS*/ decoder_mbinter(dec, mb, x, y, cbp, bs, mv, 0,x); /*Inter 解码*/ } else { /*编码模式是MODE_INTRA */ mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2] .x = mb->mvs[3].x = 0;/*MVS置0 */ mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2] .y = mb->mvs[3].y = 0;/* MVS置0*/ decoder_mbintra(dec, mb, x, y, acpred_flag, cbp,/*解码Intra块*/ bs, quant, intra_dc_threshold, bound); continue; } } else { /*当前宏块没有被编码not_coded */ mb->mode = MODE_NOT_CODED; mb->quant = quant; mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2] .x = mb->mvs[3].x = 0;/* MVS置0*/ mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2] .y = mb->mvs[3].y = 0;/* MVS置0*/ decoder_mbinter(dec, mb, x, y, 0, bs, zerovec, 0, x);/* Inter解码*/ } } //x 循环 } //y 循环 } |