MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / cmp_inline

Function cmp_inline

libavcodec/motion_est.c:179–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179static av_always_inline int cmp_inline(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
180 const int size, const int h, int ref_index, int src_index,
181 me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, int qpel, int chroma){
182 MotionEstContext * const c= &s->me;
183 const int stride= c->stride;
184 const int uvstride= c->uvstride;
185 const int dxy= subx + (suby<<(1+qpel)); //FIXME log2_subpel?
186 const int hx= subx + (x<<(1+qpel));
187 const int hy= suby + (y<<(1+qpel));
188 uint8_t * const * const ref= c->ref[ref_index];
189 uint8_t * const * const src= c->src[src_index];
190 int d;
191 //FIXME check chroma 4mv, (no crashes ...)
192 int uvdxy; /* no, it might not be used uninitialized */
193 if(dxy){
194 if(qpel){
195 c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); //FIXME prototype (add h)
196 if(chroma){
197 int cx= hx/2;
198 int cy= hy/2;
199 cx= (cx>>1)|(cx&1);
200 cy= (cy>>1)|(cy&1);
201 uvdxy= (cx&1) + 2*(cy&1);
202 //FIXME x/y wrong, but mpeg4 qpel is sick anyway, we should drop as much of it as possible in favor for h264
203 }
204 }else{
205 c->hpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride, h);
206 if(chroma)
207 uvdxy= dxy | (x&1) | (2*(y&1));
208 }
209 d = cmp_func(s, c->temp, src[0], stride, h);
210 }else{
211 d = cmp_func(s, src[0], ref[0] + x + y*stride, stride, h);
212 if(chroma)
213 uvdxy= (x&1) + 2*(y&1);
214 }
215 if(chroma){
216 uint8_t * const uvtemp= c->temp + 16*stride;
217 c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1);
218 c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1);
219 d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1);
220 d += chroma_cmp_func(s, uvtemp+8, src[2], uvstride, h>>1);
221 }
222 return d;
223}
224
225static int cmp_simple(MpegEncContext *s, const int x, const int y,
226 int ref_index, int src_index,

Callers 5

cmp_simpleFunction · 0.85
cmp_fpel_internalFunction · 0.85
cmp_internalFunction · 0.85
cmp_hpelFunction · 0.85
cmp_qpelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected