comparison motion_est_template.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 3b7fcfb9c551
comparison
equal deleted inserted replaced
953:9eb066d6e0db 954:13aec7e50c52
266 const int yy = 16 * s->mb_y + 8*(n>>1); 266 const int yy = 16 * s->mb_y + 8*(n>>1);
267 const int mx = *mx_ptr; 267 const int mx = *mx_ptr;
268 const int my = *my_ptr; 268 const int my = *my_ptr;
269 const int penalty_factor= s->me.sub_penalty_factor; 269 const int penalty_factor= s->me.sub_penalty_factor;
270 const int map_generation= s->me.map_generation; 270 const int map_generation= s->me.map_generation;
271 const int subpel_quality= s->avctx->me_subpel_quality;
271 uint32_t *map= s->me.map; 272 uint32_t *map= s->me.map;
272 me_cmp_func cmp, chroma_cmp; 273 me_cmp_func cmp, chroma_cmp;
273 me_cmp_func cmp_sub, chroma_cmp_sub; 274 me_cmp_func cmp_sub, chroma_cmp_sub;
274 275
275 LOAD_COMMON(xx, yy); 276 LOAD_COMMON(xx, yy);
307 int best[8]; 308 int best[8];
308 int best_pos[8][2]; 309 int best_pos[8][2];
309 310
310 memset(best, 64, sizeof(int)*8); 311 memset(best, 64, sizeof(int)*8);
311 #if 1 312 #if 1
312 if(s->avctx->dia_size>=2){ 313 if(s->me.dia_size>=2){
313 const int tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; 314 const int tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
314 const int bl= score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)]; 315 const int bl= score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
315 const int tr= score_map[(index-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; 316 const int tr= score_map[(index-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];
316 const int br= score_map[(index+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)]; 317 const int br= score_map[(index+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];
317 318
386 } 387 }
387 } 388 }
388 } 389 }
389 } 390 }
390 } 391 }
391 for(i=0; i<8; i++){ 392 for(i=0; i<subpel_quality; i++){
392 nx= best_pos[i][0]; 393 nx= best_pos[i][0];
393 ny= best_pos[i][1]; 394 ny= best_pos[i][1];
394 CHECK_QUARTER_MV(nx&3, ny&3, nx>>2, ny>>2) 395 CHECK_QUARTER_MV(nx&3, ny&3, nx>>2, ny>>2)
395 } 396 }
397
396 #if 0 398 #if 0
397 nx= FFMAX(4*mx - bx, bx - 4*mx); 399 const int tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
398 ny= FFMAX(4*my - by, by - 4*my); 400 const int bl= score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
401 const int tr= score_map[(index-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];
402 const int br= score_map[(index+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];
403 // if(l < r && l < t && l < b && l < tl && l < bl && l < tr && l < br && bl < tl){
404 if(tl<br){
405
406 // nx= FFMAX(4*mx - bx, bx - 4*mx);
407 // ny= FFMAX(4*my - by, by - 4*my);
399 408
400 static int stats[4][4]; 409 static int stats[7][7], count;
401 stats[nx][ny]++; 410 count++;
402 if(256*256*256*64 % (stats[0][0]+1) ==0){ 411 stats[4*mx - bx + 3][4*my - by + 3]++;
403 for(i=0; i<16; i++){ 412 if(256*256*256*64 % count ==0){
404 if((i&3)==0) printf("\n"); 413 for(i=0; i<49; i++){
414 if((i%7)==0) printf("\n");
405 printf("%6d ", stats[0][i]); 415 printf("%6d ", stats[0][i]);
406 } 416 }
407 printf("\n"); 417 printf("\n");
418 }
408 } 419 }
409 #endif 420 #endif
410 #else 421 #else
411 422
412 CHECK_QUARTER_MV(2, 2, mx-1, my-1) 423 CHECK_QUARTER_MV(2, 2, mx-1, my-1)
657 uint32_t *map, int map_generation, int size, uint16_t * const mv_penalty 668 uint32_t *map, int map_generation, int size, uint16_t * const mv_penalty
658 ) 669 )
659 { 670 {
660 me_cmp_func cmp, chroma_cmp; 671 me_cmp_func cmp, chroma_cmp;
661 Minima minima[MAX_SAB_SIZE]; 672 Minima minima[MAX_SAB_SIZE];
662 const int minima_count= ABS(s->avctx->dia_size); 673 const int minima_count= ABS(s->me.dia_size);
663 int i, j; 674 int i, j;
664 LOAD_COMMON(s->mb_x*16, s->mb_y*16); 675 LOAD_COMMON(s->mb_x*16, s->mb_y*16);
665 676
666 cmp= s->dsp.me_cmp[size]; 677 cmp= s->dsp.me_cmp[size];
667 chroma_cmp= s->dsp.me_cmp[size+1]; 678 chroma_cmp= s->dsp.me_cmp[size+1];
742 LOAD_COMMON(s->mb_x*16, s->mb_y*16); 753 LOAD_COMMON(s->mb_x*16, s->mb_y*16);
743 754
744 cmp= s->dsp.me_cmp[size]; 755 cmp= s->dsp.me_cmp[size];
745 chroma_cmp= s->dsp.me_cmp[size+1]; 756 chroma_cmp= s->dsp.me_cmp[size+1];
746 757
747 for(dia_size=1; dia_size<=s->avctx->dia_size; dia_size++){ 758 for(dia_size=1; dia_size<=s->me.dia_size; dia_size++){
748 int dir, start, end; 759 int dir, start, end;
749 const int x= best[0]; 760 const int x= best[0];
750 const int y= best[1]; 761 const int y= best[1];
751 762
752 start= FFMAX(0, y + dia_size - ymax); 763 start= FFMAX(0, y + dia_size - ymax);
891 } 902 }
892 } 903 }
893 } 904 }
894 905
895 //check(best[0],best[1],0, b0) 906 //check(best[0],best[1],0, b0)
896 if(s->avctx->dia_size==-1) 907 if(s->me.dia_size==-1)
897 dmin= RENAME(funny_diamond_search)(s, best, dmin, ref_picture, 908 dmin= RENAME(funny_diamond_search)(s, best, dmin, ref_picture,
898 pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax, 909 pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax,
899 shift, map, map_generation, size, mv_penalty); 910 shift, map, map_generation, size, mv_penalty);
900 else if(s->avctx->dia_size<-1) 911 else if(s->me.dia_size<-1)
901 dmin= RENAME(sab_diamond_search)(s, best, dmin, ref_picture, 912 dmin= RENAME(sab_diamond_search)(s, best, dmin, ref_picture,
902 pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax, 913 pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax,
903 shift, map, map_generation, size, mv_penalty); 914 shift, map, map_generation, size, mv_penalty);
904 else if(s->avctx->dia_size<2) 915 else if(s->me.dia_size<2)
905 dmin= RENAME(small_diamond_search)(s, best, dmin, ref_picture, 916 dmin= RENAME(small_diamond_search)(s, best, dmin, ref_picture,
906 pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax, 917 pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax,
907 shift, map, map_generation, size, mv_penalty); 918 shift, map, map_generation, size, mv_penalty);
908 else 919 else
909 dmin= RENAME(var_diamond_search)(s, best, dmin, ref_picture, 920 dmin= RENAME(var_diamond_search)(s, best, dmin, ref_picture,
967 (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) 978 (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
968 CHECK_CLIPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, 979 CHECK_CLIPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
969 (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) 980 (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
970 } 981 }
971 982
972 if(s->avctx->dia_size==-1) 983 if(s->me.dia_size==-1)
973 dmin= RENAME(funny_diamond_search)(s, best, dmin, ref_picture, 984 dmin= RENAME(funny_diamond_search)(s, best, dmin, ref_picture,
974 pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax, 985 pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax,
975 shift, map, map_generation, size, mv_penalty); 986 shift, map, map_generation, size, mv_penalty);
976 else if(s->avctx->dia_size<-1) 987 else if(s->me.dia_size<-1)
977 dmin= RENAME(sab_diamond_search)(s, best, dmin, ref_picture, 988 dmin= RENAME(sab_diamond_search)(s, best, dmin, ref_picture,
978 pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax, 989 pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax,
979 shift, map, map_generation, size, mv_penalty); 990 shift, map, map_generation, size, mv_penalty);
980 else if(s->avctx->dia_size<2) 991 else if(s->me.dia_size<2)
981 dmin= RENAME(small_diamond_search)(s, best, dmin, ref_picture, 992 dmin= RENAME(small_diamond_search)(s, best, dmin, ref_picture,
982 pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax, 993 pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax,
983 shift, map, map_generation, size, mv_penalty); 994 shift, map, map_generation, size, mv_penalty);
984 else 995 else
985 dmin= RENAME(var_diamond_search)(s, best, dmin, ref_picture, 996 dmin= RENAME(var_diamond_search)(s, best, dmin, ref_picture,