summaryrefslogtreecommitdiffstats
path: root/libswresample/swresample.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-21 16:29:09 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-21 17:33:46 +0200
commit4977692461f05eb205fc8c62f48d5dcebb52c6fb (patch)
tree9a6a2dc2220e8830a192752578ef1ea02184b6d6 /libswresample/swresample.c
parent4299f085f45cdd8fcb3ecf681d9fef0c4b3fe207 (diff)
downloadffmpeg-streaming-4977692461f05eb205fc8c62f48d5dcebb52c6fb.zip
ffmpeg-streaming-4977692461f05eb205fc8c62f48d5dcebb52c6fb.tar.gz
swresample: Choose 16bit internally only if input and output is 16bit or less
or if no rematrix and no resampling is performed and the input is 16bit note reampling and rematrix itself always use more than 16bit internally the "internal" sampling format is the format between these steps Its unlikely the difference from this commit is audible in any case unless there is some bug either before or after the change. but multiple people prefer this and it slightly improves the precission of computations. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/swresample.c')
-rw-r--r--libswresample/swresample.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index ab02bac..5a43371 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -210,7 +210,13 @@ av_cold int swr_init(struct SwrContext *s){
s->rematrix_custom;
if(s->int_sample_fmt == AV_SAMPLE_FMT_NONE){
- if(av_get_planar_sample_fmt(s->in_sample_fmt) <= AV_SAMPLE_FMT_S16P){
+ if( av_get_planar_sample_fmt(s-> in_sample_fmt) <= AV_SAMPLE_FMT_S16P
+ && av_get_planar_sample_fmt(s->out_sample_fmt) <= AV_SAMPLE_FMT_S16P){
+ s->int_sample_fmt= AV_SAMPLE_FMT_S16P;
+ }else if( av_get_planar_sample_fmt(s-> in_sample_fmt) <= AV_SAMPLE_FMT_S16P
+ && !s->rematrix
+ && s->out_sample_rate==s->in_sample_rate
+ && !(s->flags & SWR_FLAG_RESAMPLE)){
s->int_sample_fmt= AV_SAMPLE_FMT_S16P;
}else if( av_get_planar_sample_fmt(s-> in_sample_fmt) == AV_SAMPLE_FMT_S32P
&& av_get_planar_sample_fmt(s->out_sample_fmt) == AV_SAMPLE_FMT_S32P
OpenPOWER on IntegriCloud