Implement FFMAX3(a,b,c) - maximum over three arguments.
authorVladimir Voroshilov <voroshil@gmail.com>
Sat, 19 Apr 2008 17:07:58 +0000 (17:07 +0000)
committerVladimir Voroshilov <voroshil@gmail.com>
Sat, 19 Apr 2008 17:07:58 +0000 (17:07 +0000)
Originally committed as revision 12910 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/h263.c
libavcodec/h264.c
libavcodec/mjpegbdec.c
libavcodec/mjpegdec.c
libavcodec/mpegvideo_enc.c
libavformat/matroskadec.c
libavutil/common.h

index 3446204c6f5124f668636a55d979a9fabb417aba..ad542039308027d9a361bbe18b18c9aa5c490e27 100644 (file)
@@ -3100,7 +3100,7 @@ int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s){
         case FF_S_TYPE:
             return s->f_code+15;
         case FF_B_TYPE:
-            return FFMAX(FFMAX(s->f_code, s->b_code)+15, 17);
+            return FFMAX3(s->f_code, s->b_code, 2) + 15;
         default:
             return -1;
     }
index a1d4b0dfe31c1ba4a1262ac42361936b7166c091..219c6875fe0fb233d670a4a6224b4dc2d73026d7 100644 (file)
@@ -6502,7 +6502,7 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8
     //for sufficiently low qp, filtering wouldn't do anything
     //this is a conservative estimate: could also check beta_offset and more accurate chroma_qp
     if(!FRAME_MBAFF){
-        int qp_thresh = 15 - h->slice_alpha_c0_offset - FFMAX(0, FFMAX(h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]));
+        int qp_thresh = 15 - h->slice_alpha_c0_offset - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]);
         int qp = s->current_picture.qscale_table[mb_xy];
         if(qp <= qp_thresh
            && (mb_x == 0 || ((qp + s->current_picture.qscale_table[mb_xy-1] + 1)>>1) <= qp_thresh)
index 0f27379f30d5df160db6098a3eb97eca9ec6c1d9..a6c409a9022b135dd42c04ccbc016665eea5041c 100644 (file)
@@ -123,7 +123,7 @@ read_header:
     *data_size = sizeof(AVFrame);
 
     if(!s->lossless){
-        picture->quality= FFMAX(FFMAX(s->qscale[0], s->qscale[1]), s->qscale[2]);
+        picture->quality= FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]);
         picture->qstride= 0;
         picture->qscale_table= s->qscale_table;
         memset(picture->qscale_table, picture->quality, (s->width+15)/16);
index 83904124088c14ff2adbd8039ca59ac4c23dad1b..5f43cb5b4d32a59c1ac6ce87ef8aef42ad39bb5c 100644 (file)
@@ -1284,7 +1284,7 @@ eoi_parser:
                         *data_size = sizeof(AVFrame);
 
                         if(!s->lossless){
-                            picture->quality= FFMAX(FFMAX(s->qscale[0], s->qscale[1]), s->qscale[2]);
+                            picture->quality= FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]);
                             picture->qstride= 0;
                             picture->qscale_table= s->qscale_table;
                             memset(picture->qscale_table, picture->quality, (s->width+15)/16);
index a04e81832726fdff669072847ec5c186031ce20c..b2e3a369b864a4f10d3ebce5565be0fc024423a6 100644 (file)
@@ -2814,7 +2814,7 @@ static int encode_picture(MpegEncContext *s, int picture_number)
                 int a,b;
                 a= ff_get_best_fcode(s, s->p_field_mv_table[0][0], CANDIDATE_MB_TYPE_INTER_I); //FIXME field_select
                 b= ff_get_best_fcode(s, s->p_field_mv_table[1][1], CANDIDATE_MB_TYPE_INTER_I);
-                s->f_code= FFMAX(s->f_code, FFMAX(a,b));
+                s->f_code= FFMAX3(s->f_code, a, b);
             }
 
             ff_fix_long_p_mvs(s);
index 321968a98dac488876467a66d9ed7a70f2a98685..25fbdd5967a0f59f7e1f7aaf10aab182646794bf 100644 (file)
@@ -98,8 +98,8 @@ typedef struct MatroskaSubtitleTrack {
     //..
 } MatroskaSubtitleTrack;
 
-#define MAX_TRACK_SIZE (FFMAX(FFMAX(sizeof(MatroskaVideoTrack), \
-                                    sizeof(MatroskaAudioTrack)), \
+#define MAX_TRACK_SIZE (FFMAX3(sizeof(MatroskaVideoTrack), \
+                                    sizeof(MatroskaAudioTrack), \
                                     sizeof(MatroskaSubtitleTrack)))
 
 typedef struct MatroskaLevel {
index e9d96db78a0add6424088d1036ae71f52abc411f..6615ded044316f4b7981b0951fb70fdb89168886 100644 (file)
 #define FFSIGN(a) ((a) > 0 ? 1 : -1)
 
 #define FFMAX(a,b) ((a) > (b) ? (a) : (b))
+#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
 #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
 
 #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)