Aligned local variables must use the LOCAL_ALIGNED macro to ensure
correct alignment on all systems. The unusual size argument to
memset is required since the implementation of LOCAL_ALIGNED may
use a pointer to an array.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Uninitialized coefficients were being used to generate exponents, some
of which actually ended up in the final stream. Even though, they were
just extra exponents that are not used by any decoder, it is still
better to have consistent output for testing. This also fixes valgrind
errors.
Channel coupling is an optional AC-3 feature that increases quality by
combining high frequency information from multiple channels into a
single channel. The per-channel high frequency information is sent with
less accuracy in both the frequency and time domains. This allows more
bits to be used for lower frequencies while preserving enough
information to reconstruct the high frequencies.
There is no need to have 2 encoders, the input sample format can,does and should choose which is used
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This makes the AC3 encoder use the shared fixed-point MDCT rather
than its own implementation. The checksum changes are due to
different rounding in the MDCT.
Signed-off-by: Mans Rullgard <mans@mansr.com>
These expressions are equivalent since levels is always odd, and
overflow is impossible due to the constraints set by the assert().
Signed-off-by: Mans Rullgard <mans@mansr.com>
These fields are only used in quantize_mantissas() and reset
on each call, no need to store them in the main context.
Signed-off-by: Mans Rullgard <mans@mansr.com>
This increases the accuracy of coefficients, leading to improved quality.
Rescaling of the coefficients to full 25-bit accuracy is done rather than
offsetting the exponent values. This requires coefficient scaling to be done
before determining the rematrixing strategy. Also, the rematrixing strategy
calculation must use 64-bit math to prevent overflow due to the higher
precision coefficients.
This makes channel coupling more accurate, increasing quality for stereo
content. It also simplifies exponent extraction and mantissa quantization
by no longer needing to apply an offset to the exponents.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>