[FFmpeg-cvslog] r12910 - in trunk: libavcodec/h263.c libavcodec/h264.c libavcodec/mjpegbdec.c libavcodec/mjpegdec.c libavcodec/mpegvideo_enc.c libavformat/matroskadec.c libavutil/common.h

voroshil subversion
Sat Apr 19 19:07:58 CEST 2008


Author: voroshil
Date: Sat Apr 19 19:07:58 2008
New Revision: 12910

Log:
Implement FFMAX3(a,b,c) - maximum over three arguments.



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

Modified: trunk/libavcodec/h263.c
==============================================================================
--- trunk/libavcodec/h263.c	(original)
+++ trunk/libavcodec/h263.c	Sat Apr 19 19:07:58 2008
@@ -3100,7 +3100,7 @@ int ff_mpeg4_get_video_packet_prefix_len
         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;
     }

Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c	(original)
+++ trunk/libavcodec/h264.c	Sat Apr 19 19:07:58 2008
@@ -6502,7 +6502,7 @@ static void filter_mb( H264Context *h, i
     //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)

Modified: trunk/libavcodec/mjpegbdec.c
==============================================================================
--- trunk/libavcodec/mjpegbdec.c	(original)
+++ trunk/libavcodec/mjpegbdec.c	Sat Apr 19 19:07:58 2008
@@ -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);

Modified: trunk/libavcodec/mjpegdec.c
==============================================================================
--- trunk/libavcodec/mjpegdec.c	(original)
+++ trunk/libavcodec/mjpegdec.c	Sat Apr 19 19:07:58 2008
@@ -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);

Modified: trunk/libavcodec/mpegvideo_enc.c
==============================================================================
--- trunk/libavcodec/mpegvideo_enc.c	(original)
+++ trunk/libavcodec/mpegvideo_enc.c	Sat Apr 19 19:07:58 2008
@@ -2814,7 +2814,7 @@ static int encode_picture(MpegEncContext
                 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);

Modified: trunk/libavformat/matroskadec.c
==============================================================================
--- trunk/libavformat/matroskadec.c	(original)
+++ trunk/libavformat/matroskadec.c	Sat Apr 19 19:07:58 2008
@@ -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 {

Modified: trunk/libavutil/common.h
==============================================================================
--- trunk/libavutil/common.h	(original)
+++ trunk/libavutil/common.h	Sat Apr 19 19:07:58 2008
@@ -111,6 +111,7 @@
 #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)




More information about the ffmpeg-cvslog mailing list