comparison motion_est.c @ 954:13aec7e50c52 libavcodec

qpel in mmx2/3dnow qpel refinement quality parameter
author michaelni
date Sun, 05 Jan 2003 15:57:10 +0000
parents f348d302a51e
children dd421045b4ce
comparison
equal deleted inserted replaced
953:9eb066d6e0db 954:13aec7e50c52
309 return s->qscale*8; 309 return s->qscale*8;
310 } 310 }
311 } 311 }
312 312
313 void ff_init_me(MpegEncContext *s){ 313 void ff_init_me(MpegEncContext *s){
314 set_cmp(s, s->dsp.me_pre_cmp, s->avctx->me_pre_cmp);
314 set_cmp(s, s->dsp.me_cmp, s->avctx->me_cmp); 315 set_cmp(s, s->dsp.me_cmp, s->avctx->me_cmp);
315 set_cmp(s, s->dsp.me_sub_cmp, s->avctx->me_sub_cmp); 316 set_cmp(s, s->dsp.me_sub_cmp, s->avctx->me_sub_cmp);
316 set_cmp(s, s->dsp.mb_cmp, s->avctx->mb_cmp); 317 set_cmp(s, s->dsp.mb_cmp, s->avctx->mb_cmp);
317 318
318 if(s->flags&CODEC_FLAG_QPEL){ 319 if(s->flags&CODEC_FLAG_QPEL){
333 s->me.motion_search[0]= simple_chroma_epzs_motion_search; 334 s->me.motion_search[0]= simple_chroma_epzs_motion_search;
334 s->me.motion_search[1]= simple_chroma_epzs_motion_search4; 335 s->me.motion_search[1]= simple_chroma_epzs_motion_search4;
335 }else{ 336 }else{
336 s->me.motion_search[0]= simple_epzs_motion_search; 337 s->me.motion_search[0]= simple_epzs_motion_search;
337 s->me.motion_search[1]= simple_epzs_motion_search4; 338 s->me.motion_search[1]= simple_epzs_motion_search4;
339 }
340
341 if(s->avctx->me_pre_cmp&FF_CMP_CHROMA){
342 s->me.pre_motion_search= simple_chroma_epzs_motion_search;
343 }else{
344 s->me.pre_motion_search= simple_epzs_motion_search;
338 } 345 }
339 } 346 }
340 347
341 static int pix_dev(UINT8 * pix, int line_size, int mean) 348 static int pix_dev(UINT8 * pix, int line_size, int mean)
342 { 349 {
1035 const int mv_stride= s->mb_width + 2; 1042 const int mv_stride= s->mb_width + 2;
1036 const int xy= mb_x + 1 + (mb_y + 1)*mv_stride; 1043 const int xy= mb_x + 1 + (mb_y + 1)*mv_stride;
1037 1044
1038 assert(s->quarter_sample==0 || s->quarter_sample==1); 1045 assert(s->quarter_sample==0 || s->quarter_sample==1);
1039 1046
1040 s->me.penalty_factor = get_penalty_factor(s, s->avctx->me_cmp); 1047 s->me.pre_penalty_factor = get_penalty_factor(s, s->avctx->me_pre_cmp);
1041 1048
1042 get_limits(s, &range, &xmin, &ymin, &xmax, &ymax, s->f_code); 1049 get_limits(s, &range, &xmin, &ymin, &xmax, &ymax, s->f_code);
1043 rel_xmin= xmin - mb_x*16; 1050 rel_xmin= xmin - mb_x*16;
1044 rel_xmax= xmax - mb_x*16; 1051 rel_xmax= xmax - mb_x*16;
1045 rel_ymin= ymin - mb_y*16; 1052 rel_ymin= ymin - mb_y*16;
1070 P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]); 1077 P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
1071 1078
1072 pred_x = P_MEDIAN[0]; 1079 pred_x = P_MEDIAN[0];
1073 pred_y = P_MEDIAN[1]; 1080 pred_y = P_MEDIAN[1];
1074 } 1081 }
1075 dmin = s->me.motion_search[0](s, 0, &mx, &my, P, pred_x, pred_y, rel_xmin, rel_ymin, rel_xmax, rel_ymax, 1082 dmin = s->me.pre_motion_search(s, 0, &mx, &my, P, pred_x, pred_y, rel_xmin, rel_ymin, rel_xmax, rel_ymax,
1076 &s->last_picture, s->p_mv_table, (1<<16)>>shift, mv_penalty); 1083 &s->last_picture, s->p_mv_table, (1<<16)>>shift, mv_penalty);
1077 1084
1078 s->p_mv_table[xy][0] = mx<<shift; 1085 s->p_mv_table[xy][0] = mx<<shift;
1079 s->p_mv_table[xy][1] = my<<shift; 1086 s->p_mv_table[xy][1] = my<<shift;
1080 1087
1081 return dmin; 1088 return dmin;