1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-12 19:18:44 +02:00
Commit Graph

116744 Commits

Author SHA1 Message Date
Rémi Denis-Courmont
d8fb44c0aa lavc/mpegvideoencdsp: R-V V add_8x8basis
T-Head C908:
add_8x8basis_c:      440.6
add_8x8basis_rvv_i32: 70.3

SpacemiT X60:
add_8x8basis_c:      436.3
add_8x8basis_rvv_i32: 40.5
2024-08-19 22:41:13 +03:00
Rémi Denis-Courmont
1907dd7f23 lavc/mpegvideoencdsp: R-V V try_8x8basis
T-Head C908:
try_8x8basis_c:       922.5
try_8x8basis_rvv_i32: 135.3

SpacemiT X60:
try_8x8basis_c:       926.1
try_8x8basis_rvv_i32: 103.1
2024-08-19 22:41:13 +03:00
Rémi Denis-Courmont
0fd37c00d7 lavc/mpegvideoencdsp: R-V V pix_norm1
T-Head C908:
pix_norm1_c:       480.2
pix_norm1_rvv_i64: 146.9

SpacemiT X60:
pix_norm1_c:       478.2
pix_norm1_rvv_i64:  92.7
2024-08-19 22:41:13 +03:00
Rémi Denis-Courmont
63d016aea5 lavc/mpegvideoencdsp: R-V V pix_sum
T-Head C908:
pix_sum_c:      332.2
pix_sum_rvv_i64: 91.2

SpacemiT X60:
pix_sum_c:      321.2
pix_sum_rvv_i64: 60.9
2024-08-19 22:41:13 +03:00
Anton Khirnov
631a725670 lavc/hevcdec: call ff_thread_finish_setup() even if hwaccel is in use
Serializing frame threading for non-threadsafe hwaccels is handled at the
generic level, the decoder does not need to care about it.
2024-08-19 21:37:22 +02:00
Anton Khirnov
4b9adb35b6 lavc/hevcdec: simplify output logic
Current code is written around the "simple" decode API's limitation that
a single input packet (AU/coded frame) triggers the output of at most
one output frame. However the spec contains two cases where a coded
frame may cause multiple frames to be output (cf. C.5.2.2.2):
* start of a new sequence
* overflowing sps_max_dec_pic_buffering

The decoder currently contains rather convoluted logic to handle these
cases:
* decode/output/per-frame sequence counters,
* HEVC_FRAME_FLAG_BUMPING
* ff_hevc_bump_frame()
* special clauses in ff_hevc_output_frame()

However, with the receive_frame() API none of that is necessary, as we
can just output multiple frames at once. Previously added ContainerFifo
allows that to be done in a straightforward and efficient manner.
2024-08-19 21:37:22 +02:00
Anton Khirnov
79afc45c03 lavc/hevcdec: use a ContainerFifo to hold frames scheduled for output
Instead of a single AVFrame.

Will be useful in future commits, where we will want to produce multiple
output frames for a single coded frame.
2024-08-19 21:37:22 +02:00
Anton Khirnov
4bda7f288c lavc/videotoolbox: drop HEVC cropping from start_frame rather than end_frame
HEVCContext.output_frame will be removed in following commits.

