--- estimation_rd_based.c 2003/09/28 16:12:32 1.1.2.2 +++ estimation_rd_based.c 2003/10/03 14:23:00 1.1.2.5 @@ -20,7 +20,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: estimation_rd_based.c,v 1.1.2.2 2003/09/28 16:12:32 syskin Exp $ + * $Id: estimation_rd_based.c,v 1.1.2.5 2003/10/03 14:23:00 syskin Exp $ * ****************************************************************************/ @@ -69,7 +69,7 @@ if (sum > 0) { *cbp |= 1 << (5 - block); - bits = BITS_MULT * CodeCoeffInter_CalcBits(coeff, scan_tables[0]); + bits = BITS_MULT * CodeCoeffInter_CalcBits(coeff, data->scan_table); if (quant_type) dequant_inter(dqcoeff, coeff, quant); else dequant4_inter(dqcoeff, coeff, quant); @@ -112,7 +112,7 @@ *dcpred = b_dc; } - bits = BITS_MULT*CodeCoeffIntra_CalcBits(coeff, scan_tables[0]); + bits = BITS_MULT*CodeCoeffIntra_CalcBits(coeff, data->scan_table); if (bits != 0) *cbp |= 1 << (5 - block); if (block < 4) bits += BITS_MULT*dcy_tab[coeff[0] + 255].len; @@ -318,7 +318,7 @@ Data8->RefP[2] = Data->RefP[2] + 8*((i&1) + (i>>1)*Data->iEdgedWidth); Data8->RefP[1] = Data->RefP[1] + 8*((i&1) + (i>>1)*Data->iEdgedWidth); Data8->RefP[3] = Data->RefP[3] + 8*((i&1) + (i>>1)*Data->iEdgedWidth); - *Data8->cbp = (Data->cbp[1] & (1<<(5-i))) ? 1:0; // copy corresponding cbp bit + *Data8->cbp = (Data->cbp[1] & (1<<(5-i))) ? 1:0; /* copy corresponding cbp bit */ if(Data->qpel) { Data8->predMV = get_qpmv2(pMBs, pParam->mb_width, 0, x, y, i); @@ -524,6 +524,8 @@ VECTOR backup[5], *v; Data->iQuant = iQuant; Data->cbp = c; + Data->scan_table = VopFlags & XVID_VOP_ALTERNATESCAN ? + scan_tables[2] : scan_tables[0]; pMB->mcsel = 0; @@ -586,7 +588,7 @@ pMB->pmvs[0].y = Data->currentMV[0].y - Data->predMV.y; } - } else if (mode == MODE_INTER ) { // but mcsel == 1 + } else if (mode == MODE_INTER ) { /* but mcsel == 1 */ pMB->mcsel = 1; if (Data->qpel) { @@ -623,13 +625,15 @@ int inter4v = (VopFlags & XVID_VOP_INTER4V) && (pMB->dquant == 0); const uint32_t iQuant = pMB->quant; const int skip_possible = (coding_type == P_VOP) && (pMB->dquant == 0); - int sad; + int sad; int min_rd = -1, intra_rd, i, cbp = 63, c[2] = {0, 0}; VECTOR backup[5], *v; int sad_backup[5]; int InterBias = MV16_INTER_BIAS; int thresh = 0; int top = 0, top_right = 0, left = 0; + Data->scan_table = VopFlags & XVID_VOP_ALTERNATESCAN ? + scan_tables[2] : scan_tables[0]; pMB->mcsel = 0; @@ -734,9 +738,9 @@ thresh = 0; if((x > 0) && (y > 0) && (x < (int32_t) pParam->mb_width)) { - left = (&pMBs[(x-1) + y * pParam->mb_width])->sad16; // left - top = (&pMBs[x + (y-1) * pParam->mb_width])->sad16; // top - top_right = (&pMBs[(x+1) + (y-1) * pParam->mb_width])->sad16; // top right + left = (&pMBs[(x-1) + y * pParam->mb_width])->sad16; /* left */ + top = (&pMBs[x + (y-1) * pParam->mb_width])->sad16; /* top */ + top_right = (&pMBs[(x+1) + (y-1) * pParam->mb_width])->sad16; /* top right */ if(((&pMBs[(x-1) + y * pParam->mb_width])->mode != MODE_INTRA) && ((&pMBs[x + (y-1) * pParam->mb_width])->mode != MODE_INTRA) && @@ -844,7 +848,7 @@ pMB->pmvs[0].y = Data->currentMV[0].y - Data->predMV.y; } - } else if (mode == MODE_INTER ) { // but mcsel == 1 + } else if (mode == MODE_INTER ) { /* but mcsel == 1 */ pMB->mcsel = 1; if (Data->qpel) {