]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mathops.h
Parse ID3v[12] metadata from TTA files.
[ffmpeg] / libavcodec / mathops.h
index 486eed7822aeabf8e93a8e24ee9f4e342a9bc515..4e24350ef25e6d384d1a6e5ea9e4a6ad9f2a5cbc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * simple math operations
- * Copyright (c) 2001, 2002 Fabrice Bellard.
+ * Copyright (c) 2001, 2002 Fabrice Bellard
  * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> et al
  *
  * This file is part of FFmpeg.
 
 #include "libavutil/common.h"
 
-#ifdef ARCH_X86_32
-
-#include "i386/mathops.h"
-
-#elif defined(ARCH_ARM)
-
-#include "arm/mathops.h"
-
-#elif defined(ARCH_POWERPC)
-
-#include "ppc/mathops.h"
-
-#elif defined(ARCH_BFIN)
-
-#include "bfin/mathops.h"
-
+#if   ARCH_ARM
+#   include "arm/mathops.h"
+#elif ARCH_AVR32
+#   include "avr32/mathops.h"
+#elif ARCH_BFIN
+#   include "bfin/mathops.h"
+#elif ARCH_MIPS
+#   include "mips/mathops.h"
+#elif ARCH_PPC
+#   include "ppc/mathops.h"
+#elif ARCH_X86
+#   include "x86/mathops.h"
 #endif
 
 /* generic implementation */
@@ -83,5 +79,42 @@ static av_always_inline int MULH(int a, int b){
 #   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
+
+#ifndef sign_extend
+static inline av_const int sign_extend(int val, unsigned bits)
+{
+    return (val << (INT_BIT - bits)) >> (INT_BIT - bits);
+}
+#endif
+
 #endif /* AVCODEC_MATHOPS_H */