Reported-By: Max Bykov
2024-08-19 21:37:22 +02:00
Anton Khirnov
6174818252 lavc: add private container FIFO API
It provides a FIFO for "container" objects like AVFrame/AVPacket and
features an integrated FFRefStructPool-based pool to avoid allocating an
freeing them repeatedly.
2024-08-19 21:37:22 +02:00
Anton Khirnov
2fdecbb239 lavc/hevcdec: switch to receive_frame()
Required by following commits, where we will want to output multiple
frames per packet.
2024-08-19 21:37:22 +02:00
sunyuechi
4e7b5ac48f lavc/vp9dsp: R-V V mc bilin hv
C908   X60
vp9_avg_bilin_4hv_8bpp_c                           :   10.7    9.5
vp9_avg_bilin_4hv_8bpp_rvv_i32                     :    4.0    3.5
vp9_avg_bilin_8hv_8bpp_c                           :   38.5   34.2
vp9_avg_bilin_8hv_8bpp_rvv_i32                     :    7.2    6.5
vp9_avg_bilin_16hv_8bpp_c                          :  147.2  130.5
vp9_avg_bilin_16hv_8bpp_rvv_i32                    :   14.5   12.7
vp9_avg_bilin_32hv_8bpp_c                          :  574.2  509.7
vp9_avg_bilin_32hv_8bpp_rvv_i32                    :   42.5   38.0
vp9_avg_bilin_64hv_8bpp_c                          : 2321.2 2017.7
vp9_avg_bilin_64hv_8bpp_rvv_i32                    :  163.5  131.0
vp9_put_bilin_4hv_8bpp_c                           :   10.0    8.7
vp9_put_bilin_4hv_8bpp_rvv_i32                     :    3.5    3.0
vp9_put_bilin_8hv_8bpp_c                           :   35.2   31.2
vp9_put_bilin_8hv_8bpp_rvv_i32                     :    6.5    5.7
vp9_put_bilin_16hv_8bpp_c                          :  134.0  119.0
vp9_put_bilin_16hv_8bpp_rvv_i32                    :   12.7   11.5
vp9_put_bilin_32hv_8bpp_c                          :  538.5  464.2
vp9_put_bilin_32hv_8bpp_rvv_i32                    :   39.7   35.2
vp9_put_bilin_64hv_8bpp_c                          : 2111.7 1833.2
vp9_put_bilin_64hv_8bpp_rvv_i32                    :  138.5  122.5

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-08-19 22:29:20 +03:00
sunyuechi
9edd2e723b lavc/vp9dsp: R-V V mc bilin h v
C908   X60
vp9_avg_bilin_4h_8bpp_c                            :    5.5    4.7
vp9_avg_bilin_4h_8bpp_rvv_i32                      :    1.7    1.5
vp9_avg_bilin_4v_8bpp_c                            :    5.5    4.7
vp9_avg_bilin_4v_8bpp_rvv_i32                      :    1.5    1.2
vp9_avg_bilin_8h_8bpp_c                            :   20.0   17.7
vp9_avg_bilin_8h_8bpp_rvv_i32                      :    3.0    2.7
vp9_avg_bilin_8v_8bpp_c                            :   20.7   18.7
vp9_avg_bilin_8v_8bpp_rvv_i32                      :    3.0    2.7
vp9_avg_bilin_16h_8bpp_c                           :   78.2   69.7
vp9_avg_bilin_16h_8bpp_rvv_i32                     :    7.0    6.2
vp9_avg_bilin_16v_8bpp_c                           :   98.5   73.2
vp9_avg_bilin_16v_8bpp_rvv_i32                     :    7.0    6.0
vp9_avg_bilin_32h_8bpp_c                           :  325.5  275.5
vp9_avg_bilin_32h_8bpp_rvv_i32                     :   23.0   20.5
vp9_avg_bilin_32v_8bpp_c                           :  342.2  290.0
vp9_avg_bilin_32v_8bpp_rvv_i32                     :   21.7   19.5
vp9_avg_bilin_64h_8bpp_c                           : 1263.7 1095.7
vp9_avg_bilin_64h_8bpp_rvv_i32                     :   91.2   81.2
vp9_avg_bilin_64v_8bpp_c                           : 1331.7 1155.2
vp9_avg_bilin_64v_8bpp_rvv_i32                     :   91.2   81.0
vp9_put_bilin_4h_8bpp_c                            :    4.5    4.0
vp9_put_bilin_4h_8bpp_rvv_i32                      :    1.0    1.0
vp9_put_bilin_4v_8bpp_c                            :    4.7    4.2
vp9_put_bilin_4v_8bpp_rvv_i32                      :    1.0    1.0
vp9_put_bilin_8h_8bpp_c                            :   16.7   15.0
vp9_put_bilin_8h_8bpp_rvv_i32                      :    2.2    2.0
vp9_put_bilin_8v_8bpp_c                            :   17.5   15.7
vp9_put_bilin_8v_8bpp_rvv_i32                      :    2.2    2.0
vp9_put_bilin_16h_8bpp_c                           :   65.2   58.0
vp9_put_bilin_16h_8bpp_rvv_i32                     :    6.0    5.5
vp9_put_bilin_16v_8bpp_c                           :   69.2   61.7
vp9_put_bilin_16v_8bpp_rvv_i32                     :    5.7    5.2
vp9_put_bilin_32h_8bpp_c                           :  273.2  229.0
vp9_put_bilin_32h_8bpp_rvv_i32                     :   19.7   17.7
vp9_put_bilin_32v_8bpp_c                           :  290.5  243.7
vp9_put_bilin_32v_8bpp_rvv_i32                     :   18.7   16.7
vp9_put_bilin_64h_8bpp_c                           : 1040.5  910.5
vp9_put_bilin_64h_8bpp_rvv_i32                     :   82.5   73.0
vp9_put_bilin_64v_8bpp_c                           : 1108.5  971.0
vp9_put_bilin_64v_8bpp_rvv_i32                     :   82.2   73.2

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-08-19 22:29:20 +03:00
Marvin Scholz
8f36c6f2e7
MAINTAINERS: add CC preference for myself
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-19 17:46:44 +02:00
Michael Niedermayer
7e5410eadb
avformat/iamf_parse: clear padding
Fixes: use of uninitialized value
Fixes: 70929/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-5931276639469568

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>
2024-08-18 23:05:40 +02:00
Michael Niedermayer
67947f2a1c
avcodec/hevc/ps: use unsigned shift
Fixes: left shift of 1 by 31 places cannot be represented in type 'int'
Fixes: 70726/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6149928703819776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-18 23:05:39 +02:00
Michael Niedermayer
043875941f
avcodec/cbs_h265_syntax_template:
Fixes: Assertion width > 0 && width <= 32 failed
Fixes: 71012/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_METADATA_fuzzer-6073354744823808

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-18 23:05:28 +02:00
Michael Niedermayer
8657eb9c3f
avcodec/avcodec: Warn about data returned from get_buffer*()
Text based on suggestion by: epirat07@gmail.com
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-18 23:04:28 +02:00
Dale Curtis
4230379835
avformat/mov: Fix nullptr dereference with invalid encryption metadata.
Found by fuzzer.

