forked from FFmpeg/FFmpeg
swr: automatically choose s16/flt/dbl to preserve input precision unless user overrides.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
f2e799a3d0
commit
33f7033452
1 changed files with 10 additions and 5 deletions
|
@ -208,11 +208,16 @@ int swr_init(struct SwrContext *s){
|
|||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
//FIXME should we allow/support using FLT on material that doesnt need it ?
|
||||
if(av_get_planar_sample_fmt(s->in_sample_fmt) <= AV_SAMPLE_FMT_S16P || s->int_sample_fmt==AV_SAMPLE_FMT_S16P){
|
||||
s->int_sample_fmt= AV_SAMPLE_FMT_S16P;
|
||||
}else
|
||||
s->int_sample_fmt= AV_SAMPLE_FMT_FLTP;
|
||||
if(s->int_sample_fmt == AV_SAMPLE_FMT_NONE){
|
||||
if(av_get_planar_sample_fmt(s->in_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_FLTP){
|
||||
s->int_sample_fmt= AV_SAMPLE_FMT_FLTP;
|
||||
}else{
|
||||
av_log(s, AV_LOG_DEBUG, "Using double precission mode\n");
|
||||
s->int_sample_fmt= AV_SAMPLE_FMT_DBLP;
|
||||
}
|
||||
}
|
||||
|
||||
if( s->int_sample_fmt != AV_SAMPLE_FMT_S16P
|
||||
&&s->int_sample_fmt != AV_SAMPLE_FMT_S32P
|
||||
|
|
Loading…
Add table
Reference in a new issue