35 |
|
|
36 |
#include "../portab.h" |
#include "../portab.h" |
37 |
#include "../global.h" |
#include "../global.h" |
38 |
|
#include "../image/reduced.h" |
39 |
|
|
40 |
/* hard coded motion search parameters for motion_est and smp_motion_est */ |
/* hard coded motion search parameters for motion_est and smp_motion_est */ |
41 |
|
|
47 |
|
|
48 |
/* vector map (vlc delta size) smoother parameters ! float !*/ |
/* vector map (vlc delta size) smoother parameters ! float !*/ |
49 |
#define NEIGH_TEND_16X16 10.5 |
#define NEIGH_TEND_16X16 10.5 |
50 |
#define NEIGH_TEND_8X8 4.0 |
#define NEIGH_TEND_8X8 40.0 |
51 |
#define NEIGH_8X8_BIAS 30 |
#define NEIGH_8X8_BIAS 30 |
52 |
|
|
53 |
/* Parameters which control inter/inter4v decision */ |
/* Parameters which control inter/inter4v decision */ |
102 |
}; |
}; |
103 |
|
|
104 |
#define RRV_MV_SCALEDOWN(a) ( (a)>=0 ? (a+1)/2 : (a-1)/2 ) |
#define RRV_MV_SCALEDOWN(a) ( (a)>=0 ? (a+1)/2 : (a-1)/2 ) |
105 |
#define RRV_MV_SCALEUP(a) ( (a)>0 ? 2*(a)-1 : (a)<0 ? 2*(a)+1 : (a) ) |
|
106 |
|
static const VECTOR zeroMV = {0,0}; |
107 |
|
|
108 |
typedef struct |
typedef struct |
109 |
{ |
{ |
132 |
int qpel, qpel_precision; |
int qpel, qpel_precision; |
133 |
int chroma; |
int chroma; |
134 |
int rrv; |
int rrv; |
135 |
//fields for interpolate and direct mode |
//fields for interpolate and direct modes |
136 |
const uint8_t *bRef; |
const uint8_t *bRef; |
137 |
const uint8_t *bRefH; |
const uint8_t *bRefH; |
138 |
const uint8_t *bRefV; |
const uint8_t *bRefV; |
143 |
VECTOR directmvF[4]; |
VECTOR directmvF[4]; |
144 |
VECTOR directmvB[4]; |
VECTOR directmvB[4]; |
145 |
const VECTOR * referencemv; |
const VECTOR * referencemv; |
146 |
} |
|
147 |
SearchData; |
} SearchData; |
148 |
|
|
149 |
|
|
150 |
typedef void(CheckFunc)(const int x, const int y, |
typedef void(CheckFunc)(const int x, const int y, |
151 |
const int Direction, int * const dir, |
const int Direction, int * const dir, |
152 |
const SearchData * const Data); |
const SearchData * const Data); |
|
|
|
|
static CheckFunc CheckCandidate16, CheckCandidate16no4v, CheckCandidateInt, |
|
|
CheckCandidateDirect, CheckCandidateDirectno4v, |
|
|
CheckCandidate8; |
|
153 |
CheckFunc *CheckCandidate; |
CheckFunc *CheckCandidate; |
154 |
|
|
155 |
/* |
/* |
156 |
* Calculate the min/max range (in halfpixels) |
* Calculate the min/max range |
157 |
* relative to the _MACROBLOCK_ position |
* relative to the _MACROBLOCK_ position |
158 |
*/ |
*/ |
159 |
static void __inline |
static void __inline |
167 |
const uint32_t width, |
const uint32_t width, |
168 |
const uint32_t height, |
const uint32_t height, |
169 |
const uint32_t fcode, |
const uint32_t fcode, |
170 |
const int qpel, |
const int qpel, /* 1 if the resulting range should be in qpel precision; otherwise 0 */ |
171 |
const int rrv) |
const int rrv) |
172 |
{ |
{ |
173 |
int k, m = 2; |
int k, m = qpel ? 4 : 2; |
174 |
const int search_range = 32 << (fcode - 1); |
const int search_range = 32 << (fcode - 1); |
175 |
int high = search_range - 1; |
int high = search_range - 1; |
176 |
int low = -search_range; |
int low = -search_range; |
177 |
|
|
178 |
if (qpel) m = 4; |
if (rrv) { |
|
else if (rrv) { |
|
179 |
high = RRV_MV_SCALEUP(high); |
high = RRV_MV_SCALEUP(high); |
180 |
low = RRV_MV_SCALEUP(low); |
low = RRV_MV_SCALEUP(low); |
181 |
block_sz *= 2; |
block_sz *= 2; |