summaryrefslogtreecommitdiff
path: root/libavcodec
Commit message (Collapse)AuthorAge
* avcodec/videotoolbox: fix use of unknown builtin '__builtin_available'Limin Wang2021-12-04
| | | | | | | | | Old system is: OSX version: 10.11.6 Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin15.6.0 Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* all: Remove unused-but-set variablesAndreas Rheinhardt2021-12-03
| | | | | | Newer versions of Clang detect this and emit warnings for it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: Use av_memdup() where appropriateAndreas Rheinhardt2021-12-03
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h264_redundant_pps_bsf: Inline constantAndreas Rheinhardt2021-12-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h264_redundant_pps_bsf: Support multiple input PPSAndreas Rheinhardt2021-12-03
| | | | | | | | | | | | | | | | Up until now, the h264_redundant_pps_bsf stored the initial value of pic_init_qp_minus26 of the most recently encountered PPS; it also modified the slices based upon to assumption that the most recent PPS is the PPS the slice belongs to. Yet this assumption is flawed, as there can be several PPS with different IDs that are visible at any given time. If these have different pic_init_qp_minus26 values, the output can be invalid. Fix this by directly using the pic_init_qp_minus26 value of the input PPS. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h264_redundant_pps_bsf: Remove flush callbackAndreas Rheinhardt2021-12-03
| | | | | | | | | extradata_pic_init_qp is unset since fa75e438756f159a667080dcba58ea2e3b190001 (and resetting current_pic_init_qp to the value it had in extradata never made much sense). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/movtextenc: Simplify writing a single charAndreas Rheinhardt2021-12-02
| | | | | Reviewed-by: Philip Langdale <philipl@overt.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/movtextenc: Remove redundant byte countAndreas Rheinhardt2021-12-02
| | | | | | | Use the AVBPrint's len instead. Reviewed-by: Philip Langdale <philipl@overt.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/movtextenc: Fix encoding of subtitles with multiple rectsAndreas Rheinhardt2021-12-02
| | | | | | | | | | | | | | | | | | | | | | | | The format of a mov_text (3GPP Timed Text) sample is: uint16_t text_length; uint8_t text[text_length]; TextSampleModifierBox text_modifier; Yet in case our encoder receives an AVSubtitle with multiple ASS AVSubtitleRects, it creates something like this: uint16_t text_length; uint8_t text[text_length_1]; TextSampleModifierBox text_modifier_1; uint8_t text[text_length_2]; TextSampleModifierBox text_modifier_2; ... where text_length is the sum of all the text_length_*. This commit fixes this by writing the TextSampleModifierBoxes only after all the rects have been written. Reviewed-by: Philip Langdale <philipl@overt.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/movtextenc: Check for too long subtitlesAndreas Rheinhardt2021-12-02
| | | | | Reviewed-by: Philip Langdale <philipl@overt.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/movtextenc: Reset AVBPrint at the beginning, not end of encodingAndreas Rheinhardt2021-12-02
| | | | | | | | | This avoids abusing a variable called length for the return value and ensures that the AVBPrint is always reset before using it; previously this has been forgotten in some error paths. Reviewed-by: Philip Langdale <philipl@overt.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/movtextenc: Fix infinite loop due to variable truncationAndreas Rheinhardt2021-12-02
| | | | | | | | Regression since af043b839c38e850af1184fd6be691f8475c048e. Fixes ticket #9409. Reviewed-by: Philip Langdale <philipl@overt.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/vp3: Check version in all cases when VP4 code is not builtMichael Niedermayer2021-12-01
| | | | | | | | | Fixes: out of array read Fixes: 40284/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP3_fuzzer-4599568176644096 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/gemdec: Check tag & planes before image allocationMichael Niedermayer2021-12-01
| | | | | | | | | Fixes: Timeout Fixes: 41083/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GEM_fuzzer-5843826518917120 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: [loongarch] Optimize decode_significance/_8x8_loongarch.Hao Chen2021-12-01
| | | | | | | | Decoding 1080P H264 from 168fps to 170fps. Signed-off-by: Shiyou Yin <yinshiyou-hf@loongson.cn> Reviewed-by: 陈昊 <chenhao@loongson.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: [loongarch] optimize get_cabac.Shiyou Yin2021-12-01
| | | | | | | | Decoding 1080P H264 on 2.5Ghz 3A5000: 165fps==>168fps. Testing command: ffmpeg -i ***.mp4 -f rawvideo -y /dev/null -an Reviewed-by: 陈昊 <chenhao@loongson.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vaapi_encode: Fix segfault upon closing uninitialized encoderAndreas Rheinhardt2021-12-01
| | | | | | | Fixes ticket #9537. Probably a regression since 2b3206891649f317c20993411efef4bee39ae784. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/qsvenc: Properly flush the FIFO on closeAndreas Rheinhardt2021-11-30
| | | | | | | | Freeing the new H.264 specific fields has been forgotten. (This leak only appears in case the encoder has not been completely drained.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/qsvenc: Fix leak of A53 dataAndreas Rheinhardt2021-11-30
| | | | | | | Up until now, it has only been freed when the QSVFrame is reused, so that the last one contained in it leaked at the end. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/qsvenc: Fix leak and crash when encoding H.264 due to A53_CCAndreas Rheinhardt2021-11-30
| | | | | | | | | | | | | | | | | | | | | Since commit 3bbe0c210b05fc6fbd7b1d4bbd8479db7f2cf957, the Payloads array of every QSVFrame leaks as soon as the frame is reused; the leak is small and not very noticeable, but if there is an attempt to use said array the ensuing crash is much more noticeable. This happens when encoding H.264 with A53 CC side data. Furthermore, if said array can not be allocated at all, an AVFrame leaks. Fix all of this by not allocating the array separately at all; put it in QSVFrame instead and restore the Payloads array upon reusing the frame. Finally, use av_freep() instead of av_free() to free the payload entries. Reviewed-by: Xiang, Haihao <haihao.xiang@intel.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/iff: limit written bytes to twice the output array size in ↵Michael Niedermayer2021-11-29
| | | | | | | | | | decode_delta_l() Fixes: Timeout Fixes: 39436/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-6624915520880640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/vqavideo: Use GetByteContext and check for endMichael Niedermayer2021-11-29
| | | | | | | | Fixes: out of array access Fixes: Timeout Fixes: 40481/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQA_fuzzer-6502647583080448 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/videotoolbox: silence some -Wimplicit-fallthrough warningsJames Almer2021-11-28
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/videotoolbox: fix build on pre-10.14 SDKsrcombs2021-11-28
| | | | Also fixes handling of future codec tags (needed to bswap)
* lavc: bump minor version for new VT hwaccelsrcombs2021-11-28
|
* lavc/proresdec: add videotoolbox hwaccelrcombs2021-11-28
|
* lavc/proresdec: add scaffolding for hwdec supportrcombs2021-11-28
|
* videotoolbox: add alpha supportrcombs2021-11-28
|
* lavc/videotoolbox: add VP9 hardware accelerationrcombs2021-11-28
| | | | On M1 Max, this supports profiles 0 and 2, but not 1 and 3.
* lavc/videotoolbox: call VTRegisterSupplementalVideoDecoderIfAvailablercombs2021-11-28
| | | | This is required for VP9 to work.
* lavc/videotoolbox: expose some functions as lavc-internalrcombs2021-11-28
|
* lavc/hevcdec: support all color formats in videotoolbox hwaccelrcombs2021-11-28
|
* lavc/h264dec: support all color formats in videotoolbox hwaccelrcombs2021-11-28
|
* lavc/videotoolbox: select 4:2:2 and 4:4:4 formats when applicablercombs2021-11-28
|
* lavc/videotoolbox: fix format computationrcombs2021-11-28
| | | | Use sw_pix_fmt instead of pix_fmt (consistent with other hwaccels)
* lavc/videotoolbox: escape 0x00000[0-3]s in avcC PSsrcombs2021-11-28
|
* avcodec/vqavideo: Remove dead codeAndreas Rheinhardt2021-11-28
| | | | | | Fixes Coverity issue #1493344. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mobiclip: Rewrite code to make it clearerAndreas Rheinhardt2021-11-28
| | | | | | | | | | In order to know that the earlier code did not use uninitialized values one needs to know that the lowest four bits of each used value of pframe_block4x4_coefficients_tab do not vanish identically. E.g. Coverity did not get this and warned about it in ticket #1466632. Fix this by slightly rewriting the code. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpeg_parser: skip markers after EOI, not by sizeAlex Xu (Hello71)2021-11-27
| | | | | | | | | | | | | The check for m->size >= 0xF000 is intended to avoid skipping too much garbage data between JPEG frames in test_roman (thus missing next SOI), but it erroneously also skips valid markers between SOI and SOS. Instead of this, we should simply skip parsing markers other than SOI after EOI. That way, we will not accidentally skip over SOI due to some garbage between frames. There is still a small risk of encountering FFD8 in the garbage data, but the chance of this is fairly low. Fixes: https://trac.ffmpeg.org/ticket/8967 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/txd: Move input size checks before allocationMichael Niedermayer2021-11-26
| | | | | | | Fixes: Timeout Fixes: 40882/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TXD_fuzzer-4893364584054784 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/h263: Fix global-buffer-overflow with noout flag2 setAndreas Rheinhardt2021-11-26
| | | | | | | | | | | | h263_get_motion_length() forgot to take an absolute value; as a consequence, a negative index was used to access an array. This leads to potential crashes, but mostly it just accesses what is to the left of ff_mvtab (unless one uses ASAN), thereby defeating the purpose of the AV_CODEC_FLAG2_NO_OUTPUT because the sizes of the returned packets differ from the sizes the encoder would actually have produced. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: suppport for bitpacked encodeLimin Wang2021-11-25
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec: rename bitpacked.c to bitpacked_dec.cLimin Wang2021-11-25
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* libvpxdec: Correct linking against variables.Matt Oliver2021-11-25
| | | | Instead link against the function that returns the correct variable. This fixes linking errors with dlls with msvc.
* avcodec/libaomenc: remove the redundant initializationLimin Wang2021-11-23
| | | | | | | For dst->have_sse will be assigned by ctx->have_sse soon(code line 23). Reviewed-by: James Zern <jzern-at-google.com@ffmpeg.org> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/h263: Inline constantAndreas Rheinhardt2021-11-21
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* av(codec|device): Don't cast pointers to intAndreas Rheinhardt2021-11-21
| | | | | | | | | | C99/C11 6.3.2.3 5: "Any pointer type may be converted to an integer type. [...] If the result cannot be represented in the integer type, the behavior is undefined." So stop casting pointers to int; use uintptr_t instead. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/smcenc: Move PutByteContext to stackAndreas Rheinhardt2021-11-20
| | | | | | | | This context is transient, so putting it on the stack is more natural. Also reduces codesize: 24E6->2296 B with GCC 10 and -O3. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/dnxhddata: Unavpriv dnxhd_get_(hr_|)_frame_size()Andreas Rheinhardt2021-11-19
| | | | | | It is no longer used in libavformat. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/dnxhddata: Remove avpriv_dnxhd_get_interlaced()Andreas Rheinhardt2021-11-19
| | | | | | It is unused. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>