[FFmpeg-cvslog] r16681 - in trunk: libavcodec/cavs.c libavcodec/dsputil.c libavcodec/ffv1.c libavcodec/h263.c libavcodec/h264.c libavcodec/huffyuv.c libavcodec/jpeglsdec.c libavcodec/jpeglsenc.c libavcodec/loco.c ...

aurel subversion
Sun Jan 18 23:57:40 CET 2009


Author: aurel
Date: Sun Jan 18 23:57:40 2009
New Revision: 16681

Log:
moves mid_pred() into mathops.h (with arch specific code split by directory)

Modified:
   trunk/libavcodec/cavs.c
   trunk/libavcodec/dsputil.c
   trunk/libavcodec/ffv1.c
   trunk/libavcodec/h263.c
   trunk/libavcodec/h264.c
   trunk/libavcodec/huffyuv.c
   trunk/libavcodec/jpeglsdec.c
   trunk/libavcodec/jpeglsenc.c
   trunk/libavcodec/loco.c
   trunk/libavcodec/mathops.h
   trunk/libavcodec/motion_est.c
   trunk/libavcodec/roqvideoenc.c
   trunk/libavcodec/rv34.c
   trunk/libavcodec/snow.c
   trunk/libavcodec/svq1dec.c
   trunk/libavcodec/vc1.c
   trunk/libavcodec/wmv2dec.c
   trunk/libavcodec/x86/dsputilenc_mmx.c
   trunk/libavcodec/x86/mathops.h
   trunk/libavutil/common.h

Modified: trunk/libavcodec/cavs.c
==============================================================================
--- trunk/libavcodec/cavs.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/cavs.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -28,6 +28,7 @@
 #include "avcodec.h"
 #include "bitstream.h"
 #include "golomb.h"
+#include "mathops.h"
 #include "cavs.h"
 #include "cavsdata.h"
 

Modified: trunk/libavcodec/dsputil.c
==============================================================================
--- trunk/libavcodec/dsputil.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/dsputil.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -32,6 +32,7 @@
 #include "simple_idct.h"
 #include "faandct.h"
 #include "faanidct.h"
+#include "mathops.h"
 #include "h263.h"
 #include "snow.h"
 

Modified: trunk/libavcodec/ffv1.c
==============================================================================
--- trunk/libavcodec/ffv1.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/ffv1.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -30,6 +30,7 @@
 #include "dsputil.h"
 #include "rangecoder.h"
 #include "golomb.h"
+#include "mathops.h"
 
 #define MAX_PLANES 4
 #define CONTEXT_SIZE 32

Modified: trunk/libavcodec/h263.c
==============================================================================
--- trunk/libavcodec/h263.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/h263.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -39,6 +39,7 @@
 #include "mpegvideo.h"
 #include "h263data.h"
 #include "mpeg4data.h"
+#include "mathops.h"
 
 //#undef NDEBUG
 //#include <assert.h>

Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/h264.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -32,6 +32,7 @@
 #include "h264data.h"
 #include "h264_parser.h"
 #include "golomb.h"
+#include "mathops.h"
 #include "rectangle.h"
 #include "vdpau_internal.h"
 

Modified: trunk/libavcodec/huffyuv.c
==============================================================================
--- trunk/libavcodec/huffyuv.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/huffyuv.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -31,6 +31,7 @@
 #include "avcodec.h"
 #include "bitstream.h"
 #include "dsputil.h"
+#include "mathops.h"
 
 #define VLC_BITS 11
 

Modified: trunk/libavcodec/jpeglsdec.c
==============================================================================
--- trunk/libavcodec/jpeglsdec.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/jpeglsdec.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -28,6 +28,7 @@
 #include "avcodec.h"
 #include "bitstream.h"
 #include "golomb.h"
+#include "mathops.h"
 #include "mjpeg.h"
 #include "mjpegdec.h"
 #include "jpegls.h"

Modified: trunk/libavcodec/jpeglsenc.c
==============================================================================
--- trunk/libavcodec/jpeglsenc.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/jpeglsenc.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -28,6 +28,7 @@
 #include "avcodec.h"
 #include "bitstream.h"
 #include "golomb.h"
