Commit Graph

117171 Commits

Author SHA1 Message Date
Anton Khirnov
5c2f7e192f lavfi: drop internal.h
All that remains in it are things that belong in avfilter_internal.h.

Move them there and remove internal.h

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:48 +02:00
Anton Khirnov
6413626ddb lavfi/f_streamselect: remove a no-op ff_filter_config_links() call
It does not do anything when the links are already configured.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:47 +02:00
Anton Khirnov
64042cbe1f lavfi/inernal: move ff_fmt_is_regular_yuv() declaration to video.h
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:47 +02:00
Anton Khirnov
698ea11f6e lavfi: move ff_parse_{sample_rate,channel_layout}() to audio.[ch]
That is a more appropriate place for those functions.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:47 +02:00
Anton Khirnov
2f6e72e16d lavfi: move ff_parse_pixel_format() to vf_format, its only caller
The only thing this function does beyond calling av_get_pix_fmt() is
falling back onto parsing the argument as a number. No other filters
should need to do this.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:47 +02:00
Anton Khirnov
0abc6a5cc1 lavfi/internal: move functions used by filters to filters.h
internal.h currently mixes interfaces intended to be used by filters
with those that should be limited to generic filter- or graph-level
code.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:46 +02:00
Rémi Denis-Courmont
0de31b9892 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

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:46 +02:00
Rémi Denis-Courmont
6840f34d63 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

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:46 +02:00
Rémi Denis-Courmont
c936600cda 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

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:46 +02:00
Rémi Denis-Courmont
8658a170a3 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

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:45 +02:00
Anton Khirnov
8137582826 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:45 +02:00
Anton Khirnov
04a73d8e63 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:45 +02:00
Anton Khirnov
3bed7fbf12 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:45 +02:00
Anton Khirnov
2768532223 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
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:44 +02:00
Anton Khirnov
ad36e000f7 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:44 +02:00
Anton Khirnov
fae32f9185 lavc/hevcdec: switch to receive_frame()
Required by following commits, where we will want to output multiple
frames per packet.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:44 +02:00
sunyuechi
73b590e33c 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>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:44 +02:00
sunyuechi
d0a6dea8c1 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>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:42 +02:00
Michael Niedermayer
cea2aaf270 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>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:42 +02:00
Michael Niedermayer
2dc42e6429 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>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:42 +02:00
Michael Niedermayer
5282fbef0d 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>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:42 +02:00
Michael Niedermayer
1af2437325 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>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:42 +02:00
Dale Curtis
5df40fae29 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>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:42 +02:00
Ramiro Polla
93ae315a8d 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

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:41 +02:00
Ramiro Polla
8bee248b80 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

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:41 +02:00
Ramiro Polla
4b87fd8a49 swscale/yuv2rgb: add yuv42{0,2}p -> gbrp unscaled colorspace converters
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:41 +02:00
Ramiro Polla
b3bfa14c9f 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:41 +02:00
Ramiro Polla
101f1b84bc 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:41 +02:00
Ramiro Polla
cb1de79427 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

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:40 +02:00
Dale Curtis
1f8da7eece 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>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:40 +02:00
sfan5
bd3abae21f 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>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:40 +02:00
Timo Rothenpieler
ccb04df345 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:40 +02:00
James Almer
dcd4da05cb avfilter/f_zmq: fix graph argument
Fixes regression since d566a37003d0257229f06436bef8062fee3af6e9.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:40 +02:00
Niklas Haas
0d0aa83fe9 avcodec/dovi_rpudec: error out on strange RPU formats
Better safe than sorry.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:40 +02:00
Niklas Haas
21d57b6b0f 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:40 +02:00
Niklas Haas
ae6be0732b 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:40 +02:00
Niklas Haas
6f7c05d303 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:40 +02:00
Niklas Haas
32755a355d 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:39 +02:00
Niklas Haas
8634fbef29 avcodec/dovi_rpudec: don't unnecessarily allocate DOVIExt
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:39 +02:00
Niklas Haas
0f8ae15d56 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:39 +02:00
Niklas Haas
11381cd329 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:39 +02:00
Niklas Haas
976f47a308 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:38 +02:00
Niklas Haas
4ecd3e4bac avcodec/dovi_rpuenc: add configuration for compression
In particular, validate that the chosen compression level is compatible
with the chosen profile.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:38 +02:00
Niklas Haas
9ea62144c4 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:38 +02:00
Niklas Haas
cfe9668721 avcodec/dovi_rpu: add ff_dovi_get_metadata()
Provides direct access to the AVDOVIMetadata without having to attach it
to a frame.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:38 +02:00
Niklas Haas
2bdf035809 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)

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:38 +02:00
Niklas Haas
d52c291145 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).

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:37 +02:00
Niklas Haas
a76375998a avcodec/dovi_rpuenc: add flags to ff_dovi_rpu_generate()
Will be used to control compression, encapsulation etc.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:37 +02:00
Niklas Haas
a9bf0ea2d3 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:37 +02:00
Niklas Haas
e83e662f3e 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.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2024-08-30 18:02:37 +02:00