Bug: https://crbug.com/356720789
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-08-18 22:43:55 +02:00
Ramiro Polla
181cd260db swscale/aarch64/yuv2rgb: add neon yuv42{0,2}p -> gbrp unscaled colorspace converters
checkasm --bench on a Raspberry Pi 5 Model B Rev 1.0:
yuv420p_gbrp_128_c: 1243.0
yuv420p_gbrp_128_neon: 453.5
yuv420p_gbrp_1920_c: 18165.5
yuv420p_gbrp_1920_neon: 6700.0
yuv422p_gbrp_128_c: 1463.5
yuv422p_gbrp_128_neon: 471.5
yuv422p_gbrp_1920_c: 21343.7
yuv422p_gbrp_1920_neon: 6743.5
2024-08-18 22:26:17 +02:00
Ramiro Polla
8744764a4c swscale/x86/yuv2rgb: add ssse3 yuv42{0,2}p -> gbrp unscaled colorspace converters
Note: this implementation is limited to x86_64 due to general purpose
      register pressure.

checkasm --bench on an Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz:
yuv420p_gbrp_8_c: 118.5
yuv420p_gbrp_8_ssse3: 93.3
yuv420p_gbrp_128_c: 1068.3
yuv420p_gbrp_128_ssse3: 319.3
yuv420p_gbrp_1080_c: 8841.8
yuv420p_gbrp_1080_ssse3: 2211.8
yuv420p_gbrp_1920_c: 15903.8
yuv420p_gbrp_1920_ssse3: 3814.3
yuv422p_gbrp_8_c: 144.8
yuv422p_gbrp_8_ssse3: 93.8
yuv422p_gbrp_128_c: 1395.8
yuv422p_gbrp_128_ssse3: 313.0
yuv422p_gbrp_1080_c: 11551.5
yuv422p_gbrp_1080_ssse3: 2240.8
yuv422p_gbrp_1920_c: 20585.3
yuv422p_gbrp_1920_ssse3: 5249.5
yuva420p_gbrp_8_c: 117.5
yuva420p_gbrp_8_ssse3: 92.0
yuva420p_gbrp_128_c: 1593.0
yuva420p_gbrp_128_ssse3: 319.3
yuva420p_gbrp_1080_c: 8694.5
yuva420p_gbrp_1080_ssse3: 2186.0
yuva420p_gbrp_1920_c: 15946.5
yuva420p_gbrp_1920_ssse3: 3805.3
2024-08-18 22:26:14 +02:00
Ramiro Polla
4545205a26 swscale/yuv2rgb: add yuv42{0,2}p -> gbrp unscaled colorspace converters 2024-08-18 22:26:11 +02:00
Ramiro Polla
af5adf57e3 swscale/yuv2rgb: prepare YUV2RGBFUNC macro for multi-planar rgb
This will be used in the upcoming yuv42{0,2}p -> gbrp unscaled
colorspace converters.

