20 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
21 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 |
* |
* |
23 |
* $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 $ |
24 |
* |
* |
25 |
****************************************************************************/ |
****************************************************************************/ |
26 |
|
|
69 |
|
|
70 |
if (sum > 0) { |
if (sum > 0) { |
71 |
*cbp |= 1 << (5 - block); |
*cbp |= 1 << (5 - block); |
72 |
bits = BITS_MULT * CodeCoeffInter_CalcBits(coeff, scan_tables[0]); |
bits = BITS_MULT * CodeCoeffInter_CalcBits(coeff, data->scan_table); |
73 |
|
|
74 |
if (quant_type) dequant_inter(dqcoeff, coeff, quant); |
if (quant_type) dequant_inter(dqcoeff, coeff, quant); |
75 |
else dequant4_inter(dqcoeff, coeff, quant); |
else dequant4_inter(dqcoeff, coeff, quant); |
112 |
*dcpred = b_dc; |
*dcpred = b_dc; |
113 |
} |
} |
114 |
|
|
115 |
bits = BITS_MULT*CodeCoeffIntra_CalcBits(coeff, scan_tables[0]); |
bits = BITS_MULT*CodeCoeffIntra_CalcBits(coeff, data->scan_table); |
116 |
if (bits != 0) *cbp |= 1 << (5 - block); |
if (bits != 0) *cbp |= 1 << (5 - block); |
117 |
|
|
118 |
if (block < 4) bits += BITS_MULT*dcy_tab[coeff[0] + 255].len; |
if (block < 4) bits += BITS_MULT*dcy_tab[coeff[0] + 255].len; |
318 |
Data8->RefP[2] = Data->RefP[2] + 8*((i&1) + (i>>1)*Data->iEdgedWidth); |
Data8->RefP[2] = Data->RefP[2] + 8*((i&1) + (i>>1)*Data->iEdgedWidth); |
319 |
Data8->RefP[1] = Data->RefP[1] + 8*((i&1) + (i>>1)*Data->iEdgedWidth); |
Data8->RefP[1] = Data->RefP[1] + 8*((i&1) + (i>>1)*Data->iEdgedWidth); |
320 |
Data8->RefP[3] = Data->RefP[3] + 8*((i&1) + (i>>1)*Data->iEdgedWidth); |
Data8->RefP[3] = Data->RefP[3] + 8*((i&1) + (i>>1)*Data->iEdgedWidth); |
321 |
*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 */ |
322 |
|
|
323 |
if(Data->qpel) { |
if(Data->qpel) { |
324 |
Data8->predMV = get_qpmv2(pMBs, pParam->mb_width, 0, x, y, i); |
Data8->predMV = get_qpmv2(pMBs, pParam->mb_width, 0, x, y, i); |
524 |
VECTOR backup[5], *v; |
VECTOR backup[5], *v; |
525 |
Data->iQuant = iQuant; |
Data->iQuant = iQuant; |
526 |
Data->cbp = c; |
Data->cbp = c; |
527 |
|
Data->scan_table = VopFlags & XVID_VOP_ALTERNATESCAN ? |
528 |
|
scan_tables[2] : scan_tables[0]; |
529 |
|
|
530 |
pMB->mcsel = 0; |
pMB->mcsel = 0; |
531 |
|
|
588 |
pMB->pmvs[0].y = Data->currentMV[0].y - Data->predMV.y; |
pMB->pmvs[0].y = Data->currentMV[0].y - Data->predMV.y; |
589 |
} |
} |
590 |
|
|
591 |
} else if (mode == MODE_INTER ) { // but mcsel == 1 |
} else if (mode == MODE_INTER ) { /* but mcsel == 1 */ |
592 |
|
|
593 |
pMB->mcsel = 1; |
pMB->mcsel = 1; |
594 |
if (Data->qpel) { |
if (Data->qpel) { |
632 |
int InterBias = MV16_INTER_BIAS; |
int InterBias = MV16_INTER_BIAS; |
633 |
int thresh = 0; |
int thresh = 0; |
634 |
int top = 0, top_right = 0, left = 0; |
int top = 0, top_right = 0, left = 0; |
635 |
|
Data->scan_table = VopFlags & XVID_VOP_ALTERNATESCAN ? |
636 |
|
scan_tables[2] : scan_tables[0]; |
637 |
|
|
638 |
pMB->mcsel = 0; |
pMB->mcsel = 0; |
639 |
|
|
738 |
thresh = 0; |
thresh = 0; |
739 |
|
|
740 |
if((x > 0) && (y > 0) && (x < (int32_t) pParam->mb_width)) { |
if((x > 0) && (y > 0) && (x < (int32_t) pParam->mb_width)) { |
741 |
left = (&pMBs[(x-1) + y * pParam->mb_width])->sad16; // left |
left = (&pMBs[(x-1) + y * pParam->mb_width])->sad16; /* left */ |
742 |
top = (&pMBs[x + (y-1) * pParam->mb_width])->sad16; // top |
top = (&pMBs[x + (y-1) * pParam->mb_width])->sad16; /* top */ |
743 |
top_right = (&pMBs[(x+1) + (y-1) * pParam->mb_width])->sad16; // top right |
top_right = (&pMBs[(x+1) + (y-1) * pParam->mb_width])->sad16; /* top right */ |
744 |
|
|
745 |
if(((&pMBs[(x-1) + y * pParam->mb_width])->mode != MODE_INTRA) && |
if(((&pMBs[(x-1) + y * pParam->mb_width])->mode != MODE_INTRA) && |
746 |
((&pMBs[x + (y-1) * pParam->mb_width])->mode != MODE_INTRA) && |
((&pMBs[x + (y-1) * pParam->mb_width])->mode != MODE_INTRA) && |
848 |
pMB->pmvs[0].y = Data->currentMV[0].y - Data->predMV.y; |
pMB->pmvs[0].y = Data->currentMV[0].y - Data->predMV.y; |
849 |
} |
} |
850 |
|
|
851 |
} else if (mode == MODE_INTER ) { // but mcsel == 1 |
} else if (mode == MODE_INTER ) { /* but mcsel == 1 */ |
852 |
|
|
853 |
pMB->mcsel = 1; |
pMB->mcsel = 1; |
854 |
if (Data->qpel) { |
if (Data->qpel) { |