21 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
22 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 |
* |
* |
24 |
* $Id: estimation_pvop.c,v 1.1.2.11 2003-12-18 02:02:08 Isibaar Exp $ |
* $Id: estimation_pvop.c,v 1.1.2.12 2003-12-18 17:49:28 Isibaar Exp $ |
25 |
* |
* |
26 |
****************************************************************************/ |
****************************************************************************/ |
27 |
|
|
173 |
} |
} |
174 |
|
|
175 |
static void |
static void |
176 |
|
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) |
CheckCandidate32(const int x, const int y, SearchData * const data, const unsigned int Direction) |
210 |
{ |
{ |
211 |
uint32_t t; |
uint32_t t; |
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_FASTREFINE16) && (!Data->rrv)) |
615 |
|
SubpelRefine_Fast(Data, CheckCandidate8_qpel); |
616 |
|
else |
617 |
xvid_me_SubpelRefine(Data, CheckCandidate); |
xvid_me_SubpelRefine(Data, CheckCandidate); |
618 |
} |
} |
619 |
} |
} |
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) { |