summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/hevc_sei: add support for HDR10+ metadataMohammad Izadi2020-12-05
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/av1dec: Fix leak in case of failureAndreas Rheinhardt2020-12-05
| | | | | | | | | | | | | A reference to an AV1RawFrameHeader and consequently the AV1RawFrameHeader itself and everything it has a reference to leak if the hardware has no AV1 decoding capabilities or if some other error happens. It happens e.g. in the cbs-av1-av1-1-b8-02-allintra FATE-test; it has just been masked because the return value of ffmpeg (which indicates failure when using Valgrind or ASAN) is ignored when doing tests of type md5. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cdgraphics: Check frame before clearingMichael Niedermayer2020-12-05
| | | | | | | | | Fixes: null pointer dereference Fixes: 27730/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDGRAPHICS_fuzzer-6212402236096512 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffwavesynth: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/utils: Remove ff_codec_open2_recursive()Andreas Rheinhardt2020-12-04
| | | | | | | | | | | | | | | This function existed to enable codecs with non-threadsafe init functions to initialize other codecs despite the fact that normally no two codecs with non-threadsafe init functions can be initialized at the same time (there is a mutex guarding this). Yet there are no users of this function any more as all users have been made thread-safe (switching away from ff_codec_open2_recursive() was required for this as said function requires the caller to hold the lock to the mutex guarding the initializations and this is only true for codecs with the FF_CODEC_CAP_INIT_THREADSAFE flag unset); so remove it. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/tiff: Make decoder init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | | | | | | | | | | The only thing that stands in the way of adding the FF_CODEC_CAP_INIT_THREADSAFE flag to the TIFF decoder is its usage of ff_codec_open2_recursive(): This function requires its caller to hold the lock for the mutex that guards initialization of AVCodecContexts whose codecs have a non-threadsafe init function and only callers whose codec does not have the FF_CODEC_CAP_INIT_THREADSAFE flag set hold said lock (the others don't need to care about said lock). But one can set the flag if one switches to avcodec_open2() at the same time. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/faxcompr: Make ff_ccitt_unpack_init() thread-safeAndreas Rheinhardt2020-12-04
| | | | | | | This will allow to make the TIFF decoder's init function thread-safe. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/smvjpegdec: Make decoder init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | | | | | | | | | The only thing that stands in the way of adding the FF_CODEC_CAP_INIT_THREADSAFE flag to the SMV JPEG decoder is its usage of ff_codec_open2_recursive(): This function requires its caller to hold the lock for the mutex that guards initialization of AVCodecContexts whose codecs have a non-threadsafe init function and only callers whose codec does not have the FF_CODEC_CAP_INIT_THREADSAFE flag set hold said lock (the others don't need to care about said lock). But one can set the flag if one switches to avcodec_open2() at the same time. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cri: Make decoder init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | | | | | | | | | | The only thing that stands in the way of adding the FF_CODEC_CAP_INIT_THREADSAFE flag to the Cintel RAW decoder is its usage of ff_codec_open2_recursive(): This function requires its caller to hold the lock for the mutex that guards initialization of AVCodecContexts whose codecs have a non-threadsafe init function and only callers whose codec does not have the FF_CODEC_CAP_INIT_THREADSAFE flag set hold said lock (the others don't need to care about said lock). But one can set the flag if one switches to avcodec_open2() at the same time. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: Fix invalid uses of ff_codec_open2_recursive()Andreas Rheinhardt2020-12-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally no two codecs with FF_CODEC_CAP_INIT_THREADSAFE unset can be initialized at the same time: a mutex in avcodec_open2() ensures this. This implies that one cannot simply open a codec with a non-threadsafe init-function from the init function of a codec whose own init function is not threadsafe either as the child codec couldn't acquire the lock. ff_codec_open2_recursive() exists to get around this limitation: If the init function of the child codec to be initialized is not thread-safe, the mutex is unlocked, the child is initialized and the mutex is locked again. This of course has as a prerequisite that the parent AVCodecContext actually holds the lock, i.e. that the parent codec's init function is not thread-safe. If it is, then one can (and has to) just use avcodec_open2() directly (if the child's init function is not thread-safe, then avcodec_open2() will have to acquire the mutex itself (and potentially wait for it), so that it is perfectly fine for an otherwise thread-safe init function to open a codec with a potentially non-thread-safe init function via avcodec_open2()). Yet several of the users of ff_codec_open2_recursive() have the FF_CODEC_CAP_INIT_THREADSAFE flag set; this only worked because all the child codecs' init functions were thread-safe themselves so that ff_codec_open2_recursive() didn't touch the mutex at all. But of course the real solution to this is to directly use avcodec_open2(). Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mxpegdec: Fix memleaks upon init failureAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mjpegdec: Fix memleak upon init failureAndreas Rheinhardt2020-12-04
| | | | | | | | | This affected all decoders that used ff_mjpeg_decode_init() as init function; and it also affected decoders that open jpeg decoders via ff_codec_open2_recursive() as well as MxPEG. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/smc: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sipr: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/shorten: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sgirledec: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sgienc: Combine av_log() statementsAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sgienc: Mark encoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sgidec: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/tmv: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/ulti: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/ws-snd1: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/xxan: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/xxan: Cleanup generically on init failureAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/xsubenc: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/xsubdec: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/xl: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/xfacedec: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/xan: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/xan: Cleanup generically on init failureAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/yuv4dec: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/y41penc: Mark encoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/y41pdec: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/yop: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cljrdec: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/loco: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/pcm: Mark decoders as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/pcm: Make encoders init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/adpcmenc: Mark encoders as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/adpcm: Mark decoders as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | | | They don't modify any global state Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cdtoons: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/a64multienc: Mark encoders as init-threadsafeAndreas Rheinhardt2020-12-04
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/pthread_slice: Don't use static variable, fix raceAndreas Rheinhardt2020-12-02
| | | | | | | | | | | | | | | | | | | | | | ff_slice_thread_init() uses a static variable to hold a function pointer, although the value of said pointer needn't be saved between different runs of this function at all. The reason for this being so is probably that said pointer points to a static function (if used); but storage class specifiers like "static" are not part of the type of an object and so including it in the pointer declaration is wrong (anyway, "static" means different things in both contexts: for the function declaration it affects linkage, for the variable storage duration). Using a static variable here can lead to races, e.g. when initializing VP9 (for which said function pointer was added) and H.264 with slice threading. The latter has the FF_CODEC_CAP_INIT_THREADSAFE flag set and is therefore unaffected by the lock guarding initializations of decoders. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg12enc: Disallow using MPEG-2 intra VLC table for mpeg1videoAndreas Rheinhardt2020-12-02
| | | | | | | | | | | | Using MPEG-2 intra VLC tables is spec-incompliant for MPEG-1 and given that an MPEG-1 bitstream can't signal whether MPEG-2 intra VLC tables have been used the output is broken. Therefore this option is removed immediately without any deprecation period. Reviewed-by: James Almer <jamrial@gmail.com> Reviewed-by: Marton Balint <cus@passwd.hu> Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cbs_h2645: remove dead code in cbs_h2645_replace_ps()James Almer2020-12-01
| | | | | | | Missed in 0720e15c0330f0f101c02d5c2c6548e964079f6d. PS units are now guaranteed to always be reference counter. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cbs_av1: ensure Sequence Header unit content is always reference countedJames Almer2020-12-01
| | | | | | Prevents a NULL pointer dereference. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/vaapi_av1: read film grain param values from AV1FramesJames Almer2020-11-30
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/dxva2_av1: read film grain param values from AV1FramesJames Almer2020-11-30
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/nvdec_av1: read film grain param values from AV1FramesJames Almer2020-11-30
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/av1dec: infer and store film grain param values in AV1FrameJames Almer2020-11-30
| | | | | | | | | They are not always coded in the bistream for each frame. In some cases, the values need to be taken from a reference frame. See section 6.8.20 from the AV1 spec. Signed-off-by: James Almer <jamrial@gmail.com>