summaryrefslogtreecommitdiff
path: root/libavcodec/atrac3plus.c
Commit message (Collapse)AuthorAge
* avcodec/atrac3plus: Run-length encode length tables to make them smallerAndreas Rheinhardt2020-12-08
| | | | | | | | | | | | | | | | | This is very beneficial for the scale factor tables where 4*64+4*15 bytes of length information can be replaced by eight codebooks of 12 bytes each; furthermore the number of codes as well as the maximum length of a code can be easily derived from said codebooks, making tables containing said information superfluous. This and combining the symbols into one big array also made an array of pointers to the tables redundant. For the wordlen and code table tables the benefits are not that big (given these tables don't contain that many elements), but all in all using codebooks is also advantageouos for them. Therefore it has been done. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac3plus: Combine codebooks into one arrayAndreas Rheinhardt2020-12-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | ATRAC3+ uses VLCs whose code lengths are ascending from left to right in the tree; ergo it is possible (and done) to run-length encode the lengths into so-called codebooks. These codebooks were variable-sized: The first byte contained the minimum length of a code, the second the maximum length; this was followed by max - min + 1 bytes containing the actual numbers. The minimal min was 1, the maximal max 12. While one saves a few bytes by only containing the range that is actually used, this is more than offset by the fact that there needs to be a pointer to each of these codebooks. Furthermore, since 5f8de7b74147e2a347481d7bc900ebecba6f340f the content of the Atrac3pSpecCodeTab structure (containing data for spectrum decoding) can be cleanly separated into fields that are only used during initialization and fields used during actual decoding: The pointers to the codebooks and the field indicating whether an earlier codebook should be reused constitute the former category. Therefore the new codebooks are not placed into the Atrac3pSpecCodeTab (which is now unused during init), but in an array of its own. The information whether an earlier codebook should be reused is encoded in the first number of each spectrum codebook: If it is negative, an earlier codebook (given by the number) should be reused. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac3plus: Combine symbols tablesAndreas Rheinhardt2020-12-08
| | | | | | | | | This allows to remove lots of pointers (130) to small symbol tables; it has the downside that some of the default tables must now be coded explicitly, but this costs only 6 + 4 + 8 + 16 + 8 bytes and is therefore dwarfed by the gains. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac3plus: Simplify getting offset of VLC in VLC_TYPE bufAndreas Rheinhardt2020-12-08
| | | | | | | The earlier code used several different offset parameters that were initialized to magic values. This is unnecessary. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac3plus: Make tables used to initialize VLCs smallerAndreas Rheinhardt2020-12-08
| | | | | | | | | | | | | | | | | The ATRAC3+ decoder currently uses ff_init_vlc_sparse() to initialize several VLCs; sometimes a symbols table is used, sometimes not; some of the codes tables are uint16_t, some are uint8_t. Because of these two latter facts it makes sense to switch to ff_init_vlc_from_lengths() because it allows to remove the codes at the cost of adding symbols tables of type uint8_t in the cases where there were none before. Notice that sometimes the same codes and lengths tables were reused with two different symbols tables; this could have been preserved (meaning one could use a lengths table twice), but hasn't, because this allows to use only one pointer to both the symbols and lengths instead of two pointers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac3plus: Simplify creating VLCsAndreas Rheinhardt2020-12-08
| | | | | | Use ff_init_vlc_from_lengths() to offload the computation of the codes. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac3plus: Perform reusing of VLCs during initAndreas Rheinhardt2020-10-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac3plus: Check split point in fill mode 3Michael Niedermayer2019-11-09
| | | | | | | | Fixes: index 32 out of bounds for type 'int [32]' Fixes: 18350/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC3P_fuzzer-5643794862571520 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec: Reduce the size of some arraysAndreas Rheinhardt2019-06-20
| | | | | | | | | | This commit uses smaller types for some static const arrays to reduce their size in case the entries can be represented in the smaller type. The biggest savings came from inv_map_table in vp9.c. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3'James Almer2017-09-26
|\ | | | | | | | | | | | | * commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3': Mark some arrays that never change as const. Merged-by: James Almer <jamrial@gmail.com>
| * Mark some arrays that never change as const.Anton Khirnov2017-02-01
| |
| * atrac3plus: Convert to the new bitstream readerAlexandra Hájková2016-11-18
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * lavc: Use get_bitsz where neededAndreas Cadhalpun2016-01-11
| | | | | | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | lavc: use get_bitsz to simplify the codeAndreas Cadhalpun2016-01-03
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* | atrac3plus: give the phase_shift flag a better name.Max Poliakovski2015-06-08
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | atrac3plus: add support for GHA phase inversion.Max Poliakovski2015-06-08
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec: use av_mod_uintp2() where usefulJames Almer2015-04-21
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: James Almer <jamrial@gmail.com>
* | Merge commit 'd16ec1b6db25bc348b0d4800c9a0c9b7070e3710'Michael Niedermayer2014-11-15
|\| | | | | | | | | | | | | | | | | | | | | * commit 'd16ec1b6db25bc348b0d4800c9a0c9b7070e3710': atrac3plus: always initialize refwaves The initialization is not needed, the array is never read before being written to. Its merged anyway for robustness in respect to future changes Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * atrac3plus: always initialize refwavesVittorio Giovara2014-11-14
| | | | | | | | | | CC: libav-stable@libav.org Bug-Id: CID 1163851
* | Add missing "const" all over the place.Reimar Döffinger2014-08-29
| | | | | | | | | | | | Only "./configure --enable-gpl" on x86 was tested. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2014-01-09
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: ATRAC3+ decoder Conflicts: Changelog configure libavcodec/atrac3plus.c libavcodec/atrac3plus.h libavcodec/atrac3plus_data.h libavcodec/atrac3plusdec.c libavcodec/atrac3plusdsp.c libavcodec/version.h See: 2e1fb96af36348479e14aa85f445915ea09e70fa Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * ATRAC3+ decoderMaxim Polijakowski2014-01-09
| | | | | | Cleanup by Diego Biurrun. Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
* atrac3plus: Add forgotten initialization of an internal structMaxim Poliakovski2014-01-02
| | | | | | This patch also fixes trac ticket 3254. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* ATRAC+ decoderMaxim Poliakovski2013-12-29
Cleanup by Diego Biurrun. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>