39 |
#include "motion_inlines.h" |
#include "motion_inlines.h" |
40 |
|
|
41 |
static void |
static void |
42 |
CheckCandidate16I(const int x, const int y, const SearchData * const data, const unsigned int Direction) |
CheckCandidate16I(const int x, const int y, SearchData * const data, const unsigned int Direction) |
43 |
{ |
{ |
44 |
int sad; |
int sad; |
45 |
const uint8_t * Reference; |
const uint8_t * Reference; |
54 |
if (sad < data->iMinSAD[0]) { |
if (sad < data->iMinSAD[0]) { |
55 |
data->iMinSAD[0] = sad; |
data->iMinSAD[0] = sad; |
56 |
data->currentMV[0].x = x; data->currentMV[0].y = y; |
data->currentMV[0].x = x; data->currentMV[0].y = y; |
57 |
*data->dir = Direction; |
data->dir = Direction; |
58 |
} |
} |
59 |
} |
} |
60 |
|
|
78 |
Data->predMV = get_pmv2(pMBs, pParam->mb_width, 0, x, y, 0); |
Data->predMV = get_pmv2(pMBs, pParam->mb_width, 0, x, y, 0); |
79 |
|
|
80 |
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, |
81 |
pParam->width, pParam->height, 16, 1, 0); |
pParam->width, pParam->height, 16, 1); |
82 |
|
|
83 |
Data->Cur = pCur + 16*(x + y * pParam->edged_width); |
Data->Cur = pCur + 16*(x + y * pParam->edged_width); |
84 |
Data->RefP[0] = pRef + 16*(x + y * pParam->edged_width); |
Data->RefP[0] = pRef + 16*(x + y * pParam->edged_width); |
94 |
|
|
95 |
xvid_me_DiamondSearch(Data->currentMV[0].x, Data->currentMV[0].y, Data, 255, CheckCandidate16I); |
xvid_me_DiamondSearch(Data->currentMV[0].x, Data->currentMV[0].y, Data, 255, CheckCandidate16I); |
96 |
|
|
97 |
xvid_me_SubpelRefine(Data, CheckCandidate16I); |
xvid_me_SubpelRefine(Data->currentMV[0], Data, CheckCandidate16I, 0); |
98 |
|
|
99 |
|
|
100 |
/* for QPel halfpel positions are worse than in halfpel mode :( */ |
/* for QPel halfpel positions are worse than in halfpel mode :( */ |
111 |
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]; |
112 |
pMB->sad16 = Data->iMinSAD[0]; |
pMB->sad16 = Data->iMinSAD[0]; |
113 |
pMB->mode = MODE_INTER; |
pMB->mode = MODE_INTER; |
114 |
pMB->sad16 += 10*d_mv_bits(pMB->mvs[0].x, pMB->mvs[0].y, Data->predMV, Data->iFcode, 0, 0); |
pMB->sad16 += 10*d_mv_bits(pMB->mvs[0].x, pMB->mvs[0].y, Data->predMV, Data->iFcode, 0); |
115 |
return; |
return; |
116 |
} |
} |
117 |
|
|
129 |
const IMAGE * const pCurrent = ¤t->image; |
const IMAGE * const pCurrent = ¤t->image; |
130 |
const IMAGE * const pReference = &reference->image; |
const IMAGE * const pReference = &reference->image; |
131 |
|
|
|
int32_t iMinSAD[5], temp[5]; |
|
|
VECTOR currentMV[5]; |
|
|
uint32_t dir; |
|
132 |
SearchData Data; |
SearchData Data; |
133 |
memset(&Data, 0, sizeof(SearchData)); |
memset(&Data, 0, sizeof(SearchData)); |
134 |
|
|
135 |
Data.iEdgedWidth = pParam->edged_width; |
Data.iEdgedWidth = pParam->edged_width; |
136 |
Data.rounding = pParam->m_rounding_type; |
Data.rounding = pParam->m_rounding_type; |
137 |
|
|
|
Data.currentMV = ¤tMV[0]; |
|
|
Data.iMinSAD = &iMinSAD[0]; |
|
138 |
Data.iFcode = current->fcode; |
Data.iFcode = current->fcode; |
|
Data.temp = temp; |
|
|
Data.dir = &dir; |
|
139 |
|
|
140 |
if (sadInit) (*sadInit) (); |
if (sadInit) (*sadInit) (); |
141 |
|
|