]> git.sesse.net Git - ffmpeg/commitdiff
Simplify spatial direct ref selection with FFMIN3()
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 21 Jul 2008 01:41:56 +0000 (01:41 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 21 Jul 2008 01:41:56 +0000 (01:41 +0000)
Originally committed as revision 14319 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/h264.c

index 4d3d32b0e2a02e34481247b271c9d1f7517b2812..7fa1b074737b3e381b9f2f9a128a7556989de479 100644 (file)
@@ -1001,11 +1001,7 @@ static inline void pred_direct_motion(H264Context * const h, int *mb_type){
             int refc = h->ref_cache[list][scan8[0] - 8 + 4];
             if(refc == -2)
                 refc = h->ref_cache[list][scan8[0] - 8 - 1];
-            ref[list] = refa;
-            if(ref[list] < 0 || (refb < ref[list] && refb >= 0))
-                ref[list] = refb;
-            if(ref[list] < 0 || (refc < ref[list] && refc >= 0))
-                ref[list] = refc;
+            ref[list] = FFMIN3((unsigned)refa, (unsigned)refb, (unsigned)refc);
             if(ref[list] < 0)
                 ref[list] = -1;
         }