60 |
}; |
}; |
61 |
|
|
62 |
static void |
static void |
63 |
CheckCandidate16(const int x, const int y, const SearchData * const data, const unsigned int Direction) |
CheckCandidate16(const int x, const int y, SearchData * const data, const unsigned int Direction) |
64 |
{ |
{ |
65 |
const uint8_t * Reference; |
const uint8_t * Reference; |
66 |
int32_t sad; uint32_t t; |
int32_t sad; uint32_t t; |
85 |
if (sad < data->iMinSAD[0]) { |
if (sad < data->iMinSAD[0]) { |
86 |
data->iMinSAD[0] = sad; |
data->iMinSAD[0] = sad; |
87 |
data->currentMV[0].x = x; data->currentMV[0].y = y; |
data->currentMV[0].x = x; data->currentMV[0].y = y; |
88 |
*data->dir = Direction; |
data->dir = Direction; |
89 |
} |
} |
90 |
|
|
91 |
no16: |
no16: |
100 |
} |
} |
101 |
|
|
102 |
static void |
static void |
103 |
CheckCandidate16_qpel(const int x, const int y, const SearchData * const data, const unsigned int Direction) |
CheckCandidate16_qpel(const int x, const int y, SearchData * const data, const unsigned int Direction) |
104 |
{ |
{ |
105 |
const uint8_t *Reference; |
const uint8_t *Reference; |
106 |
int32_t sad; uint32_t t; |
int32_t sad; uint32_t t; |
116 |
sad += (data->lambda16 * t * sad)>>10; |
sad += (data->lambda16 * t * sad)>>10; |
117 |
data->temp[0] += (data->lambda8 * t * (data->temp[0] + NEIGH_8X8_BIAS))>>10; |
data->temp[0] += (data->lambda8 * t * (data->temp[0] + NEIGH_8X8_BIAS))>>10; |
118 |
|
|
119 |
if (data->chroma && (sad < data->iMinSAD[0] || sad < data->iMinSAD2[0]) ) |
if (data->chroma && (sad < data->iMinSAD[0] || sad < data->iMinSAD2) ) |
120 |
sad += xvid_me_ChromaSAD(((x/2) >> 1) + roundtab_79[(x/2) & 0x3], |
sad += xvid_me_ChromaSAD(((x/2) >> 1) + roundtab_79[(x/2) & 0x3], |
121 |
((y/2) >> 1) + roundtab_79[(y/2) & 0x3], data); |
((y/2) >> 1) + roundtab_79[(y/2) & 0x3], data); |
122 |
|
|
130 |
data->iMinSAD[4] = data->temp[3]; data->currentQMV[4].x = x; data->currentQMV[4].y = y; } |
data->iMinSAD[4] = data->temp[3]; data->currentQMV[4].x = x; data->currentQMV[4].y = y; } |
131 |
|
|
132 |
if (sad < data->iMinSAD[0]) { |
if (sad < data->iMinSAD[0]) { |
133 |
*(data->iMinSAD2) = *(data->iMinSAD); |
data->iMinSAD2 = *(data->iMinSAD); |
134 |
data->currentQMV2->x = data->currentQMV->x; |
data->currentQMV2.x = data->currentQMV->x; |
135 |
data->currentQMV2->y = data->currentQMV->y; |
data->currentQMV2.y = data->currentQMV->y; |
136 |
|
|
137 |
data->iMinSAD[0] = sad; |
data->iMinSAD[0] = sad; |
138 |
data->currentQMV[0].x = x; data->currentQMV[0].y = y; |
data->currentQMV[0].x = x; data->currentQMV[0].y = y; |
139 |
} else if (sad < *(data->iMinSAD2)) { |
} else if (sad < data->iMinSAD2) { |
140 |
*(data->iMinSAD2) = sad; |
data->iMinSAD2 = sad; |
141 |
data->currentQMV2->x = x; data->currentQMV2->y = y; |
data->currentQMV2.x = x; data->currentQMV2.y = y; |
142 |
} |
} |
143 |
} |
} |
144 |
|
|
145 |
static void |
static void |
146 |
CheckCandidate8(const int x, const int y, const SearchData * const data, const unsigned int Direction) |
CheckCandidate8(const int x, const int y, SearchData * const data, const unsigned int Direction) |
147 |
{ |
{ |
148 |
int32_t sad; uint32_t t; |
int32_t sad; uint32_t t; |
149 |
const uint8_t * Reference; |
const uint8_t * Reference; |
168 |
if (sad < *(data->iMinSAD)) { |
if (sad < *(data->iMinSAD)) { |
169 |
*(data->iMinSAD) = sad; |
*(data->iMinSAD) = sad; |
170 |
current->x = x; current->y = y; |
current->x = x; current->y = y; |
171 |
*data->dir = Direction; |
data->dir = Direction; |
172 |
} |
} |
173 |
} |
} |
174 |
|
|
175 |
static void |
static void |
176 |
CheckCandidate32(const int x, const int y, const SearchData * const data, const unsigned int Direction) |
CheckCandidate8_qpel(const int x, const int y, SearchData * const data, const unsigned int Direction) |
177 |
|
{ |
178 |
|
int32_t sad; uint32_t t; |
179 |
|
const uint8_t * Reference; |
180 |
|
VECTOR * current; |
181 |
|
|
182 |
|
if ( (x > data->max_dx) || (x < data->min_dx) |
183 |
|
|| (y > data->max_dy) || (y < data->min_dy) ) return; |
184 |
|
|
185 |
|
/* x and y are in 1/4 precision */ |
186 |
|
Reference = xvid_me_interpolate8x8qpel(x, y, 0, 0, data); |
187 |
|
current = data->currentQMV; |
188 |
|
|
189 |
|
sad = sad8(data->Cur, Reference, data->iEdgedWidth); |
190 |
|
t = d_mv_bits(x, y, data->predMV, data->iFcode, data->qpel^data->qpel_precision, 0); |
191 |
|
|
192 |
|
sad += (data->lambda8 * t * (sad+NEIGH_8X8_BIAS))>>10; |
193 |
|
|
194 |
|
if (sad < *(data->iMinSAD)) { |
195 |
|
data->iMinSAD2 = *(data->iMinSAD); |
196 |
|
data->currentQMV2.x = data->currentQMV->x; |
197 |
|
data->currentQMV2.y = data->currentQMV->y; |
198 |
|
|
199 |
|
*(data->iMinSAD) = sad; |
200 |
|
data->currentQMV->x = x; data->currentQMV->y = y; |
201 |
|
data->dir = Direction; |
202 |
|
} else if (sad < data->iMinSAD2) { |
203 |
|
data->iMinSAD2 = sad; |
204 |
|
data->currentQMV2.x = x; data->currentQMV2.y = y; |
205 |
|
} |
206 |
|
} |
207 |
|
|
208 |
|
static void |
209 |
|
CheckCandidate32(const int x, const int y, SearchData * const data, const unsigned int Direction) |
210 |
{ |
{ |
211 |
uint32_t t; |
uint32_t t; |
212 |
const uint8_t * Reference; |
const uint8_t * Reference; |
227 |
if (sad < data->iMinSAD[0]) { |
if (sad < data->iMinSAD[0]) { |
228 |
data->iMinSAD[0] = sad; |
data->iMinSAD[0] = sad; |
229 |
data->currentMV[0].x = x; data->currentMV[0].y = y; |
data->currentMV[0].x = x; data->currentMV[0].y = y; |
230 |
*data->dir = Direction; |
data->dir = Direction; |
231 |
} |
} |
232 |
|
|
233 |
if (data->temp[0] < data->iMinSAD[1]) { |
if (data->temp[0] < data->iMinSAD[1]) { |
240 |
data->iMinSAD[4] = data->temp[3]; data->currentMV[4].x = x; data->currentMV[4].y = y; } |
data->iMinSAD[4] = data->temp[3]; data->currentMV[4].x = x; data->currentMV[4].y = y; } |
241 |
} |
} |
242 |
|
|
|
static void |
|
|
SubpelRefine_Fast(SearchData * data, CheckFunc * CheckCandidate) |
|
|
{ |
|
|
/* Do a fast q-pel refinement */ |
|
|
VECTOR centerMV; |
|
|
VECTOR second_best; |
|
|
int best_sad = *data->iMinSAD; |
|
|
int xo, yo, xo2, yo2; |
|
|
int size = 2; |
|
|
*data->iMinSAD2 = 0; |
|
|
|
|
|
/* check all halfpixel positions near our best halfpel position */ |
|
|
centerMV = *data->currentQMV; |
|
|
*data->iMinSAD = 256 * 4096; |
|
|
|
|
|
CHECK_CANDIDATE(centerMV.x, centerMV.y - size, 0); |
|
|
CHECK_CANDIDATE(centerMV.x + size, centerMV.y - size, 0); |
|
|
CHECK_CANDIDATE(centerMV.x + size, centerMV.y, 0); |
|
|
CHECK_CANDIDATE(centerMV.x + size, centerMV.y + size, 0); |
|
|
|
|
|
CHECK_CANDIDATE(centerMV.x, centerMV.y + size, 0); |
|
|
CHECK_CANDIDATE(centerMV.x - size, centerMV.y + size, 0); |
|
|
CHECK_CANDIDATE(centerMV.x - size, centerMV.y, 0); |
|
|
CHECK_CANDIDATE(centerMV.x - size, centerMV.y - size, 0); |
|
|
|
|
|
second_best = *data->currentQMV; |
|
|
|
|
|
/* after second_best has been found, go back to the vector we began with */ |
|
|
|
|
|
data->currentQMV[0] = centerMV; |
|
|
*data->iMinSAD = best_sad; |
|
|
|
|
|
xo = centerMV.x; |
|
|
yo = centerMV.y; |
|
|
xo2 = second_best.x; |
|
|
yo2 = second_best.y; |
|
|
|
|
|
*data->iMinSAD2 = 256 * 4096; |
|
|
|
|
|
if (yo == yo2) { |
|
|
CHECK_CANDIDATE((xo+xo2)>>1, yo, 0); |
|
|
CHECK_CANDIDATE(xo, yo-1, 0); |
|
|
CHECK_CANDIDATE(xo, yo+1, 0); |
|
|
|
|
|
if(best_sad <= *data->iMinSAD2) return; |
|
|
|
|
|
if(data->currentQMV[0].x == data->currentQMV2[0].x) { |
|
|
CHECK_CANDIDATE((xo+xo2)>>1, yo-1, 0); |
|
|
CHECK_CANDIDATE((xo+xo2)>>1, yo+1, 0); |
|
|
} else { |
|
|
CHECK_CANDIDATE((xo+xo2)>>1, |
|
|
(data->currentQMV[0].x == xo) ? data->currentQMV[0].y : data->currentQMV2[0].y, 0); |
|
|
} |
|
|
return; |
|
|
} |
|
|
|
|
|
if (xo == xo2) { |
|
|
CHECK_CANDIDATE(xo, (yo+yo2)>>1, 0); |
|
|
CHECK_CANDIDATE(xo-1, yo, 0); |
|
|
CHECK_CANDIDATE(xo+1, yo, 0); |
|
|
|
|
|
if(best_sad < *data->iMinSAD2) return; |
|
|
|
|
|
if(data->currentQMV[0].y == data->currentQMV2[0].y) { |
|
|
CHECK_CANDIDATE(xo-1, (yo+yo2)>>1, 0); |
|
|
CHECK_CANDIDATE(xo+1, (yo+yo2)>>1, 0); |
|
|
} else { |
|
|
CHECK_CANDIDATE((data->currentQMV[0].y == yo) ? data->currentQMV[0].x : data->currentQMV2[0].x, (yo+yo2)>>1, 0); |
|
|
} |
|
|
return; |
|
|
} |
|
|
|
|
|
CHECK_CANDIDATE(xo, (yo+yo2)>>1, 0); |
|
|
CHECK_CANDIDATE((xo+xo2)>>1, yo, 0); |
|
|
|
|
|
if(best_sad <= *data->iMinSAD2) return; |
|
|
|
|
|
CHECK_CANDIDATE((xo+xo2)>>1, (yo+yo2)>>1, 0); |
|
|
} |
|
|
|
|
243 |
int |
int |
244 |
xvid_me_SkipDecisionP(const IMAGE * current, const IMAGE * reference, |
xvid_me_SkipDecisionP(const IMAGE * current, const IMAGE * reference, |
245 |
const int x, const int y, |
const int x, const int y, |
432 |
|
|
433 |
/* intra decision */ |
/* intra decision */ |
434 |
|
|
435 |
if (iQuant > 8) InterBias += 100 * (iQuant - 8); /* to make high quants work */ |
if (iQuant > 10) InterBias += 60 * (iQuant - 10); /* to make high quants work */ |
436 |
if (y != 0) |
if (y != 0) |
437 |
if ((pMB - pParam->mb_width)->mode == MODE_INTRA ) InterBias -= 80; |
if ((pMB - pParam->mb_width)->mode == MODE_INTRA ) InterBias -= 80; |
438 |
if (x != 0) |
if (x != 0) |
534 |
} |
} |
535 |
|
|
536 |
static void |
static void |
537 |
Search8(const SearchData * const OldData, |
Search8(SearchData * const OldData, |
538 |
const int x, const int y, |
const int x, const int y, |
539 |
const uint32_t MotionFlags, |
const uint32_t MotionFlags, |
540 |
const MBParam * const pParam, |
const MBParam * const pParam, |
545 |
{ |
{ |
546 |
int i = 0; |
int i = 0; |
547 |
CheckFunc * CheckCandidate; |
CheckFunc * CheckCandidate; |
548 |
Data->iMinSAD = OldData->iMinSAD + 1 + block; |
*Data->iMinSAD = *(OldData->iMinSAD + 1 + block); |
549 |
Data->currentMV = OldData->currentMV + 1 + block; |
*Data->currentMV = *(OldData->currentMV + 1 + block); |
550 |
Data->currentQMV = OldData->currentQMV + 1 + block; |
*Data->currentQMV = *(OldData->currentQMV + 1 + block); |
551 |
|
|
552 |
if(Data->qpel) { |
if(Data->qpel) { |
553 |
Data->predMV = get_qpmv2(pMBs, pParam->mb_width, 0, x/2, y/2, block); |
Data->predMV = get_qpmv2(pMBs, pParam->mb_width, 0, x/2, y/2, block); |
606 |
} |
} |
607 |
} |
} |
608 |
|
|
609 |
if (Data->qpel && MotionFlags & XVID_ME_QUARTERPELREFINE8) { |
if (Data->qpel && (MotionFlags & XVID_ME_QUARTERPELREFINE8)) { |
610 |
Data->qpel_precision = 1; |
Data->qpel_precision = 1; |
611 |
get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 3, |
get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 3, |
612 |
pParam->width, pParam->height, Data->iFcode, 2, 0); |
pParam->width, pParam->height, Data->iFcode, 2, 0); |
613 |
|
|
614 |
|
if((MotionFlags & XVID_ME_FASTREFINE8) && (!Data->rrv)) |
615 |
|
SubpelRefine_Fast(Data, CheckCandidate8_qpel); |
616 |
|
else |
617 |
xvid_me_SubpelRefine(Data, CheckCandidate); |
xvid_me_SubpelRefine(Data, CheckCandidate); |
618 |
} |
} |
619 |
} |
} |
632 |
pMB->pmvs[block].y = Data->currentMV->y - Data->predMV.y; |
pMB->pmvs[block].y = Data->currentMV->y - Data->predMV.y; |
633 |
} |
} |
634 |
|
|
635 |
|
*(OldData->iMinSAD + 1 + block) = *Data->iMinSAD; |
636 |
|
*(OldData->currentMV + 1 + block) = *Data->currentMV; |
637 |
|
*(OldData->currentQMV + 1 + block) = *Data->currentQMV; |
638 |
|
|
639 |
pMB->mvs[block] = *Data->currentMV; |
pMB->mvs[block] = *Data->currentMV; |
640 |
pMB->sad8[block] = 4 * *Data->iMinSAD; |
pMB->sad8[block] = 4 * *Data->iMinSAD; |
641 |
} |
} |
669 |
|
|
670 |
get_pmvdata2(pMBs, pParam->mb_width, 0, x, y, pmv, Data->temp); |
get_pmvdata2(pMBs, pParam->mb_width, 0, x, y, pmv, Data->temp); |
671 |
|
|
672 |
Data->temp[5] = Data->temp[6] = 0; /* chroma-sad cache */ |
Data->chromaX = Data->chromaY = 0; /* chroma-sad cache */ |
673 |
i = Data->rrv ? 2 : 1; |
i = Data->rrv ? 2 : 1; |
674 |
Data->Cur = pCur->y + (x + y * Data->iEdgedWidth) * 16*i; |
Data->Cur = pCur->y + (x + y * Data->iEdgedWidth) * 16*i; |
675 |
Data->CurV = pCur->v + (x + y * (Data->iEdgedWidth/2)) * 8*i; |
Data->CurV = pCur->v + (x + y * (Data->iEdgedWidth/2)) * 8*i; |
685 |
Data->lambda16 = xvid_me_lambda_vec16[pMB->quant]; |
Data->lambda16 = xvid_me_lambda_vec16[pMB->quant]; |
686 |
Data->lambda8 = xvid_me_lambda_vec8[pMB->quant]; |
Data->lambda8 = xvid_me_lambda_vec8[pMB->quant]; |
687 |
Data->qpel_precision = 0; |
Data->qpel_precision = 0; |
688 |
*Data->dir = 0; |
Data->dir = 0; |
689 |
|
|
690 |
memset(Data->currentMV, 0, 5*sizeof(VECTOR)); |
memset(Data->currentMV, 0, 5*sizeof(VECTOR)); |
691 |
|
|
729 |
else { |
else { |
730 |
|
|
731 |
MainSearchFunc * MainSearchPtr; |
MainSearchFunc * MainSearchPtr; |
732 |
int mask = make_mask(pmv, i, *Data->dir); /* all vectors pmv[0..i-1] have been checked */ |
int mask = make_mask(pmv, i, Data->dir); /* all vectors pmv[0..i-1] have been checked */ |
733 |
|
|
734 |
if (MotionFlags & XVID_ME_USESQUARES16) MainSearchPtr = xvid_me_SquareSearch; |
if (MotionFlags & XVID_ME_USESQUARES16) MainSearchPtr = xvid_me_SquareSearch; |
735 |
else if (MotionFlags & XVID_ME_ADVANCEDDIAMOND16) MainSearchPtr = xvid_me_AdvDiamondSearch; |
else if (MotionFlags & XVID_ME_ADVANCEDDIAMOND16) MainSearchPtr = xvid_me_AdvDiamondSearch; |
755 |
bSAD = Data->iMinSAD[0]; Data->iMinSAD[0] = MV_MAX_ERROR; |
bSAD = Data->iMinSAD[0]; Data->iMinSAD[0] = MV_MAX_ERROR; |
756 |
|
|
757 |
CheckCandidate(startMV.x, startMV.y, Data, 255); |
CheckCandidate(startMV.x, startMV.y, Data, 255); |
758 |
MainSearchPtr(startMV.x, startMV.y, Data, 255, CheckCandidate); |
xvid_me_DiamondSearch(startMV.x, startMV.y, Data, 255, CheckCandidate); |
759 |
if (bSAD < Data->iMinSAD[0]) { |
if (bSAD < Data->iMinSAD[0]) { |
760 |
Data->currentMV[0] = backupMV; |
Data->currentMV[0] = backupMV; |
761 |
Data->iMinSAD[0] = bSAD; } |
Data->iMinSAD[0] = bSAD; } |
767 |
bSAD = Data->iMinSAD[0]; Data->iMinSAD[0] = MV_MAX_ERROR; |
bSAD = Data->iMinSAD[0]; Data->iMinSAD[0] = MV_MAX_ERROR; |
768 |
|
|
769 |
CheckCandidate(startMV.x, startMV.y, Data, 255); |
CheckCandidate(startMV.x, startMV.y, Data, 255); |
770 |
MainSearchPtr(startMV.x, startMV.y, Data, 255, CheckCandidate); |
xvid_me_DiamondSearch(startMV.x, startMV.y, Data, 255, CheckCandidate); |
771 |
if (bSAD < Data->iMinSAD[0]) { |
if (bSAD < Data->iMinSAD[0]) { |
772 |
Data->currentMV[0] = backupMV; |
Data->currentMV[0] = backupMV; |
773 |
Data->iMinSAD[0] = bSAD; |
Data->iMinSAD[0] = bSAD; |
796 |
} |
} |
797 |
} |
} |
798 |
|
|
799 |
if (Data->iMinSAD[0] < (int32_t)pMB->quant * 30) |
if (Data->iMinSAD[0] < (int32_t)pMB->quant * 30*((MotionFlags & XVID_ME_FASTREFINE16) ? 8 : 1)) |
800 |
inter4v = 0; |
inter4v = 0; |
801 |
|
|
802 |
if (inter4v) { |
if (inter4v) { |
894 |
(current->vop_flags & XVID_VOP_MODEDECISION_RD ? 2:1); |
(current->vop_flags & XVID_VOP_MODEDECISION_RD ? 2:1); |
895 |
|
|
896 |
/* some pre-initialized thingies for SearchP */ |
/* some pre-initialized thingies for SearchP */ |
|
int32_t temp[8]; uint32_t dir; |
|
|
VECTOR currentMV[5]; |
|
|
VECTOR currentQMV[5]; |
|
|
VECTOR currentQMV2; |
|
|
int32_t iMinSAD[5]; |
|
|
int32_t iMinSAD2; |
|
897 |
DECLARE_ALIGNED_MATRIX(dct_space, 3, 64, int16_t, CACHE_LINE); |
DECLARE_ALIGNED_MATRIX(dct_space, 3, 64, int16_t, CACHE_LINE); |
898 |
SearchData Data; |
SearchData Data; |
899 |
memset(&Data, 0, sizeof(SearchData)); |
memset(&Data, 0, sizeof(SearchData)); |
900 |
Data.iEdgedWidth = iEdgedWidth; |
Data.iEdgedWidth = iEdgedWidth; |
|
Data.currentMV = currentMV; |
|
|
Data.currentQMV = currentQMV; |
|
|
Data.currentQMV2 = ¤tQMV2; |
|
|
Data.iMinSAD = iMinSAD; |
|
|
Data.iMinSAD2 = &iMinSAD2; |
|
|
Data.temp = temp; |
|
|
Data.dir = &dir; |
|
901 |
Data.iFcode = current->fcode; |
Data.iFcode = current->fcode; |
902 |
Data.rounding = pParam->m_rounding_type; |
Data.rounding = pParam->m_rounding_type; |
903 |
Data.qpel = (current->vol_flags & XVID_VOL_QUARTERPEL ? 1:0); |
Data.qpel = (current->vol_flags & XVID_VOL_QUARTERPEL ? 1:0); |
905 |
Data.rrv = (current->vop_flags & XVID_VOP_REDUCED) ? 1:0; |
Data.rrv = (current->vop_flags & XVID_VOP_REDUCED) ? 1:0; |
906 |
Data.dctSpace = dct_space; |
Data.dctSpace = dct_space; |
907 |
Data.quant_type = !(pParam->vol_flags & XVID_VOL_MPEGQUANT); |
Data.quant_type = !(pParam->vol_flags & XVID_VOL_MPEGQUANT); |
908 |
|
Data.mpeg_quant_matrices = pParam->mpeg_quant_matrices; |
909 |
|
Data.iMinSAD2 = 0; |
910 |
|
|
911 |
if ((current->vop_flags & XVID_VOP_REDUCED)) { |
if ((current->vop_flags & XVID_VOP_REDUCED)) { |
912 |
mb_width = (pParam->width + 31) / 32; |
mb_width = (pParam->width + 31) / 32; |
933 |
pParam->edged_width, pMB->sad8 ); |
pParam->edged_width, pMB->sad8 ); |
934 |
|
|
935 |
if (Data.chroma) { |
if (Data.chroma) { |
936 |
Data.temp[7] = sad8(pCurrent->u + x*8 + y*(iEdgedWidth/2)*8, |
Data.chromaSAD = sad8(pCurrent->u + x*8 + y*(iEdgedWidth/2)*8, |
937 |
pRef->u + x*8 + y*(iEdgedWidth/2)*8, iEdgedWidth/2) |
pRef->u + x*8 + y*(iEdgedWidth/2)*8, iEdgedWidth/2) |
938 |
+ sad8(pCurrent->v + (x + y*(iEdgedWidth/2))*8, |
+ sad8(pCurrent->v + (x + y*(iEdgedWidth/2))*8, |
939 |
pRef->v + (x + y*(iEdgedWidth/2))*8, iEdgedWidth/2); |
pRef->v + (x + y*(iEdgedWidth/2))*8, iEdgedWidth/2); |
940 |
pMB->sad16 += Data.temp[7]; |
pMB->sad16 += Data.chromaSAD; |
941 |
} |
} |
942 |
|
|
943 |
sad00 = pMB->sad16; |
sad00 = pMB->sad16; |
963 |
MAX((&pMBs[x + (y-1) * pParam->mb_width])->sad16, |
MAX((&pMBs[x + (y-1) * pParam->mb_width])->sad16, |
964 |
MAX((&pMBs[(x+1) + (y-1) * pParam->mb_width])->sad16, |
MAX((&pMBs[(x+1) + (y-1) * pParam->mb_width])->sad16, |
965 |
prevMB->sad16))); |
prevMB->sad16))); |
|
} |
|
966 |
} else { |
} else { |
967 |
stat_thresh = MIN((&pMBs[(x-1) + y * pParam->mb_width])->sad16, |
stat_thresh = MIN((&pMBs[(x-1) + y * pParam->mb_width])->sad16, |
968 |
MIN((&pMBs[x + (y-1) * pParam->mb_width])->sad16, |
MIN((&pMBs[x + (y-1) * pParam->mb_width])->sad16, |
970 |
prevMB->sad16))); |
prevMB->sad16))); |
971 |
} |
} |
972 |
} |
} |
973 |
|
} |
974 |
|
|
975 |
/* favorize (0,0) vector for cartoons */ |
/* favorize (0,0) vector for cartoons */ |
976 |
if ((current->vop_flags & XVID_VOP_CARTOON) && |
if ((current->vop_flags & XVID_VOP_CARTOON) && |