comparison motion_est_template.c @ 1162:8c15d82c1893 libavcodec

some static -> dynamic alloc & 16->8 bit
author michaelni
date Mon, 31 Mar 2003 11:13:14 +0000
parents 1e39f273ecd6
children fea03d2c4946
comparison
equal deleted inserted replaced
1161:556b5d0b5228 1162:8c15d82c1893
70 #if 0 70 #if 0
71 static int RENAME(hpel_motion_search)(MpegEncContext * s, 71 static int RENAME(hpel_motion_search)(MpegEncContext * s,
72 int *mx_ptr, int *my_ptr, int dmin, 72 int *mx_ptr, int *my_ptr, int dmin,
73 int xmin, int ymin, int xmax, int ymax, 73 int xmin, int ymin, int xmax, int ymax,
74 int pred_x, int pred_y, Picture *ref_picture, 74 int pred_x, int pred_y, Picture *ref_picture,
75 int n, int size, uint16_t * const mv_penalty) 75 int n, int size, uint8_t * const mv_penalty)
76 { 76 {
77 const int xx = 16 * s->mb_x + 8*(n&1); 77 const int xx = 16 * s->mb_x + 8*(n&1);
78 const int yy = 16 * s->mb_y + 8*(n>>1); 78 const int yy = 16 * s->mb_y + 8*(n>>1);
79 const int mx = *mx_ptr; 79 const int mx = *mx_ptr;
80 const int my = *my_ptr; 80 const int my = *my_ptr;
139 #else 139 #else
140 static int RENAME(hpel_motion_search)(MpegEncContext * s, 140 static int RENAME(hpel_motion_search)(MpegEncContext * s,
141 int *mx_ptr, int *my_ptr, int dmin, 141 int *mx_ptr, int *my_ptr, int dmin,
142 int xmin, int ymin, int xmax, int ymax, 142 int xmin, int ymin, int xmax, int ymax,
143 int pred_x, int pred_y, Picture *ref_picture, 143 int pred_x, int pred_y, Picture *ref_picture,
144 int n, int size, uint16_t * const mv_penalty) 144 int n, int size, uint8_t * const mv_penalty)
145 { 145 {
146 const int xx = 16 * s->mb_x + 8*(n&1); 146 const int xx = 16 * s->mb_x + 8*(n&1);
147 const int yy = 16 * s->mb_y + 8*(n>>1); 147 const int yy = 16 * s->mb_y + 8*(n>>1);
148 const int mx = *mx_ptr; 148 const int mx = *mx_ptr;
149 const int my = *my_ptr; 149 const int my = *my_ptr;
244 return dmin; 244 return dmin;
245 } 245 }
246 #endif 246 #endif
247 247
248 static int RENAME(hpel_get_mb_score)(MpegEncContext * s, int mx, int my, int pred_x, int pred_y, Picture *ref_picture, 248 static int RENAME(hpel_get_mb_score)(MpegEncContext * s, int mx, int my, int pred_x, int pred_y, Picture *ref_picture,
249 uint16_t * const mv_penalty) 249 uint8_t * const mv_penalty)
250 { 250 {
251 // const int check_luma= s->dsp.me_sub_cmp != s->dsp.mb_cmp; 251 // const int check_luma= s->dsp.me_sub_cmp != s->dsp.mb_cmp;
252 const int size= 0; 252 const int size= 0;
253 const int xx = 16 * s->mb_x; 253 const int xx = 16 * s->mb_x;
254 const int yy = 16 * s->mb_y; 254 const int yy = 16 * s->mb_y;
293 293
294 static int RENAME(qpel_motion_search)(MpegEncContext * s, 294 static int RENAME(qpel_motion_search)(MpegEncContext * s,
295 int *mx_ptr, int *my_ptr, int dmin, 295 int *mx_ptr, int *my_ptr, int dmin,
296 int xmin, int ymin, int xmax, int ymax, 296 int xmin, int ymin, int xmax, int ymax,
297 int pred_x, int pred_y, Picture *ref_picture, 297 int pred_x, int pred_y, Picture *ref_picture,
298 int n, int size, uint16_t * const mv_penalty) 298 int n, int size, uint8_t * const mv_penalty)
299 { 299 {
300 const int xx = 16 * s->mb_x + 8*(n&1); 300 const int xx = 16 * s->mb_x + 8*(n&1);
301 const int yy = 16 * s->mb_y + 8*(n>>1); 301 const int yy = 16 * s->mb_y + 8*(n>>1);
302 const int mx = *mx_ptr; 302 const int mx = *mx_ptr;
303 const int my = *my_ptr; 303 const int my = *my_ptr;
511 511
512 return dmin; 512 return dmin;
513 } 513 }
514 514
515 static int RENAME(qpel_get_mb_score)(MpegEncContext * s, int mx, int my, int pred_x, int pred_y, Picture *ref_picture, 515 static int RENAME(qpel_get_mb_score)(MpegEncContext * s, int mx, int my, int pred_x, int pred_y, Picture *ref_picture,
516 uint16_t * const mv_penalty) 516 uint8_t * const mv_penalty)
517 { 517 {
518 const int size= 0; 518 const int size= 0;
519 const int xx = 16 * s->mb_x; 519 const int xx = 16 * s->mb_x;
520 const int yy = 16 * s->mb_y; 520 const int yy = 16 * s->mb_y;
521 const int penalty_factor= s->me.mb_penalty_factor; 521 const int penalty_factor= s->me.mb_penalty_factor;
596 596
597 static inline int RENAME(small_diamond_search)(MpegEncContext * s, int *best, int dmin, 597 static inline int RENAME(small_diamond_search)(MpegEncContext * s, int *best, int dmin,
598 Picture *ref_picture, 598 Picture *ref_picture,
599 int const pred_x, int const pred_y, int const penalty_factor, 599 int const pred_x, int const pred_y, int const penalty_factor,
600 int const xmin, int const ymin, int const xmax, int const ymax, int const shift, 600 int const xmin, int const ymin, int const xmax, int const ymax, int const shift,
601 uint32_t *map, int map_generation, int size, uint16_t * const mv_penalty 601 uint32_t *map, int map_generation, int size, uint8_t * const mv_penalty
602 ) 602 )
603 { 603 {
604 me_cmp_func cmp, chroma_cmp; 604 me_cmp_func cmp, chroma_cmp;
605 int next_dir=-1; 605 int next_dir=-1;
606 LOAD_COMMON(s->mb_x*16, s->mb_y*16); 606 LOAD_COMMON(s->mb_x*16, s->mb_y*16);
638 638
639 static inline int RENAME(funny_diamond_search)(MpegEncContext * s, int *best, int dmin, 639 static inline int RENAME(funny_diamond_search)(MpegEncContext * s, int *best, int dmin,
640 Picture *ref_picture, 640 Picture *ref_picture,
641 int const pred_x, int const pred_y, int const penalty_factor, 641 int const pred_x, int const pred_y, int const penalty_factor,
642 int const xmin, int const ymin, int const xmax, int const ymax, int const shift, 642 int const xmin, int const ymin, int const xmax, int const ymax, int const shift,
643 uint32_t *map, int map_generation, int size, uint16_t * const mv_penalty 643 uint32_t *map, int map_generation, int size, uint8_t * const mv_penalty
644 ) 644 )
645 { 645 {
646 me_cmp_func cmp, chroma_cmp; 646 me_cmp_func cmp, chroma_cmp;
647 int dia_size; 647 int dia_size;
648 LOAD_COMMON(s->mb_x*16, s->mb_y*16); 648 LOAD_COMMON(s->mb_x*16, s->mb_y*16);
729 #define MAX_SAB_SIZE 16 729 #define MAX_SAB_SIZE 16
730 static inline int RENAME(sab_diamond_search)(MpegEncContext * s, int *best, int dmin, 730 static inline int RENAME(sab_diamond_search)(MpegEncContext * s, int *best, int dmin,
731 Picture *ref_picture, 731 Picture *ref_picture,
732 int const pred_x, int const pred_y, int const penalty_factor, 732 int const pred_x, int const pred_y, int const penalty_factor,
733 int const xmin, int const ymin, int const xmax, int const ymax, int const shift, 733 int const xmin, int const ymin, int const xmax, int const ymax, int const shift,
734 uint32_t *map, int map_generation, int size, uint16_t * const mv_penalty 734 uint32_t *map, int map_generation, int size, uint8_t * const mv_penalty
735 ) 735 )
736 { 736 {
737 me_cmp_func cmp, chroma_cmp; 737 me_cmp_func cmp, chroma_cmp;
738 Minima minima[MAX_SAB_SIZE]; 738 Minima minima[MAX_SAB_SIZE];
739 const int minima_count= ABS(s->me.dia_size); 739 const int minima_count= ABS(s->me.dia_size);
809 809
810 static inline int RENAME(var_diamond_search)(MpegEncContext * s, int *best, int dmin, 810 static inline int RENAME(var_diamond_search)(MpegEncContext * s, int *best, int dmin,
811 Picture *ref_picture, 811 Picture *ref_picture,
812 int const pred_x, int const pred_y, int const penalty_factor, 812 int const pred_x, int const pred_y, int const penalty_factor,
813 int const xmin, int const ymin, int const xmax, int const ymax, int const shift, 813 int const xmin, int const ymin, int const xmax, int const ymax, int const shift,
814 uint32_t *map, int map_generation, int size, uint16_t * const mv_penalty 814 uint32_t *map, int map_generation, int size, uint8_t * const mv_penalty
815 ) 815 )
816 { 816 {
817 me_cmp_func cmp, chroma_cmp; 817 me_cmp_func cmp, chroma_cmp;
818 int dia_size; 818 int dia_size;
819 LOAD_COMMON(s->mb_x*16, s->mb_y*16); 819 LOAD_COMMON(s->mb_x*16, s->mb_y*16);
886 886
887 static int RENAME(epzs_motion_search)(MpegEncContext * s, int block, 887 static int RENAME(epzs_motion_search)(MpegEncContext * s, int block,
888 int *mx_ptr, int *my_ptr, 888 int *mx_ptr, int *my_ptr,
889 int P[10][2], int pred_x, int pred_y, 889 int P[10][2], int pred_x, int pred_y,
890 int xmin, int ymin, int xmax, int ymax, Picture *ref_picture, int16_t (*last_mv)[2], 890 int xmin, int ymin, int xmax, int ymax, Picture *ref_picture, int16_t (*last_mv)[2],
891 int ref_mv_scale, uint16_t * const mv_penalty) 891 int ref_mv_scale, uint8_t * const mv_penalty)
892 { 892 {
893 int best[2]={0, 0}; 893 int best[2]={0, 0};
894 int d, dmin; 894 int d, dmin;
895 const int shift= 1+s->quarter_sample; 895 const int shift= 1+s->quarter_sample;
896 uint32_t *map= s->me.map; 896 uint32_t *map= s->me.map;
998 #ifndef CMP_DIRECT /* no 4mv search needed in direct mode */ 998 #ifndef CMP_DIRECT /* no 4mv search needed in direct mode */
999 static int RENAME(epzs_motion_search4)(MpegEncContext * s, int block, 999 static int RENAME(epzs_motion_search4)(MpegEncContext * s, int block,
1000 int *mx_ptr, int *my_ptr, 1000 int *mx_ptr, int *my_ptr,
1001 int P[10][2], int pred_x, int pred_y, 1001 int P[10][2], int pred_x, int pred_y,
1002 int xmin, int ymin, int xmax, int ymax, Picture *ref_picture, int16_t (*last_mv)[2], 1002 int xmin, int ymin, int xmax, int ymax, Picture *ref_picture, int16_t (*last_mv)[2],
1003 int ref_mv_scale, uint16_t * const mv_penalty) 1003 int ref_mv_scale, uint8_t * const mv_penalty)
1004 { 1004 {
1005 int best[2]={0, 0}; 1005 int best[2]={0, 0};
1006 int d, dmin; 1006 int d, dmin;
1007 const int shift= 1+s->quarter_sample; 1007 const int shift= 1+s->quarter_sample;
1008 uint32_t *map= s->me.map; 1008 uint32_t *map= s->me.map;