]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/motion_est_template.c
avcodec: rename the AV1 profiles
[ffmpeg] / libavcodec / motion_est_template.c
index 575dadd269d656c22d6a843afb45ff790fa300ed..c655e199b764ddebfcf124edf1dc957fe0d821f4 100644 (file)
@@ -63,8 +63,8 @@ static int hpel_motion_search(MpegEncContext * s,
 
  //FIXME factorize
 
-    cmp_sub= s->dsp.me_sub_cmp[size];
-    chroma_cmp_sub= s->dsp.me_sub_cmp[size+1];
+    cmp_sub        = s->mecc.me_sub_cmp[size];
+    chroma_cmp_sub = s->mecc.me_sub_cmp[size + 1];
 
     if(c->skip){ //FIXME move out of hpel?
         *mx_ptr = 0;
@@ -166,7 +166,6 @@ static inline int get_mb_score(MpegEncContext *s, int mx, int my,
                                int src_index, int ref_index, int size,
                                int h, int add_rate)
 {
-//    const int check_luma= s->dsp.me_sub_cmp != s->dsp.mb_cmp;
     MotionEstContext * const c= &s->me;
     const int penalty_factor= c->mb_penalty_factor;
     const int flags= c->mb_flags;
@@ -179,8 +178,8 @@ static inline int get_mb_score(MpegEncContext *s, int mx, int my,
 
  //FIXME factorize
 
-    cmp_sub= s->dsp.mb_cmp[size];
-    chroma_cmp_sub= s->dsp.mb_cmp[size+1];
+    cmp_sub        = s->mecc.mb_cmp[size];
+    chroma_cmp_sub = s->mecc.mb_cmp[size + 1];
 
 //    assert(!c->skip);
 //    assert(c->avctx->me_sub_cmp != c->avctx->mb_cmp);
@@ -226,12 +225,12 @@ static int qpel_motion_search(MpegEncContext * s,
     LOAD_COMMON
     int flags= c->sub_flags;
 
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1]; //factorize FIXME
+    cmpf        = s->mecc.me_cmp[size];
+    chroma_cmpf = s->mecc.me_cmp[size + 1]; // FIXME: factorize
  //FIXME factorize
 
-    cmp_sub= s->dsp.me_sub_cmp[size];
-    chroma_cmp_sub= s->dsp.me_sub_cmp[size+1];
+    cmp_sub        = s->mecc.me_sub_cmp[size];
+    chroma_cmp_sub = s->mecc.me_sub_cmp[size + 1];
 
     if(c->skip){ //FIXME somehow move up (benchmark)
         *mx_ptr = 0;
@@ -417,7 +416,7 @@ if( (y)>(ymax<<(S)) ) printf("%d %d %d %d %d ymax" #v, ymax, (x), (y), s->mb_x,
     const int shift= 1+qpel;\
 
 static av_always_inline int small_diamond_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
+                                       int src_index, int ref_index, const int penalty_factor,
                                        int size, int h, int flags)
 {
     MotionEstContext * const c= &s->me;
@@ -427,13 +426,13 @@ static av_always_inline int small_diamond_search(MpegEncContext * s, int *best,
     LOAD_COMMON2
     unsigned map_generation = c->map_generation;
 
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
+    cmpf        = s->mecc.me_cmp[size];
+    chroma_cmpf = s->mecc.me_cmp[size + 1];
 
     { /* ensure that the best point is in the MAP as h/qpel refinement needs it */
         const unsigned key = (best[1]<<ME_MAP_MV_BITS) + best[0] + map_generation;
         const int index= ((best[1]<<ME_MAP_SHIFT) + best[0])&(ME_MAP_SIZE-1);
-        if(map[index]!=key){ //this will be executed only very rarey
+        if (map[index] != key) { // this will be executed only very rarely
             score_map[index]= cmp(s, best[0], best[1], 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);
             map[index]= key;
         }
@@ -458,7 +457,7 @@ static av_always_inline int small_diamond_search(MpegEncContext * s, int *best,
 }
 
 static int funny_diamond_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
+                                       int src_index, int ref_index, const int penalty_factor,
                                        int size, int h, int flags)
 {
     MotionEstContext * const c= &s->me;
@@ -468,8 +467,8 @@ static int funny_diamond_search(MpegEncContext * s, int *best, int dmin,
     LOAD_COMMON2
     unsigned map_generation = c->map_generation;
 
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
+    cmpf        = s->mecc.me_cmp[size];
+    chroma_cmpf = s->mecc.me_cmp[size + 1];
 
     for(dia_size=1; dia_size<=4; dia_size++){
         int dir;
@@ -500,7 +499,7 @@ static int funny_diamond_search(MpegEncContext * s, int *best, int dmin,
 }
 
 static int hex_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
+                                       int src_index, int ref_index, const int penalty_factor,
                                        int size, int h, int flags, int dia_size)
 {
     MotionEstContext * const c= &s->me;
@@ -511,8 +510,8 @@ static int hex_search(MpegEncContext * s, int *best, int dmin,
     int x,y,d;
     const int dec= dia_size & (dia_size-1);
 
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
+    cmpf        = s->mecc.me_cmp[size];
+    chroma_cmpf = s->mecc.me_cmp[size + 1];
 
     for(;dia_size; dia_size= dec ? dia_size-1 : dia_size>>1){
         do{
@@ -534,7 +533,7 @@ static int hex_search(MpegEncContext * s, int *best, int dmin,
 }
 
 static int l2s_dia_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
+                                       int src_index, int ref_index, const int penalty_factor,
                                        int size, int h, int flags)
 {
     MotionEstContext * const c= &s->me;
@@ -548,8 +547,8 @@ static int l2s_dia_search(MpegEncContext * s, int *best, int dmin,
     static const int hex[8][2]={{-2, 0}, {-1,-1}, { 0,-2}, { 1,-1},
                                 { 2, 0}, { 1, 1}, { 0, 2}, {-1, 1}};
 
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
+    cmpf        = s->mecc.me_cmp[size];
+    chroma_cmpf = s->mecc.me_cmp[size + 1];
 
     for(; dia_size; dia_size= dec ? dia_size-1 : dia_size>>1){
         do{
@@ -572,7 +571,7 @@ static int l2s_dia_search(MpegEncContext * s, int *best, int dmin,
 }
 
 static int umh_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
+                                       int src_index, int ref_index, const int penalty_factor,
                                        int size, int h, int flags)
 {
     MotionEstContext * const c= &s->me;
@@ -587,8 +586,8 @@ static int umh_search(MpegEncContext * s, int *best, int dmin,
                                  {-2, 3}, { 0, 4}, { 2, 3},
                                  {-2,-3}, { 0,-4}, { 2,-3},};
 
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
+    cmpf        = s->mecc.me_cmp[size];
+    chroma_cmpf = s->mecc.me_cmp[size + 1];
 
     x= best[0];
     y= best[1];
@@ -619,7 +618,7 @@ static int umh_search(MpegEncContext * s, int *best, int dmin,
 }
 
 static int full_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
+                                       int src_index, int ref_index, const int penalty_factor,
                                        int size, int h, int flags)
 {
     MotionEstContext * const c= &s->me;
@@ -630,8 +629,8 @@ static int full_search(MpegEncContext * s, int *best, int dmin,
     int x,y, d;
     const int dia_size= c->dia_size&0xFF;
 
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
+    cmpf        = s->mecc.me_cmp[size];
+    chroma_cmpf = s->mecc.me_cmp[size + 1];
 
     for(y=FFMAX(-dia_size, ymin); y<=FFMIN(dia_size,ymax); y++){
         for(x=FFMAX(-dia_size, xmin); x<=FFMIN(dia_size,xmax); x++){
@@ -682,7 +681,7 @@ static int full_search(MpegEncContext * s, int *best, int dmin,
 
 #define MAX_SAB_SIZE ME_MAP_SIZE
 static int sab_diamond_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
+                                       int src_index, int ref_index, const int penalty_factor,
                                        int size, int h, int flags)
 {
     MotionEstContext * const c= &s->me;
@@ -694,8 +693,8 @@ static int sab_diamond_search(MpegEncContext * s, int *best, int dmin,
     LOAD_COMMON2
     unsigned map_generation = c->map_generation;
 
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
+    cmpf        = s->mecc.me_cmp[size];
+    chroma_cmpf = s->mecc.me_cmp[size + 1];
 
     /*Note j<MAX_SAB_SIZE is needed if MAX_SAB_SIZE < ME_MAP_SIZE as j can
       become larger due to MVs overflowing their ME_MAP_MV_BITS bits space in map
@@ -705,7 +704,8 @@ static int sab_diamond_search(MpegEncContext * s, int *best, int dmin,
 
         key += (1<<(ME_MAP_MV_BITS-1)) + (1<<(2*ME_MAP_MV_BITS-1));
 
-        if((key&((-1)<<(2*ME_MAP_MV_BITS))) != map_generation) continue;
+        if ((key & (-(1 << (2 * ME_MAP_MV_BITS)))) != map_generation)
+            continue;
 
         minima[j].height= score_map[i];
         minima[j].x= key & ((1<<ME_MAP_MV_BITS)-1); key>>=ME_MAP_MV_BITS;
@@ -759,7 +759,7 @@ static int sab_diamond_search(MpegEncContext * s, int *best, int dmin,
     if(   best[0] < xmax && best[0] > xmin
        && best[1] < ymax && best[1] > ymin){
         int d;
-        //ensure that the refernece samples for hpel refinement are in the map
+        // ensure that the reference samples for hpel refinement are in the map
         CHECK_MV(best[0]-1, best[1])
         CHECK_MV(best[0]+1, best[1])
         CHECK_MV(best[0], best[1]-1)
@@ -769,7 +769,7 @@ static int sab_diamond_search(MpegEncContext * s, int *best, int dmin,
 }
 
 static int var_diamond_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
+                                       int src_index, int ref_index, const int penalty_factor,
                                        int size, int h, int flags)
 {
     MotionEstContext * const c= &s->me;
@@ -779,8 +779,8 @@ static int var_diamond_search(MpegEncContext * s, int *best, int dmin,
     LOAD_COMMON2
     unsigned map_generation = c->map_generation;
 
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
+    cmpf        = s->mecc.me_cmp[size];
+    chroma_cmpf = s->mecc.me_cmp[size + 1];
 
     for(dia_size=1; dia_size<=c->dia_size; dia_size++){
         int dir, start, end;
@@ -830,7 +830,7 @@ static int var_diamond_search(MpegEncContext * s, int *best, int dmin,
 }
 
 static av_always_inline int diamond_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
+                                       int src_index, int ref_index, const int penalty_factor,
                                        int size, int h, int flags){
     MotionEstContext * const c= &s->me;
     if(c->dia_size==-1)
@@ -872,7 +872,7 @@ static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int
     unsigned map_generation;
     int penalty_factor;
     const int ref_mv_stride= s->mb_stride; //pass as arg  FIXME
-    const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; //add to last_mv beforepassing FIXME
+    const int ref_mv_xy = s->mb_x + s->mb_y * ref_mv_stride; // add to last_mv before passing FIXME
     me_cmp_func cmpf, chroma_cmpf;
 
     LOAD_COMMON
@@ -880,12 +880,12 @@ static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int
 
     if(c->pre_pass){
         penalty_factor= c->pre_penalty_factor;
-        cmpf= s->dsp.me_pre_cmp[size];
-        chroma_cmpf= s->dsp.me_pre_cmp[size+1];
+        cmpf           = s->mecc.me_pre_cmp[size];
+        chroma_cmpf    = s->mecc.me_pre_cmp[size + 1];
     }else{
         penalty_factor= c->penalty_factor;
-        cmpf= s->dsp.me_cmp[size];
-        chroma_cmpf= s->dsp.me_cmp[size+1];
+        cmpf           = s->mecc.me_cmp[size];
+        chroma_cmpf    = s->mecc.me_cmp[size + 1];
     }
 
     map_generation= update_map_generation(c);
@@ -973,7 +973,7 @@ static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int
     return dmin;
 }
 
-//this function is dedicated to the braindamaged gcc
+//this function is dedicated to the brain damaged gcc
 int ff_epzs_motion_search(MpegEncContext *s, int *mx_ptr, int *my_ptr,
                           int P[10][2], int src_index, int ref_index,
                           int16_t (*last_mv)[2], int ref_mv_scale,
@@ -1009,8 +1009,8 @@ static int epzs_motion_search4(MpegEncContext * s,
     int flags= c->flags;
     LOAD_COMMON2
 
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
+    cmpf        = s->mecc.me_cmp[size];
+    chroma_cmpf = s->mecc.me_cmp[size + 1];
 
     map_generation= update_map_generation(c);
 
@@ -1068,8 +1068,8 @@ static int epzs_motion_search2(MpegEncContext * s,
     int flags= c->flags;
     LOAD_COMMON2
 
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
+    cmpf        = s->mecc.me_cmp[size];
+    chroma_cmpf = s->mecc.me_cmp[size + 1];
 
     map_generation= update_map_generation(c);