[FFmpeg-devel] [PATCH 0/3] AC3 fixed-point encoder sample shifting

Justin Ruggles justin.ruggles
Tue Mar 8 19:18:54 CET 2011

This patch set changes how and when the fixed-point encoder does sample 
value shifting.  Currently it left-shift normalizes samples to 16-bit in 
each block for each channel, then adjusts the exponents accordingly so 
that the final coefficient scale will be correct.  With the addition of 
channel coupling, it now becomes important to have greater than 16-bit 
accuracy in the coefficients.  The floating-point encoder converts the 
coefficients to 25-bit fixed-point since that is the internal scale for 
AC3.  This patch does the same for the fixed-point encoder by shifting 
the coefficients back to their original scale, but in the 25-bit range.

Patch 1 is needed to handle the higher coefficient scale in channel 

Patch 2 is what I describe above.

Patch 3 adds x86 SIMD optimization for both pre-MDCT and post-MDCT 

Total encoding time:
current: 4.16s
patch 1: 4.16s
patch 2: 4.07s
patch 3: 4.01s

Justin Ruggles (3):
  ac3enc: use MUL64() to multiply fixed-point coefficients
  ac3enc: shift coefficients to 24-bit following MDCT rather than using
    an     exponent offset.
  ac3enc: add SIMD-optimized shifting functions for use with the
    fixed-point AC3     encoder

 libavcodec/ac3dsp.c         |   26 +++++++++++++++
 libavcodec/ac3dsp.h         |   22 +++++++++++++
 libavcodec/ac3enc.c         |   21 ++++++------
 libavcodec/ac3enc_fixed.c   |   40 ++++++++---------------
 libavcodec/ac3enc_fixed.h   |    2 +
 libavcodec/ac3enc_float.h   |    2 +
 libavcodec/x86/ac3dsp.asm   |   74 +++++++++++++++++++++++++++++++++++++++++++
 libavcodec/x86/ac3dsp_mmx.c |   13 +++++++
 tests/ref/acodec/ac3_fixed  |    2 +-
 9 files changed, 164 insertions(+), 38 deletions(-)

More information about the ffmpeg-devel mailing list