aboutsummaryrefslogtreecommitdiffstats
path: root/libswresample
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <ceffmpeg@gmail.com>2017-10-28 22:52:02 +0200
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>2017-11-01 01:04:43 +0100
commitff994c2aaa0a9bbe49cfcdb175f1f6782f7856ed (patch)
treedb01ad9a269f7a6d0b48910169e018c1474cfb9b /libswresample
parent7a02b364b68c0bf7f065f5c217fae458f0efdb8d (diff)
downloadffmpeg-ff994c2aaa0a9bbe49cfcdb175f1f6782f7856ed.tar.gz
lswr/rematrix: Support s32p.
Fixes ticket #6785.
Diffstat (limited to 'libswresample')
-rw-r--r--libswresample/rematrix.c19
-rw-r--r--libswresample/version.h2
2 files changed, 15 insertions, 6 deletions
diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 66a43c16c1..9fcfff1318 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -445,14 +445,23 @@ av_cold int swri_rematrix_init(SwrContext *s){
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));
if (!s->native_one)
return AVERROR(ENOMEM);
-// 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];
+ s->native_matrix = av_calloc(nb_in * nb_out, sizeof(int));
+ if (!s->native_matrix) {
+ av_freep(&s->native_one);
+ return AVERROR(ENOMEM);
+ }
+ for (i = 0; i < nb_out; i++) {
+ double rem = 0;
+
+ for (j = 0; j < nb_in; j++) {
+ double target = s->matrix[i][j] * 32768 + rem;
+ ((int*)s->native_matrix)[i * nb_in + j] = lrintf(target);
+ rem += target - ((int*)s->native_matrix)[i * nb_in + 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;
diff --git a/libswresample/version.h b/libswresample/version.h
index 54dfd71e42..2640b10675 100644
--- a/libswresample/version.h
+++ b/libswresample/version.h
@@ -30,7 +30,7 @@
#define LIBSWRESAMPLE_VERSION_MAJOR 3
#define LIBSWRESAMPLE_VERSION_MINOR 0
-#define LIBSWRESAMPLE_VERSION_MICRO 100
+#define LIBSWRESAMPLE_VERSION_MICRO 101
#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
LIBSWRESAMPLE_VERSION_MINOR, \