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.2 2002-09-25 21:27:12 Isibaar Exp $ |
* $Id: motion_est.h,v 1.1.2.6 2002-10-17 13:50:23 syskin Exp $ |
30 |
* |
* |
31 |
***************************************************************************/ |
***************************************************************************/ |
32 |
|
|
49 |
|
|
50 |
/* vector map (vlc delta size) smoother parameters ! float !*/ |
/* vector map (vlc delta size) smoother parameters ! float !*/ |
51 |
#define NEIGH_TEND_16X16 4.0 |
#define NEIGH_TEND_16X16 4.0 |
52 |
#define NEIGH_TEND_8X8 7.0 |
#define NEIGH_TEND_8X8 6.0 |
53 |
|
|
54 |
static const int lambda_vec16[32] = |
static const int lambda_vec16[32] = |
55 |
{ 0 ,(int)(1.00235 * NEIGH_TEND_16X16 + 0.5), |
{ 0 ,(int)(1.00235 * NEIGH_TEND_16X16 + 0.5), |
95 |
10, 11, 11, 11, 11, 11, 11, 12, 12 |
10, 11, 11, 11, 11, 11, 11, 12, 12 |
96 |
}; |
}; |
97 |
|
|
98 |
|
static const int DQtab[4] = { |
99 |
|
-1, -2, 1, 2 |
100 |
|
}; |
101 |
|
|
102 |
|
|
103 |
typedef struct |
typedef struct |
104 |
{ |
{ |
105 |
// general fields |
// general fields |
106 |
int max_dx, min_dx, max_dy, min_dy; |
int max_dx, min_dx, max_dy, min_dy; |
107 |
|
uint32_t rounding; |
108 |
VECTOR predMV; |
VECTOR predMV; |
109 |
|
VECTOR predQMV; |
110 |
VECTOR *currentMV; |
VECTOR *currentMV; |
111 |
|
VECTOR *currentQMV; |
112 |
int32_t *iMinSAD; |
int32_t *iMinSAD; |
113 |
const uint8_t * Ref; |
const uint8_t * Ref; |
114 |
const uint8_t * RefH; |
const uint8_t * RefH; |
115 |
const uint8_t * RefV; |
const uint8_t * RefV; |
116 |
const uint8_t * RefHV; |
const uint8_t * RefHV; |
117 |
|
const uint8_t * RefQ; |
118 |
const uint8_t * Cur; |
const uint8_t * Cur; |
119 |
uint32_t iQuant; |
uint32_t lambda16; //weights of motion vectors |
120 |
|
uint32_t lambda8; |
121 |
uint32_t iEdgedWidth; |
uint32_t iEdgedWidth; |
122 |
uint32_t iFcode; |
uint32_t iFcode; |
123 |
int * temp; |
int * temp; |
159 |
const uint32_t block_sz, /* block dimension, 8 or 16 */ |
const uint32_t block_sz, /* block dimension, 8 or 16 */ |
160 |
const uint32_t width, |
const uint32_t width, |
161 |
const uint32_t height, |
const uint32_t height, |
162 |
const uint32_t fcode) |
const uint32_t fcode, |
163 |
|
const uint32_t quarterpel) |
164 |
{ |
{ |
165 |
|
|
166 |
int k; |
int k; |
167 |
int high = (32 << (fcode - 1)) - 1; |
const int search_range = 32 << (fcode - 1 - quarterpel); |
168 |
|
const int high = search_range - 1; |
169 |
|
const int low = -search_range; |
170 |
|
|
171 |
k = 2 * (int)(width - x*block_sz); |
k = 2 * (int)(width - x*block_sz); |
172 |
*max_dx = MIN(high, k); |
*max_dx = MIN(high, k); |
173 |
k = 2 * (int)(height - y*block_sz); |
k = 2 * (int)(height - y*block_sz); |
174 |
*max_dy = MIN(high, k); |
*max_dy = MIN(high, k); |
175 |
|
|
|
high = -(32 << (fcode - 1)); |
|
176 |
k = -2 * (int)((x+1) * block_sz); |
k = -2 * (int)((x+1) * block_sz); |
177 |
*min_dx = MAX(high, k); |
*min_dx = MAX(low, k); |
178 |
k = -2 * (int)((y+1) * block_sz); |
k = -2 * (int)((y+1) * block_sz); |
179 |
*min_dy = MAX(high, k); |
*min_dy = MAX(low, k); |
180 |
|
|
181 |
} |
} |
182 |
|
|
208 |
const uint8_t * const pRefH, |
const uint8_t * const pRefH, |
209 |
const uint8_t * const pRefV, |
const uint8_t * const pRefV, |
210 |
const uint8_t * const pRefHV, |
const uint8_t * const pRefHV, |
211 |
|
const uint8_t * const pRefQ, |
212 |
const IMAGE * const pCur, |
const IMAGE * const pCur, |
213 |
const int x, |
const int x, |
214 |
const int y, |
const int y, |