There is no difference in performance.
2024-08-18 22:26:08 +02:00
Ramiro Polla
24063e7827 swscale/yuv2rgb: prepare LOADCHROMA/PUTFUNC macros for multi-planar rgb
This will be used in the upcoming yuv42{0,2}p -> gbrp unscaled
colorspace converters.

There is no difference in performance.
2024-08-18 22:26:05 +02:00
Ramiro Polla
5c1c0325cd avcodec/aarch64/me_cmp: add dotprod implementations of sse16 and vsse_intra16
checkasm --bench for Raspberry Pi 5 Model B Rev 1.0:
sse_0_c: 241.5
sse_0_neon: 37.2
sse_0_dotprod: 22.2
vsse_4_c: 148.7
vsse_4_neon: 31.0
vsse_4_dotprod: 15.7
2024-08-17 15:31:48 +02:00
Dale Curtis
a31106d849 lavf/demux: don't reallocate a AVCodecContext when closing a non-open codec.
This results in an unnecessary ~800k allocation with H.264. A
nearby callsite uses avcodec_is_open() to avoid this, so do the
same when exiting avformat_find_stream_info().

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-08-17 12:54:41 +02:00
sfan5
c779766b5c avcodec/mediacodecdec: call MediaCodec.stop on close
Usually the MediaCodec context will be released immediately, or it needs to stay
alive due to existing hardware buffers.

However we can free resources early in the case of
hw_buffer_count == 0 && refcount > 1, which can be reproduced by keeping frames
referenced after flushing and closing. mpv currently behaves like this.

Signed-off-by: sfan5 <sfan5@live.de>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2024-08-17 09:03:05 +02:00
Timo Rothenpieler
817c6a6762 avformat/hlsenc: correctly reset subtitle stream counter per-varstream
Without resetting it, if there was a previous set of varstreams with
subtitles, it would subtract from all the streams, leading to chaos and
segfaults when trying to access for example stream -1.
2024-08-16 20:22:09 +02:00
James Almer
211c88b9d5 avfilter/f_zmq: fix graph argument
Fixes regression since d566a37003.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-08-16 09:53:22 -03:00
Niklas Haas
7b723ebd5a avcodec/dovi_rpudec: error out on strange RPU formats
Better safe than sorry.
2024-08-16 11:48:02 +02:00
Niklas Haas
3e1b70383e avcodec/dovi_rpuenc: slightly improve profile autodetection
In the absence of an RPU header, we can consult the colorspace tags to
make a more informed guess about whether we're looking at profile 5 or
profile 8.
2024-08-16 11:48:02 +02:00
Niklas Haas
ecea6ed3c9 avcodec/dovi_rpuenc: implement DM metadata compression
This implements limited metadata compression. To be a bit more lenient,
we try and re-order the static extension blocks when testing for an
exact match.

For sanity, and to avoid producing bitstreams we couldn't ourselves
decode, we don't accept partial matches - if some extension blocks
change while others remain static, compression is disabled for the
entire frame.

This shouldn't be an issue in practice because static extension blocks
are stated to remain constant throughout the entire sequence.
2024-08-16 11:48:02 +02:00
Niklas Haas
9824d1539e avcodec/dovi_rpudec: sanitize DM data before decoding
Some DM types do not fill the whole struct, so just clear it entirely
before going filling the decoded values.
2024-08-16 11:48:02 +02:00
Niklas Haas
45f5f4d3da avcodec/dovi_rpudec: implement limited DM decompression
This implements the limited DM metadata compression scheme described in
chapter 9 of the dolby vision bitstream specification.

The spec is a bit unclear about how to handle the presence of static
metadata inside compressed frames; in that it doesn't explicitly forbid
an encoder from repeating redundant metadata. In theory, we would need
to detect this case and then strip the corresponding duplicate metadata
from the existing set of static metadata. However, this is difficult to
implement - esspecially for the case of metadata blocks which may be
internally repeated (e.g. level 10).

That said, the spec states outright that static metadata should be
constant throughout the entire sequence, so a sane bitstream should not
have any static metadata values changing from one frame to the next (at
least up to a keyframe boundary), and therefore they should never be
present in compressed frames. As a consequence, it makes sense to treat
this as an error state regardless. (Ignoring them by default, or
erroring if either AV_EF_EXPLODE or AV_EF_AGGRESSIVE are set)

