summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/mpegvideo: Don't zero-initialize unnecessarilyAndreas Rheinhardt2020-12-31
| | | | | | | mbintra_table will be memset to 1 a few lines after its allocation. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/aacsbr_template: Remove pointless runtime initializationAndreas Rheinhardt2020-12-31
| | | | | | | | | | | | | | | | | The sbr_qmf_window_us array is basically symmetric around its middle element and therefore the latter half is currently initialized from the first half at runtime. Yet because the first half is initialized, the array can't be placed in .bss at all, so that one gains nothing from not already initializing the whole array statically. Therefore this commit does exactly this. (There are two exceptions to the symmetry: Elements 384 and 512 are the negations of their mirror element; for the fixed-point decoder, Q31(-x) does not equal -Q31(x). In order to keep the array exactly the same, the latter form has been used for these two elements.) Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/aacsbr: Remove remnants of tablegenAndreas Rheinhardt2020-12-31
| | | | | | | | These tables are always initialized at runtime since commit cb93df0dcbd34107c64ec053504fa294b728a9c9. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac3plus_data: Mark array as constAndreas Rheinhardt2020-12-31
| | | | | | | Forgotten in a7dbeb77c3c30ac4904928978938b209ff6e1ab1. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mlpenc: Simplify finding best codebookAndreas Rheinhardt2020-12-31
| | | | | | | | | | | | Finding the best codebook involves comparing different paths, where each path is a sequence of several decisions (namely which codebook to use). Up until now, these sequence was encoded in a NUL-terminated string and the actual decisions were encoded as ’\0'..'\3' (which encoded 0..3). This commit modifies this to actually encode it via 0..3 by switching away from a C-string to a simple array with an explicit length field. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/opusdec: Remove always-true checkAndreas Rheinhardt2020-12-31
| | | | | | | | The celt_delay AVAudioFifo is always allocated during init, so checking for its existence in .flush is unnecessary. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/opustab: Make array staticAndreas Rheinhardt2020-12-31
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/motion_est, mpegvideo: Make pointers to static storage constAndreas Rheinhardt2020-12-31
| | | | | | | | | Modifying static storage must not happen because of multithreading (except initialization of course), so add const to the pointed-to type for pointers that point to static storage. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* configure, libavcodec/speedhq: Fix compiling SpeedHQ encoderAndreas Rheinhardt2020-12-31
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegvideo: Merge ff_mpv_decode_defaults into ff_mpv_decode_initAndreas Rheinhardt2020-12-31
| | | | | | | | | | | | | These two are always called directly after each other (with the exception of the calls in mpeg_decode_init() where some irrelevant modifications of the avctx (which could just as well be done before ff_mpv_decode_defaults(), because it doesn't have a pointer to the AVCodecContext at all and therefore can't see these modifications at all) are performed in between), so merge ff_mpv_decode_defaults() in ff_mpv_decode_init(). Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/h261dec: Don't use too big max_depth in get_vlc2()Andreas Rheinhardt2020-12-31
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/speedhq: Remove castAndreas Rheinhardt2020-12-31
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg12: ReindentationAndreas Rheinhardt2020-12-31
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg12: Make initializing VLCs thread-safeAndreas Rheinhardt2020-12-31
| | | | | | | | | This automatically makes the eamad, eatqi, ipu and mdec decoders init-threadsafe; in addition to the actual mpeg[12]video decoders, of course. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg12: Don't initialize encoder-only parts of RLTableAndreas Rheinhardt2020-12-31
| | | | | | | | | | | ff_mpeg12_init_vlcs() currently initializes index_run, max_level and max_run of ff_rl_mpeg1/2; yet the only user of these fields is the MPEG-1/2 encoder which already initializes these tables on its own. So remove the initializations in ff_mpeg12_init_vlcs(); this also simplifies making ff_mpeg12_init_vlcs() thread-safe. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/rl: Remove nonstatic storage of RL tablesAndreas Rheinhardt2020-12-31
| | | | | | | | ff_rl_free() was added in 324e50ee95929a9491b855c5e15451145bd5d1ec, but never used; nonstatic storage was not used long before that. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/codec_desc: describe AV_CODEC_ID_MPEG2TSAman Karmani2020-12-28
| | | | Signed-off-by: Aman Karmani <aman@tmm1.net>
* avcodec/tiff: Disallow striped and tiled tiffs except for DNGMichael Niedermayer2020-12-28
| | | | | | | | | | | | | | strips + tiles is not allowed in TIFF DNG uses a separate codepath Regression since da5b3d002862d1e105002a6dc1567e6551860896. Fixes: NULL pointer dereference Fixes: poc1 Fixes: Ticket8960 Found-by: 1vanChen of NSFOCUS Security Team Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/cfhd: properly handle midstream size changes for transform type 2Paul B Mahol2020-12-25
|
* avcodec/ffv1dec: Fix off by 1 error with quant tablesMichael Niedermayer2020-12-22
| | | | | | | | | Fixes: assertion failure Fixes: 28447/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-5369575948550144 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/fastaudio: Fix invalid shift exponentMichael Niedermayer2020-12-19
| | | | | | | | Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int' Fixes: 25434/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FASTAUDIO_fuzzer-6252363168612352 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: Check bitrate for overflow in get_bit_rate()Michael Niedermayer2020-12-19
| | | | | | | | Fixes: signed integer overflow: 617890810133996544 * 16 cannot be represented in type 'long' Fixes: 26565/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5092054700654592 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevc_ps: Change scaling_list_dc_coef to 8 bitMichael Niedermayer2020-12-19
| | | | | Suggested-by: James Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevc_ps: check scaling_list_dc_coefMichael Niedermayer2020-12-19
| | | | | | | | | Fixes: signed integer overflow: 2147483640 + 8 cannot be represented in type 'int' Fixes: 28449/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5686013259284480 Reviewed-by: James Almer <jamrial@gmail.com> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/dpx: fix use of uninitialised valueJames Almer2020-12-18
| | | | | | | Found by Valgrind. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_sei: return the correct error code on User Data Registered ↵James Almer2020-12-18
| | | | | | parsing failure Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_sei: print a log message when a unsupported ITU-T T35 SEI ↵James Almer2020-12-18
| | | | | | messages is parsed Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevc_sei: refactor parsing User Data Registered ITU-T T35 SEI messagesJames Almer2020-12-18
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h264_sei: print a log message when a unsupported ITU-T T35 SEI ↵James Almer2020-12-18
| | | | | | messages is parsed Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h264_sei: refactor parsing User Data Registered ITU-T T35 SEI messagesJames Almer2020-12-18
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/dpx: Fix B&W film scans from Lasergraphics IncHarry Mallon2020-12-17
| | | | Signed-off-by: Harry Mallon <harry.mallon@codex.online>
* avcodec/dpx: Read color information from DPX headerHarry Mallon2020-12-17
| | | | Signed-off-by: Harry Mallon <harry.mallon@codex.online>
* avcodec/dpx: Report color_range from DPX headerHarry Mallon2020-12-17
| | | | Signed-off-by: Harry Mallon <harry.mallon@codex.online>
* avcodec/dpx: Read SMPTE timecode from DPXHarry Mallon2020-12-17
| | | | Signed-off-by: Harry Mallon <harry.mallon@codex.online>
* avcodec/dpx: Read alternative frame rate from television headerHarry Mallon2020-12-17
| | | | Signed-off-by: Harry Mallon <harry.mallon@codex.online>
* avcodec/av1dec: support exporting Film Grain params as frame side dataJames Almer2020-12-16
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cuviddec: unref output frame on failureJames Almer2020-12-13
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cuviddec: check for av_buffer_ref() failureJames Almer2020-12-13
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/libdav1d: stop setting AVFrame->best_effort_timestampJames Almer2020-12-13
| | | | | | It's now set by the generic decode code. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mjpegdec: stop setting AVFrame->best_effort_timestampJames Almer2020-12-13
| | | | | | It's now set by the generic decode code. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/decode: set best_effort_timestamp on output frames for all decodersJames Almer2020-12-13
| | | | | | | | | Fixes a decoding regression introduced by e9a2a87773, and as a side effect also fixes bogus values set to certain audio frames that had some samples discarded, where the offsets added to pts, pkt_dts and pkt_duration were not reflected in best_effort_timestamp. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/speedhqenc: Call correct functionAndreas Rheinhardt2020-12-11
| | | | | | | | | | | | | | | | | | | Up until now, the SpeedHQ encoder called a wrong function for init: void ff_init_uni_ac_vlc(const uint8_t huff_size_ac[256], uint8_t *uni_ac_vlc_len); Yet the first argument actually used is of type RLTable; the size of said struct is less than 256 if the size of a pointer is four, leading to an access beyond the end of the RLTable. This commit fixes this by calling the actually intended function: init_uni_ac_vlc() from mpeg12enc.c. It was intended to use this function [1], yet doing so was forgotten when the patch was actually applied. [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-July/266187.html Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: set AV_CODEC_CAP_CHANNEL_CONF on decoders which set their own channelsHendrik Leppkes2020-12-10
| | | | | | | | | | | | The decoders in this set either have a fixed channel count, or read it from the bitstream, and thus do not require the channel count as external information. Fixes various regressions since 81503ac58a763a36b1f57264013b1e76acb62b68, which requires a valid channel count for decoders which do not set this capability. Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
* smvjpegdec: merge into mjpegdecAnton Khirnov2020-12-10
| | | | | | | | | | | | | | | | | | | | | | | SMVJPEG stores frames as slices of a big JPEG image. The decoder is implemented as a wrapper that instantiates a full internal MJPEG decoder, then forwards the decoded frames with offset data pointers. This is unnecessarily complex and fragile, not supporting useful decoder capabilities like direct rendering. Re-implement the decoder inside the MJPEG decoder, which is accomplished by returning each decoded frame multiple times, setting cropping information appropriately on each instance. One peculiar aspect of the previous design is that since - the smvjpeg decoder returns one frame per input packet - there are multiple frames in each packets (the aformentioned slices) the demuxer needs to return each packet multiple times. This is now also eliminated - the demuxer now returns each packet exactly once, with the duration set to the number of frames it decodes to. This also removes one of the last remaining internal uses of the old video decoding API.
* mjpegdec: convert to receive_frame()Anton Khirnov2020-12-10
| | | | This will be useful in the following commit.
* codec_desc: add SMVJPEG flagsAnton Khirnov2020-12-10
| | | | Same flags as MJPEG, as it's essentially the same codec.
* avcodec/hevcdec: dynamic allocate sList and HEVClcListNuo Mi2020-12-10
| | | | | | | | | following comandline will crash the ffmpeg ffmpeg -threads 17 -thread_type slice -i WPP_A_ericsson_MAIN_2.bit out.yuv -y the HEVCContext->sList size is MAX_NB_THREADS(16), any > 16 thread number will crash the application Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avcodec/snow: Use ff_thread_once() in ff_snow_common_init()Andreas Rheinhardt2020-12-10
| | | | | | | | | | | | ff_snow_common_init() currently initializes static data every time it is invoked; given that both the Snow encoder and decoder have the FF_CODEC_CAP_INIT_THREADSAFE flag set, this can lead to data races (and therefore undefined behaviour) even though all threads write the same values. This commit fixes this by using ff_thread_once() for the initializations. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/idcinvideo: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-10
| | | | | Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cinepak: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-10
| | | | | Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>