summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/libdav1d: stop setting AVFrame->best_effort_timestampJames Almer2020-12-131-1/+1
| | | | | | 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-131-1/+0
| | | | | | 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-131-7/+4
| | | | | | | | | 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-114-5/+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-1044-49/+49
| | | | | | | | | | | | 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-104-226/+92
| | | | | | | | | | | | | | | | | | | | | | | 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-104-44/+80
| | | | This will be useful in the following commit.
* codec_desc: add SMVJPEG flagsAnton Khirnov2020-12-101-0/+1
| | | | Same flags as MJPEG, as it's essentially the same codec.
* avcodec/hevcdec: dynamic allocate sList and HEVClcListNuo Mi2020-12-102-14/+17
| | | | | | | | | 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-101-5/+13
| | | | | | | | | | | | 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-101-0/+1
| | | | | 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-101-0/+1
| | | | | Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cinepakenc: Mark encoder as init-threadsafeAndreas Rheinhardt2020-12-101-1/+1
| | | | | Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vaapi_av1: fill the remaining VAFilmGrainStructAV1 fieldsJames Almer2020-12-091-9/+51
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/exr: preserve half-float NaN bits and add fate testMark Reid2020-12-091-2/+1
| | | | | Handles NaNs more like the official implementation handles them, preserving the original bits.
* avcodec/mpegvideo_enc: check for SpeedHQ encoderGyan Doshi2020-12-091-1/+1
| | | | | Avoids build failure when mpegvideo_enc is built but SpeedHQ encoder isn't.
* avcodec/libaom: Support monochrome encoding with libaom >= 2.0.1Philip Langdale2020-12-082-3/+41
| | | | | | | | | | | Monochrome encoding with libaom was buggy for a long time, but this was finally sorted out in libaom 2.0.1 (2.0.0 is almost there but was still buggy in realtime mode). We'll keep support for libaom 1.x around until the LTS distros that include it are EOL (which is still a long time from now). Fixes: https://trac.ffmpeg.org/ticket/7599
* avcodec/wmadec: Apply VLC offset during initAndreas Rheinhardt2020-12-081-4/+3
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/wmadec: Reduce the size of tables used to initialize VLCAndreas Rheinhardt2020-12-083-17/+12
| | | | | | | | By switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths() one can replace a table of codes of type uint16_t by a table of symbols of type uint8_t, saving space. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/ivi: Make initializing VLCs thread-safeAndreas Rheinhardt2020-12-083-6/+10
| | | | | | This automatically makes indeo4/5 init-threadsafe. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/dsddec: Inline constantAndreas Rheinhardt2020-12-081-2/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/dsd: Make initializing DSD tables thread-safeAndreas Rheinhardt2020-12-084-6/+7
| | | | | | | This automatically makes the DSD formats as well as DST and WavPack init-threadsafe. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/wavpack: Fix leak on init failureAndreas Rheinhardt2020-12-081-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/h261enc: Remove unused function parameterAndreas Rheinhardt2020-12-081-3/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/asvdec: ReindentationAndreas Rheinhardt2020-12-081-15/+15
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/asvdec: Make decoders init-threadsafeAndreas Rheinhardt2020-12-081-8/+7
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sinewin: Fix wrong number of elements of array declarationAndreas Rheinhardt2020-12-081-1/+1
| | | | | | There are actually only 14 elements in each ff_sine_windows array. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/aactab: Make AAC encoder and decoders actually init-threadsafeAndreas Rheinhardt2020-12-081-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 1a29804558c13ef512d9ef73a9b0d782af4fa5f2 guarded several initializations of static data in the AAC decoders with an AVOnce and set the FF_CODEC_CAP_INIT_THREADSAFE flag, believing the former to be sufficient for the latter. It wasn't, because several of these static tables are shared with other components, so that there might be data races if they are initialized from multiple threads. This affected initializing the ff_sine_* tables as well as initializing the ff_aac_pow*sf_tab tables (shared between both decoders and encoder) as well as ff_aac_kbd_* tables (shared between encoder and floating point decoder). Commit 3d62e7a30fa552be52d12b31e3e0f79153aff891 set the FF_CODEC_CAP_INIT_THREADSAFE flag for the AAC encoder. More explicitly, this commit used the same AVOnce to guard initializing ff_aac_pow*sf_tab in the encoder and to guard initializing the static data of each decoder; the ensuing catastrophe was "fixed" in commit ec0719264cb9a9d5cbaf225da48929aea24997a3 by using a single AVOnce for each codec again. But the codec cap has not been removed and therefore the encoder claimed to be init-threadsafe, but wasn't, because of the same tables as above. The ff_sine_* tables as well as ff_aac_pow*sf_tab tables have already been fixed; this commit deals with the ff_aac_kbd_* tables, making the encoder as well as the floating-point decoder init-threadsafe (the fixed-point decoder is it already). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/aac: Share common init code of float decoder and encoderAndreas Rheinhardt2020-12-084-9/+24
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/aacdec, aactab: Move kbd tables to their only userAndreas Rheinhardt2020-12-086-24/+23
| | | | | | | | | | | | The floating point kbd tables for 120 and 960 samples are only used by the floating point decoder whereas the fixed point kbd tables for 128 and 1024 samples are only used by the fixed point AAC decoder. So move these tables to their only users. This ensures that they are not accidentally used somewhere else without ensuring that initializing these tables stays thread-safe (as it is now because the only place from where they are initialized is guarded by an AVOnce). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/aactab: Remove declaration of inexistent arrayAndreas Rheinhardt2020-12-081-1/+0
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/nellymoserenc: Make encoder init-threadsafeAndreas Rheinhardt2020-12-081-17/+24
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/nellymoserenc: Cleanup generically on init failureAndreas Rheinhardt2020-12-081-12/+6
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/nellymoserdec: Make decoder init-threadsafeAndreas Rheinhardt2020-12-081-4/+4
| | | | | | Easy now that initializing the ff_sine_* tables is thread-safe. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac3plus: Make decoders init-threadsafeAndreas Rheinhardt2020-12-083-12/+18
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac1: Mark decoder as init-threadsafeAndreas Rheinhardt2020-12-081-1/+1
| | | | | | Possible because ff_init_ff_sine_windows() is now threadsafe. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sinewin_tablegen: Make initializing ff_sine_windows thread-safeAndreas Rheinhardt2020-12-082-0/+44
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/aacdec, sinewin: Move 120 and 960 point sine tables to aacdecAndreas Rheinhardt2020-12-085-16/+8
| | | | | | | | | | | | | The floating point AAC decoder is the only user of these tables, so it makes sense to move them there. Furthermore, initializing the ordinary power-of-two sinetables is currently not thread-safe and if the 120- and 960-point sinetables were not moved, one would have to choose whether to guard initializing these two tables with their own AVOnces or not. Doing so would add unnecessary AVOnces as the AAC decoder already guards initializing its static data by an AVOnce; not doing so would be fragile if a second user of these tables were to be added. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sinewin_tablegen: Use better check in assertAndreas Rheinhardt2020-12-081-1/+1
| | | | | | | There are no ff_sine_windows for 2^i, 0 <= i < 5, so one should check for the index being >= 5. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac3: Make decoders init-threadsafeAndreas Rheinhardt2020-12-081-7/+7
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac: Make generating tables thread-safeAndreas Rheinhardt2020-12-081-12/+15
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudio_tablegen: Make exponential LUT sharedAndreas Rheinhardt2020-12-088-26/+133
| | | | | | | | | | | | | | | | Both the fixed as well as the floating point mpegaudio decoders use LUTs of type int8_t and uint32_t with 32K entries each; these tables are completely the same, yet they are not shared. This commit makes them shared. When both fixed as well as floating point decoders are enabled, this saves 160KiB from the bss segment for a normal build (translating into 160KiB less memory usage if both a shared as well as a floating point decoder have actually been used) and 160KiB from the binary for a build with hardcoded tables. It also means that the code to create said LUTs is no longer duplicated (for a normal build). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec: Hardcode tables to save spaceAndreas Rheinhardt2020-12-087-46/+58
| | | | | | | | | | | | | | | | | | | The csa_tables (which always consist of 32 entries of four byte each, but the type depends upon whether the decoder is fixed or floating-point) are currently initialized once during decoder initialization; yet it turns out that this is actually no benefit: The code used to initialize these tables takes up 153 (fixed point) and 122 (floating point) bytes when compiled with GCC 9.3 with -O3 on x64, so it is better to just hardcode these tables. Essentially the same applies to the is_tables: They have a size of 128B each and the code to initialize them occupies 149 (fixed point) resp. 140 (floating point) bytes. So hardcode them, too. To make the origin of the tables clear, references to the code used to create them have been added. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudio_tablegen: Don't inappropriately use static arrayAndreas Rheinhardt2020-12-081-1/+1
| | | | | | | | | Each invocation of this function is only entered once, so using a static array makes no sense (and given that the whole array is reinitialized at the beginning of this function, it wouldn't even make sense if the function were called multiple times). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudio_tablegen: Avoid write-only buffersAndreas Rheinhardt2020-12-082-0/+19
| | | | | | | | | | | | | | | | | | | | | The mpegaudio_tablegen header contains code to initialize several tables; it is included in both the fixed as well as the floating point mpegaudio decoders and some of these tables are only used by the fixed resp. floating point decoders; yet both types are always initialized, leaving the compiler to figure out that one of them is unused. GCC 9.3 fails at this (even with -O3): $ readelf -s mpegaudiodec_fixed.o|grep _float 28: 0000000000001660 32768 OBJECT LOCAL DEFAULT 4 expval_table_float An actually unused table (expval_table_fixed/float) of size 32KiB is kept and initialized (the reason for this is probably that this table is read from, namely to initialize another table: exp_table_fixed/float; of course the float resp. fixed tables are not used in the fixed resp. floating point decoder). Therefore #ifdef the unneeded tables away. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec: Share fixed and floating point data and init codeAndreas Rheinhardt2020-12-084-132/+165
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec_template: Apply shift during initAndreas Rheinhardt2020-12-081-3/+3
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec: Make decoders init-threadsafeAndreas Rheinhardt2020-12-083-8/+14
| | | | | | Simple now that ff_mpadsp_init() and ff_mpa_synth_init_* are thread-safe. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec: Combine tables used to initialize VLCsAndreas Rheinhardt2020-12-082-115/+44
| | | | | | | | Up until now, there were several indiviual tables which were accessed via pointers to them; by combining the tables, one can avoid said pointers, saving space. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegaudiodec: Reduce the size of tables used to initialize VLCsAndreas Rheinhardt2020-12-082-428/+271
| | | | | | | | | | By switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths() one can replace tables of codes of type uint16_t by tables of symbols of type uint8_t; this saves about 1.3KB for both the fixed and floating point decoders (if enabled). Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>