I was not able to find such samples in the wild (outside of artificially
produced test cases for this exact scenario), so I don't think we need
to worry about it until somebody produces one.
2024-08-16 11:48:02 +02:00
Niklas Haas
1c4d4cc368 avcodec/dovi_rpudec: don't unnecessarily allocate DOVIExt 2024-08-16 11:48:02 +02:00
Niklas Haas
a1f96ae157 avcodec/dovi_rpu: separate static ext blocks
Static and dynamic extension blocks are handled differently by metadata
compression, so we need to separate the extension block array into two.
2024-08-16 11:48:02 +02:00
Niklas Haas
f5d6eb4017 avcodec/dovi_rpu: move ext blocks into dedicated struct
Slightly re-organize the logic around extension blocks in order to allow
expanding the state tracking in a following commit.
2024-08-16 11:48:02 +02:00
Niklas Haas
b3d33f11fa avcodec/bsf/dovi_rpu: add new bitstream filter
This can be used to strip dovi metadata, or enable/disable dovi
metadata compression. Possibly more use cases in the future.
2024-08-16 11:48:02 +02:00
Niklas Haas
07712a0cab avcodec/dovi_rpuenc: add configuration for compression
In particular, validate that the chosen compression level is compatible
with the chosen profile.
2024-08-16 11:48:02 +02:00
Niklas Haas
1917270d32 avcodec/dovi_rpuenc: add ff_dovi_configure_ext()
More flexible version of ff_dovi_configure() which does not require an
AVCodecContext. Usable, for example, inside a bitstream filter.
2024-08-16 11:48:02 +02:00
Niklas Haas
765f29c61e avcodec/dovi_rpu: add ff_dovi_get_metadata()
Provides direct access to the AVDOVIMetadata without having to attach it
to a frame.
2024-08-16 11:48:02 +02:00
Niklas Haas
ae3a78593d avcodec/dovi_rpuenc: add a flag to enable compression
Keyframes must reset the metadata compression state, so we need to
also signal this at rpu generation time.

Default to uncompressed, because encoders cannot generally know if
a given frame will be a keyframe before they finish encoding, but also
cannot retroactively attach the RPU. (Within the confines of current
APIs)
2024-08-16 11:48:02 +02:00
Niklas Haas
b3bc8f8e1e avcodec/dovi_rpuenc: make encapsulation optional
And move the choice of desired container to `flags`. This is needed to
handle differing API requirements (e.g. libx265 requires the NAL RBSP,
but CBS BSF requires the unescaped bytes).
2024-08-16 11:48:02 +02:00
Niklas Haas
1e6fdb89bd avcodec/dovi_rpuenc: add flags to ff_dovi_rpu_generate()
Will be used to control compression, encapsulation etc.
2024-08-16 11:48:02 +02:00
Niklas Haas
c62b364dcb avcodec/dovi_rpuenc: respect dv_md_compression
Limited mode can only ever maintain a single VDR RPU reference, and
furthermore requires vdr_rpu_id == 0. So in practice, it will only ever
use VDR RPU slot 0. All remaining slots get flushed in this case, to
avoid leaking partial state.
2024-08-16 11:48:02 +02:00
Niklas Haas
fd00a56653 avcodec/dovi_rpuenc: eliminate unnecessary loop
This struct itself contains vdr_rpu_id, so we can never match it except
in the case of i == vdr_rpu_id. So just directly use this ID.
2024-08-16 11:48:02 +02:00
Niklas Haas
bf92441d6a avcodec/dovi_rpuenc: also copy ext blocks to dovi ctx
As the comment implies, DOVIContext.ext_blocks should also reflect the
current state after ff_dovi_rpu_generate().

Fluff for now, but will be needed once we start implementing metadata
compression for extension blocks as well.
2024-08-16 11:48:02 +02:00
Niklas Haas
a93801b626 avcodec/dovi_rpudec: implement validation for compression
Add some error checking. I've limited it to AV_EF_CAREFUL and
AV_EF_COMPLIANT for now, because we can technically decode such RPUs
just fine.
2024-08-16 11:48:02 +02:00
Niklas Haas
2a2e0aced2 avutil/dovi_meta: document static vs dynamic ext blocks 2024-08-16 11:48:02 +02:00
Niklas Haas
ae31acd702 fate/scalechroma: switch to standard chroma location
Replace the manually specified chroma location by one using standard
notation, arbitrarily "bottomleft" as it is a less common path.

Required if we want to phase out the use of manual chroma locations.
2024-08-16 11:43:37 +02:00
Niklas Haas
f1071dc634 avfilter/vf_zscale: remove unused fields 2024-08-16 11:43:37 +02:00