19 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
22 |
* $Id: estimation_gmc.c,v 1.5 2004-12-05 04:53:01 syskin Exp $ |
* $Id: estimation_gmc.c,v 1.6 2010-12-18 16:02:00 Isibaar Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
68 |
const int y, |
const int y, |
69 |
const MBParam * const pParam, |
const MBParam * const pParam, |
70 |
MACROBLOCK * const pMBs, |
MACROBLOCK * const pMBs, |
71 |
SearchData * const Data) |
SearchData * const Data, |
72 |
|
const int bound) |
73 |
{ |
{ |
74 |
|
|
75 |
MACROBLOCK * const pMB = &pMBs[x + y * pParam->mb_width]; |
MACROBLOCK * const pMB = &pMBs[x + y * pParam->mb_width]; |
76 |
|
|
77 |
Data->iMinSAD[0] = MV_MAX_ERROR; |
Data->iMinSAD[0] = MV_MAX_ERROR; |
78 |
|
|
79 |
Data->predMV = get_pmv2(pMBs, pParam->mb_width, 0, x, y, 0); |
Data->predMV = get_pmv2(pMBs, pParam->mb_width, bound, x, y, 0); |
80 |
|
|
81 |
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, |
82 |
pParam->width, pParam->height, 16, 1); |
pParam->width, pParam->height, 16, 1); |
123 |
const FRAMEINFO * const reference, |
const FRAMEINFO * const reference, |
124 |
const IMAGE * const pRefH, |
const IMAGE * const pRefH, |
125 |
const IMAGE * const pRefV, |
const IMAGE * const pRefV, |
126 |
const IMAGE * const pRefHV) |
const IMAGE * const pRefHV, |
127 |
|
const int num_slices) |
128 |
{ |
{ |
129 |
uint32_t x, y; |
uint32_t x, y; |
130 |
MACROBLOCK * const pMBs = current->mbs; |
MACROBLOCK * const pMBs = current->mbs; |
131 |
const IMAGE * const pCurrent = ¤t->image; |
const IMAGE * const pCurrent = ¤t->image; |
132 |
const IMAGE * const pReference = &reference->image; |
const IMAGE * const pReference = &reference->image; |
133 |
|
int bound = 0; |
134 |
|
const uint32_t mb_width = pParam->mb_width; |
135 |
|
const uint32_t mb_height = pParam->mb_height; |
136 |
|
|
137 |
SearchData Data; |
SearchData Data; |
138 |
memset(&Data, 0, sizeof(SearchData)); |
memset(&Data, 0, sizeof(SearchData)); |
145 |
if (sadInit) (*sadInit) (); |
if (sadInit) (*sadInit) (); |
146 |
|
|
147 |
for (y = 0; y < pParam->mb_height; y ++) { |
for (y = 0; y < pParam->mb_height; y ++) { |
148 |
|
bound = mb_width * ((((y*num_slices) / mb_height) * mb_height + (num_slices-1))/ num_slices); |
149 |
for (x = 0; x < pParam->mb_width; x ++) { |
for (x = 0; x < pParam->mb_width; x ++) { |
150 |
GMEanalyzeMB(pCurrent->y, pReference->y, pRefH->y, pRefV->y, pRefHV->y, x, y, pParam, pMBs, &Data); |
GMEanalyzeMB(pCurrent->y, pReference->y, pRefH->y, pRefV->y, pRefHV->y, x, y, pParam, pMBs, &Data, bound); |
151 |
} |
} |
152 |
} |
} |
153 |
return; |
return; |
160 |
const FRAMEINFO * const reference, |
const FRAMEINFO * const reference, |
161 |
const IMAGE * const pRefH, |
const IMAGE * const pRefH, |
162 |
const IMAGE * const pRefV, |
const IMAGE * const pRefV, |
163 |
const IMAGE * const pRefHV) |
const IMAGE * const pRefHV, |
164 |
|
const int num_slices) |
165 |
{ |
{ |
166 |
|
|
167 |
const int deltax=8; /* upper bound for difference between a MV and it's neighbour MVs */ |
const int deltax=8; /* upper bound for difference between a MV and it's neighbour MVs */ |
185 |
|
|
186 |
gmc.duv[0].x = gmc.duv[0].y = gmc.duv[1].x = gmc.duv[1].y = gmc.duv[2].x = gmc.duv[2].y = 0; |
gmc.duv[0].x = gmc.duv[0].y = gmc.duv[1].x = gmc.duv[1].y = gmc.duv[2].x = gmc.duv[2].y = 0; |
187 |
|
|
188 |
GMEanalysis(pParam,current, reference, pRefH, pRefV, pRefHV); |
GMEanalysis(pParam,current, reference, pRefH, pRefV, pRefHV, num_slices); |
189 |
|
|
190 |
/* block based ME isn't done, yet, so do a quick presearch */ |
/* block based ME isn't done, yet, so do a quick presearch */ |
191 |
|
|