summaryrefslogtreecommitdiff
authorMichael Niedermayer <michaelni@gmx.at>2013-06-04 12:54:58 (GMT)
committer Michael Niedermayer <michaelni@gmx.at>2013-06-04 13:12:11 (GMT)
commitb84de51f548aabf478f84dfa38e4d5ca0b0ffe1f (patch)
treee4657b10e74b6e338a90bc3e3ce4ee3bbe64b1f5
parentf3c638eac1e37127ab3ad1a5fa49bf39fb357dfa (diff)
downloadffmpeg-b84de51f548aabf478f84dfa38e4d5ca0b0ffe1f.zip
ffmpeg-b84de51f548aabf478f84dfa38e4d5ca0b0ffe1f.tar.gz
ffmpeg-b84de51f548aabf478f84dfa38e4d5ca0b0ffe1f.tar.bz2
swresample/rematrix: add S32 mixing code
Needed for dithering S32 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat
-rw-r--r--libswresample/rematrix.c15
-rw-r--r--libswresample/rematrix_template.c6
2 files changed, 21 insertions, 0 deletions
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 84c55ee..3abfb3e 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -34,6 +34,10 @@
#include "rematrix_template.c"
#undef TEMPLATE_REMATRIX_S16
+#define TEMPLATE_REMATRIX_S32
+#include "rematrix_template.c"
+#undef TEMPLATE_REMATRIX_S32
+
#define FRONT_LEFT 0
#define FRONT_RIGHT 1
#define FRONT_CENTER 2
@@ -366,6 +370,17 @@ av_cold int swri_rematrix_init(SwrContext *s){
s->mix_1_1_f = (mix_1_1_func_type*)copy_double;
s->mix_2_1_f = (mix_2_1_func_type*)sum2_double;
s->mix_any_f = (mix_any_func_type*)get_mix_any_func_double(s);
+ }else if(s->midbuf.fmt == AV_SAMPLE_FMT_S32P){
+ // Only for dithering currently
+// s->native_matrix = av_calloc(nb_in * nb_out, sizeof(double));
+ s->native_one = av_mallocz(sizeof(int));
+// for (i = 0; i < nb_out; i++)
+// for (j = 0; j < nb_in; j++)
+// ((double*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j];
+ *((int*)s->native_one) = 32768;
+ s->mix_1_1_f = (mix_1_1_func_type*)copy_s32;
+ s->mix_2_1_f = (mix_2_1_func_type*)sum2_s32;
+ s->mix_any_f = (mix_any_func_type*)get_mix_any_func_s32(s);
}else
av_assert0(0);
//FIXME quantize for integeres
diff --git a/libswresample/rematrix_template.c b/libswresample/rematrix_template.c
index ecdeab3..214d905 100644
--- a/libswresample/rematrix_template.c
+++ b/libswresample/rematrix_template.c
@@ -36,6 +36,12 @@
# define COEFF int
# define INTER int
# define RENAME(x) x ## _s16
+#elif defined(TEMPLATE_REMATRIX_S32)
+# define R(x) (((x) + 16384)>>15)
+# define SAMPLE int32_t
+# define COEFF int
+# define INTER int64_t
+# define RENAME(x) x ## _s32
#endif
typedef void (RENAME(mix_any_func_type))(SAMPLE **out, const SAMPLE **in1, COEFF *coeffp, integer len);