+#include "mathops.h"
 #include "dsputil.h"
 #include "mjpeg.h"
 #include "jpegls.h"

Modified: trunk/libavcodec/loco.c
==============================================================================
--- trunk/libavcodec/loco.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/loco.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -27,6 +27,7 @@
 #include "avcodec.h"
 #include "bitstream.h"
 #include "golomb.h"
+#include "mathops.h"
 
 enum LOCO_MODE {LOCO_UNKN=0, LOCO_CYUY2=-1, LOCO_CRGB=-2, LOCO_CRGBA=-3, LOCO_CYV12=-4,
  LOCO_YUY2=1, LOCO_UYVY=2, LOCO_RGB=3, LOCO_RGBA=4, LOCO_YV12=5};

Modified: trunk/libavcodec/mathops.h
==============================================================================
--- trunk/libavcodec/mathops.h	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/mathops.h	Sun Jan 18 23:57:40 2009	(r16681)
@@ -83,5 +83,35 @@ static av_always_inline int MULH(int a, 
 #   define MLS16(rt, ra, rb) ((rt) -= (ra) * (rb))
 #endif
 
+/* median of 3 */
+#ifndef mid_pred
+#define mid_pred mid_pred
+static inline av_const int mid_pred(int a, int b, int c)
+{
+#if 0
+    int t= (a-b)&((a-b)>>31);
+    a-=t;
+    b+=t;
+    b-= (b-c)&((b-c)>>31);
+    b+= (a-b)&((a-b)>>31);
+
+    return b;
+#else
+    if(a>b){
+        if(c>b){
+            if(c>a) b=a;
+            else    b=c;
+        }
+    }else{
+        if(b>c){
+            if(c>a) b=c;
+            else    b=a;
+        }
+    }
+    return b;
+#endif
+}
+#endif
+
 #endif /* AVCODEC_MATHOPS_H */
 

Modified: trunk/libavcodec/motion_est.c
==============================================================================
--- trunk/libavcodec/motion_est.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/motion_est.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -32,6 +32,7 @@
 #include <limits.h>
 #include "avcodec.h"
 #include "dsputil.h"
+#include "mathops.h"
 #include "mpegvideo.h"
 
 #undef NDEBUG

Modified: trunk/libavcodec/roqvideoenc.c
==============================================================================
--- trunk/libavcodec/roqvideoenc.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/roqvideoenc.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -60,6 +60,7 @@
 #include "roqvideo.h"
 #include "bytestream.h"
 #include "elbg.h"
+#include "mathops.h"
 
 #define CHROMA_BIAS 1
 

Modified: trunk/libavcodec/rv34.c
==============================================================================
--- trunk/libavcodec/rv34.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/rv34.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -28,6 +28,7 @@
 #include "dsputil.h"
 #include "mpegvideo.h"
 #include "golomb.h"
+#include "mathops.h"
 #include "rectangle.h"
 
 #include "rv34vlc.h"

Modified: trunk/libavcodec/snow.c
==============================================================================
--- trunk/libavcodec/snow.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/snow.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -23,6 +23,7 @@
 #include "snow.h"
 
 #include "rangecoder.h"
+#include "mathops.h"
 
 #include "mpegvideo.h"
 

Modified: trunk/libavcodec/svq1dec.c
==============================================================================
--- trunk/libavcodec/svq1dec.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/svq1dec.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -37,6 +37,7 @@
 #include "avcodec.h"
 #include "dsputil.h"
 #include "mpegvideo.h"
+#include "mathops.h"
 
 #include "svq1.h"
 

Modified: trunk/libavcodec/vc1.c
==============================================================================
--- trunk/libavcodec/vc1.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/vc1.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -34,6 +34,7 @@
 #include "msmpeg4data.h"
 #include "unary.h"
 #include "simple_idct.h"
+#include "mathops.h"
 
 #undef NDEBUG
 #include <assert.h>

Modified: trunk/libavcodec/wmv2dec.c
==============================================================================
--- trunk/libavcodec/wmv2dec.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/wmv2dec.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -21,6 +21,7 @@
 #include "avcodec.h"
 #include "dsputil.h"
 #include "mpegvideo.h"
+#include "mathops.h"
 #include "msmpeg4.h"
 #include "msmpeg4data.h"
 #include "intrax8.h"

Modified: trunk/libavcodec/x86/dsputilenc_mmx.c
==============================================================================
--- trunk/libavcodec/x86/dsputilenc_mmx.c	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/x86/dsputilenc_mmx.c	Sun Jan 18 23:57:40 2009	(r16681)
@@ -25,6 +25,7 @@
 #include "libavutil/x86_cpu.h"
 #include "libavcodec/dsputil.h"
 #include "libavcodec/mpegvideo.h"
+#include "libavcodec/mathops.h"
 #include "dsputil_mmx.h"
 
 

Modified: trunk/libavcodec/x86/mathops.h
==============================================================================
--- trunk/libavcodec/x86/mathops.h	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavcodec/x86/mathops.h	Sun Jan 18 23:57:40 2009	(r16681)
@@ -22,6 +22,9 @@
 #ifndef AVCODEC_X86_MATHOPS_H
 #define AVCODEC_X86_MATHOPS_H
 
+#include "config.h"
+#include "libavutil/common.h"
+
 #define MULL(ra, rb, shift) \
         ({ int rt, dummy; __asm__ (\
             "imull %3               \n\t"\
@@ -40,4 +43,25 @@
      __asm__ ("imull %2\n\t" : "=A"(rt) : "a" ((int)ra), "g" ((int)rb));\
      rt; })
 
+#if HAVE_CMOV
+/* median of 3 */
+#define mid_pred mid_pred
+static inline av_const int mid_pred(int a, int b, int c)
+{
+    int i=b;
+    __asm__ volatile(
+        "cmp    %2, %1 \n\t"
+        "cmovg  %1, %0 \n\t"
+        "cmovg  %2, %1 \n\t"
+        "cmp    %3, %1 \n\t"
+        "cmovl  %3, %1 \n\t"
+        "cmp    %1, %0 \n\t"
+        "cmovg  %1, %0 \n\t"
+        :"+&r"(i), "+&r"(a)
+        :"r"(b), "r"(c)
+    );
+    return i;
+}
+#endif
+
 #endif /* AVCODEC_X86_MATHOPS_H */

Modified: trunk/libavutil/common.h
==============================================================================
--- trunk/libavutil/common.h	Sun Jan 18 23:53:28 2009	(r16680)
+++ trunk/libavutil/common.h	Sun Jan 18 23:57:40 2009	(r16681)
@@ -151,47 +151,6 @@ static inline av_const int av_log2_16bit
     return n;
 }
 
-/* median of 3 */
-static inline av_const int mid_pred(int a, int b, int c)
-{
-#if HAVE_CMOV
-    int i=b;
-    __asm__ volatile(
-        "cmp    %2, %1 \n\t"
-        "cmovg  %1, %0 \n\t"
-        "cmovg  %2, %1 \n\t"
-        "cmp    %3, %1 \n\t"
-        "cmovl  %3, %1 \n\t"
-        "cmp    %1, %0 \n\t"
-        "cmovg  %1, %0 \n\t"
-        :"+&r"(i), "+&r"(a)
-        :"r"(b), "r"(c)
-    );
-    return i;
-#elif 0
-    int t= (a-b)&((a-b)>>31);
-    a-=t;
-    b+=t;
-    b-= (b-c)&((b-c)>>31);
-    b+= (a-b)&((a-b)>>31);
-
-    return b;
-#else
-    if(a>b){
-        if(c>b){
-            if(c>a) b=a;
-            else    b=c;
-        }
-    }else{
-        if(b>c){
-            if(c>a) b=c;
-            else    b=a;
-        }
-    }
-    return b;
-#endif
-}
-
 /**
  * clip a signed integer value into the amin-amax range
  * @param a value to clip




More information about the ffmpeg-cvslog mailing list