aboutsummaryrefslogtreecommitdiffstats
path: root/libswresample/rematrix_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-05-15 21:34:37 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-05-15 22:25:34 +0200
commit2f76157eb05bf63725f96167feda6b2e07501c7e (patch)
tree4881ea98223e73d38880e91c29df69d618c1dec5 /libswresample/rematrix_template.c
parent5afecff1effe5470bc816edf8036ccdf0073a448 (diff)
downloadffmpeg-2f76157eb05bf63725f96167feda6b2e07501c7e.tar.gz
swresample/rematrix: Use clipping s16 rematrixing if overflows are possible
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libswresample/rematrix_template.c')
-rw-r--r--libswresample/rematrix_template.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libswresample/rematrix_template.c b/libswresample/rematrix_template.c
index 95a3b9a8c0..add65e3155 100644
--- a/libswresample/rematrix_template.c
+++ b/libswresample/rematrix_template.c
@@ -31,11 +31,16 @@
# define INTER double
# define RENAME(x) x ## _double
#elif defined(TEMPLATE_REMATRIX_S16)
-# define R(x) (((x) + 16384)>>15)
# define SAMPLE int16_t
# define COEFF int
# define INTER int
+# ifdef TEMPLATE_CLIP
+# define R(x) av_clip_int16(((x) + 16384)>>15)
+# define RENAME(x) x ## _clip_s16
+# else
+# define R(x) (((x) + 16384)>>15)
# define RENAME(x) x ## _s16
+# endif
#elif defined(TEMPLATE_REMATRIX_S32)
# define R(x) (((x) + 16384)>>15)
# define SAMPLE int32_t