[FFmpeg-cvslog] swr/rematrix: move templating parameters to template itself.

Clément Bœsch git at videolan.org
Thu Nov 15 21:27:07 CET 2012


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Wed Nov 14 23:02:12 2012 +0100| [5e68bf9b927ef377f271a0d12185aac6172e5658] | committer: Clément Bœsch

swr/rematrix: move templating parameters to template itself.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5e68bf9b927ef377f271a0d12185aac6172e5658
---

 libswresample/rematrix.c          |   41 ++++++++-----------------------------
 libswresample/rematrix_template.c |   30 +++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 33 deletions(-)

diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index e23c45e..51658ce 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -22,42 +22,17 @@
 #include "libavutil/avassert.h"
 #include "libavutil/channel_layout.h"
 
-#define ONE (1.0)
-#define R(x) x
-#define SAMPLE float
-#define COEFF float
-#define INTER float
-#define RENAME(x) x ## _float
+#define TEMPLATE_REMATRIX_FLT
 #include "rematrix_template.c"
-#undef SAMPLE
-#undef RENAME
-#undef R
-#undef ONE
-#undef COEFF
-#undef INTER
-
-#define ONE (1.0)
-#define R(x) x
-#define SAMPLE double
-#define COEFF double
-#define INTER double
-#define RENAME(x) x ## _double
-#include "rematrix_template.c"
-#undef SAMPLE
-#undef RENAME
-#undef R
-#undef ONE
-#undef COEFF
-#undef INTER
-
-#define ONE (-32768)
-#define R(x) (((x) + 16384)>>15)
-#define SAMPLE int16_t
-#define COEFF int
-#define INTER int
-#define RENAME(x) x ## _s16
+#undef TEMPLATE_REMATRIX_FLT
+
+#define TEMPLATE_REMATRIX_DBL
 #include "rematrix_template.c"
+#undef TEMPLATE_REMATRIX_DBL
 
+#define TEMPLATE_REMATRIX_S16
+#include "rematrix_template.c"
+#undef TEMPLATE_REMATRIX_S16
 
 #define FRONT_LEFT             0
 #define FRONT_RIGHT            1
diff --git a/libswresample/rematrix_template.c b/libswresample/rematrix_template.c
index 61d3fe9..a0d3fd1 100644
--- a/libswresample/rematrix_template.c
+++ b/libswresample/rematrix_template.c
@@ -18,6 +18,29 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#if defined(TEMPLATE_REMATRIX_FLT)
+#    define ONE (1.0)
+#    define R(x) x
+#    define SAMPLE float
+#    define COEFF float
+#    define INTER float
+#    define RENAME(x) x ## _float
+#elif defined(TEMPLATE_REMATRIX_DBL)
+#    define ONE (1.0)
+#    define R(x) x
+#    define SAMPLE double
+#    define COEFF double
+#    define INTER double
+#    define RENAME(x) x ## _double
+#elif defined(TEMPLATE_REMATRIX_S16)
+#    define ONE (-32768)
+#    define R(x) (((x) + 16384)>>15)
+#    define SAMPLE int16_t
+#    define COEFF int
+#    define INTER int
+#    define RENAME(x) x ## _s16
+#endif
+
 typedef void (RENAME(mix_any_func_type))(SAMPLE **out, const SAMPLE **in1, COEFF *coeffp, integer len);
 
 static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, COEFF *coeffp, integer index1, integer index2, integer len){
@@ -72,3 +95,10 @@ static RENAME(mix_any_func_type) *RENAME(get_mix_any_func)(SwrContext *s){
 
     return NULL;
 }
+
+#undef ONE
+#undef R
+#undef SAMPLE
+#undef COEFF
+#undef INTER
+#undef RENAME



More information about the ffmpeg-cvslog mailing list