58 |
int xb, yb; |
int xb, yb; |
59 |
if (qpel) { x *= 2; y *= 2;} |
if (qpel) { x *= 2; y *= 2;} |
60 |
else if (rrv) { x = RRV_MV_SCALEDOWN(x); y = RRV_MV_SCALEDOWN(y); } |
else if (rrv) { x = RRV_MV_SCALEDOWN(x); y = RRV_MV_SCALEDOWN(y); } |
61 |
x = pred.x - x; |
x -= pred.x; |
62 |
y = pred.y - y; |
y -= pred.y; |
63 |
|
|
64 |
if (x == 0) xb = 1; |
if (x) { |
|
else { |
|
65 |
if (x < 0) x = -x; |
if (x < 0) x = -x; |
66 |
x += (1 << (iFcode - 1)) - 1; |
x += (1 << (iFcode - 1)) - 1; |
67 |
x >>= (iFcode - 1); |
x >>= (iFcode - 1); |
68 |
if (x > 32) x = 32; |
if (x > 32) x = 32; |
69 |
xb = mvtab[x] + iFcode; |
xb = mvtab[x] + iFcode; |
70 |
} |
} else xb = 1; |
71 |
|
|
72 |
if (y == 0) yb = 1; |
if (y) { |
|
else { |
|
73 |
if (y < 0) y = -y; |
if (y < 0) y = -y; |
74 |
y += (1 << (iFcode - 1)) - 1; |
y += (1 << (iFcode - 1)) - 1; |
75 |
y >>= (iFcode - 1); |
y >>= (iFcode - 1); |
76 |
if (y > 32) y = 32; |
if (y > 32) y = 32; |
77 |
yb = mvtab[y] + iFcode; |
yb = mvtab[y] + iFcode; |
78 |
} |
} else yb = 1; |
79 |
return xb + yb; |
return xb + yb; |
80 |
} |
} |
81 |
|
|
83 |
ChromaSAD(int dx, int dy, const SearchData * const data) |
ChromaSAD(int dx, int dy, const SearchData * const data) |
84 |
{ |
{ |
85 |
int sad; |
int sad; |
86 |
|
const uint32_t stride = data->iEdgedWidth/2; |
87 |
dx = (dx >> 1) + roundtab_79[dx & 0x3]; |
dx = (dx >> 1) + roundtab_79[dx & 0x3]; |
88 |
dy = (dy >> 1) + roundtab_79[dy & 0x3]; |
dy = (dy >> 1) + roundtab_79[dy & 0x3]; |
89 |
|
|
90 |
if (dx == data->temp[5] && dy == data->temp[6]) return data->temp[7]; //it has been checked recently |
if (dx == data->temp[5] && dy == data->temp[6]) return data->temp[7]; //it has been checked recently |
91 |
|
data->temp[5] = dx; data->temp[6] = dy; // backup |
92 |
|
|
93 |
switch (((dx & 1) << 1) | (dy & 1)) { |
switch (((dx & 1) << 1) | (dy & 1)) { |
94 |
case 0: |
case 0: |
95 |
sad = sad8(data->CurU, data->RefCU + (dy/2) * (data->iEdgedWidth/2) + dx/2, data->iEdgedWidth/2); |
dx = dx / 2; dy = dy / 2; |
96 |
sad += sad8(data->CurV, data->RefCV + (dy/2) * (data->iEdgedWidth/2) + dx/2, data->iEdgedWidth/2); |
sad = sad8(data->CurU, data->RefCU + dy * stride + dx, stride); |
97 |
|
sad += sad8(data->CurV, data->RefCV + dy * stride + dx, stride); |
98 |
break; |
break; |
99 |
case 1: |
case 1: |
100 |
dx = dx / 2; dy = (dy - 1) / 2; |
dx = dx / 2; dy = (dy - 1) / 2; |
101 |
sad = sad8bi(data->CurU, data->RefCU + dy * (data->iEdgedWidth/2) + dx, data->RefCU + (dy+1) * (data->iEdgedWidth/2) + dx, data->iEdgedWidth/2); |
sad = sad8bi(data->CurU, data->RefCU + dy * stride + dx, data->RefCU + (dy+1) * stride + dx, stride); |
102 |
sad += sad8bi(data->CurV, data->RefCV + dy * (data->iEdgedWidth/2) + dx, data->RefCV + (dy+1) * (data->iEdgedWidth/2) + dx, data->iEdgedWidth/2); |
sad += sad8bi(data->CurV, data->RefCV + dy * stride + dx, data->RefCV + (dy+1) * stride + dx, stride); |
103 |
break; |
break; |
104 |
case 2: |
case 2: |
105 |
dx = (dx - 1) / 2; dy = dy / 2; |
dx = (dx - 1) / 2; dy = dy / 2; |
106 |
sad = sad8bi(data->CurU, data->RefCU + dy * (data->iEdgedWidth/2) + dx, data->RefCU + dy * (data->iEdgedWidth/2) + dx+1, data->iEdgedWidth/2); |
sad = sad8bi(data->CurU, data->RefCU + dy * stride + dx, data->RefCU + dy * stride + dx+1, stride); |
107 |
sad += sad8bi(data->CurV, data->RefCV + dy * (data->iEdgedWidth/2) + dx, data->RefCV + dy * (data->iEdgedWidth/2) + dx+1, data->iEdgedWidth/2); |
sad += sad8bi(data->CurV, data->RefCV + dy * stride + dx, data->RefCV + dy * stride + dx+1, stride); |
108 |
break; |
break; |
109 |
default: |
default: |
110 |
dx = (dx - 1) / 2; dy = (dy - 1) / 2; |
dx = (dx - 1) / 2; dy = (dy - 1) / 2; |
111 |
interpolate8x8_halfpel_hv(data->RefQ, |
interpolate8x8_halfpel_hv(data->RefQ, data->RefCU + dy * stride + dx, stride, data->rounding); |
112 |
data->RefCU + dy * (data->iEdgedWidth/2) + dx, data->iEdgedWidth/2, |
sad = sad8(data->CurU, data->RefQ, stride); |
113 |
data->rounding); |
|
114 |
sad = sad8(data->CurU, data->RefQ, data->iEdgedWidth/2); |
interpolate8x8_halfpel_hv(data->RefQ, data->RefCV + dy * stride + dx, stride, data->rounding); |
115 |
interpolate8x8_halfpel_hv(data->RefQ, |
sad += sad8(data->CurV, data->RefQ, stride); |
|
data->RefCV + dy * (data->iEdgedWidth/2) + dx, data->iEdgedWidth/2, |
|
|
data->rounding); |
|
|
sad += sad8(data->CurV, data->RefQ, data->iEdgedWidth/2); |
|
116 |
break; |
break; |
117 |
} |
} |
118 |
data->temp[5] = dx; data->temp[6] = dy; data->temp[7] = sad; //backup |
data->temp[7] = sad; //backup, part 2 |
119 |
return sad; |
return sad; |
120 |
} |
} |
121 |
|
|
122 |
static __inline const uint8_t * |
static __inline const uint8_t * |
123 |
GetReference(const int x, const int y, const int dir, const SearchData * const data) |
GetReferenceB(const int x, const int y, const int dir, const SearchData * const data) |
124 |
{ |
{ |
125 |
// dir : 0 = forward, 1 = backward |
// dir : 0 = forward, 1 = backward |
126 |
switch ( (dir << 2) | ((x&1)<<1) | (y&1) ) { |
switch ( (dir << 2) | ((x&1)<<1) | (y&1) ) { |
135 |
} |
} |
136 |
} |
} |
137 |
|
|
138 |
|
// this is a simpler copy of GetReferenceB, but as it's __inline anyway, we can keep the two separate |
139 |
|
static __inline const uint8_t * |
140 |
|
GetReference(const int x, const int y, const SearchData * const data) |
141 |
|
{ |
142 |
|
switch ( ((x&1)<<1) | (y&1) ) { |
143 |
|
case 0 : return data->Ref + x/2 + (y/2)*(data->iEdgedWidth); |
144 |
|
case 1 : return data->RefV + x/2 + ((y-1)/2)*(data->iEdgedWidth); |
145 |
|
case 2 : return data->RefH + (x-1)/2 + (y/2)*(data->iEdgedWidth); |
146 |
|
default : return data->RefHV + (x-1)/2 + ((y-1)/2)*(data->iEdgedWidth); |
147 |
|
} |
148 |
|
} |
149 |
|
|
150 |
static uint8_t * |
static uint8_t * |
151 |
Interpolate8x8qpel(const int x, const int y, const int block, const int dir, const SearchData * const data) |
Interpolate8x8qpel(const int x, const int y, const int block, const int dir, const SearchData * const data) |
152 |
{ |
{ |
158 |
const int halfpel_y = y/2; |
const int halfpel_y = y/2; |
159 |
const uint8_t *ref1, *ref2, *ref3, *ref4; |
const uint8_t *ref1, *ref2, *ref3, *ref4; |
160 |
|
|
161 |
ref1 = GetReference(halfpel_x, halfpel_y, dir, data); |
ref1 = GetReferenceB(halfpel_x, halfpel_y, dir, data); |
162 |
ref1 += 8 * (block&1) + 8 * (block>>1) * iEdgedWidth; |
ref1 += 8 * (block&1) + 8 * (block>>1) * iEdgedWidth; |
163 |
switch( ((x&1)<<1) + (y&1) ) { |
switch( ((x&1)<<1) + (y&1) ) { |
164 |
case 0: // pure halfpel position |
case 0: // pure halfpel position |
166 |
break; |
break; |
167 |
|
|
168 |
case 1: // x halfpel, y qpel - top or bottom during qpel refinement |
case 1: // x halfpel, y qpel - top or bottom during qpel refinement |
169 |
ref2 = GetReference(halfpel_x, y - halfpel_y, dir, data); |
ref2 = GetReferenceB(halfpel_x, y - halfpel_y, dir, data); |
170 |
ref2 += 8 * (block&1) + 8 * (block>>1) * iEdgedWidth; |
ref2 += 8 * (block&1) + 8 * (block>>1) * iEdgedWidth; |
171 |
interpolate8x8_avg2(Reference, ref1, ref2, iEdgedWidth, rounding, 8); |
interpolate8x8_avg2(Reference, ref1, ref2, iEdgedWidth, rounding, 8); |
172 |
break; |
break; |
173 |
|
|
174 |
case 2: // x qpel, y halfpel - left or right during qpel refinement |
case 2: // x qpel, y halfpel - left or right during qpel refinement |
175 |
ref2 = GetReference(x - halfpel_x, halfpel_y, dir, data); |
ref2 = GetReferenceB(x - halfpel_x, halfpel_y, dir, data); |
176 |
ref2 += 8 * (block&1) + 8 * (block>>1) * iEdgedWidth; |
ref2 += 8 * (block&1) + 8 * (block>>1) * iEdgedWidth; |
177 |
interpolate8x8_avg2(Reference, ref1, ref2, iEdgedWidth, rounding, 8); |
interpolate8x8_avg2(Reference, ref1, ref2, iEdgedWidth, rounding, 8); |
178 |
break; |
break; |
179 |
|
|
180 |
default: // x and y in qpel resolution - the "corners" (top left/right and |
default: // x and y in qpel resolution - the "corners" (top left/right and |
181 |
// bottom left/right) during qpel refinement |
// bottom left/right) during qpel refinement |
182 |
ref2 = GetReference(halfpel_x, y - halfpel_y, dir, data); |
ref2 = GetReferenceB(halfpel_x, y - halfpel_y, dir, data); |
183 |
ref3 = GetReference(x - halfpel_x, halfpel_y, dir, data); |
ref3 = GetReferenceB(x - halfpel_x, halfpel_y, dir, data); |
184 |
ref4 = GetReference(x - halfpel_x, y - halfpel_y, dir, data); |
ref4 = GetReferenceB(x - halfpel_x, y - halfpel_y, dir, data); |
185 |
ref2 += 8 * (block&1) + 8 * (block>>1) * iEdgedWidth; |
ref2 += 8 * (block&1) + 8 * (block>>1) * iEdgedWidth; |
186 |
ref3 += 8 * (block&1) + 8 * (block>>1) * iEdgedWidth; |
ref3 += 8 * (block&1) + 8 * (block>>1) * iEdgedWidth; |
187 |
ref4 += 8 * (block&1) + 8 * (block>>1) * iEdgedWidth; |
ref4 += 8 * (block&1) + 8 * (block>>1) * iEdgedWidth; |
202 |
const int halfpel_y = y/2; |
const int halfpel_y = y/2; |
203 |
const uint8_t *ref1, *ref2, *ref3, *ref4; |
const uint8_t *ref1, *ref2, *ref3, *ref4; |
204 |
|
|
205 |
ref1 = GetReference(halfpel_x, halfpel_y, dir, data); |
ref1 = GetReferenceB(halfpel_x, halfpel_y, dir, data); |
206 |
switch( ((x&1)<<1) + (y&1) ) { |
switch( ((x&1)<<1) + (y&1) ) { |
207 |
case 0: // pure halfpel position |
case 0: // pure halfpel position |
208 |
return (uint8_t *) ref1; |
return (uint8_t *) ref1; |
209 |
case 1: // x halfpel, y qpel - top or bottom during qpel refinement |
case 1: // x halfpel, y qpel - top or bottom during qpel refinement |
210 |
ref2 = GetReference(halfpel_x, y - halfpel_y, dir, data); |
ref2 = GetReferenceB(halfpel_x, y - halfpel_y, dir, data); |
211 |
interpolate8x8_avg2(Reference, ref1, ref2, iEdgedWidth, rounding, 8); |
interpolate8x8_avg2(Reference, ref1, ref2, iEdgedWidth, rounding, 8); |
212 |
interpolate8x8_avg2(Reference+8, ref1+8, ref2+8, iEdgedWidth, rounding, 8); |
interpolate8x8_avg2(Reference+8, ref1+8, ref2+8, iEdgedWidth, rounding, 8); |
213 |
interpolate8x8_avg2(Reference+8*iEdgedWidth, ref1+8*iEdgedWidth, ref2+8*iEdgedWidth, iEdgedWidth, rounding, 8); |
interpolate8x8_avg2(Reference+8*iEdgedWidth, ref1+8*iEdgedWidth, ref2+8*iEdgedWidth, iEdgedWidth, rounding, 8); |
215 |
break; |
break; |
216 |
|
|
217 |
case 2: // x qpel, y halfpel - left or right during qpel refinement |
case 2: // x qpel, y halfpel - left or right during qpel refinement |
218 |
ref2 = GetReference(x - halfpel_x, halfpel_y, dir, data); |
ref2 = GetReferenceB(x - halfpel_x, halfpel_y, dir, data); |
219 |
interpolate8x8_avg2(Reference, ref1, ref2, iEdgedWidth, rounding, 8); |
interpolate8x8_avg2(Reference, ref1, ref2, iEdgedWidth, rounding, 8); |
220 |
interpolate8x8_avg2(Reference+8, ref1+8, ref2+8, iEdgedWidth, rounding, 8); |
interpolate8x8_avg2(Reference+8, ref1+8, ref2+8, iEdgedWidth, rounding, 8); |
221 |
interpolate8x8_avg2(Reference+8*iEdgedWidth, ref1+8*iEdgedWidth, ref2+8*iEdgedWidth, iEdgedWidth, rounding, 8); |
interpolate8x8_avg2(Reference+8*iEdgedWidth, ref1+8*iEdgedWidth, ref2+8*iEdgedWidth, iEdgedWidth, rounding, 8); |
224 |
|
|
225 |
default: // x and y in qpel resolution - the "corners" (top left/right and |
default: // x and y in qpel resolution - the "corners" (top left/right and |
226 |
// bottom left/right) during qpel refinement |
// bottom left/right) during qpel refinement |
227 |
ref2 = GetReference(halfpel_x, y - halfpel_y, dir, data); |
ref2 = GetReferenceB(halfpel_x, y - halfpel_y, dir, data); |
228 |
ref3 = GetReference(x - halfpel_x, halfpel_y, dir, data); |
ref3 = GetReferenceB(x - halfpel_x, halfpel_y, dir, data); |
229 |
ref4 = GetReference(x - halfpel_x, y - halfpel_y, dir, data); |
ref4 = GetReferenceB(x - halfpel_x, y - halfpel_y, dir, data); |
230 |
interpolate8x8_avg4(Reference, ref1, ref2, ref3, ref4, iEdgedWidth, rounding); |
interpolate8x8_avg4(Reference, ref1, ref2, ref3, ref4, iEdgedWidth, rounding); |
231 |
interpolate8x8_avg4(Reference+8, ref1+8, ref2+8, ref3+8, ref4+8, iEdgedWidth, rounding); |
interpolate8x8_avg4(Reference+8, ref1+8, ref2+8, ref3+8, ref4+8, iEdgedWidth, rounding); |
232 |
interpolate8x8_avg4(Reference+8*iEdgedWidth, ref1+8*iEdgedWidth, ref2+8*iEdgedWidth, ref3+8*iEdgedWidth, ref4+8*iEdgedWidth, iEdgedWidth, rounding); |
interpolate8x8_avg4(Reference+8*iEdgedWidth, ref1+8*iEdgedWidth, ref2+8*iEdgedWidth, ref3+8*iEdgedWidth, ref4+8*iEdgedWidth, iEdgedWidth, rounding); |
253 |
xc = x/2; yc = y/2; //for chroma sad |
xc = x/2; yc = y/2; //for chroma sad |
254 |
current = data->currentQMV; |
current = data->currentQMV; |
255 |
} else { |
} else { |
256 |
Reference = GetReference(x, y, 0, data); |
Reference = GetReference(x, y, data); |
257 |
current = data->currentMV; |
current = data->currentMV; |
258 |
xc = x; yc = y; |
xc = x; yc = y; |
259 |
} |
} |
292 |
( x > data->max_dx) || ( x < data->min_dx) |
( x > data->max_dx) || ( x < data->min_dx) |
293 |
|| ( y > data->max_dy) || (y < data->min_dy)) return; |
|| ( y > data->max_dy) || (y < data->min_dy)) return; |
294 |
|
|
295 |
Reference = GetReference(x, y, 0, data); |
Reference = GetReference(x, y, data); |
296 |
t = d_mv_bits(x, y, data->predMV, data->iFcode, 0, 1); |
t = d_mv_bits(x, y, data->predMV, data->iFcode, 0, 1); |
297 |
|
|
298 |
data->temp[0] = sad32v_c(data->Cur, Reference, data->iEdgedWidth, data->temp + 1); |
data->temp[0] = sad32v_c(data->Cur, Reference, data->iEdgedWidth, data->temp + 1); |
333 |
Reference = Interpolate16x16qpel(x, y, 0, data); |
Reference = Interpolate16x16qpel(x, y, 0, data); |
334 |
current = data->currentQMV; |
current = data->currentQMV; |
335 |
} else { |
} else { |
336 |
Reference = GetReference(x, y, 0, data); |
Reference = GetReference(x, y, data); |
337 |
current = data->currentMV; |
current = data->currentMV; |
338 |
} |
} |
339 |
t = d_mv_bits(x, y, data->predMV, data->iFcode, |
t = d_mv_bits(x, y, data->predMV, data->iFcode, |
340 |
data->qpel && !data->qpel_precision && !data->rrv, data->rrv); |
data->qpel && !data->qpel_precision, data->rrv); |
341 |
|
|
342 |
sad = sad16(data->Cur, Reference, data->iEdgedWidth, 256*4096); |
sad = sad16(data->Cur, Reference, data->iEdgedWidth, 256*4096); |
343 |
sad += (data->lambda16 * t * sad)/1000; |
sad += (data->lambda16 * t * sad)/1000; |
373 |
|
|
374 |
} |
} |
375 |
|
|
|
|
|
376 |
static void |
static void |
377 |
CheckCandidateInt(const int xf, const int yf, const int Direction, int * const dir, const SearchData * const data) |
CheckCandidateInt(const int xf, const int yf, const int Direction, int * const dir, const SearchData * const data) |
378 |
{ |
{ |
390 |
current = data->currentQMV; |
current = data->currentQMV; |
391 |
ReferenceB = Interpolate16x16qpel(xb, yb, 1, data); |
ReferenceB = Interpolate16x16qpel(xb, yb, 1, data); |
392 |
} else { |
} else { |
393 |
ReferenceF = GetReference(xf, yf, 0, data); |
ReferenceF = GetReference(xf, yf, data); |
394 |
xb = data->currentMV[1].x; yb = data->currentMV[1].y; |
xb = data->currentMV[1].x; yb = data->currentMV[1].y; |
395 |
ReferenceB = GetReference(xb, yb, 1, data); |
ReferenceB = GetReferenceB(xb, yb, 1, data); |
396 |
current = data->currentMV; |
current = data->currentMV; |
397 |
} |
} |
398 |
|
|
509 |
|| ( y > data->max_dy) || (y < data->min_dy)) return; |
|| ( y > data->max_dy) || (y < data->min_dy)) return; |
510 |
|
|
511 |
if (data->qpel) Reference = Interpolate16x16qpel(x, y, 0, data); |
if (data->qpel) Reference = Interpolate16x16qpel(x, y, 0, data); |
512 |
else Reference = GetReference(x, y, 0, data); |
else Reference = GetReference(x, y, data); |
513 |
|
|
514 |
sad = sad8(data->Cur, Reference, data->iEdgedWidth); |
sad = sad8(data->Cur, Reference, data->iEdgedWidth); |
515 |
t = d_mv_bits(x, y, data->predMV, data->iFcode, data->qpel && !data->qpel_precision, 0); |
t = d_mv_bits(x, y, data->predMV, data->iFcode, data->qpel && !data->qpel_precision, 0); |
682 |
backupMV = *(data->currentQMV); |
backupMV = *(data->currentQMV); |
683 |
else backupMV = *(data->currentMV); |
else backupMV = *(data->currentMV); |
684 |
|
|
685 |
CHECK_CANDIDATE(backupMV.x - 1, backupMV.y - 1, 0); |
CHECK_CANDIDATE(backupMV.x, backupMV.y - 1, 0); |
686 |
CHECK_CANDIDATE(backupMV.x + 1, backupMV.y - 1, 0); |
CHECK_CANDIDATE(backupMV.x + 1, backupMV.y - 1, 0); |
|
CHECK_CANDIDATE(backupMV.x - 1, backupMV.y + 1, 0); |
|
|
CHECK_CANDIDATE(backupMV.x + 1, backupMV.y + 1, 0); |
|
|
|
|
|
CHECK_CANDIDATE(backupMV.x - 1, backupMV.y, 0); |
|
687 |
CHECK_CANDIDATE(backupMV.x + 1, backupMV.y, 0); |
CHECK_CANDIDATE(backupMV.x + 1, backupMV.y, 0); |
688 |
|
CHECK_CANDIDATE(backupMV.x + 1, backupMV.y + 1, 0); |
689 |
CHECK_CANDIDATE(backupMV.x, backupMV.y + 1, 0); |
CHECK_CANDIDATE(backupMV.x, backupMV.y + 1, 0); |
690 |
CHECK_CANDIDATE(backupMV.x, backupMV.y - 1, 0); |
CHECK_CANDIDATE(backupMV.x - 1, backupMV.y + 1, 0); |
691 |
|
CHECK_CANDIDATE(backupMV.x - 1, backupMV.y, 0); |
692 |
|
CHECK_CANDIDATE(backupMV.x - 1, backupMV.y - 1, 0); |
693 |
} |
} |
694 |
|
|
695 |
static __inline int |
static __inline int |
1100 |
Data->currentQMV[i].y = 2 * Data->currentMV[i].y; |
Data->currentQMV[i].y = 2 * Data->currentMV[i].y; |
1101 |
} |
} |
1102 |
|
|
1103 |
if((!Data->rrv) && (pParam->m_quarterpel) && (MotionFlags & PMV_QUARTERPELREFINE16)) { |
if((Data->qpel) && (MotionFlags & PMV_QUARTERPELREFINE16)) { |
1104 |
|
|
1105 |
Data->qpel_precision = 1; |
Data->qpel_precision = 1; |
1106 |
get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 16, |
get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 16, |
1247 |
} |
} |
1248 |
} |
} |
1249 |
|
|
1250 |
if(!Data->rrv && Data->qpel) { |
if(Data->qpel) { |
1251 |
if((!(Data->currentQMV->x & 1)) && (!(Data->currentQMV->y & 1)) && |
if((!(Data->currentQMV->x & 1)) && (!(Data->currentQMV->y & 1)) && |
1252 |
(MotionFlags & PMV_QUARTERPELREFINE8)) { |
(MotionFlags & PMV_QUARTERPELREFINE8)) { |
1253 |
Data->qpel_precision = 1; |
Data->qpel_precision = 1; |
2079 |
max_x = gmc.x + step; |
max_x = gmc.x + step; |
2080 |
min_y = gmc.y - step; |
min_y = gmc.y - step; |
2081 |
max_y = gmc.y + step; |
max_y = gmc.y + step; |
|
|
|
2082 |
} |
} |
2083 |
|
|
2084 |
if (bestcount < (pParam->mb_height-2)*(pParam->mb_width-2)/10) |
if (bestcount < (pParam->mb_height-2)*(pParam->mb_width-2)/10) |
2085 |
gmc.x = gmc.y = 0; //no camara pan, no GMC |
gmc.x = gmc.y = 0; //no camara pan, no GMC |
2086 |
|
|
2087 |
// step2: let's refine camera panning using gradiend-descent approach. |
// step2: let's refine camera panning using gradiend-descent approach |
2088 |
// TODO: more warping points may be evaluated here (like in interpolate mode search - two vectors in one diamond) |
// TODO: more warping points may be evaluated here (like in interpolate mode search - two vectors in one diamond) |
2089 |
bestcount = 0; |
bestcount = 0; |
2090 |
CheckGMC(gmc.x, gmc.y, 255, &iDirection, pMBs, &bestcount, &gmc, pParam); |
CheckGMC(gmc.x, gmc.y, 255, &iDirection, pMBs, &bestcount, &gmc, pParam); |