summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/hevc_filter: copy_CTB() only within width&heightMichael Niedermayer2022-07-22
| | | | | | | | Fixes: out of array access Fixes: 49271/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5424984922652672 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: Check tile_length and tile_widthMichael Niedermayer2022-07-22
| | | | | | | | Fixes: Division by 0 Fixes: 49235/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5495613847896064 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/aacdec: remove skip samples multiplierJames Almer2022-07-22
| | | | | | | | | The amount of padding samples reported by containers take into account the extended samplerate in HE-AAC. Fixes ticket #9671. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mss4: Check image size with av_image_check_size2()Michael Niedermayer2022-07-21
| | | | | | | | Fixes: Timeout Fixes: 48418/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MTS2_fuzzer-4834851466903552 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/exr: Check x/ysizeMichael Niedermayer2022-07-21
| | | | | | | | Fixes: OOM Fixes: 48911/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6352002510094336 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1dec: Fix AC_GOLOMB_RICE min size checkMichael Niedermayer2022-07-21
| | | | | | Found-by: mkver Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1dec: consider run increase in minimal golomb frame sizeMichael Niedermayer2022-07-20
| | | | | | | | | Fixes: Timeout Fixes: 49160/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-5672826144686080 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mpeg4videoenc: fix encoding long framesMichael Niedermayer2022-07-20
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hdrdec: lines can be emptyMichael Niedermayer2022-07-20
| | | | | | | | | Fixes: infinite loop Fixes: 49223/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HDR_fuzzer-6603308596330496 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>
* libavcodec/qsvenc: Use parameter from AVCodecContext to reset qsv codecWenbin Chen2022-07-20
| | | | | | | | | | | | | | | Using parameter from AVCodecContext to reset qsv codec is more suitable for MFXVideoENCODE_Reset()'s usage. Per-frame metadata is more suitable for the usage of mfxEncodeCtrl being passed to MFXVideoENCODE_EncodeFrameAsync(). Now change it to use the value from AVCodecContext. Because q->param is passed to both "in" and "out" parameters when call MFXVideoENCODE_Query(), the value in q->param may be changed. New variables are added to store old configuration, so that we can detect real parameter change. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* libavcodec/qsvenc: Change the parameter log to be thread safeWenbin Chen2022-07-20
| | | | | | | | Dividing one line log into several av_log() call is not thread safe. Now merge these strings into one av_log() call. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* lavc: use AVFrame.duration instead of AVFrame.pkt_durationAnton Khirnov2022-07-19
|
* avcodec/wrapped_avframe: Don't presume AVPacket to be writableAndreas Rheinhardt2022-07-18
| | | | | | | | | | It need not be writable; in fact, it is often not writable even if the packet sent to the decoder was writable, because the generic code calls av_packet_ref() on it. It is never writable if a user drains the decoder after every packet, because in this case the decode callback is called from avcodec_send_packet(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/wrapped_avframe: Don't leak frame metadata, side-dataAndreas Rheinhardt2022-07-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | wrapped_avframe_decode() uses an AVFrame as dst in av_frame_move_ref() after having called ff_decode_frame_props() to attach side-date to this very frame. This leaks all the side-data and metadata that ff_decode_frame_props() has attached. This happens in various fate-filter-metadata tests since 6ca43a9675d651d7ea47c7ba2fafb1bf831c4d0b. These particular leaks (which affect metadata-only) could be fixed by not adding metadata side-data to AVPackets in libavdevice if they are also available from the AVFrames. Yet this would break users that extract the metadata from AVPackets. The changes to FATE happen because of the way av_dict_set() works when it overwrites an already existing entry: It overwrites the entry to be overwritten with the last entry and adds the new entry at the end. The end result is that the first entry of the dict is the second-to-last-entry of the original dict, the last entry of the dict is the last entry of the old dict and the first count - 2 entries of the original dict are at positions 1..count - 2 in their original order. Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-18
| | | | | | | | | | | and remove FF_CODEC_CAP_INIT_THREADSAFE All our native codecs are already init-threadsafe (only wrappers for external libraries and hwaccels are typically not marked as init-threadsafe yet), so it is only natural for this to also be the default state. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Add FF_CODEC_CAP_NOT_INIT_THREADSAFEAndreas Rheinhardt2022-07-18
| | | | | | | This is in preparation of switching the default init-thread-safety to a codec being init-thread-safe. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pnmdec: Mark PHM decoder as init-threadsafeAndreas Rheinhardt2022-07-18
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/libjxlenc: avoid hard failure with unspecified primariesLeo Izen2022-07-17
| | | | | | | | This patch prevents the libjxl encoder wrapper from failing to encode images when the input video has untagged primaries. It will instead assume BT.709/sRGB primaries and print a warning. Signed-off-by: Leo Izen <leo.izen@gmail.com>
* avcodec: add Radiance HDR image format supportPaul B Mahol2022-07-16
|
* aarch64: me_cmp: Don't do uaddlv once per iterationMartin Storsjö2022-07-16
| | | | | | | | | | | | | | | | | | | | The max height is currently documented as 16; the max difference per pixel is 255, and a .8h element can easily contain 16*255, thus keep accumulating in two .8h vectors, and just do the final accumulationat the end. This should work for heights up to 256. This requires a minor register renumbering in ff_pix_abs16_xy2_neon. Before: Cortex A53 A72 A73 Graviton 3 pix_abs_0_0_neon: 97.7 47.0 37.5 22.7 pix_abs_0_1_neon: 154.0 59.0 52.0 25.0 pix_abs_0_3_neon: 179.7 96.7 87.5 41.2 After: pix_abs_0_0_neon: 96.0 39.2 31.2 22.0 pix_abs_0_1_neon: 150.7 59.7 46.2 23.7 pix_abs_0_3_neon: 175.7 83.7 81.7 38.2 Signed-off-by: Martin Storsjö <martin@martin.st>
* aarch64: me_cmp: Switch from uabd to uabal in ff_pix_abs16_xy2_neonMartin Storsjö2022-07-16
| | | | | | | | | | | | | | | | | | Using absolute-difference-accumulate does use twice the amount of absolute-difference instructions, but avoids the need for the uaddl and add instructions, reducing the total number of instructions by 3. These can be interleaved in the rest of the calculation, to avoid tight dependencies at the end. Unfortunately, this is marginally slower on Cortex A53, but faster on A72 and A73. Before: Cortex A53 A72 A73 Graviton 3 pix_abs_0_3_neon: 175.7 109.2 92.0 41.2 After: pix_abs_0_3_neon: 179.7 96.7 87.5 41.2 Signed-off-by: Martin Storsjö <martin@martin.st>
* aarch64: me_cmp: Interleave some of the loads in ff_pix_abs16_xy2_neonMartin Storsjö2022-07-16
| | | | | | | | | Before: Cortex A53 A72 A73 Graviton 3 pix_abs_0_3_neon: 183.7 112.7 97.5 41.2 After: pix_abs_0_3_neon: 175.7 109.2 92.0 41.2 Signed-off-by: Martin Storsjö <martin@martin.st>
* libavcodec: aarch64: Don't clobber v8 in the h%4 case in ff_pix_abs16_xy2_neonMartin Storsjö2022-07-16
| | | | | | Checkasm doesn't currently test this codepath. Signed-off-by: Martin Storsjö <martin@martin.st>
* avcodec/lagarith: Check dst/src in zero run codeMichael Niedermayer2022-07-14
| | | | | | | | | Fixes: out of array access Fixes: 48799/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-4764457825337344 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>
* lavc/aarch64: Add pix_abs16_x2 neon implementationHubert Mazur2022-07-13
| | | | | | | | | | | | | Provide neon implementation for pix_abs16_x2 function. Performance tests of implementation are below. - pix_abs_0_1_c: 283.5 - pix_abs_0_1_neon: 39.0 Benchmarks and tests run with checkasm tool on AWS Graviton 3. Signed-off-by: Hubert Mazur <hum@semihalf.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* Bump versions after 5.1 branchMichael Niedermayer2022-07-13
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Bump Versions for 5.1 branchMichael Niedermayer2022-07-13
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/h264dec: Skip late SEIMichael Niedermayer2022-07-12
| | | | | | | | | Fixes: Race condition Fixes: clusterfuzz-testcase-minimized-mediasource_MP2T_AVC_pipeline_integration_fuzzer-6282675434094592 Found-by: google ClusterFuzz Tested-by: Dan Sanders <sandersd@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/sbrdsp_fixed: Fix integer overflows in sbr_qmf_deint_neg_c()Michael Niedermayer2022-07-12
| | | | | | | | Fixes: signed integer overflow: 2147483645 + 16 cannot be represented in type 'int' Fixes: 46993/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-4759025234870272 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/pixlet: consider minimum plane header in the minimal packet sizeMichael Niedermayer2022-07-12
| | | | | | | | Fixes: Timeout Fixes: 46956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PIXLET_fuzzer-5698161106092032 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevcdsp_template: stay within tables in sao_band_filter()Michael Niedermayer2022-07-12
| | | | | | | | Fixes: out of array read Fixes: 47875/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5719393113341952 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/tiff: Check pixel format types for dngMichael Niedermayer2022-07-12
| | | | | | | | Fixes: out of array access Fixes: 48271/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-6149705769287680 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/qpeldsp: copy less for the mc0x casesMichael Niedermayer2022-07-12
| | | | | | | | Fixes: out of array access Fixes: 47936/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5745039940124672 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1dec: Check for min packet sizeMichael Niedermayer2022-07-12
| | | | | | | | Fixes: Timeout Fixes: 48619/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-5793597923917824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1dec: Limit golomb rice coded slices to width 8MMichael Niedermayer2022-07-12
| | | | | | | This limit is possibly not reachable due to other restrictions on buffers but the decoder run table is too small beyond this, so explicitly check for it. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/wnv1: Check for width =1Michael Niedermayer2022-07-12
| | | | | | | | | | The decoder only outputs pixels for width >1 images, fail early Fixes: Timeout Fixes: 48298/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WNV1_fuzzer-6198626319204352 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1dec_template: fix indentionMichael Niedermayer2022-07-12
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/aarch64: Hook up the existing ff_pix_abs16_neon to the sad[0] function ↵Hubert Mazur2022-07-11
| | | | | | | pointer Signed-off-by: Hubert Mazur <hum@semihalf.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* avcodec/pcm-dvdenc: Fix encoding 24bit samplesAndreas Rheinhardt2022-07-10
| | | | | | | | The earlier code ignored the lower 16 bits and instead used the highest 8 bits twice. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pcm-dvdenc: Remove unused extra_sample(s|_count)Andreas Rheinhardt2022-07-10
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegvideo_enc: Unify the code styleWenbin Chen2022-07-09
| | | | | | | Change whitespace and add newline to unify the code style. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/mpegvideo_enc: Fix a chroma mb size error in sse_mb()Wenbin Chen2022-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | For 422 frames we should not use hard coded 8 to calculate mb size for uv plane. Chroma shift should be taken into consideration to be compatiple with different sampling format. The error is reported by fate test when av_cpu_max_align() return 64 on the platform supporting AVX512. This is a hidden error and it is exposed after commit 17a59a634c39b00a680c6ebbaea58db95594d13d. mpeg2enc has a mechanism to reuse frames. When it computes SSE (sum of squared error) on current mb, reconstructed mb will be wrote to the previous mb space, so that the memory can be saved. However if the align is 64, the frame is shared in somewhere else, so the frame cannot be reused and a new frame to store reconstrued data is created. Because the height of mb is wrong when compute sse on 422 frame, starting from the second line of macro block, changed data is read when frame is reused (we need to read row 16 rather than row 8 if frame is 422), and unchanged data is read when frame is not reused (a new frame is created so the original frame will not be changed). That is why commit 17a59a634c39b00a680c6ebbaea58db95594d13d exposes this issue, because it add av_cpu_max_align() and this function return 64 on platform supporting AVX512 which lead to creating a frame in mpeg2enc, and this lead to the different outputs. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/hevc_cabac: Don't cast const away unnecessarilyAndreas Rheinhardt2022-07-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_refs: Constify ff_hevc_get_ref_list()Andreas Rheinhardt2022-07-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_sei: Use proper type for NALU typeAndreas Rheinhardt2022-07-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h26[45]_metadata_bsf: Fix range of chroma_sample_loc_typeAndreas Rheinhardt2022-07-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_ps: Fix wrong copyright yearsAndreas Rheinhardt2022-07-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/dv: Remove unnecessary headerAndreas Rheinhardt2022-07-09
| | | | | | Forgotten in 6d484671ecb612c32cbda0fab65f961743aff5f8. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cbs: Mark init and close functions as av_coldAndreas Rheinhardt2022-07-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/encode: Avoid check whose result is known in advanceAndreas Rheinhardt2022-07-09
| | | | | | | | | | | | | | | encode_send_frame_internal() is always only called if the buffer packet is empty and except when we are dealing with an audio codec that does not allow variable frame size it stays that way until a call to av_frame_ref() at the end of encode_send_frame_internal(). In case we are dealing with the small last frame of an audio encoder requiring constant frame size the frame will be allocated by pad_last_frame() and this the only case where this is so. So by returning directly after pad_last_frame(), we can avoid having to recheck whether the frame is still empty before av_frame_ref(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>