Justin Ruggles
bd2deab706
cosmetics: remove outdated comment that is no longer true
14 years ago
Justin Ruggles
8683c6a638
ac3enc: move ff_ac3_encode_frame() to ac3enc_template.c
...
This avoids using function pointers for quite a few small functions, most of
which just call DSP functions.
14 years ago
Justin Ruggles
7dcdf974d0
ac3enc: Remove bit allocation fallbacks.
...
They introduce too much complexity for very little benefit. The result is that
encoding will be more likely to fail at extremely low bitrates where quality
would be awful anyway.
14 years ago
Justin Ruggles
684f4abfac
ac3enc: remove unneeded local variable in asym_quant()
14 years ago
Justin Ruggles
f21fb76b1b
ac3enc: remove a branch in asym_quant() by doing 2 shifts
14 years ago
Justin Ruggles
0e4dbe2996
ac3enc: avoid masking output in asym_quant() by using signed values for
...
quantized mantissas.
14 years ago
Justin Ruggles
99477adc31
ac3enc: fix allocation of floating point samples.
...
sizeof(SampleType) is different for fixed and float encoders.
14 years ago
Justin Ruggles
38c304addd
ac3enc: remove empty ac3_float function that is never called
14 years ago
Justin Ruggles
e0cc66df61
ac3enc: split templated float vs. fixed functions into a separate file.
...
Function pointers are used for templated functions instead of needlessly
duplicating many functions.
14 years ago
Justin Ruggles
e754dfc0bb
ac3enc: dynamically allocate AC3EncodeContext fields windowed_samples and mdct
...
This will allow the same struct to be used for both the fixed and float ac3
encoders.
14 years ago
Justin Ruggles
36151b3e31
ac3enc: use function pointer to choose between AC-3 and E-AC-3 header output
...
functions.
14 years ago
Diego Biurrun
d3778972d8
ac3enc: Fix linking of AC-3 encoder without the E-AC-3 encoder.
...
The AC-3 encoder unconditionally references some symbols from the E-AC-3
encoder; make those references conditional to fix linking.
14 years ago
Justin Ruggles
c8e9ea43d0
Move E-AC-3 encoder functions to a separate eac3enc.c file.
14 years ago
Justin Ruggles
787a13535a
ac3enc: remove convenience macro, #define DEBUG
14 years ago
Justin Ruggles
a8bd53402a
ac3enc: remove unused #define
14 years ago
Justin Ruggles
35d5cb1ab4
ac3enc: extract all exponents for the frame at once
14 years ago
Mans Rullgard
90da52f01f
ac3enc: fix LOCAL_ALIGNED usage in count_mantissa_bits()
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Justin Ruggles
6ca23db9cc
ac3enc: modify mantissa bit counting to keep bap counts for all values of bap
...
instead of just 0 to 4.
This does all the actual bit counting as a final step.
14 years ago
Justin Ruggles
1323828a0f
ac3enc: split mantissa bit counting into a separate function.
...
No speed difference. This is to allow for more flexible bit counting.
14 years ago
Justin Ruggles
7743865ffc
ac3enc: store per-block/channel bap pointers by reference block in a 2D array
...
rather than in the AC3Block struct.
This will make it easier to access the bap values without having to chase
the reference block pointers each time.
14 years ago
Mans Rullgard
7f7726c7a2
ac3enc: use LOCAL_ALIGNED macro
...
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>
14 years ago
Justin Ruggles
1a950da6a2
cosmetics: indentation and alignment after previous commit
14 years ago
Justin Ruggles
aa47c35dff
ac3enc: add support for E-AC-3 encoding.
...
This adds basic stream format support and allows for arbitrary bit rates
rather than just those supported in AC-3.
14 years ago
Justin Ruggles
b1bf8c7887
ac3enc: Move AC-3 AVOptions array to a separate file to make it easier to
...
use only selected options for the different AC-3 encoder types.
14 years ago
Justin Ruggles
478455d66b
ac3enc: initialize all coefficients to zero.
...
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.
14 years ago
Justin Ruggles
7f3a7b5c40
ac3enc: add channel coupling support
...
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.
14 years ago
Justin Ruggles
4d7a421574
ac3enc: put the counting of stereo rematrixing bits in the same place to
...
make the code easier to understand.
14 years ago
Justin Ruggles
257de756fb
ac3enc: clean up count_frame_bits() and count_frame_bits_fixed()
14 years ago
Anton Khirnov
b66752790a
AVOptions: make default_val a union, as proposed in AVOption2.
...
This breaks API and ABI.
14 years ago
Alex Converse
1a5e4fd8c5
Replace strncpy() with av_strlcpy().
14 years ago
Justin Ruggles
177fed4e9b
ac3enc: do not store a bandwidth code for each channel.
...
Although AC-3 allows it, it's not very useful. The encoder uses the same code
for all full-bandwidth channels.
14 years ago
Justin Ruggles
a1d0f511fc
ac3enc: remove bandwidth reduction as fallback for bit allocation failure.
...
It was only needed at low bitrates, which now already use a low bandwidth, so
the bandwidth reduction is no longer needed.
14 years ago
Justin Ruggles
ba6bce5140
ac3enc: merge compute_exp_strategy_ch() into compute_exp_strategy()
14 years ago
Justin Ruggles
4142487d1c
ac3enc: return error if frame+exponent bits are too large instead of using
...
av_assert2().
This can occur in some very rare cases with low bitrates.
14 years ago
Justin Ruggles
987fe2dc55
ac3enc: differentiate between current block and reference block in bit_alloc()
14 years ago
Justin Ruggles
6b2636bba6
ac3enc: simplify exponent_init() by calculating exponent_group_tab[] based
...
on exponent group sizes.
14 years ago
Justin Ruggles
e0b33d479c
ac3enc: simplify stereo rematrixing decision options
14 years ago
Anton Khirnov
85770f2a26
AVOptions: make default_val a union, as proposed in AVOption2.
...
This breaks API and ABI.
14 years ago
Justin Ruggles
8745e9c458
ac3enc: remove check for mismatching channels and channel_layout
14 years ago
Vitor Sessak
9d35fa520e
Add AVX FFT implementation.
...
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
14 years ago
Michael Niedermayer
1aeb88b77d
Correctly implement ac3 float/fixed encoder.
...
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>
14 years ago
Mans Rullgard
2310ee4b1c
ac3enc: move extract_exponents inner loop to ac3dsp
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Justin Ruggles
e05a3ac713
ac3enc: select bandwidth based on bit rate, sample rate, and number of
...
full-bandwidth channels.
This reduces high-frequency artifacts and improves the quality of the lower
frequency audio at low bit rates.
14 years ago
Mans Rullgard
79997def65
ac3enc: use generic fixed-point mdct
...
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>
14 years ago
Mans Rullgard
7f6e05cdfd
ac3enc: simplify sym_quant()
...
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>
14 years ago
Mans Rullgard
52fd16a264
ac3enc: move compute_mantissa_size() to ac3dsp
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Mans Rullgard
6f718471ea
ac3enc: move mant*_cnt and qmant*_ptr out of AC3EncodeContext
...
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>
14 years ago
Mans Rullgard
6d9f52b2cd
ac3: move ff_ac3_bit_alloc_calc_bap to ac3dsp
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Justin Ruggles
c4549bd66a
ac3enc: avoid memcpy() of exponents and baps in EXP_REUSE case by using
...
exponent reference blocks.
14 years ago
Justin Ruggles
991f3de1bb
ac3enc: Add codec-specific options for writing AC-3 metadata.
14 years ago