changeset 847:f3c369b8ddca libavcodec

reversing header game MIN/MAX -> FFMIN/FFMAX
author michaelni
date Sun, 10 Nov 2002 11:46:59 +0000
parents ade627a74709
children c075abb7fb3c
files common.h error_resilience.c h263.c motion_est.c mpegvideo.c msmpeg4.c ratecontrol.c
diffstat 7 files changed, 20 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/common.h	Sun Nov 10 11:24:27 2002 +0000
+++ b/common.h	Sun Nov 10 11:46:59 2002 +0000
@@ -161,13 +161,8 @@
 #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
 #define ABS(a) ((a) >= 0 ? (a) : (-(a)))
 
-#ifndef MAX
-#    define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-#ifndef MIN
-#    define MIN(a,b) ((a) > (b) ? (b) : (a))
-#endif
+#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
+#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
 
 #ifdef ARCH_X86
 // avoid +32 for shift optimization (gcc should do that ...)
--- a/error_resilience.c	Sun Nov 10 11:24:27 2002 +0000
+++ b/error_resilience.c	Sun Nov 10 11:46:59 2002 +0000
@@ -209,7 +209,7 @@
                 c= dst[offset + 9 + y*stride] - dst[offset + 8 + y*stride];
                 
                 d= ABS(b) - ((ABS(a) + ABS(c) + 1)>>1);
-                d= MAX(d, 0);
+                d= FFMAX(d, 0);
                 if(b<0) d= -d;
                 
                 if(d==0) continue;
@@ -269,7 +269,7 @@
                 c= dst[offset + x + 9*stride] - dst[offset + x + 8*stride];
                 
                 d= ABS(b) - ((ABS(a) + ABS(c)+1)>>1);
-                d= MAX(d, 0);
+                d= FFMAX(d, 0);
                 if(b<0) d= -d;
                 
                 if(d==0) continue;
@@ -430,10 +430,10 @@
                             min_x=min_y=max_x=max_y=0;
                         }
                         for(j=0; j<pred_count; j++){
-                            max_x= MAX(max_x, mv_predictor[j][0]);
-                            max_y= MAX(max_y, mv_predictor[j][1]);
-                            min_x= MIN(min_x, mv_predictor[j][0]);
-                            min_y= MIN(min_y, mv_predictor[j][1]);
+                            max_x= FFMAX(max_x, mv_predictor[j][0]);
+                            max_y= FFMAX(max_y, mv_predictor[j][1]);
+                            min_x= FFMIN(min_x, mv_predictor[j][0]);
+                            min_y= FFMIN(min_y, mv_predictor[j][1]);
                         }
                         mv_predictor[pred_count+1][0] = sum_x - max_x - min_x;
                         mv_predictor[pred_count+1][1] = sum_y - max_y - min_y;
@@ -538,7 +538,7 @@
     
     if(undamaged_count < 5) return 0; //allmost all MBs damaged -> use temporal prediction
     
-    skip_amount= MAX(undamaged_count/50, 1); //check only upto 50 MBs 
+    skip_amount= FFMAX(undamaged_count/50, 1); //check only upto 50 MBs 
     is_intra_likely=0;
 
     j=0;
--- a/h263.c	Sun Nov 10 11:24:27 2002 +0000
+++ b/h263.c	Sun Nov 10 11:46:59 2002 +0000
@@ -2204,7 +2204,7 @@
         case S_TYPE:
             return s->f_code+15;
         case B_TYPE:
-            return MAX(MAX(s->f_code, s->b_code)+15, 17);
+            return FFMAX(FFMAX(s->f_code, s->b_code)+15, 17);
         default:
             return -1;
     }
@@ -3981,7 +3981,7 @@
             s->sprite_shift[1]= alpha+rho+2;
             break;
         case 3:
-            min_ab= MIN(alpha, beta);
+            min_ab= FFMIN(alpha, beta);
             w3= w2>>min_ab;
             h3= h2>>min_ab;
             s->sprite_offset[0][0]=  (sprite_ref[0][0]<<(alpha+beta+rho-min_ab))
--- a/motion_est.c	Sun Nov 10 11:24:27 2002 +0000
+++ b/motion_est.c	Sun Nov 10 11:46:59 2002 +0000
@@ -1600,8 +1600,8 @@
             i= y*s->mb_width;
             for(x=0; x<s->mb_width; x++){
                 if(s->mb_type[i] & type){
-                    int fcode= MAX(fcode_tab[mv_table[xy][0] + MAX_MV],
-                                   fcode_tab[mv_table[xy][1] + MAX_MV]);
+                    int fcode= FFMAX(fcode_tab[mv_table[xy][0] + MAX_MV],
+                                     fcode_tab[mv_table[xy][1] + MAX_MV]);
                     int j;
                     
                     for(j=0; j<fcode && j<8; j++){
--- a/mpegvideo.c	Sun Nov 10 11:24:27 2002 +0000
+++ b/mpegvideo.c	Sun Nov 10 11:46:59 2002 +0000
@@ -1264,10 +1264,10 @@
         src_x=1-block_w;
     }
 
-    start_y= MAX(0, -src_y);
-    start_x= MAX(0, -src_x);
-    end_y= MIN(block_h, h-src_y);
-    end_x= MIN(block_w, w-src_x);
+    start_y= FFMAX(0, -src_y);
+    start_x= FFMAX(0, -src_x);
+    end_y= FFMIN(block_h, h-src_y);
+    end_x= FFMIN(block_w, w-src_x);
 
     // copy existing part
     for(y=start_y; y<end_y; y++){
--- a/msmpeg4.c	Sun Nov 10 11:24:27 2002 +0000
+++ b/msmpeg4.c	Sun Nov 10 11:46:59 2002 +0000
@@ -425,7 +425,7 @@
 {
         put_bits(&s->pb, 5, s->frame_rate / FRAME_RATE_BASE); //yes 29.97 -> 29
 
-        put_bits(&s->pb, 11, MIN(s->bit_rate/1024, 2047));
+        put_bits(&s->pb, 11, FFMIN(s->bit_rate/1024, 2047));
 
         if(s->msmpeg4_version<3)
             s->flipflop_rounding=0;
--- a/ratecontrol.c	Sun Nov 10 11:24:27 2002 +0000
+++ b/ratecontrol.c	Sun Nov 10 11:46:59 2002 +0000
@@ -405,7 +405,7 @@
             else if(d<0.0001) d=0.0001;
             q*= pow(d, 1.0/s->avctx->rc_buffer_aggressivity);
 
-            q= MIN(q, bits2qp(rce, MAX((min_rate - buffer_size + rcc->buffer_index)*2, 1)));
+            q= FFMIN(q, bits2qp(rce, FFMAX((min_rate - buffer_size + rcc->buffer_index)*2, 1)));
         }
 
         if(max_rate){
@@ -414,7 +414,7 @@
             else if(d<0.0001) d=0.0001;
             q/= pow(d, 1.0/s->avctx->rc_buffer_aggressivity);
 
-            q= MAX(q, bits2qp(rce, MAX(rcc->buffer_index/2, 1)));
+            q= FFMAX(q, bits2qp(rce, FFMAX(rcc->buffer_index/2, 1)));
         }
     }
 //printf("q:%f max:%f min:%f size:%f index:%d bits:%f agr:%f\n", q,max_rate, min_rate, buffer_size, rcc->buffer_index, bits, s->avctx->rc_buffer_aggressivity);