1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-02 03:06:28 +02:00
Commit Graph

115474 Commits

Author SHA1 Message Date
LuMingYin
3f691c0c6a libavfilter/vf_curves: fix a memory leak on error path
Signed-off-by: LuMingYin <lumingyindetect@163.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-05-20 23:57:45 +08:00
LuMingYin
14f9e47314 libavformat/rtsp: fix a memory leak on error path
Signed-off-by: LuMingYin <lumingyindetect@163.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-05-20 23:57:05 +08:00
LuMingYin
9481b7d932 libavformat/hlsenc: fix a memory leak on error path
Signed-off-by: LuMingYin <lumingyindetect@163.com>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-05-20 23:56:58 +08:00
James Almer
b113050d96 avcodec/cbs_h266: read vps_ptl_max_tid before using it
Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-20 10:29:30 -03:00
Andreas Rheinhardt
0d7430d3ab avfilter/vf_v360: Add assert to suppress Coverity false positives
Should fix many Coverity false positives, namely #1457947-#1457994
as well as #1461195-#146210.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 14:16:39 +02:00
Andreas Rheinhardt
2c94b1bbf1 avcodec/tiff: Fix leak on error
Fixes Coverity issue #1516957.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 14:15:48 +02:00
Andreas Rheinhardt
62929f40ee fftools/ffmpeg_filter: Fix leak on error
Do this by attaching the FilterGraph directly to more permanent
storage from which it will be automatically freed.
Fixes Coverity issue #1596533.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 14:15:23 +02:00
Andreas Rheinhardt
b50c5d0290 avformat/flacdec: Reorder allocations to avoid leak on error
Fixes Coverity issue #1591795.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 14:15:18 +02:00
Andreas Rheinhardt
59b1838e09 avcodec/ac3enc: Move transient PutBitContext to stack
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 14:11:25 +02:00
Andreas Rheinhardt
e863cbceae avcodec/ac3enc_template: Avoid always-true check
This might also help Coverity with issue #1596532.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 14:11:03 +02:00
Andreas Rheinhardt
f3d206d25f fftools, avfilter, avformat: Simplify check for "is dictionary empty?"
Reviewed-by: epirat07@gmail.com
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 13:52:41 +02:00
Andreas Rheinhardt
482afe8f3f avcodec/lib*, avformat/tee: Simplify iterating over AVDictionary
Reviewed-by: epirat07@gmail.com
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 13:51:55 +02:00
Andreas Rheinhardt
ce22e7ab28 avformat/tee: Use smaller scope for variables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 13:49:58 +02:00
Andreas Rheinhardt
26f3e79114 avformat/tee: Constify AVDictionaryEntry* pointee where possible
This is in preparation for using av_dict_iterate().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 13:33:38 +02:00
Andreas Rheinhardt
583c3d45fa avformat/tls_openssl: #if ff_openssl_init/deinit() away if possible
These functions do nothing useful when used with a non-ancient
version of openssl (namely 1.1.0 or above).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 12:37:42 +02:00
Andreas Rheinhardt
8b48b0adab avformat/utils: Use static mutexes instead of ff_lock_avformat()
Its existence is a remnant of (libavcodec's) lock-manager API
which has been removed in a04c2c707d.
There is no need to use the same lock for avisynth, chromaprint
or tls, so switch to ordinary static mutexes instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 12:28:28 +02:00
Andreas Rheinhardt
a2874c5721 avcodec/aac_ac3_parser: Use ff_adts_header_parse_buf()
instead of avpriv_adts_header_parse(). Using the former avoids
an indirection.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 12:06:50 +02:00
Andreas Rheinhardt
12ded9cd85 avcodec/adts_header: Add ff_adts_header_parse_buf()
Most users of ff_adts_header_parse() don't already have
an opened GetBitContext for the header, so add a convenience
function for them.
Also use a forward declaration of GetBitContext in adts_header.h
as this avoids (implicit) inclusion of get_bits.h in some of
the users that now no longer use a GetBitContext of their own.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 12:06:31 +02:00
Andreas Rheinhardt
ae937c4902 avcodec/aac_ac3_parser: Untangle AAC and AC3 parsing error codes
Also remove the (unused) AAC_AC3_PARSE_ERROR_CHANNEL_CFG while at it;
furthermore, fix the documentation of ff_ac3_parse_header()
and (ff|avpriv)_adts_header_parse().

Reviewed-by: Andrew Sayers <ffmpeg-devel@pileofstuff.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 11:58:07 +02:00
Andreas Rheinhardt
6c812a80dd avcodec/adts_parser: Don't presume buffer to be padded
The documentation of av_adts_header_parse() does not require
the buffer to be padded at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 11:48:03 +02:00
Haihao Xiang
127ded5078 lavfi/qsvvpp: require a dynamic frame pool for output if possible
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-05-20 09:30:49 +08:00
Haihao Xiang
5646285f76 lavfi/qsvvpp: use the right mfxFrameInfo when dynamic frame pool is used
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-05-20 09:30:49 +08:00
Haihao Xiang
a00cfc6c24 lavc/qsvdec: require a dynamic frame pool if possible
This allows a downstream element stores more frames from qsv decoders
and fixes error in get_buffer().

$ ffmpeg -hwaccel qsv -hwaccel_output_format qsv -i input.mp4 -vf
reverse -f null -

[vist#0:0/h264 @ 0x562248f12c50] Decoding error: Cannot allocate memory
[h264_qsv @ 0x562248f66b10] get_buffer() failed

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-05-20 09:30:49 +08:00
Haihao Xiang
75015f9b0e lavc/qsvenc: use the right info for encoding
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-05-20 09:30:49 +08:00
Haihao Xiang
cda721e01d lavc/qsv: fix the mfx allocator to support dynamic frame pool
When the external allocator is used for dynamic frame allocation, only
video memory is supported, the SDK doesn't lock/unlock the memory block
via Lock()/Unlock() calls.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-05-20 09:30:49 +08:00
Haihao Xiang
d3cc5ead42 lavu/hwcontext_qsv: add support for dynamic frame pool in qsv_map_to
Make it work with the source which has a dynamic frame pool.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-05-20 09:30:49 +08:00
Haihao Xiang
932f78c4e5 lavu/hwcontext_qsv: add support for dynamic frame pool in qsv_frames_derive_to
Make it work with the source which has a dynamic frame pool.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-05-20 09:30:49 +08:00
Haihao Xiang
96db4a62e0 lavu/hwcontext_qsv: create dynamic frame pool if required
When AVHWFramesContext.initial_pool_size is 0, a dynamic frame pool is
required. We may support this under certain conditions, e.g. oneVPL 2.9+
support dynamic frame allocation, we needn't provide a fixed frame pool
in the mfxFrameAllocator.Alloc callback.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-05-20 09:30:49 +08:00
Haihao Xiang
4c0bb7d4a9 lavu/hwcontext_qsv: update AVQSVFramesContext to support dynamic frame pool
Add AVQSVFramesContext.info and update the description.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-05-20 09:30:48 +08:00
Haihao Xiang
3178c99fa9 lavu/version: fix minor version
The latest version should be 59.18.100 since commit 01c5f4ad

$ git diff 01c5f4ad~1..HEAD doc/APIchanges
...
+2024-05-10 - xxxxxxxxx - lavu 59.18.100 - cpu.h
+  Add AV_CPU_FLAG_RV_ZVBB.
+

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-05-20 09:24:44 +08:00
Andreas Rheinhardt
d7fdd502d6 tests/ref/fate/source: Add exceptions for riscv startcode files
Fixes fate-source.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 00:08:51 +02:00
Michael Niedermayer
e35fe3d8b9
avcodec/mscc & mwsc: Check loop counts before use
This could cause timeouts

Fixes: CID1439568 Untrusted loop bound

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-19 22:14:39 +02:00
Michael Niedermayer
b6b2b01025
avcodec/mpegvideo_enc: Fix potential overflow in RD
Fixes: CID1500285 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-19 22:14:38 +02:00
Michael Niedermayer
8fc649b931
avcodec/mpeg4videodec: assert impossible wrap points
Helps: CID1473517 Uninitialized scalar variable
Helps: CID1473497 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-19 22:14:37 +02:00
Michael Niedermayer
4c725df059
avcodec/mpeg12dec: Use 64bit in bit computation
I dont think this can actually overflow but 64bit seems reasonable to use

Fixes: CID1521983 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-19 22:14:37 +02:00
Michael Niedermayer
6a9302739f
avcodec/vqcdec: Check init_get_bits8() for failure
Fixes: CID1516090 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-19 22:12:55 +02:00
Michael Niedermayer
4a8506c794
avcodec/vvc/dec: Check init_get_bits8() for failure
Fixes: CID1560042 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-19 22:12:55 +02:00
Michael Niedermayer
dd5379db5d
avcodec/vble: Check av_image_get_buffer_size() for failure
Fixes: CID1461482 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Reviewed-.by: "Xiang, Haihao" <haihao.xiang@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-19 22:12:54 +02:00
Michael Niedermayer
1b991e77b9
avcodec/vp3: Replace check by assert
Fixes: CID1452425 Logically dead code

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-19 22:12:54 +02:00
Michael Niedermayer
63feed1519
avcodec/vp8: Forward return of ff_vpx_init_range_decoder()
Fixes: CID1507483 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-19 22:12:54 +02:00
Andrea Mastroberti
90ce54804a
avfilter/smartblur: Added alpha layer support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-19 22:12:53 +02:00
Rémi Denis-Courmont
463c573e6b lavc/huffyuvdsp: optimise RVV vtype for add_hfyu_left_pred_bgr32
T-Head C908:
add_hfyu_left_pred_bgr32_c:       237.5
add_hfyu_left_pred_bgr32_rvv_i32: 173.5 (before)
add_hfyu_left_pred_bgr32_rvv_i32: 110.0 (after)
2024-05-19 18:37:33 +03:00
Rémi Denis-Courmont
233066e85a lavc/flacdsp: optimise RVV vector type for lpc32
This is pretty much the same as for lpc16, though it only improves half
as large prediction orders. With 128-bit vectors, this gives:

   C      V old  V new
1   69.2  181.5   95.5
2  107.7  180.7   95.2
3  145.5  180.0  103.5
4  183.0  179.2  102.7
5  220.7  178.5  128.0
6  257.7  194.0  127.5
7  294.5  193.7  126.7
8  331.0  193.0  126.5

Larger prediction orders see no significant changes at that size.
2024-05-19 18:37:33 +03:00
Rémi Denis-Courmont
6ab4b92e82 lavc/flacdsp: optimise RVV vector type for lpc16
This calculates the optimal vector type value at run-time based on the
hardware vector length and the FLAC LPC prediction order. In this
particular case, the additional computation is easily amortised over
the loop iterations:

T-Head C908:
    C     V before  V after
 1   48.0    214.7     95.2
 2   64.7    214.2     94.7
 3   79.7    213.5     94.5
 4   96.2    196.5     94.2 #
 5  111.0    195.7    118.5
 6  127.0    211.2    102.0
 7  143.7    194.2    101.5
 8  175.7    193.2    101.2 #
 9  176.2    224.2    126.0
10  191.5    192.0    125.5
11  224.5    191.2    124.7
12  223.0    190.2    124.2
13  239.2    189.5    123.7
14  253.7    188.7    139.5
15  286.2    188.0    122.7
16  284.0    187.0    122.5 #
17  300.2    186.5    186.5
18  314.0    185.5    185.7
19  329.7    184.7    185.0
20  343.0    184.2    184.2
21  358.7    199.2    183.7
22  371.7    182.7    182.7
23  387.5    181.7    182.0
24  400.7    181.0    181.2
25  431.5    180.2    196.5
26  443.7    195.5    196.0
27  459.0    178.7    196.2
28  470.7    177.7    194.2
29  470.0    177.0    193.5
30  481.2    176.2    176.5
31  496.2    175.5    175.7
32  507.2    174.7    191.0 #

 # Power of two boundary.

With 128-bit vectors, improvements are expected for the first two
test cases only. For the other two, there is overhead but below noise.
Improvements should be better observable with prediction order of 8
and less, or on hardware with larger vector sizes.
2024-05-19 18:37:33 +03:00
Rémi Denis-Courmont
ee1526c05f lavu/riscv: add assembler macros for adjusting vector LMUL
vtype_vli computes the VTYPE value with the optimal LMUL for a given
element width, tail and mask policies and a run-time vector length.

vtype_ivli does the same, but with the compile-time constant vector
length.

vwtypei and vntypei can be used to widen or narrow a VTYPE value for
use in mixed-width vector-optimised functions.
2024-05-19 18:37:33 +03:00
Andreas Rheinhardt
a7e506fcd8 avcodec/vc1_parser: Check init_get_bits8()
Addresses Coverity issue #1441935.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-19 11:49:33 +02:00
Andreas Rheinhardt
95937d6316 avcodec/codec_desc: Mark AVRN, TGQ, PhotoCD, VBN as intra-only
Also remove the then redundant assignments of AV_FRAME_FLAG_KEY,
AV_PICTURE_TYPE_I.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-19 11:40:55 +02:00
Andreas Rheinhardt
2a00d68c09 avcodec/yop: Add missing AV_CODEC_CAP_DR1
This decoder does not do anything fancy any more since
c6303f8d70 (before that,
it overwrote the frame's linesize) so that it supports
direct rendering. This effectively reverts
d3de3a16d1.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-19 11:40:43 +02:00
Andreas Rheinhardt
df3cdf4c75 avcodec: Remove redundant setting of AV_FRAME_FLAG_KEY, AV_PICTURE_TYPE_I
This is done generically now.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-19 11:40:07 +02:00
Andreas Rheinhardt
eee88ba0dc avcodec/decode: Set KEY flag+pict_type generically for intra-only codecs
This commit is the analog of 3f11eac757
for decoding: It sets the AV_FRAME_FLAG_KEY and (for video decoders)
also pict_type to AV_PICTURE_TYPE_I. It furthermore stops setting
audio frames as always being key frames -- it is wrong for e.g.
TrueHD/MLP. The latter also affects TAK and DFPWM.

The change already improves output for several decoders where
it has been forgotten to set e.g. pict_type like speedhq, wnv1
or tiff. The latter is the reason for the change to the exif-image-tiff
FATE test reference file.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-19 11:39:45 +02:00