summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* lavc: un-avpriv avpriv_bprint_to_extradata()Anton Khirnov2020-10-28
| | | | | | It has not been used outside of lavc since 6f69f7a8bf6. Also, move it to the only place where it is used.
* put_bits: make avpriv_copy_bits() lavc-localAnton Khirnov2020-10-28
| | | | | It is not used outside of lavc anymore. Keep the avpriv exported symbol around until the next bump to preserve ABI compatibility.
* put_bits: make avpriv_put_string() lavc-localAnton Khirnov2020-10-28
| | | | | It has not been used outside of libavcodec since 20f325f320c6e18ee88983870d2a1fee94257293
* put_bits: make avpriv_align_put_bits() inlineAnton Khirnov2020-10-28
| | | | | | | | | This function is so extremely simple that it is preferable to make it inline rather than deal with all the complications arising from it being an exported symbol. Keep avpriv_align_put_bits() around until the next major bump to preserve ABI compatibility.
* avcodec/bitstream: Stop allocating one VLCcode more than neededAndreas Rheinhardt2020-10-28
| | | | | | | | | Allocating one temporary entry more than needed was made necessary by the COPY loop below writing an element before having checked that it should be written at all. But given that this behaviour changed, the need for overallocating is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/bitstream: Check code length before truncating to uint8_tAndreas Rheinhardt2020-10-28
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/hevcdec: constrained intra predict, do not check top left IS_INTRA ↵Xu Guangxin2020-10-28
| | | | | | | | | | | | | | if it's not available fix ticket: 8932 For poc 2, we have tile boundary at x = 640. When we predict cu(640,912),the top left pixel is not avaliable to the cu. So, we can not check it's intra or not. We need set top[-1] = top[0] directly. see 8.4.4.2.1 for details Signed-off-by: Xu Guangxin <oddstone@gmail.com> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* avcodec/webp: Replace never-true check by assertAndreas Rheinhardt2020-10-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/webp: Return directly when creating Huff table failsAndreas Rheinhardt2020-10-27
| | | | | | | Neither the auxiliary VLC table nor the code_lengths array need to be freed if creating the auxiliary VLC table fails. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/webp: Use uint8_t for code lengthsAndreas Rheinhardt2020-10-27
| | | | | | | | | | They are always in the range 0..15, so using an int is not necessary. Furthermore, using an int would not work if sizeof(int) != 4 as ff_init_vlc_sparse() can only handle uint8_t, uint16_t and uint32_t lengths. Reviewed-by: zhilizhao(赵志立) <quinkblack@foxmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/bitstream: Consistently treat symbol as VLC_TYPEAndreas Rheinhardt2020-10-27
| | | | | | | | | | | | | If a static VLC table gets initialized a second time (or concurrently by two threads) and if said VLC table uses symbols that have the sign bit of VLC_TYPE (a typedef for int16_t) set, initializing the VLC fails. The reason is that the type of the symbol in the temporary array is an uint16_t and so comparing it to the symbol read from the VLC table will fail, because only the lower 16bits coincide. Said failure triggers an assert. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg4videodec: Don't check for errors for complete VLCsAndreas Rheinhardt2020-10-27
| | | | 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/atrac3: Use least max_depth for get_vlc2()Andreas Rheinhardt2020-10-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac3: Inline constantsAndreas Rheinhardt2020-10-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac3: Don't use too big VLC tablesAndreas Rheinhardt2020-10-27
| | | | | | | | | The longest code of any of the VLC tables used is eight bits long, so using nine bits long VLC tables is wasteful. Furthermore, there are only seven VLC tables used, yet the code up until now made it look like there should be eight. This has been corrected, too. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/av1dec: Check for unset obu instead of crashingMichael Niedermayer2020-10-26
| | | | | | | | | Fixes: NULL pointer dereference Fixes: 26550/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5417762807349248 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/dirac_parser: do not offset AV_NOPTS_OFFSETMichael Niedermayer2020-10-26
| | | | | | | | | Fixes: signed integer overflow: -9223372036854775807 - 48000 cannot be represented in type 'long long' Fixes: 26521/clusterfuzz-testcase-minimized-ffmpeg_dem_DIRAC_fuzzer-5635536506847232 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mobiclip: Use smaller type for codesAndreas Rheinhardt2020-10-26
| | | | | | | | | Even though the length of these codes is > 8, only the lowest seven bits are ever set (because the long codes are on the left of the tree), so one can use an uint8_t for them, saving space. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mobiclip: Use static VLC tablesAndreas Rheinhardt2020-10-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mobiclip: Don't use too big max_depth, inline constantsAndreas Rheinhardt2020-10-26
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mobiclip: Don't check for errors for complete VLCsAndreas Rheinhardt2020-10-26
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mobiclip: Reduce size of VLCs, inline constantsAndreas Rheinhardt2020-10-26
| | | | | | | | | The longest motion vector VLC for mobiclip is six bits long, so using eight bits for the VLC table is wasteful. Furthermore, the length can be inlined. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/rv34: Simplify getting right VLCAndreas Rheinhardt2020-10-26
| | | | | | | | | | | For both RealVideo 3.0 as well as RealVideo 4.0 the VLC table to use depends upon the slice's quantization parameter; these are coded on five bits in the bitstream and are therefore in the range of 0..31; yet the last element here is not valid and therefore the quantizer is clipped to the range 0..30 to get the index. But this is unnecessary: One can just add one element more to the relevant array to avoid the clipping. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/rv34: Don't needlessly copy VLC length and symbol arraysAndreas Rheinhardt2020-10-26
| | | | | | | | | | | | | | | | | | | | | | | Most of the VLCs used by RealVideo 3 and 4 obey three simple rules: Shorter codes are on the left of the tree, for each length, the symbols are ascending from left to right and the symbols either form a permutation of 1..size or 0..(size - 1). For the latter case, one just needs to store the length of each symbol and create the codes according to the other rules; no explicit code or symbol array must be stored. The former case is also treated in much the same way by artificially assigning a length of zero to the symbol 0; when a length of zero was encountered, the element was ignored except that the symbol counter was still incremented. If the length was nonzero, the symbol would be assigned via the symbol counter and the length copied over into a new array. Yet this is unnecessary, as ff_init_vlc_sparse() follows exactly the same pattern: If a length of zero is encountered, the element is ignored and only the symbol counter incremented. So one can directly forward the length array and also need not create a symbol table oneself, because ff_init_vlc_sparse() will infer the same symbol table in this case. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp3: Make parsing Theora Huffman tables more spec-compliantAndreas Rheinhardt2020-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Theora allows to use custom Huffman tables which are coded in the bitstream as a tree: Whether the next node is a leaf or not is coded in a bit; each node itself contains a five bit token. Each tree can contain at most 32 leafs; typically they contain exactly 32 with the 32 symbols forming a permutation of 0..31. Yet the standard does not impose either of these requirements. It explicitly allows less than 32 leafs and multiple codes with the same token. But our decoder used an algorithm that required the codes->token mapping to be injective and that also presumed that there be at least two leafs: Instead of using an array for codes, tokens and code lengths, the decoder only had arrays for codes and code lengths. The code and length for a given token were stored in entry[token]. As no symbols table was used when initializing the VLC, the default one applied and therefore the entry[token] got the symbol token (if the length of said entry is >0). Yet if multiple codes had the same token, the codes and lengths from the later token would overwrite the earlier codes and lengths. Furthermore, less than 32 leafs could also lead to problems: Namely if this was not the first time Huffman tables have been parsed in which case the array is not zeroed initially so that old entries could make the new table invalid. libtheora seems to always use 32 leafs and no duplicate tokens; I am not aware of any existing valid files that do not. This is fixed by using a codes, symbols and lengths array when initializing the VLC. In order to reduce the amount of stuff kept in the context only the symbols and lengths (which both fit into an uint8_t) are kept in the context; the codes are derived from the lengths immediately before creating the tables. There is now only one thing left which is not spec-compliant: Trees with only one node (which has length zero) are not supported by ff_init_vlc_sparse() yet. Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/adpcm_ima_cunning: document origin of tablesZane van Iperen2020-10-26
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec: add adpcm_ima_alp encoderZane van Iperen2020-10-25
|
* avcodec/pgxdec: Check depth more completelyMichael Niedermayer2020-10-25
| | | | | | | | | Fixes: shift exponent -1 is negative Fixes: 26107/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGX_fuzzer-5378790047612928 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp9dsp_template: Fix some overflows in iadst8_1d()Michael Niedermayer2020-10-24
| | | | | | | | Fixes: signed integer overflow: 190587 * 11585 cannot be represented in type 'int' Fixes: 26407/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-5086348408782848 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/fits: Check bscaleMichael Niedermayer2020-10-24
| | | | | | | | Fixes: division by 0 Fixes: 26208/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-6270472117026816 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mpeg4videodec: Use smallest max_depth in get_vlc2()Andreas Rheinhardt2020-10-24
| | | | | | | The longest code here is 12 bits long and can be read in two attempts. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/imc: Inline constantsAndreas Rheinhardt2020-10-24
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/magicyuv: Check slice size before reading flags and predMichael Niedermayer2020-10-24
| | | | | | | | | Fixes: heap-buffer-overflow Fixes: 26487/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MAGICYUV_fuzzer-5742553675333632 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wmadec: Don't check for errors for complete VLC tablesAndreas Rheinhardt2020-10-23
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/wma: Remove unused arrayAndreas Rheinhardt2020-10-23
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/nvenc: removed unused and deprecated fieldTimo Rothenpieler2020-10-21
|
* avcodec/nvenc: reduce automated use of deprecated modesTimo Rothenpieler2020-10-21
|
* avcodec/nvenc: mark newly deprecated rc modesTimo Rothenpieler2020-10-21
|
* avcodec/nvenc: use alias to provide deprecated profilesTimo Rothenpieler2020-10-21
|
* avcodec/on2avc: Remove redundant code for freeingAndreas Rheinhardt2020-10-21
| | | | | | This decoder has the FF_CODEC_CAP_INIT_CLEANUP set. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/on2avc: Use least max_depth for get_vlc2()Andreas Rheinhardt2020-10-21
| | | | | | | | The longest codes of any VLC codebooks are 18 bits long and the VLC tables itself use 9 bits; therefore it is sufficient to read twice from the table, yet this has been done thrice. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/on2avc: Unify initializing quad and pair VLCsAndreas Rheinhardt2020-10-21
| | | | | | | | | | | | Up until now, quad VLCs are initialized with codes of type uint32_t, pair VLCs with codes of type uint16_t. There were two separate loops in the decoder's init function for each type of VLC. This commit unifies this: The type of the codes are now passed in as void * and the actual size of the codes is obtained from a table. This approach also allows to use the smallest type for each VLC code table: some quad tables actually fitted in uint16_t. This allows to remove about 7KB from the binary. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/on2avcdata: Deduplicate symbol tablesAndreas Rheinhardt2020-10-21
| | | | | | Saves about 10KB. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp3: Unify initializing and freeing VLC tablesAndreas Rheinhardt2020-10-21
| | | | | Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp3: Check allocations of VLCsAndreas Rheinhardt2020-10-21
| | | | | | | It would lead to crashs lateron if they failed. Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp3: Fix memleak upon init failureAndreas Rheinhardt2020-10-21
| | | | | | | | | | Up until now, there was no cleanup in case initializing the Theora VLC tables failed, leading to memleaks. This commit gets rid of them by setting the FF_CODEC_CAP_INIT_CLEANUP flag for all decoders in vp3.c; this also allows to remove some (now redundant) cleanup code. Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/adpcm_swf: support custom block size for encodingZane van Iperen2020-10-21
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcm_swf: set block_align when encodingZane van Iperen2020-10-21
| | | | | | Allows it to be muxed to WAVs. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcm_swf: support decoding multiple fixed-sized blocks at onceZane van Iperen2020-10-21
| | | | | | For incoming packets from WAV. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>