4 |
* - Rate-Distortion Based Motion Estimation for P- and S- VOPs - |
* - Rate-Distortion Based Motion Estimation for P- and S- VOPs - |
5 |
* |
* |
6 |
* Copyright(C) 2003 Radoslaw Czyz <xvid@syskin.cjb.net> |
* Copyright(C) 2003 Radoslaw Czyz <xvid@syskin.cjb.net> |
7 |
* 2003 Michael Militzer <michael@xvid.org> |
* 2003-2010 Michael Militzer <michael@xvid.org> |
8 |
* |
* |
9 |
* This program is free software ; you can redistribute it and/or modify |
* This program is free software ; you can redistribute it and/or modify |
10 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
57 |
const int block, |
const int block, |
58 |
const uint16_t * scan_table, |
const uint16_t * scan_table, |
59 |
const unsigned int lambda, |
const unsigned int lambda, |
60 |
const uint16_t * mpeg_quant_matrices) |
const uint16_t * mpeg_quant_matrices, |
61 |
|
const unsigned int quant_sq, |
62 |
|
const unsigned int rel_var8, |
63 |
|
const unsigned int metric) |
64 |
{ |
{ |
65 |
int sum; |
int sum; |
66 |
int bits; |
int bits; |
67 |
int distortion = 0; |
int distortion = 0; |
68 |
|
|
69 |
fdct(data); |
fdct((short * const)data); |
70 |
|
|
71 |
if (quant_type) sum = quant_h263_inter(coeff, data, quant, mpeg_quant_matrices); |
if (quant_type) sum = quant_h263_inter(coeff, data, quant, mpeg_quant_matrices); |
72 |
else sum = quant_mpeg_inter(coeff, data, quant, mpeg_quant_matrices); |
else sum = quant_mpeg_inter(coeff, data, quant, mpeg_quant_matrices); |
78 |
if (quant_type) dequant_h263_inter(dqcoeff, coeff, quant, mpeg_quant_matrices); |
if (quant_type) dequant_h263_inter(dqcoeff, coeff, quant, mpeg_quant_matrices); |
79 |
else dequant_mpeg_inter(dqcoeff, coeff, quant, mpeg_quant_matrices); |
else dequant_mpeg_inter(dqcoeff, coeff, quant, mpeg_quant_matrices); |
80 |
|
|
81 |
distortion = sse8_16bit(data, dqcoeff, 8*sizeof(int16_t)); |
if (metric) distortion = masked_sseh8_16bit(data, dqcoeff, rel_var8); |
82 |
|
else distortion = sse8_16bit(data, dqcoeff, 8*sizeof(int16_t)); |
83 |
|
|
84 |
} else { |
} else { |
85 |
const static int16_t zero_block[64] = |
const static int16_t zero_block[64] = |
86 |
{ |
{ |
94 |
0, 0, 0, 0, 0, 0, 0, 0, |
0, 0, 0, 0, 0, 0, 0, 0, |
95 |
}; |
}; |
96 |
bits = 0; |
bits = 0; |
|
distortion = sse8_16bit(data, zero_block, 8*sizeof(int16_t)); |
|
|
} |
|
97 |
|
|
98 |
|
if (metric) distortion = masked_sseh8_16bit(data, (int16_t * const) zero_block, rel_var8); |
99 |
|
else distortion = sse8_16bit(data, (int16_t * const) zero_block, 8*sizeof(int16_t)); |
100 |
|
|
101 |
return bits + (lambda*distortion)/(quant*quant); |
} |
102 |
|
|
103 |
|
return bits + (lambda*distortion)/quant_sq; |
104 |
} |
} |
105 |
|
|
106 |
static __inline unsigned int |
static __inline unsigned int |
118 |
unsigned int bits[2], |
unsigned int bits[2], |
119 |
unsigned int cbp[2], |
unsigned int cbp[2], |
120 |
unsigned int lambda, |
unsigned int lambda, |
121 |
const uint16_t * mpeg_quant_matrices) |
const uint16_t * mpeg_quant_matrices, |
122 |
|
const unsigned int quant_sq, |
123 |
|
const unsigned int metric) |
124 |
{ |
{ |
125 |
int direction; |
int direction; |
126 |
int16_t *pCurrent; |
int16_t *pCurrent; |
128 |
unsigned int distortion = 0; |
unsigned int distortion = 0; |
129 |
const uint32_t iDcScaler = get_dc_scaler(quant, block < 4); |
const uint32_t iDcScaler = get_dc_scaler(quant, block < 4); |
130 |
|
|
131 |
fdct(coeff); |
fdct((short * const)coeff); |
132 |
|
|
133 |
if (quant_type) { |
if (quant_type) { |
134 |
quant_h263_intra(qcoeff, coeff, quant, iDcScaler, mpeg_quant_matrices); |
quant_h263_intra(qcoeff, coeff, quant, iDcScaler, mpeg_quant_matrices); |
142 |
quant, iDcScaler, predictors, 0); |
quant, iDcScaler, predictors, 0); |
143 |
|
|
144 |
direction = pMB->acpred_directions[block]; |
direction = pMB->acpred_directions[block]; |
145 |
pCurrent = pMB->pred_values[block]; |
pCurrent = (int16_t*)pMB->pred_values[block]; |
146 |
|
|
147 |
/* store current coeffs to pred_values[] for future prediction */ |
/* store current coeffs to pred_values[] for future prediction */ |
148 |
pCurrent[0] = qcoeff[0] * iDcScaler; |
pCurrent[0] = qcoeff[0] * iDcScaler; |
155 |
/* dc prediction */ |
/* dc prediction */ |
156 |
qcoeff[0] = qcoeff[0] - predictors[0]; |
qcoeff[0] = qcoeff[0] - predictors[0]; |
157 |
|
|
158 |
if (block < 4) bits[1] = bits[0] = dcy_tab[qcoeff[0] + 255].len; |
if (block < 4) bits[1] = bits[0] = dcy_tab[qcoeff[0] + 255].len - 3; /* 3 bits added before (4 times) */ |
159 |
else bits[1] = bits[0] = dcc_tab[qcoeff[0] + 255].len; |
else bits[1] = bits[0] = dcc_tab[qcoeff[0] + 255].len - 2; /* 2 bits added before (2 times)*/ |
160 |
|
|
161 |
/* calc cost before ac prediction */ |
/* calc cost before ac prediction */ |
162 |
bits[0] += coded = CodeCoeffIntra_CalcBits(qcoeff, scan_tables[0]); |
bits[0] += coded = CodeCoeffIntra_CalcBits(qcoeff, scan_tables[0]); |
178 |
bits[1] += coded = CodeCoeffIntra_CalcBits(qcoeff, scan_tables[direction]); |
bits[1] += coded = CodeCoeffIntra_CalcBits(qcoeff, scan_tables[direction]); |
179 |
if (coded > 0) cbp[1] |= 1 << (5 - block); |
if (coded > 0) cbp[1] |= 1 << (5 - block); |
180 |
|
|
181 |
distortion = sse8_16bit(coeff, dqcoeff, 8*sizeof(int16_t)); |
if (metric) distortion = masked_sseh8_16bit(coeff, dqcoeff, pMB->rel_var8[block]); |
182 |
|
else distortion = sse8_16bit(coeff, dqcoeff, 8*sizeof(int16_t)); |
183 |
|
|
184 |
return (lambda*distortion)/(quant*quant); |
return (lambda*distortion)/quant_sq; |
185 |
} |
} |
186 |
|
|
187 |
|
|
191 |
{ |
{ |
192 |
|
|
193 |
int16_t *in = data->dctSpace, *coeff = data->dctSpace + 64; |
int16_t *in = data->dctSpace, *coeff = data->dctSpace + 64; |
194 |
int32_t rd = 0; |
/* minimum nuber of bits INTER can take is 1 (mcbpc) + 2 (cby) + 2 (vector) */ |
195 |
|
int32_t rd = BITS_MULT * (1+2+2); |
196 |
VECTOR * current; |
VECTOR * current; |
197 |
const uint8_t * ptr; |
const uint8_t * ptr; |
198 |
int i, t, xc, yc; |
int i, t, xc, yc; |
214 |
for(i = 0; i < 4; i++) { |
for(i = 0; i < 4; i++) { |
215 |
int s = 8*((i&1) + (i>>1)*data->iEdgedWidth); |
int s = 8*((i&1) + (i>>1)*data->iEdgedWidth); |
216 |
transfer_8to16subro(in, data->Cur + s, ptr + s, data->iEdgedWidth); |
transfer_8to16subro(in, data->Cur + s, ptr + s, data->iEdgedWidth); |
217 |
rd += data->temp[i] = Block_CalcBits(coeff, in, data->dctSpace + 128, data->iQuant, data->quant_type, &cbp, i, data->scan_table, data->lambda[i], data->mpeg_quant_matrices); |
rd += data->temp[i] = Block_CalcBits(coeff, in, data->dctSpace + 128, data->iQuant, |
218 |
|
data->quant_type, &cbp, i, data->scan_table, data->lambda[i], |
219 |
|
data->mpeg_quant_matrices, data->quant_sq, data->rel_var8[i], data->metric); |
220 |
} |
} |
221 |
|
|
222 |
rd += t = BITS_MULT*d_mv_bits(x, y, data->predMV, data->iFcode, data->qpel^data->qpel_precision, 0); |
rd += t = BITS_MULT * (d_mv_bits(x, y, data->predMV, data->iFcode, data->qpel^data->qpel_precision) - 2); |
223 |
|
|
224 |
if (data->temp[0] + t < data->iMinSAD[1]) { |
if (data->temp[0] + t < data->iMinSAD[1]) { |
225 |
data->iMinSAD[1] = data->temp[0] + t; current[1].x = x; current[1].y = y; data->cbp[1] = (data->cbp[1]&~32) | (cbp&32); } |
data->iMinSAD[1] = data->temp[0] + t; current[1].x = x; current[1].y = y; data->cbp[1] = (data->cbp[1]&~32) | (cbp&32); } |
230 |
if (data->temp[3] < data->iMinSAD[4]) { |
if (data->temp[3] < data->iMinSAD[4]) { |
231 |
data->iMinSAD[4] = data->temp[3]; current[4].x = x; current[4].y = y; data->cbp[1] = (data->cbp[1]&~4) | (cbp&4); } |
data->iMinSAD[4] = data->temp[3]; current[4].x = x; current[4].y = y; data->cbp[1] = (data->cbp[1]&~4) | (cbp&4); } |
232 |
|
|
233 |
rd += BITS_MULT*xvid_cbpy_tab[15-(cbp>>2)].len; |
rd += BITS_MULT * (xvid_cbpy_tab[15-(cbp>>2)].len - 2); |
234 |
|
|
235 |
if (rd >= data->iMinSAD[0]) return; |
if (rd >= data->iMinSAD[0]) return; |
236 |
|
|
241 |
/* chroma U */ |
/* chroma U */ |
242 |
ptr = interpolate8x8_switch2(data->RefQ, data->RefP[4], 0, 0, xc, yc, data->iEdgedWidth/2, data->rounding); |
ptr = interpolate8x8_switch2(data->RefQ, data->RefP[4], 0, 0, xc, yc, data->iEdgedWidth/2, data->rounding); |
243 |
transfer_8to16subro(in, data->CurU, ptr, data->iEdgedWidth/2); |
transfer_8to16subro(in, data->CurU, ptr, data->iEdgedWidth/2); |
244 |
rd += Block_CalcBits(coeff, in, data->dctSpace + 128, data->iQuant, data->quant_type, &cbp, 4, data->scan_table, data->lambda[4], data->mpeg_quant_matrices); |
rd += Block_CalcBits(coeff, in, data->dctSpace + 128, data->iQuant, data->quant_type, |
245 |
|
&cbp, 4, data->scan_table, data->lambda[4], |
246 |
|
data->mpeg_quant_matrices, data->quant_sq, data->rel_var8[4], data->metric); |
247 |
if (rd >= data->iMinSAD[0]) return; |
if (rd >= data->iMinSAD[0]) return; |
248 |
|
|
249 |
/* chroma V */ |
/* chroma V */ |
250 |
ptr = interpolate8x8_switch2(data->RefQ, data->RefP[5], 0, 0, xc, yc, data->iEdgedWidth/2, data->rounding); |
ptr = interpolate8x8_switch2(data->RefQ, data->RefP[5], 0, 0, xc, yc, data->iEdgedWidth/2, data->rounding); |
251 |
transfer_8to16subro(in, data->CurV, ptr, data->iEdgedWidth/2); |
transfer_8to16subro(in, data->CurV, ptr, data->iEdgedWidth/2); |
252 |
rd += Block_CalcBits(coeff, in, data->dctSpace + 128, data->iQuant, data->quant_type, &cbp, 5, data->scan_table, data->lambda[5], data->mpeg_quant_matrices); |
rd += Block_CalcBits(coeff, in, data->dctSpace + 128, data->iQuant, data->quant_type, |
253 |
|
&cbp, 5, data->scan_table, data->lambda[5], |
254 |
|
data->mpeg_quant_matrices, data->quant_sq, data->rel_var8[5], data->metric); |
255 |
|
|
256 |
rd += BITS_MULT*mcbpc_inter_tab[(MODE_INTER & 7) | ((cbp & 3) << 3)].len; |
rd += BITS_MULT * (mcbpc_inter_tab[(MODE_INTER & 7) | ((cbp & 3) << 3)].len - 1); /* one was added before */ |
257 |
|
|
258 |
if (rd < data->iMinSAD[0]) { |
if (rd < data->iMinSAD[0]) { |
259 |
data->iMinSAD[0] = rd; |
data->iMinSAD[0] = rd; |
285 |
} |
} |
286 |
|
|
287 |
transfer_8to16subro(in, data->Cur, ptr, data->iEdgedWidth); |
transfer_8to16subro(in, data->Cur, ptr, data->iEdgedWidth); |
288 |
rd = Block_CalcBits(coeff, in, data->dctSpace + 128, data->iQuant, data->quant_type, &cbp, 5, data->scan_table, data->lambda[0], data->mpeg_quant_matrices); |
rd = Block_CalcBits(coeff, in, data->dctSpace + 128, data->iQuant, data->quant_type, |
289 |
rd += BITS_MULT*d_mv_bits(x, y, data->predMV, data->iFcode, data->qpel^data->qpel_precision, 0); |
&cbp, 5, data->scan_table, data->lambda[0], |
290 |
|
data->mpeg_quant_matrices, data->quant_sq, data->rel_var8[0], data->metric); |
291 |
|
/* we took 2 bits into account before */ |
292 |
|
rd += BITS_MULT * (d_mv_bits(x, y, data->predMV, data->iFcode, data->qpel^data->qpel_precision) - 2); |
293 |
|
|
294 |
|
|
295 |
if (rd < data->iMinSAD[0]) { |
if (rd < data->iMinSAD[0]) { |
296 |
*data->cbp = cbp; |
*data->cbp = cbp; |
321 |
if (MotionFlags & (XVID_ME_HALFPELREFINE16_RD | XVID_ME_EXTSEARCH_RD)) { /* we have to prepare for halfpixel-precision search */ |
if (MotionFlags & (XVID_ME_HALFPELREFINE16_RD | XVID_ME_EXTSEARCH_RD)) { /* we have to prepare for halfpixel-precision search */ |
322 |
for(i = 0; i < 5; i++) bsad[i] = Data->iMinSAD[i]; |
for(i = 0; i < 5; i++) bsad[i] = Data->iMinSAD[i]; |
323 |
get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 4, |
get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 4, |
324 |
pParam->width, pParam->height, Data->iFcode - Data->qpel, 1, Data->rrv); |
pParam->width, pParam->height, Data->iFcode - Data->qpel, 1); |
325 |
Data->qpel_precision = 0; |
Data->qpel_precision = 0; |
326 |
if (Data->currentQMV->x & 1 || Data->currentQMV->y & 1) |
if (Data->currentQMV->x & 1 || Data->currentQMV->y & 1) |
327 |
CheckCandidateRD16(Data->currentMV[0].x, Data->currentMV[0].y, Data, 255); |
CheckCandidateRD16(Data->currentMV[0].x, Data->currentMV[0].y, Data, 255); |
348 |
/* preparing for qpel-precision search */ |
/* preparing for qpel-precision search */ |
349 |
Data->qpel_precision = 1; |
Data->qpel_precision = 1; |
350 |
get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 4, |
get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 4, |
351 |
pParam->width, pParam->height, Data->iFcode, 2, 0); |
pParam->width, pParam->height, Data->iFcode, 2); |
352 |
} |
} |
353 |
if (MotionFlags & XVID_ME_QUARTERPELREFINE16_RD) { |
if (MotionFlags & XVID_ME_QUARTERPELREFINE16_RD) { |
354 |
if (MotionFlags & XVID_ME_FASTREFINE16) |
if (MotionFlags & XVID_ME_FASTREFINE16) |
371 |
MACROBLOCK * const pMB, const MACROBLOCK * const pMBs, |
MACROBLOCK * const pMB, const MACROBLOCK * const pMBs, |
372 |
const int x, const int y, |
const int x, const int y, |
373 |
const MBParam * const pParam, const uint32_t MotionFlags, |
const MBParam * const pParam, const uint32_t MotionFlags, |
374 |
const VECTOR * const backup) |
const VECTOR * const backup, const int bound) |
375 |
{ |
{ |
376 |
|
|
377 |
unsigned int cbp = 0, bits = 0, t = 0, i; |
unsigned int cbp = 0, t = 0, i; |
378 |
|
|
379 |
|
/* minimum number of bits INTER4V can take is 2 (cbpy) + 3 (mcbpc) + 4*2 (vectors)*/ |
380 |
|
int bits = (2+3+4*2)*BITS_MULT; |
381 |
SearchData Data2, *Data8 = &Data2; |
SearchData Data2, *Data8 = &Data2; |
382 |
int sumx = 0, sumy = 0; |
int sumx = 0, sumy = 0; |
383 |
int16_t *in = Data->dctSpace, *coeff = Data->dctSpace + 64; |
int16_t *in = Data->dctSpace, *coeff = Data->dctSpace + 64; |
397 |
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); |
398 |
*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 */ |
399 |
Data8->lambda[0] = Data->lambda[i]; |
Data8->lambda[0] = Data->lambda[i]; |
400 |
|
Data8->rel_var8[0] = Data->rel_var8[i]; |
401 |
|
|
402 |
if(Data->qpel) { |
if(Data->qpel) { |
403 |
Data8->predMV = get_qpmv2(pMBs, pParam->mb_width, 0, x, y, i); |
Data8->predMV = get_qpmv2(pMBs, pParam->mb_width, bound, x, y, i); |
404 |
if (i != 0) t = d_mv_bits( Data8->currentQMV->x, Data8->currentQMV->y, |
if (i != 0) t = d_mv_bits( Data8->currentQMV->x, Data8->currentQMV->y, |
405 |
Data8->predMV, Data8->iFcode, 0, 0); |
Data8->predMV, Data8->iFcode, 0) - 2; |
406 |
} else { |
} else { |
407 |
Data8->predMV = get_pmv2(pMBs, pParam->mb_width, 0, x, y, i); |
Data8->predMV = get_pmv2(pMBs, pParam->mb_width, bound, x, y, i); |
408 |
if (i != 0) t = d_mv_bits( Data8->currentMV->x, Data8->currentMV->y, |
if (i != 0) t = d_mv_bits( Data8->currentMV->x, Data8->currentMV->y, |
409 |
Data8->predMV, Data8->iFcode, 0, 0); |
Data8->predMV, Data8->iFcode, 0) - 2; |
410 |
} |
} |
411 |
|
|
412 |
get_range(&Data8->min_dx, &Data8->max_dx, &Data8->min_dy, &Data8->max_dy, 2*x + (i&1), 2*y + (i>>1), 3, |
get_range(&Data8->min_dx, &Data8->max_dx, &Data8->min_dy, &Data8->max_dy, 2*x + (i&1), 2*y + (i>>1), 3, |
413 |
pParam->width, pParam->height, Data8->iFcode, Data8->qpel+1, 0); |
pParam->width, pParam->height, Data8->iFcode, Data8->qpel+1); |
414 |
|
|
415 |
*Data8->iMinSAD += BITS_MULT*t; |
*Data8->iMinSAD += BITS_MULT*t; |
416 |
|
|
433 |
if (MotionFlags&XVID_ME_HALFPELREFINE8_RD || (MotionFlags&XVID_ME_EXTSEARCH8 && MotionFlags&XVID_ME_EXTSEARCH_RD)) { /* halfpixel motion search follows */ |
if (MotionFlags&XVID_ME_HALFPELREFINE8_RD || (MotionFlags&XVID_ME_EXTSEARCH8 && MotionFlags&XVID_ME_EXTSEARCH_RD)) { /* halfpixel motion search follows */ |
434 |
Data8->qpel_precision = 0; |
Data8->qpel_precision = 0; |
435 |
get_range(&Data8->min_dx, &Data8->max_dx, &Data8->min_dy, &Data8->max_dy, 2*x + (i&1), 2*y + (i>>1), 3, |
get_range(&Data8->min_dx, &Data8->max_dx, &Data8->min_dy, &Data8->max_dy, 2*x + (i&1), 2*y + (i>>1), 3, |
436 |
pParam->width, pParam->height, Data8->iFcode - 1, 1, 0); |
pParam->width, pParam->height, Data8->iFcode - 1, 1); |
437 |
|
|
438 |
if (Data8->currentQMV->x & 1 || Data8->currentQMV->y & 1) |
if (Data8->currentQMV->x & 1 || Data8->currentQMV->y & 1) |
439 |
CheckCandidateRD8(Data8->currentMV->x, Data8->currentMV->y, Data8, 255); |
CheckCandidateRD8(Data8->currentMV->x, Data8->currentMV->y, Data8, 255); |
452 |
|
|
453 |
Data8->qpel_precision = 1; |
Data8->qpel_precision = 1; |
454 |
get_range(&Data8->min_dx, &Data8->max_dx, &Data8->min_dy, &Data8->max_dy, 2*x + (i&1), 2*y + (i>>1), 3, |
get_range(&Data8->min_dx, &Data8->max_dx, &Data8->min_dy, &Data8->max_dy, 2*x + (i&1), 2*y + (i>>1), 3, |
455 |
pParam->width, pParam->height, Data8->iFcode, 2, 0); |
pParam->width, pParam->height, Data8->iFcode, 2); |
456 |
|
|
457 |
} |
} |
458 |
|
|
507 |
|
|
508 |
} /* end - for all luma blocks */ |
} /* end - for all luma blocks */ |
509 |
|
|
510 |
bits += BITS_MULT*xvid_cbpy_tab[15-(cbp>>2)].len; |
bits += BITS_MULT * (xvid_cbpy_tab[15-(cbp>>2)].len - 2); /* 2 were added before */ |
511 |
|
|
512 |
/* let's check chroma */ |
/* let's check chroma */ |
513 |
sumx = (sumx >> 3) + roundtab_76[sumx & 0xf]; |
sumx = (sumx >> 3) + roundtab_76[sumx & 0xf]; |
516 |
/* chroma U */ |
/* chroma U */ |
517 |
ptr = interpolate8x8_switch2(Data->RefQ + 64, Data->RefP[4], 0, 0, sumx, sumy, Data->iEdgedWidth/2, Data->rounding); |
ptr = interpolate8x8_switch2(Data->RefQ + 64, Data->RefP[4], 0, 0, sumx, sumy, Data->iEdgedWidth/2, Data->rounding); |
518 |
transfer_8to16subro(in, Data->CurU, ptr, Data->iEdgedWidth/2); |
transfer_8to16subro(in, Data->CurU, ptr, Data->iEdgedWidth/2); |
519 |
bits += Block_CalcBits(coeff, in, Data->dctSpace + 128, Data->iQuant, Data->quant_type, &cbp, 4, Data->scan_table, Data->lambda[4], Data->mpeg_quant_matrices); |
bits += Block_CalcBits(coeff, in, Data->dctSpace + 128, Data->iQuant, Data->quant_type, &cbp, 4, |
520 |
|
Data->scan_table, Data->lambda[4], Data->mpeg_quant_matrices, Data->quant_sq, Data->rel_var8[4], Data->metric); |
521 |
|
|
522 |
if (bits >= *Data->iMinSAD) return bits; |
if (bits >= *Data->iMinSAD) return bits; |
523 |
|
|
524 |
/* chroma V */ |
/* chroma V */ |
525 |
ptr = interpolate8x8_switch2(Data->RefQ + 64, Data->RefP[5], 0, 0, sumx, sumy, Data->iEdgedWidth/2, Data->rounding); |
ptr = interpolate8x8_switch2(Data->RefQ + 64, Data->RefP[5], 0, 0, sumx, sumy, Data->iEdgedWidth/2, Data->rounding); |
526 |
transfer_8to16subro(in, Data->CurV, ptr, Data->iEdgedWidth/2); |
transfer_8to16subro(in, Data->CurV, ptr, Data->iEdgedWidth/2); |
527 |
bits += Block_CalcBits(coeff, in, Data->dctSpace + 128, Data->iQuant, Data->quant_type, &cbp, 5, Data->scan_table, Data->lambda[5], Data->mpeg_quant_matrices); |
bits += Block_CalcBits(coeff, in, Data->dctSpace + 128, Data->iQuant, Data->quant_type, &cbp, 5, |
528 |
|
Data->scan_table, Data->lambda[5], Data->mpeg_quant_matrices, Data->quant_sq, Data->rel_var8[5], Data->metric); |
529 |
|
|
530 |
bits += BITS_MULT*mcbpc_inter_tab[(MODE_INTER4V & 7) | ((cbp & 3) << 3)].len; |
bits += BITS_MULT*(mcbpc_inter_tab[(MODE_INTER4V & 7) | ((cbp & 3) << 3)].len - 3); /* 3 were added before */ |
531 |
|
|
532 |
*Data->cbp = cbp; |
*Data->cbp = cbp; |
533 |
return bits; |
return bits; |
538 |
const int x, const int y, const int mb_width) |
const int x, const int y, const int mb_width) |
539 |
{ |
{ |
540 |
unsigned int cbp[2] = {0, 0}, bits[2], i; |
unsigned int cbp[2] = {0, 0}, bits[2], i; |
541 |
unsigned int bits1 = BITS_MULT*1, bits2 = BITS_MULT*1; /* this one is ac/dc prediction flag bit */ |
/* minimum number of bits that WILL be coded in intra - mcbpc 5, cby 2 acdc flag - 1 and DC coeffs - 4*3+2*2 */ |
542 |
|
int bits1 = BITS_MULT*(5+2+1+4*3+2*2), bits2 = BITS_MULT*(5+2+1+4*3+2*2); |
543 |
unsigned int distortion = 0; |
unsigned int distortion = 0; |
544 |
|
|
545 |
int16_t *in = Data->dctSpace, * coeff = Data->dctSpace + 64, * dqcoeff = Data->dctSpace + 128; |
int16_t *in = Data->dctSpace, * coeff = Data->dctSpace + 64, * dqcoeff = Data->dctSpace + 128; |
552 |
|
|
553 |
|
|
554 |
distortion = Block_CalcBitsIntra(pMB, x, y, mb_width, i, in, coeff, dqcoeff, |
distortion = Block_CalcBitsIntra(pMB, x, y, mb_width, i, in, coeff, dqcoeff, |
555 |
predictors[i], iQuant, Data->quant_type, bits, cbp, Data->lambda[i], Data->mpeg_quant_matrices); |
predictors[i], iQuant, Data->quant_type, bits, cbp, |
556 |
|
Data->lambda[i], Data->mpeg_quant_matrices, Data->quant_sq, Data->metric); |
557 |
bits1 += distortion + BITS_MULT * bits[0]; |
bits1 += distortion + BITS_MULT * bits[0]; |
558 |
bits2 += distortion + BITS_MULT * bits[1]; |
bits2 += distortion + BITS_MULT * bits[1]; |
559 |
|
|
561 |
return bits1; |
return bits1; |
562 |
} |
} |
563 |
|
|
564 |
bits1 += BITS_MULT*xvid_cbpy_tab[cbp[0]>>2].len; |
bits1 += BITS_MULT * (xvid_cbpy_tab[cbp[0]>>2].len - 2); /* two bits were added before */ |
565 |
bits2 += BITS_MULT*xvid_cbpy_tab[cbp[1]>>2].len; |
bits2 += BITS_MULT * (xvid_cbpy_tab[cbp[1]>>2].len - 2); |
566 |
|
|
567 |
/*chroma U */ |
/*chroma U */ |
568 |
transfer_8to16copy(in, Data->CurU, Data->iEdgedWidth/2); |
transfer_8to16copy(in, Data->CurU, Data->iEdgedWidth/2); |
569 |
distortion = Block_CalcBitsIntra(pMB, x, y, mb_width, 4, in, coeff, dqcoeff, |
distortion = Block_CalcBitsIntra(pMB, x, y, mb_width, 4, in, coeff, dqcoeff, |
570 |
predictors[4], iQuant, Data->quant_type, bits, cbp, Data->lambda[4], Data->mpeg_quant_matrices); |
predictors[4], iQuant, Data->quant_type, bits, cbp, |
571 |
|
Data->lambda[4], Data->mpeg_quant_matrices, Data->quant_sq, Data->metric); |
572 |
bits1 += distortion + BITS_MULT * bits[0]; |
bits1 += distortion + BITS_MULT * bits[0]; |
573 |
bits2 += distortion + BITS_MULT * bits[1]; |
bits2 += distortion + BITS_MULT * bits[1]; |
574 |
|
|
578 |
/* chroma V */ |
/* chroma V */ |
579 |
transfer_8to16copy(in, Data->CurV, Data->iEdgedWidth/2); |
transfer_8to16copy(in, Data->CurV, Data->iEdgedWidth/2); |
580 |
distortion = Block_CalcBitsIntra(pMB, x, y, mb_width, 5, in, coeff, dqcoeff, |
distortion = Block_CalcBitsIntra(pMB, x, y, mb_width, 5, in, coeff, dqcoeff, |
581 |
predictors[5], iQuant, Data->quant_type, bits, cbp, Data->lambda[5], Data->mpeg_quant_matrices); |
predictors[5], iQuant, Data->quant_type, bits, cbp, |
582 |
|
Data->lambda[5], Data->mpeg_quant_matrices, Data->quant_sq, Data->metric); |
583 |
|
|
584 |
bits1 += distortion + BITS_MULT * bits[0]; |
bits1 += distortion + BITS_MULT * bits[0]; |
585 |
bits2 += distortion + BITS_MULT * bits[1]; |
bits2 += distortion + BITS_MULT * bits[1]; |
586 |
|
|
587 |
bits1 += BITS_MULT*mcbpc_inter_tab[(MODE_INTRA & 7) | ((cbp[0] & 3) << 3)].len; |
bits1 += BITS_MULT * (mcbpc_inter_tab[(MODE_INTRA & 7) | ((cbp[0] & 3) << 3)].len - 5); /* 5 bits were added before */ |
588 |
bits2 += BITS_MULT*mcbpc_inter_tab[(MODE_INTRA & 7) | ((cbp[1] & 3) << 3)].len; |
bits2 += BITS_MULT * (mcbpc_inter_tab[(MODE_INTRA & 7) | ((cbp[1] & 3) << 3)].len - 5); |
589 |
|
|
590 |
*Data->cbp = bits1 <= bits2 ? cbp[0] : cbp[1]; |
*Data->cbp = bits1 <= bits2 ? cbp[0] : cbp[1]; |
591 |
|
|
596 |
static int |
static int |
597 |
findRD_gmc(SearchData * const Data, const IMAGE * const vGMC, const int x, const int y) |
findRD_gmc(SearchData * const Data, const IMAGE * const vGMC, const int x, const int y) |
598 |
{ |
{ |
599 |
int bits = BITS_MULT*1; /* this one is mcsel */ |
/* minimum nubler of bits - 1 (mcbpc) + 2 (cby) + 1 (mcsel) */ |
600 |
|
int bits = BITS_MULT * (1+2+1); |
601 |
unsigned int cbp = 0, i; |
unsigned int cbp = 0, i; |
602 |
int16_t *in = Data->dctSpace, * coeff = Data->dctSpace + 64; |
int16_t *in = Data->dctSpace, * coeff = Data->dctSpace + 64; |
603 |
|
|
604 |
for(i = 0; i < 4; i++) { |
for(i = 0; i < 4; i++) { |
605 |
int s = 8*((i&1) + (i>>1)*Data->iEdgedWidth); |
int s = 8*((i&1) + (i>>1)*Data->iEdgedWidth); |
606 |
transfer_8to16subro(in, Data->Cur + s, vGMC->y + s + 16*(x+y*Data->iEdgedWidth), Data->iEdgedWidth); |
transfer_8to16subro(in, Data->Cur + s, vGMC->y + s + 16*(x+y*Data->iEdgedWidth), Data->iEdgedWidth); |
607 |
bits += Block_CalcBits(coeff, in, Data->dctSpace + 128, Data->iQuant, Data->quant_type, &cbp, i, Data->scan_table, Data->lambda[i], Data->mpeg_quant_matrices); |
bits += Block_CalcBits(coeff, in, Data->dctSpace + 128, Data->iQuant, Data->quant_type, &cbp, i, |
608 |
|
Data->scan_table, Data->lambda[i], Data->mpeg_quant_matrices, |
609 |
|
Data->quant_sq, Data->rel_var8[i], Data->metric); |
610 |
if (bits >= Data->iMinSAD[0]) return bits; |
if (bits >= Data->iMinSAD[0]) return bits; |
611 |
} |
} |
612 |
|
|
613 |
bits += BITS_MULT*xvid_cbpy_tab[15-(cbp>>2)].len; |
bits += BITS_MULT * (xvid_cbpy_tab[15-(cbp>>2)].len - 2); |
614 |
|
|
615 |
/*chroma U */ |
/*chroma U */ |
616 |
transfer_8to16subro(in, Data->CurU, vGMC->u + 8*(x+y*(Data->iEdgedWidth/2)), Data->iEdgedWidth/2); |
transfer_8to16subro(in, Data->CurU, vGMC->u + 8*(x+y*(Data->iEdgedWidth/2)), Data->iEdgedWidth/2); |
617 |
bits += Block_CalcBits(coeff, in, Data->dctSpace + 128, Data->iQuant, Data->quant_type, &cbp, 4, Data->scan_table, Data->lambda[4], Data->mpeg_quant_matrices); |
bits += Block_CalcBits(coeff, in, Data->dctSpace + 128, Data->iQuant, Data->quant_type, &cbp, 4, |
618 |
|
Data->scan_table, Data->lambda[4], Data->mpeg_quant_matrices, |
619 |
|
Data->quant_sq, Data->rel_var8[4], Data->metric); |
620 |
|
|
621 |
if (bits >= Data->iMinSAD[0]) return bits; |
if (bits >= Data->iMinSAD[0]) return bits; |
622 |
|
|
623 |
/* chroma V */ |
/* chroma V */ |
624 |
transfer_8to16subro(in, Data->CurV , vGMC->v + 8*(x+y*(Data->iEdgedWidth/2)), Data->iEdgedWidth/2); |
transfer_8to16subro(in, Data->CurV , vGMC->v + 8*(x+y*(Data->iEdgedWidth/2)), Data->iEdgedWidth/2); |
625 |
bits += Block_CalcBits(coeff, in, Data->dctSpace + 128, Data->iQuant, Data->quant_type, &cbp, 5, Data->scan_table, Data->lambda[5], Data->mpeg_quant_matrices); |
bits += Block_CalcBits(coeff, in, Data->dctSpace + 128, Data->iQuant, Data->quant_type, &cbp, 5, |
626 |
|
Data->scan_table, Data->lambda[5], Data->mpeg_quant_matrices, |
627 |
|
Data->quant_sq, Data->rel_var8[5], Data->metric); |
628 |
|
|
629 |
bits += BITS_MULT*mcbpc_inter_tab[(MODE_INTER & 7) | ((cbp & 3) << 3)].len; |
bits += BITS_MULT * (mcbpc_inter_tab[(MODE_INTER & 7) | ((cbp & 3) << 3)].len - 1); |
630 |
|
|
631 |
*Data->cbp = cbp; |
*Data->cbp = cbp; |
632 |
|
|
645 |
const IMAGE * const pCurrent, |
const IMAGE * const pCurrent, |
646 |
const IMAGE * const pRef, |
const IMAGE * const pRef, |
647 |
const IMAGE * const vGMC, |
const IMAGE * const vGMC, |
648 |
const int coding_type) |
const int coding_type, |
649 |
|
const int bound) |
650 |
{ |
{ |
651 |
int mode = MODE_INTER; |
int mode = MODE_INTER; |
652 |
int mcsel = 0; |
int mcsel = 0; |
653 |
int inter4v = (VopFlags & XVID_VOP_INTER4V) && (pMB->dquant == 0); |
int inter4v = (VopFlags & XVID_VOP_INTER4V) && (pMB->dquant == 0); |
654 |
const uint32_t iQuant = pMB->quant; |
const uint32_t iQuant = pMB->quant; |
|
|
|
655 |
int min_rd, intra_rd, i, cbp; |
int min_rd, intra_rd, i, cbp; |
656 |
VECTOR backup[5], *v; |
VECTOR backup[5], *v; |
657 |
Data->iQuant = iQuant; |
Data->iQuant = iQuant; |
658 |
|
Data->quant_sq = iQuant*iQuant; |
659 |
Data->scan_table = VopFlags & XVID_VOP_ALTERNATESCAN ? |
Data->scan_table = VopFlags & XVID_VOP_ALTERNATESCAN ? |
660 |
scan_tables[2] : scan_tables[0]; |
scan_tables[2] : scan_tables[0]; |
661 |
|
Data->metric = !!(VopFlags & XVID_VOP_RD_PSNRHVSM); |
662 |
|
|
663 |
pMB->mcsel = 0; |
pMB->mcsel = 0; |
664 |
|
|
669 |
} |
} |
670 |
|
|
671 |
for (i = 0; i < 6; i++) { |
for (i = 0; i < 6; i++) { |
672 |
/* HVS models, anyone ? */ |
Data->lambda[i] = (LAMBDA*pMB->lambda[i])>>LAMBDA_EXP; |
673 |
Data->lambda[i] = LAMBDA; |
Data->rel_var8[i] = pMB->rel_var8[i]; |
674 |
} |
} |
675 |
|
|
676 |
min_rd = findRD_inter(Data, x, y, pParam, MotionFlags); |
min_rd = findRD_inter(Data, x, y, pParam, MotionFlags); |
690 |
|
|
691 |
if (inter4v) { |
if (inter4v) { |
692 |
int v4_rd; |
int v4_rd; |
693 |
v4_rd = findRD_inter4v(Data, pMB, pMBs, x, y, pParam, MotionFlags, backup); |
v4_rd = findRD_inter4v(Data, pMB, pMBs, x, y, pParam, MotionFlags, backup, bound); |
694 |
if (v4_rd < min_rd) { |
if (v4_rd < min_rd) { |
695 |
Data->iMinSAD[0] = min_rd = v4_rd; |
Data->iMinSAD[0] = min_rd = v4_rd; |
696 |
mode = MODE_INTER4V; |
mode = MODE_INTER4V; |
698 |
} |
} |
699 |
} |
} |
700 |
|
|
701 |
|
/* there is no way for INTRA to take less than 24 bits - go to findRD_intra() for calculations */ |
702 |
|
if (min_rd > 24*BITS_MULT) { |
703 |
intra_rd = findRD_intra(Data, pMB, x, y, pParam->mb_width); |
intra_rd = findRD_intra(Data, pMB, x, y, pParam->mb_width); |
704 |
if (intra_rd < min_rd) { |
if (intra_rd < min_rd) { |
705 |
*Data->iMinSAD = min_rd = intra_rd; |
*Data->iMinSAD = min_rd = intra_rd; |
706 |
mode = MODE_INTRA; |
mode = MODE_INTRA; |
707 |
cbp = *Data->cbp; |
cbp = *Data->cbp; |
708 |
} |
} |
709 |
|
} |
710 |
|
|
711 |
pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = 0; |
pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = 0; |
712 |
pMB->cbp = cbp; |
pMB->cbp = cbp; |
713 |
|
|
|
|
|
|
if (Data->rrv) { |
|
|
Data->currentMV[0].x = RRV_MV_SCALEDOWN(Data->currentMV[0].x); |
|
|
Data->currentMV[0].y = RRV_MV_SCALEDOWN(Data->currentMV[0].y); |
|
|
} |
|
|
|
|
714 |
if (mode == MODE_INTER && mcsel == 0) { |
if (mode == MODE_INTER && mcsel == 0) { |
715 |
pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = Data->currentMV[0]; |
pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = Data->currentMV[0]; |
716 |
|
|
754 |
const IMAGE * const pCurrent, |
const IMAGE * const pCurrent, |
755 |
const IMAGE * const pRef, |
const IMAGE * const pRef, |
756 |
const IMAGE * const vGMC, |
const IMAGE * const vGMC, |
757 |
const int coding_type) |
const int coding_type, |
758 |
|
const int bound) |
759 |
{ |
{ |
760 |
int mode = MODE_INTER; |
int mode = MODE_INTER; |
761 |
int mcsel = 0; |
int mcsel = 0; |
771 |
int top = 0, top_right = 0, left = 0; |
int top = 0, top_right = 0, left = 0; |
772 |
Data->scan_table = VopFlags & XVID_VOP_ALTERNATESCAN ? |
Data->scan_table = VopFlags & XVID_VOP_ALTERNATESCAN ? |
773 |
scan_tables[2] : scan_tables[0]; |
scan_tables[2] : scan_tables[0]; |
774 |
|
Data->metric = !!(VopFlags & XVID_VOP_RD_PSNRHVSM); |
775 |
|
|
776 |
pMB->mcsel = 0; |
pMB->mcsel = 0; |
777 |
|
Data->iQuant = iQuant; |
778 |
|
Data->quant_sq = iQuant*iQuant; |
779 |
|
|
780 |
|
for (i = 0; i < 6; i++) { |
781 |
|
Data->lambda[i] = (LAMBDA*pMB->lambda[i])>>LAMBDA_EXP; |
782 |
|
Data->rel_var8[i] = pMB->rel_var8[i]; |
783 |
|
} |
784 |
|
|
785 |
/* INTER <-> INTER4V decision */ |
/* INTER <-> INTER4V decision */ |
786 |
if ((Data->iMinSAD[0] + 75 < Data->iMinSAD[1] + |
if ((Data->iMinSAD[0] + 75 < Data->iMinSAD[1] + |
799 |
/* final skip decision, a.k.a. "the vector you found, really that good?" */ |
/* final skip decision, a.k.a. "the vector you found, really that good?" */ |
800 |
if (skip_possible && (pMB->sad16 < (int)iQuant * MAX_SAD00_FOR_SKIP)) |
if (skip_possible && (pMB->sad16 < (int)iQuant * MAX_SAD00_FOR_SKIP)) |
801 |
if ( (100*sad)/(pMB->sad16+1) > FINAL_SKIP_THRESH) |
if ( (100*sad)/(pMB->sad16+1) > FINAL_SKIP_THRESH) |
802 |
if (Data->chroma || xvid_me_SkipDecisionP(pCurrent, pRef, x, y, Data->iEdgedWidth/2, iQuant, Data->rrv)) { |
if (Data->chroma || xvid_me_SkipDecisionP(pCurrent, pRef, x, y, Data->iEdgedWidth/2, iQuant)) { |
803 |
mode = MODE_NOT_CODED; |
mode = MODE_NOT_CODED; |
804 |
sad = 0; /* Compiler warning */ |
sad = 0; /* Compiler warning */ |
805 |
goto early_out; |
goto early_out; |
830 |
/* final skip decision, a.k.a. "the vector you found, really that good?" */ |
/* final skip decision, a.k.a. "the vector you found, really that good?" */ |
831 |
if (skip_possible && (pMB->sad16 < (int)iQuant * MAX_SAD00_FOR_SKIP)) |
if (skip_possible && (pMB->sad16 < (int)iQuant * MAX_SAD00_FOR_SKIP)) |
832 |
if ( (100*Data->iMinSAD[0])/(pMB->sad16+1) > FINAL_SKIP_THRESH) |
if ( (100*Data->iMinSAD[0])/(pMB->sad16+1) > FINAL_SKIP_THRESH) |
833 |
if (Data->chroma || xvid_me_SkipDecisionP(pCurrent, pRef, x, y, Data->iEdgedWidth/2, iQuant, Data->rrv)) { |
if (Data->chroma || xvid_me_SkipDecisionP(pCurrent, pRef, x, y, Data->iEdgedWidth/2, iQuant)) { |
834 |
mode = MODE_NOT_CODED; |
mode = MODE_NOT_CODED; |
835 |
sad = 0; /* Compiler warning */ |
sad = 0; /* Compiler warning */ |
836 |
goto early_out; |
goto early_out; |
867 |
|
|
868 |
if (inter4v) { |
if (inter4v) { |
869 |
int v4_rd; |
int v4_rd; |
870 |
v4_rd = findRD_inter4v(Data, pMB, pMBs, x, y, pParam, MotionFlags, backup); |
v4_rd = findRD_inter4v(Data, pMB, pMBs, x, y, pParam, MotionFlags, backup, bound); |
871 |
if (v4_rd < min_rd) { |
if (v4_rd < min_rd) { |
872 |
Data->iMinSAD[0] = min_rd = v4_rd; |
Data->iMinSAD[0] = min_rd = v4_rd; |
873 |
mode = MODE_INTER4V; |
mode = MODE_INTER4V; |
906 |
if ((pMB - 1)->mode == MODE_INTRA ) InterBias -= 80; |
if ((pMB - 1)->mode == MODE_INTRA ) InterBias -= 80; |
907 |
|
|
908 |
if (Data->chroma) InterBias += 50; /* dev8(chroma) ??? <-- yes, we need dev8 (no big difference though) */ |
if (Data->chroma) InterBias += 50; /* dev8(chroma) ??? <-- yes, we need dev8 (no big difference though) */ |
|
if (Data->rrv) InterBias *= 4; |
|
909 |
|
|
910 |
if (InterBias < sad) { |
if (InterBias < sad) { |
911 |
int32_t deviation; |
int32_t deviation = dev16(Data->Cur, Data->iEdgedWidth); |
|
if (!Data->rrv) |
|
|
deviation = dev16(Data->Cur, Data->iEdgedWidth); |
|
|
else |
|
|
deviation = dev16(Data->Cur, Data->iEdgedWidth) + /* dev32() */ |
|
|
dev16(Data->Cur+16, Data->iEdgedWidth) + |
|
|
dev16(Data->Cur + 16*Data->iEdgedWidth, Data->iEdgedWidth) + |
|
|
dev16(Data->Cur+16+16*Data->iEdgedWidth, Data->iEdgedWidth); |
|
|
|
|
912 |
if (deviation < (sad - InterBias)) mode = MODE_INTRA; |
if (deviation < (sad - InterBias)) mode = MODE_INTRA; |
913 |
} |
} |
914 |
|
|
943 |
|
|
944 |
if(mode == MODE_INTER4V) { |
if(mode == MODE_INTER4V) { |
945 |
int v4_rd; |
int v4_rd; |
946 |
v4_rd = findRD_inter4v(Data, pMB, pMBs, x, y, pParam, MotionFlags, backup); |
v4_rd = findRD_inter4v(Data, pMB, pMBs, x, y, pParam, MotionFlags, backup, bound); |
947 |
if (v4_rd < min_rd) { |
if (v4_rd < min_rd) { |
948 |
Data->iMinSAD[0] = min_rd = v4_rd; |
Data->iMinSAD[0] = min_rd = v4_rd; |
949 |
mode = MODE_INTER4V; |
mode = MODE_INTER4V; |
964 |
early_out: |
early_out: |
965 |
pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = sad; |
pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = sad; |
966 |
|
|
|
if (Data->rrv) { |
|
|
Data->currentMV[0].x = RRV_MV_SCALEDOWN(Data->currentMV[0].x); |
|
|
Data->currentMV[0].y = RRV_MV_SCALEDOWN(Data->currentMV[0].y); |
|
|
} |
|
|
|
|
967 |
if (mode == MODE_INTER && mcsel == 0) { |
if (mode == MODE_INTER && mcsel == 0) { |
968 |
pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = Data->currentMV[0]; |
pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = Data->currentMV[0]; |
969 |
|
|