summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/aacdec_fixed: Move fixed-point sinewin tables to its only userAndreas Rheinhardt2021-02-07
| | | | | | | | | | | | | | | | | | | | | | The fixed-point AAC decoder is the only user of the fixed-point sinewin tables from sinewin; and it only uses a few of them (about 10% when counting by size). This means that guarding initializing these tables by an AVOnce (as done in 3719122065863f701026632f610175980d42b05a) is unnecessary for them. Furthermore the array of pointers to the individual arrays is also unneeded. Therefore this commit moves these tables directly into aacdec_fixed.c; this is done by ridding the original sinewin.h and sinewin_tablegen.h headers completely of any fixed-point code at the cost of a bit of duplicated code (the alternative is an ugly ifdef-mess). This saves about 58KB from the binary when using hardcoded tables (as these tables are hardcoded in this scenario); when not using hardcoded tables, most of these savings only affect the .bss segment, but the rest (< 1KB) contains relocations (i.e. savings in .data.rel.ro). Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/xbm_parser: mark frame as intra only and as key framePaul B Mahol2021-02-05
|
* avcodec/xbm_parser: split long linePaul B Mahol2021-02-05
|
* avcodec: add xbm parserPaul B Mahol2021-02-05
|
* avcodec/vp9dsp_template: Fix integer overflows in itxfm_wrapperMichael Niedermayer2021-02-04
| | | | | | | | Fixes: signed integer overflow: 2147483641 + 32 cannot be represented in type 'int' Fixes: 27452/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-5078752576667648 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: unbreak BINKAUDIO_DCT duration calculationPaul B Mahol2021-02-04
|
* avcodec/mxpegdec: fix SOF countingMichael Niedermayer2021-02-04
| | | | | | | | Fixes: Timeout (>10sec -> 15ms) Fixes: 27652/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MXPEG_fuzzer-5125920868007936 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/rscc: Check inflated_buf size whan it is usedMichael Niedermayer2021-02-04
| | | | | | | Fixes: out of array access Fixes: 27434/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RSCC_fuzzer-5196757675540480 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
* avcodec/cabac_functions, x86/cabac: Include stddef.hAndreas Rheinhardt2021-02-04
| | | | | | Fixes checkheaders after 8c01eb0a315fec8f09ba6210ce8b0296de6cc784. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/cdxl: add support for custom 24bit pal8 formatsPaul B Mahol2021-02-03
| | | | Also stop discarding half of audio samples and use planar pcm s8.
* avcodec/xbmdec: get_nibble() minor speed increase, and binary reductionJose Da Silva2021-02-03
| | | | | | | | | | Replace av_isxdigit(*ptr) and convert(*ptr) with get_nibble(*ptr) which returns a valid nibble=={0x00..0x0f} or false==255 for all other values. This way we only need to work with *ptr once instead of twice. Removing inline av_isxdigit(x) functions also shrinks executable size. Signed-off-by: Joe Da Silva <digital@joescat.com>
* avcodec/xbmdec: convert() minor speed increaseJose Da Silva2021-02-03
| | | | | | | | If we test for {0..9} first, we have tested for 10/16th of all possible characters first and avoid testing the remaining 6/16th of all possible characters, which can be either 6/16th lowercase or 6/16th uppercase. Signed-off-by: Joe Da Silva <digital@joescat.com>
* avcodec/xbmenc: Pre-compute variables once for parse_str_int()Jose Da Silva2021-02-03
| | | | | | | | | Some compilers are very intuitive, and others are not so much, so let's pre-compute the variables e and keylen outside the for loop. Ensuring a minor speed increase regardless of if compiler is smart enough to solve this improvement for itself, or not. Signed-off-by: Joe Da Silva <digital@joescat.com>
* avcodec/xbmenc: substitute end instead of recalculating endJose Da Silva2021-02-03
| | | | | | | | Minor speed increase, end is calculated before entering parse_str_int(), so let's take advantage of the value and avoid recalculating twice more. This also allows parse_str_int() to work with file size larger than int. Signed-off-by: Joe Da Silva <digital@joescat.com>
* avcodec/cabac: Move encoder related stuff to libavcodec/tests/cabac.cAndreas Rheinhardt2021-02-02
| | | | | | | (This is actually the second time the encoder stuff is removed; the first was in 8b4119187b62d6932e07aded11d33d3b24e1b42f.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/h264_levels, h265_profile_level: Remove ff_h26[45]_get_levelAndreas Rheinhardt2021-02-02
| | | | | | | Unused. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* vc2enc: Add missing static to local variablesMark Thompson2021-02-02
|
* avcodec: add PFM image encoderPaul B Mahol2021-02-02
|
* avcodec/simple_idct: Fix undefined integer overflow in idct4row()Michael Niedermayer2021-02-02
| | | | | | | | Fixes: signed integer overflow: -1498310196 - 902891776 cannot be represented in type 'int' Fixes: 28445/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5075163389493248 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/cri: Use ff_set_dimensions()Michael Niedermayer2021-02-02
| | | | | | | | | Fixes: out of memory Fixes: 29985/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CRI_fuzzer-6424425392111616 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/aacps_fixed_tablegen: Don't include config.hAndreas Rheinhardt2021-02-02
| | | | | | | | It is only valid for the target, not the host and therefore it must not be included when building the tables when hardcoded tables are enabled. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/aac_ac3_parser: fix channel information parsing in case decoder is ↵Piotr Uracz2021-02-01
| | | | | | disabled Fixes #7372
* avcodec/cscd: Check output len in zlib as in lzoMichael Niedermayer2021-01-31
| | | | | | | | Fixes: Timeout (>10sec -> 134ms) Fixes: 27245/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CSCD_fuzzer-575318210772992 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vp3: Check input amount in theora_decode_header()Michael Niedermayer2021-01-31
| | | | | | | | | Fixes: Timeout Fixes: 29226/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-6195092572471296 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/pnm: disable check for PFM as it is not neededPaul B Mahol2021-01-31
|
* avcodec/dolby_e: Avoid duplicating sample rate tableAndreas Rheinhardt2021-01-30
| | | | | | | Set the sample rate when parsing the header instead and only copy the value in the decoder and the parser. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/dolby_e: Avoid code duplication when converting inputAndreas Rheinhardt2021-01-30
| | | | | | | | | convert_input, a nontrivial auxiliary function used by both the general parsing code as well as the decoder itself, has been duplicated in c7016e35a624a75bb5b82bee932ddfe28d013b3f; this commit removes said duplication. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/dolby_e_parse: Merge ff_dolby_e_parse_init/headerAndreas Rheinhardt2021-01-30
| | | | | | | | | | | These two functions are always called after another; after all, what ff_dolby_e_parse_init does is obviously part of parsing the frame header. Also move the DolbyEHeaderInfo into DBEContext so that parsing the frame header only needs one struct (both users used a DBEContext immediately followed by a separate DolbyEHeaderInfo). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/dolby_e_parser: Remove unused ParseContextAndreas Rheinhardt2021-01-30
| | | | | | | | Parsers are not forced to use a ParseContext and the other stuff from parser.h which is just designed to help parsers recombining frames. But this parser does not do this at all, i.e. the ParseContext is unused. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cfhd: check peak.offsetMichael Niedermayer2021-01-29
| | | | | | | | Fixes: signed integer overflow: -2147483648 - 4 cannot be represented in type 'int' Fixes: 26907/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-5746202330267648 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vorbis_data: Move encoder-related table to its only userAndreas Rheinhardt2021-01-29
| | | | | | | Said table was unused in case libvorbis was disabled. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/fft_template: Avoid useless functionAndreas Rheinhardt2021-01-29
| | | | | | | | ff_init_ff_cos_tabs is only used for the floating point FFT and only if hardcoded tables are disabled. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/msmpeg4: Inline number of motion vectorsAndreas Rheinhardt2021-01-29
| | | | | | | | Both motion vector tables have the same number of elements, hence one can inline said number and remove the field containing the number of elements from the structure. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/msmpeg4dec: Don't check for errors for complete VLCsAndreas Rheinhardt2021-01-29
| | | | | | | This also affected other users of VLCs from msmpeg4dec, namely vc1_block and wmv2dec. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* 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>