[FFmpeg-devel] [PATCH 0/2] Remove float_to_int16 add bias hack (original) (raw)

Justin Ruggles justin.ruggles
Wed Jan 26 19:46:32 CET 2011


I'm not convinced that the hack in DSPContxt.float_to_int16 where the C version has a different scale and bias than the SIMD versions is really needed. The addition still has to be done somewhere. In most cases this seems to be in vector_fmul_window(), and in other cases it's just a completely separate loop over the samples to add the bias that would otherwise not be needed. For the vector_fmul_window() cases, the add bias in that function is ONLY there because of the C version of float_to_int16. And if a system has to use a C version of float_to_int16, likely it also has to use the C version of vector_fmul_window() and there is no net gain.

Anyway, here is a patch to make float_to_int16() always take input in the range [-32768.0,32767.0], removing the need for the add bias. The scaling could still be useful in the future though if those decoders are modified to give float output instead of int16. It would be nice to still have the flexibility to change the scale of the output float samples per user request without additional overhead.

This patch does not address the 3 asm functions that will no longer need the bias parameter. I just don't feel comfortable enough with modifying the ARM versions myself. SynthFilterContext.synth_filter_float() DCADSPContext.lfe_fir() DSPContext.vector_fmul_window()

Cheers, Justin

Justin Ruggles (2): Remove the add bias hack for the C version of DSPContext.float_to_int16_*(). cosmetics: indentation and spacing

libavcodec/aac.h | 1 - libavcodec/aacdec.c | 46 +++++++++++++--------------------- libavcodec/aacsbr.c | 13 ++------- libavcodec/ac3dec.c | 17 +++---------- libavcodec/ac3dec.h | 1 - libavcodec/binkaudio.c | 5 ---- libavcodec/dca.c | 58 ++++++++++++++++++------------------------- libavcodec/dsputil.c | 9 +------ libavcodec/dsputil.h | 3 +- libavcodec/nellymoserdec.c | 11 +------- libavcodec/wmadec.c | 29 +++++---------------- 11 files changed, 60 insertions(+), 133 deletions(-)



More information about the ffmpeg-devel mailing list