Commit Graph

31 Commits

Author SHA1 Message Date
Andreas Rheinhardt
465e27e0f2 avcodec/dcahuff: Replace DCAVLC by ordinary VLCs
This is possible now that the offsets are already applied
when creating the VLC.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
3652114596 avcodec/dca_core: Don't use too big max_depth in get_vlc2()
Most of the VLCs used here have a max_depth of two;
some have a max_depth of one. Therefore one can just use two
and avoid the runtime check for whether one should
perform another round of LUT lookup in case the first read
did not read a complete codeword.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
9dbc370769 avcodec/dca_core: Inline number of bits of scale factor VLCs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
597bfff342 avcodec/dcahuff, dca_core, dca_lbr: Apply offset during VLC creation
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
077880ad88 avcodec/dcahuff: Always use three bits for transition mode VLCs
It increases the size of one VLC from two to three bits, thereby
requiring four more VLCEntries (16 bytes .bss), but it allows to
inline the number of bits used when reading them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
8819860f34 avcodec/dca_core, dcahuff: Don't use DCAVLC unnecessarily
The ff_dca_vlc_transition_mode VLCs don't use an offset at all,
so just use ordinary VLCs for them.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-16 18:07:29 +02:00
Andreas Rheinhardt
df215e5758 avcodec/dca_core: Only call emms_c() if needed
It is not needed on x64, because the AV_COPY* and AV_ZERO*
macros never use MMX on x64.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-11 21:08:04 +02:00
Andreas Rheinhardt
d1a5ef4069 avcodec/internal: Move ff_side_data_update_matrix_encoding to decode.h
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 14:14:57 +02:00
Andreas Rheinhardt
66b691f99f avcodec/internal: Move ff_get_buffer() to decode.h
Only used by decoders (encoders have ff_encode_alloc_frame()).

Also clean up the other headers a bit while removing now redundant
internal.h inclusions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-27 14:14:56 +02:00
Andreas Rheinhardt
88f9b1fc45 avcodec/dcadec: Treat the input packet's data as const
A decoder's input packet need not be writable, so we must not modify
the data.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-04 15:03:53 +02:00
Anton Khirnov
b2af4bc807 dca: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:41 -03:00
Andreas Rheinhardt
27f22f3383 all: Remove unnecessary libavcodec/internal.h inclusions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-08 06:16:26 +01:00
Andreas Rheinhardt
3afb41655e avcodec/dca: Unavpriv dca_sample_rates
Said table is 64 bytes long and exported so that it can be used both
in libavcodec and libavformat. This commit stops doing so and instead
duplicates it for shared builds, because the overhead of exporting the
symbol is bigger than 64 bytes. It consists of the length of the name of
the symbol (2x24 bytes), two entries in .dynsym (2x24 bytes), two
entries for symbol version (2x2 bytes), one hash value in the exporting
library (4 bytes) in addition to one entry in the importing library's
.got and .rela.dyn (8 + 24 bytes).
(The above numbers are for a Linux/GNU/Elf system; the numbers for other
platforms may be different.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 13:16:49 +01:00
Andreas Rheinhardt
1be3d8a0cb avcodec/avcodec: Stop including channel_layout.h in avcodec.h
Also include channel_layout.h directly wherever used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 11:14:31 +02:00
foo86
73789b85a7 avcodec/dca_core: always limit frame size to data size
Silences pointless error message when decoding DTS-in-WAV stream with
excessive frame size stored in header.
2017-10-09 16:53:23 +03:00
James Almer
7c9d2ad45f avcodec/dca: remove GetBitContext usage from avpriv_dca_parse_core_frame_header()
This prevents potential ABI issues with GetBitContext.

Reviewed-by: foo86 <foobaz86@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-07-21 12:18:10 -03:00
foo86
012620aa1b avcodec/dca: avoid using bitstream reader in a non-standard way
Use proper get_bits.h functions instead of directly accessing index.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-07-18 21:04:58 -03:00
foo86
902cd30e9b avcodec/dca_core: probe extension headers directly
Avoid using bitstream reader in a non-standard way by directly accessing
index. Use bit shifting/masking operations instead.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-07-18 21:04:58 -03:00
foo86
33fc6c17a6 avcodec/dca_core: switch to common frame header parsing function
Signed-off-by: James Almer <jamrial@gmail.com>
2017-07-18 21:04:56 -03:00
foo86
f6b86b62f7 avcodec/dca: move some enumeration typedefs into headers
These values will be used by the parser. Prefix them with DCA_
appropriately.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-07-18 21:04:55 -03:00
Daniil Cherednik
b8c2b9c392 avcodec/dcaenc: Initial implementation of ADPCM encoding for DCA encoder 2017-05-08 05:56:14 +01:00
Daniil Cherednik
c2500d62c6 dcaenc: Implementation of Huffman codes for DCA encoder
Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2017-01-15 18:17:12 +00:00
foo86
b5cda23039 avcodec/dca: remove useless debug message
Most DTS-in-WAV streams trigger this, making debug output hard to read.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-05-20 14:58:25 -03:00
foo86
b7d267399b avcodec/dca: convert to AVCRC
Signed-off-by: James Almer <jamrial@gmail.com>
2016-05-03 16:40:43 -03:00
foo86
ce2f9fdb0a avcodec/dca: fix sync word search error condition
This didn't actually check if sync word was found and always errored out
with "-err_detect explode" option enabled.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-02 23:26:44 +02:00
foo86
2df7d4fa45 avcodec/dca: move huffman data into separate object file
Signed-off-by: James Almer <jamrial@gmail.com>
2016-05-01 16:50:29 -03:00
foo86
db44b59980 avcodec/dca: clear X96 channels if nothing was decoded
The first X96 channel set can have more channels than core, causing X96
decoding to be skipped. Clear the number of decoded X96 channels to zero
in this rudimentary case.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-06 18:24:20 +01:00
Hendrik Leppkes
5fc310f7ca dca: add emms_c after usage of AV_COPY128
Similar to AV_ZERO128, AV_COPY128 can use MMX instructions in x86
2016-02-02 23:27:30 +01:00
Hendrik Leppkes
0b1972d409 dca: add emms_c after AV_ZERO128 macros
AV_ZERO64/128 can use MMX on x86.

Reviewed-By: James Almer <jamrial@gmail.com>
2016-02-02 20:06:13 +01:00
James Almer
77b5b95247 avcodec/dca_core: rename get_vlc function
Fixes compilation with TRACE enabled

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-02-01 12:11:37 -03:00
foo86
ae5b2c5250 avcodec/dca: add new decoder based on libdcadec 2016-01-31 17:09:38 +01:00