26 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
27 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
28 |
* |
* |
29 |
* $Id: motion_est.h,v 1.1.2.8 2002-11-20 15:29:07 syskin Exp $ |
* $Id: motion_est.h,v 1.1.2.9 2002-12-08 14:57:09 syskin Exp $ |
30 |
* |
* |
31 |
***************************************************************************/ |
***************************************************************************/ |
32 |
|
|
165 |
const uint32_t block_sz, /* block dimension, 8 or 16 */ |
const uint32_t block_sz, /* block dimension, 8 or 16 */ |
166 |
const uint32_t width, |
const uint32_t width, |
167 |
const uint32_t height, |
const uint32_t height, |
168 |
const uint32_t fcode, |
const uint32_t fcode) |
|
const uint32_t quarterpel) |
|
169 |
{ |
{ |
|
|
|
170 |
int k; |
int k; |
171 |
const int search_range = 32 << (fcode - 1 - quarterpel); |
const int search_range = 32 << (fcode - 1); |
172 |
const int high = search_range - 1; |
const int high = search_range - 1; |
173 |
const int low = -search_range; |
const int low = -search_range; |
174 |
|
|
181 |
*min_dx = MAX(low, k); |
*min_dx = MAX(low, k); |
182 |
k = -2 * (int)((y+1) * block_sz); |
k = -2 * (int)((y+1) * block_sz); |
183 |
*min_dy = MAX(low, k); |
*min_dy = MAX(low, k); |
184 |
|
} |
185 |
|
|
186 |
|
static void __inline |
187 |
|
get_range_qpel(int32_t * const min_dx, |
188 |
|
int32_t * const max_dx, |
189 |
|
int32_t * const min_dy, |
190 |
|
int32_t * const max_dy, |
191 |
|
const uint32_t x, |
192 |
|
const uint32_t y, |
193 |
|
const uint32_t block_sz, /* block dimension, 8 or 16 */ |
194 |
|
const uint32_t width, |
195 |
|
const uint32_t height, |
196 |
|
const uint32_t fcode) |
197 |
|
{ |
198 |
|
int k; |
199 |
|
const int search_range = 32 << (fcode - 1); |
200 |
|
const int high = search_range - 1; |
201 |
|
const int low = -search_range; |
202 |
|
|
203 |
|
k = 4 * (int)(width - x*block_sz); |
204 |
|
*max_dx = MIN(high, k); |
205 |
|
k = 4 * (int)(height - y*block_sz); |
206 |
|
*max_dy = MIN(high, k); |
207 |
|
|
208 |
|
k = -4 * (int)((x+1) * block_sz); |
209 |
|
*min_dx = MAX(low, k); |
210 |
|
k = -4 * (int)((y+1) * block_sz); |
211 |
|
*min_dy = MAX(low, k); |
212 |
} |
} |
213 |
|
|
214 |
|
|