comparison motion_est_template.c @ 2015:3ab8f3e2ae6a libavcodec

moving motion estimation specific variables from MpegEncContext -> MotionEstContext
author michael
date Tue, 11 May 2004 01:38:46 +0000
parents 15c885db82a8
children c200977cdf78
comparison
equal deleted inserted replaced
2014:15c885db82a8 2015:3ab8f3e2ae6a
77 *mx_ptr = 0; 77 *mx_ptr = 0;
78 *my_ptr = 0; 78 *my_ptr = 0;
79 return dmin; 79 return dmin;
80 } 80 }
81 81
82 if(s->avctx->me_cmp != s->avctx->me_sub_cmp){ 82 if(c->avctx->me_cmp != c->avctx->me_sub_cmp){
83 CMP_HPEL(dmin, 0, 0, mx, my, size); 83 CMP_HPEL(dmin, 0, 0, mx, my, size);
84 if(mx || my) 84 if(mx || my)
85 dmin += (mv_penalty[2*mx - pred_x] + mv_penalty[2*my - pred_y])*penalty_factor; 85 dmin += (mv_penalty[2*mx - pred_x] + mv_penalty[2*my - pred_y])*penalty_factor;
86 } 86 }
87 87
136 *mx_ptr = 0; 136 *mx_ptr = 0;
137 *my_ptr = 0; 137 *my_ptr = 0;
138 return dmin; 138 return dmin;
139 } 139 }
140 140
141 if(s->avctx->me_cmp != s->avctx->me_sub_cmp){ 141 if(c->avctx->me_cmp != c->avctx->me_sub_cmp){
142 dmin= cmp(s, mx, my, 0, 0, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags); 142 dmin= cmp(s, mx, my, 0, 0, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags);
143 if(mx || my || size>0) 143 if(mx || my || size>0)
144 dmin += (mv_penalty[2*mx - pred_x] + mv_penalty[2*my - pred_y])*penalty_factor; 144 dmin += (mv_penalty[2*mx - pred_x] + mv_penalty[2*my - pred_y])*penalty_factor;
145 } 145 }
146 146
241 241
242 cmp_sub= s->dsp.mb_cmp[size]; 242 cmp_sub= s->dsp.mb_cmp[size];
243 chroma_cmp_sub= s->dsp.mb_cmp[size+1]; 243 chroma_cmp_sub= s->dsp.mb_cmp[size+1];
244 244
245 assert(!c->skip); 245 assert(!c->skip);
246 assert(s->avctx->me_sub_cmp != s->avctx->mb_cmp); 246 assert(c->avctx->me_sub_cmp != c->avctx->mb_cmp);
247 247
248 d= cmp(s, mx>>(qpel+1), my>>(qpel+1), mx&mask, my&mask, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags); 248 d= cmp(s, mx>>(qpel+1), my>>(qpel+1), mx&mask, my&mask, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags);
249 //FIXME check cbp before adding penalty for (0,0) vector 249 //FIXME check cbp before adding penalty for (0,0) vector
250 if(mx || my || size>0) 250 if(mx || my || size>0)
251 d += (mv_penalty[mx - pred_x] + mv_penalty[my - pred_y])*penalty_factor; 251 d += (mv_penalty[mx - pred_x] + mv_penalty[my - pred_y])*penalty_factor;
270 MotionEstContext * const c= &s->me; 270 MotionEstContext * const c= &s->me;
271 const int mx = *mx_ptr; 271 const int mx = *mx_ptr;
272 const int my = *my_ptr; 272 const int my = *my_ptr;
273 const int penalty_factor= c->sub_penalty_factor; 273 const int penalty_factor= c->sub_penalty_factor;
274 const int map_generation= c->map_generation; 274 const int map_generation= c->map_generation;
275 const int subpel_quality= s->avctx->me_subpel_quality; 275 const int subpel_quality= c->avctx->me_subpel_quality;
276 uint32_t *map= c->map; 276 uint32_t *map= c->map;
277 me_cmp_func cmpf, chroma_cmpf; 277 me_cmp_func cmpf, chroma_cmpf;
278 me_cmp_func cmp_sub, chroma_cmp_sub; 278 me_cmp_func cmp_sub, chroma_cmp_sub;
279 279
280 LOAD_COMMON 280 LOAD_COMMON
291 *mx_ptr = 0; 291 *mx_ptr = 0;
292 *my_ptr = 0; 292 *my_ptr = 0;
293 return dmin; 293 return dmin;
294 } 294 }
295 295
296 if(s->avctx->me_cmp != s->avctx->me_sub_cmp){ 296 if(c->avctx->me_cmp != c->avctx->me_sub_cmp){
297 dmin= cmp(s, mx, my, 0, 0, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags); 297 dmin= cmp(s, mx, my, 0, 0, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags);
298 if(mx || my || size>0) 298 if(mx || my || size>0)
299 dmin += (mv_penalty[4*mx - pred_x] + mv_penalty[4*my - pred_y])*penalty_factor; 299 dmin += (mv_penalty[4*mx - pred_x] + mv_penalty[4*my - pred_y])*penalty_factor;
300 } 300 }
301 301
906 CHECK_CLIPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, 906 CHECK_CLIPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
907 (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) 907 (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
908 } 908 }
909 } 909 }
910 910
911 if(s->avctx->last_predictor_count){ 911 if(c->avctx->last_predictor_count){
912 const int count= s->avctx->last_predictor_count; 912 const int count= c->avctx->last_predictor_count;
913 const int xstart= FFMAX(0, s->mb_x - count); 913 const int xstart= FFMAX(0, s->mb_x - count);
914 const int ystart= FFMAX(0, s->mb_y - count); 914 const int ystart= FFMAX(0, s->mb_y - count);
915 const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); 915 const int xend= FFMIN(s->mb_width , s->mb_x + count + 1);
916 const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); 916 const int yend= FFMIN(s->mb_height, s->mb_y + count + 1);
917 int mb_y; 917 int mb_y;