summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/siren: Increase noise category 5 and 6Michael Niedermayer2021-01-28
| | | | | | | | | | | The entry read is not used in subsequent computation, thus its value is not important. Fixes: out of array read Fixes: 28578/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SIREN_fuzzer-6332019122503680 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/siren: Factorize category 5 and 6 noise computationMichael Niedermayer2021-01-28
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/siren: remove constant region_sizeMichael Niedermayer2021-01-28
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/xbmenc: Allow for making UW imagesJose Da Silva2021-01-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've run into some bugs where I was downloading a bunch of data and began seeing weird hiccups. For example, javascript promises to allow you to push some very long lines of data, but the hiccups I saw was with data larger than 2k in length (windows) pushed out of a child process stdout piped into the stdin of the calling parent program. Soo much for smooth promises, this was broken and would run into similar problems on a linux PC with 32k line limits. The solution was to break the data into smaller chunks than 2k - and then these data hiccups disappeared (windows PC). It would be expected to be similar for linux PCs (32k I think) and other OSes with different sizes. If the ANSI required minimum needs to be 509 chars or larger (assuming 509+<CR>+<LF>+<0>=512), then 509 was chosen as the shortest worst-case scenario) in this patch. Most small pictures will go output looking pretty much the same data out until you get to about 84bytes (672 pixels wide), where lines out begin to be split. For example a UW 4K will exceed a 2k readln and a UW 10K picture approaches an 8k readln The purpose for this patch is to ensure that data remains below the readline limits (of 509 chars), so that programs (like javascript) can push data in large chunks without breaking into hiccups because the data length is too long to be pushed cleanly in one go. Subject: [PATCH 3/3] avcodec/xbmenc: Allow for making UW images Worst-case ANSI must allow for 509 chars, while Windows allows for 2048 and Linux for 32K line length. This allows an OS with a small readline access limitation to fetch very wide images (created from ffmpeg).
* avcodec/xbmenc: xbm Lower memory useJose Da Silva2021-01-28
| | | | | | | | | | | | | | | | Two minor memory improvements. First bug reduces memory needed to about 6/7 the needed amount, which allows you to host almost 7 pictures in the same memory needed for 6 Second is a recalculation of the total additional memory for headers etc. size = avctx->height x (linesize * 6 + 1) + (31+32+38+4+1) Subject: [PATCH 2/3] avcodec/xbmenc: xbm Lower memory use Small 6/7th size memory reduction. size = avctx->height x (linesize * 6 + 1) + (31+32+38+4+1) Signed-off-by: Joe Da Silva <digital@joescat.com>
* avcodec/xbmenc: Do not add last comma into outputJose Da Silva2021-01-28
| | | | | | | | | | | | | | | | | | | | | | There is a minor bug in xbm encode which adds a trailing comma at the end of data. This isn't a big problem, but it would be nicer to be more technically true to an array of data (by not including the last comma). This bug fixes the output from something like this (having 4 values): static unsigned char image_bits[] = { 0x00, 0x11, 0x22, } to C code that looks like this instead (having 3 values): static unsigned char image_bits[] = { 0x00, 0x11, 0x22 } which is the intended results. Subject: [PATCH 1/3] avcodec/xbmenc: Do not add last comma into output array xbm outputs c arrays of data. Including a comma at the end means there is another value to be added. This bug fix changes something like this: static unsigned char image_bits[] = { 0x00, 0x11, 0x22, } to C code like this: static unsigned char image_bits[] = { 0x00, 0x11, 0x22 } Signed-off-by: Joe Da Silva <digital@joescat.com>
* avcodec/flashsv2enc: Fix use of uninitialized valueAndreas Rheinhardt2021-01-28
| | | | | | | | | | | | | | Before 257a83b969157eb76c18158a4e503e908d8b1125, certain buffers were zero-allocated in the init function and only reallocated lateron if they turned out to be too small; now they are only allocated during init, leading to use-of-uninitialized values lateron. The same could happen before if the dimensions are big enough so that the buffers would be reallocated, as the new part of the reallocated buffer would not be zeroed (happened for 960x960). So always zero the buffers in the function designed to init them. Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/h261dec: Make VLC smallerAndreas Rheinhardt2021-01-27
| | | | | | | | | The VLC for the macroblock address increment uses nine bits; yet there is no code with this length: All codes are either shorter or longer. So one can make the table smaller without changing the amount of codes that need more than one round of parsing. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* Revert "mpeg4videodec: raise an error if sprite_trajectory.table is NULL"Andreas Rheinhardt2021-01-27
| | | | | | | | | | | | | | | | | | | | This reverts commit 6ac0e7818399a57e4684202bac79f35b3561ad1e. The mpeg4video parser can reach code that presumes that a certain VLC has been initialized; yet Libav did not ensure this and Libav bug #1012 [1] is about an ensuing crash. Instead of fixing the root cause a simple check for whether said VLC has already been initialized was added; said check is inherently racy. The proper fix is of course to ensure that the VLC is initialized and commit 7c76eaeca2791261d3f4f5c98c95f44abdbd879a already ensured this, so there was no need to merge 6ac0e7818399a57e4684202bac79f35b3561ad1e at all. This commit therefore reverts said commit. [1]: https://bugzilla.libav.org/show_bug.cgi?id=1012 Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sei: add Parameter Sets Inclusion Indication enum valueJames Almer2021-01-26
| | | | | | | Defined in H.274, it shares the same value as Active Parameter Sets from the H.265 spec. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cri: Fix whitespace issue in unpack_10bit()Michael Niedermayer2021-01-26
| | | | | Found-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/apedec: Use FFABSU() in do_apply_filter()Michael Niedermayer2021-01-26
| | | | | | | | | Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself Fixes: 29053/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-4814432697974784 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>
* lavc: shedule old encoding/decoding API for removalAnton Khirnov2021-01-26
| | | | | | | | It has been deprecated for 4 years and certain new codecs do not work with it. Also include AVCodecContext.refcounted_frames, as it has no effect with the new API.
* lavc/decode: move unrefcount_frame() right before its only callerAnton Khirnov2021-01-26
| | | | Will make wrapping it in deprecation guards simpler.
* avcodec/mpeg4videodec: Fix indentationAndreas Rheinhardt2021-01-26
| | | | | | It was wrong since e03bf251d8784f4d1df2c22381c902087e151e31. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg4videodec: Move code around to avoid forward declarationAndreas Rheinhardt2021-01-26
| | | | | | | Also fix the indentation of decode_studio_vol_header while at it; it was wrong since 177133a0f4b41b3c98b9cbc7f8f45755412c537b. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sp5x: Remove unused quant tablesAndreas Rheinhardt2021-01-26
| | | | | | Only the fifth one is used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/exif: Avoid allocation for small bufferAndreas Rheinhardt2021-01-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/amrnbdata: Remove unused arrayAndreas Rheinhardt2021-01-26
| | | | | | Always unused. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/ilbcdata: Remove unused arrayAndreas Rheinhardt2021-01-26
| | | | | | Never used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/atrac3plus_data: Remove unused arraysAndreas Rheinhardt2021-01-26
| | | | | | Forgotten in 58fc810d42fde26ed6c1f2996122e98ab7005849. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/dnxhd: Make ff_dxnhd_get_cid_table return a pointer, not indexAndreas Rheinhardt2021-01-26
| | | | | | | All callers only use the index into ff_dnxhd_cid_table to get a pointer to the desired entry. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: deprecate AVCodecContext.debug_mvJames Almer2021-01-25
| | | | | | It's been unused for almost three years now. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: remove long dead debug_mv codeJames Almer2021-01-25
| | | | | | FF_API_DEBUG_MV has been zero since ffmpeg 4.0 Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/dolby_e: split decoder and parser more thoroughlyJames Almer2021-01-25
| | | | | | | | | Neither module should depend on the other. Move shared functions to its own file for this purpose, and ensure source files are compiled only when the required modules are enabled. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h263data, ituh263*: Make initializing RL inter table thread-safeAndreas Rheinhardt2021-01-25
| | | | | | | | | | | | Up until now, ff_h263_rl_inter was initialized by both ituh263dec and ituh263enc; this is an obstacle in making the codecs that use this code init-threadsafe. This obstacle is eliminated by only initializing this RLTable from a single place that is guarded by a dedicated AVOnce. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/ituh263enc: Remove unused function parameterAndreas Rheinhardt2021-01-25
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/ituh263dec: Don't initialize unused parts of RLTableAndreas Rheinhardt2021-01-25
| | | | | | | | | | The RLTable ff_rl_intra_aic is only used by ituh263dec and ituh263enc; the former only uses the RLTable's VLC, the latter only index_run, max_level and max_run. Yet ituh263dec also initializes the latter. This commit stops doing so. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/h261enc: Make encoder init-threadsafeAndreas Rheinhardt2021-01-25
| | | | | | | | This is easy now that the H.261 encoder is the only user that initializes the non-VLC parts of ff_h261_rl_tcoeff. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/h261dec: ReindentationAndreas Rheinhardt2021-01-25
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/h261dec: Make decoder init-threadsafeAndreas Rheinhardt2021-01-25
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/h261dec: Don't initialize unused part of RLTableAndreas Rheinhardt2021-01-25
| | | | | | | | | | | The H.261 decoder only uses an RLTable's VLC table, yet it also initializes its index_run, max_level and max_run. This commit stops doing so; it will also simplify making this decoder init-threadsafe, as the H.261 decoder and encoder now initialize disjoint parts of their common RLTable. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpegvideo_enc: Make mpv_encode_defaults thread-safeAndreas Rheinhardt2021-01-25
| | | | | | | | | This is a prerequisite for making any encoder that uses ff_mpv_encode_init() init-threadsafe; it already makes the AMV, the MJPEG and the MPEG-1/2 encoders init-threadsafe. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/msmpeg4dec: Reuse identical MV VLCAndreas Rheinhardt2021-01-25
| | | | | | | | | | msmpeg4dec and ituh263dec both create VLCs with identical parameters out of ff_mvtab. Given that ff_msmpeg4_decode_init() always (indirectly) calls ff_h263_decode_init_vlc(), the VLC initialized by the latter can be directly used by msmpeg4dec. Doing so saves a bit more than 2KB from the .bss segment as well as the code to initialize a VLC. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/msmpeg4dec: Reuse identical RL VLCsAndreas Rheinhardt2021-01-25
| | | | | | | | | | | | | Some of the RLTables used by msmpeg4dec actually coincide with other RLTables: ff_rl_table[5] coincides with ff_h263_rl_inter (and ff_rl_table[2] with ff_mpeg4_rl_intra). Given that ff_h263_rl_inter is always initialized before msmpeg4dec's RLTables are initialized, one can just reuse the VLC tables by copying the pointers; after all, there are no ownership issues for static data. This saves 70912B from the .bss segment, translating into actual memory savings when this decoder is actually used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/ituh263dec: Don't initialize unused RL VLCsAndreas Rheinhardt2021-01-25
| | | | | | | | | | The ff_rl_intra_aic RLTable is only used by ituh263dec and ituh263enc; the former is the only user of its RL VLC tables. It uses only the very first one of these VLC tables, but up until now all 32 are initialized, wasting 68696B from the .bss segment (or that amount of memory if this decoder has actually been used). This commit changes this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg4videodec: Don't initialize unused RL VLCsAndreas Rheinhardt2021-01-25
| | | | | | | | | | The RLTables whose VLC tables are only used for intra blocks only use the very first VLC table; yet all 32 have been initialized. This commit stops this by switching to INIT_FIRST_VLC_RL. This saves 201624B from the .bss segment; in case the decoder is actually used, this translates into less memory used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/msmpeg4dec: Don't initialize unused RL VLCsAndreas Rheinhardt2021-01-25
| | | | | | | | | For the RLTables ff_rl_table[0..2] only the very first VLC is only ever used, so it makes no sense to create 32 of them. This saves 285200B from the .bss segment; this amount of memory is actually saved when this decoder is used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/h261dec: Don't initialize unused VLCsAndreas Rheinhardt2021-01-25
| | | | | | | | The H.261 decoder uses only the very first VLC of ff_h261_rl_tcoeff, so only initialize this one. Saves 68448B from the .bss segment; in case the decoder is actually used, this amount of memory is saved. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/rl: Allow to create only a few VLC tablesAndreas Rheinhardt2021-01-25
| | | | | | | It is not uncommon that only the first one is used; this is similar to ff_init_2d_vlc_rl(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mpeg12enc, speedhqenc: Avoid redundant copies of tablesAndreas Rheinhardt2021-01-25
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/dolby_e: Split decoder/parser filesNicolas Gaullier2021-01-25
|
* avcodec/dolby_e: Add a parserNicolas Gaullier2021-01-25
|
* avcodec/tiff_common: Remove declarations of inexistent functionsAndreas Rheinhardt2021-01-25
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/vp8data: Remove unused arrayAndreas Rheinhardt2021-01-25
| | | | | | | Unused since 748f921ad1997a464fb8963d0ba2c5bb5e036b1b. Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/dvenc: dv100_weight_shift never usedPeter Ross2021-01-24
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/flashsv2enc: factorize updating block dimensionsMarton Balint2021-01-23
| | | | | | | | | | | | The patch changes the init function to initialize block dimensions to fixed 64x64 instead of the previously used image width/height based value. This should not cause any actual change in behaviour because block dimensions are recalculated on every keyframe in optimum_block_width() and optimum_block_height() functions and in the current code the result is always 64x64 regardless of the image dimensions used. Signed-off-by: Marton Balint <cus@passwd.hu>
* qsv: dump more info in error, debug and verbose modeHaihao Xiang2021-01-23
| | | | | | | | Dump iopattern mode and the SDK error/warning desciptions for qsv based filters and iopattern mode for qsvenc Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com
* avcodec/qsvdec: refact, remove duplicate code for plugin loadingXu Guangxin2021-01-23
| | | | | Signed-off-by: Xu Guangxin <guangxin.xu@intel.com> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
* avcodec/qsvdec: refact, move qsvdec_other.c to qsvdec.cXu Guangxin2021-01-23
| | | | | Signed-off-by: Xu Guangxin <guangxin.xu@intel.com> Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>