1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00
Commit Graph

119587 Commits

Author SHA1 Message Date
25812d3033 avcodec/bsf/h264_mp4toannexb: Fix mixed bitstream format
This bsf converts AV_PKT_DATA_NEW_EXTRADATA side data in avcc format
to in-band annexb format. However, the side data wasn't been removed
and copied from input packet to output packet. So the output packet
has mixed bitstream format. We don't support mixed bitstream format.
For example, h264_metadata report error in the following case:

ffmpeg -i foo.flv \
  -bsf:v "h264_mp4toannexb,h264_metadata" \
  -c copy -f null

This patch removed NEW_EXTRADATA side data after process.

This patch also add a check so only NEW_EXTRADATA in avcc format is
processed. NEW_EXTRADATA in annexb format is copied to output as is.

Reported-by: jiangjie <jiangjie618@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-04-29 15:25:08 +08:00
26752368f0 aarch64/h26x: Add put_hevc_pel_bi_w_pixels
On rpi5 (A76):

put_hevc_pel_bi_w_pixels4_8_c:                          90.0 ( 1.00x)
put_hevc_pel_bi_w_pixels4_8_neon:                       34.1 ( 2.64x)
put_hevc_pel_bi_w_pixels6_8_c:                         188.3 ( 1.00x)
put_hevc_pel_bi_w_pixels6_8_neon:                       73.5 ( 2.56x)
put_hevc_pel_bi_w_pixels8_8_c:                         327.1 ( 1.00x)
put_hevc_pel_bi_w_pixels8_8_neon:                       75.8 ( 4.32x)
put_hevc_pel_bi_w_pixels12_8_c:                        728.8 ( 1.00x)
put_hevc_pel_bi_w_pixels12_8_neon:                     186.1 ( 3.92x)
put_hevc_pel_bi_w_pixels16_8_c:                       1288.1 ( 1.00x)
put_hevc_pel_bi_w_pixels16_8_neon:                     268.5 ( 4.80x)
put_hevc_pel_bi_w_pixels24_8_c:                       2855.5 ( 1.00x)
put_hevc_pel_bi_w_pixels24_8_neon:                     723.8 ( 3.95x)
put_hevc_pel_bi_w_pixels32_8_c:                       5095.3 ( 1.00x)
put_hevc_pel_bi_w_pixels32_8_neon:                    1165.0 ( 4.37x)
put_hevc_pel_bi_w_pixels48_8_c:                      11521.5 ( 1.00x)
put_hevc_pel_bi_w_pixels48_8_neon:                    2856.0 ( 4.03x)
put_hevc_pel_bi_w_pixels64_8_c:                      21020.5 ( 1.00x)
put_hevc_pel_bi_w_pixels64_8_neon:                    4699.1 ( 4.47x)

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-04-29 15:24:14 +08:00
39786f8cd5 aarch64/h26x: optimize sao_band_filter
int8_t[] is enough for offset_table of 8 bit streams.

On rpi5:
                             Before               After
hevc_sao_band_8_8_c:          252.3 ( 1.00x)     252.3 ( 1.00x)
hevc_sao_band_8_8_neon:        95.8 ( 2.63x)      61.0 ( 4.57x)
hevc_sao_band_16_8_c:         875.2 ( 1.00x)     864.9 ( 1.00x)
hevc_sao_band_16_8_neon:      317.5 ( 2.76x)     150.0 ( 6.26x)
hevc_sao_band_32_8_c:        3853.5 ( 1.00x)    3871.6 ( 1.00x)
hevc_sao_band_32_8_neon:     1222.3 ( 3.15x)     550.6 ( 7.39)
hevc_sao_band_48_8_c:        8203.6 ( 1.00x)    8182.6 ( 1.00x)
hevc_sao_band_48_8_neon:     2685.7 ( 3.05x)    1185.8 ( 7.36x)
hevc_sao_band_64_8_c:       14023.0 ( 1.00x)   14038.9 ( 1.00x)
hevc_sao_band_64_8_neon:     4783.2 ( 2.93x)    2078.4 ( 7.15x)

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-04-29 15:11:45 +08:00
ca964ba139 avformat/mov: Reduce seek when interleaved_read is disabled
Don't select sample with small dts when interleaved_read is disabled.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2025-04-29 14:35:09 +08:00
d11d4277f9 postproc/tests: Add test tools to .gitignore
Reviewed-by: Marvin Scholz <epirat07@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-28 16:56:44 +02:00
fcc562693e avcodec/apv_decode: Remove redundant log message
ff_thread_get_buffer() already emits its own logmessage.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-27 23:00:10 +02:00
e2fcf234e4 avcodec/apv_decode: Fix shadowing
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-27 23:00:07 +02:00
431c0f305d avformat/apvenc: Add AVFMT_NOTIMESTAMPS flag
This is a raw format.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-27 23:00:02 +02:00
aa50d2eca2 avformat/apvenc: Remove unused header
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-27 22:59:59 +02:00
7fd796c600 avformat/apvenc: Only allow APV
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-27 22:59:40 +02:00
8ea11dcd84 Changelog, doc: Add entries for new APV features 2025-04-27 15:52:30 +01:00
b511c767d0 lavf: APV muxer 2025-04-27 15:52:30 +01:00
de42e06b5b lavc: APV metadata bitstream filter 2025-04-27 15:52:30 +01:00
d03c99441d lavc/apv: AVX2 transquant for x86-64
Typical checkasm result on Alder Lake:

decode_transquant_8_c:                                 464.2 ( 1.00x)
decode_transquant_8_avx2:                               86.2 ( 5.38x)
decode_transquant_10_c:                                481.6 ( 1.00x)
decode_transquant_10_avx2:                              83.5 ( 5.77x)
2025-04-27 15:52:30 +01:00
483cadf8d7 lavc: APV decoder 2025-04-27 15:52:30 +01:00
324330a11e lavf: APV demuxer
Demuxes raw streams as defined in draft spec section 10.2.
2025-04-27 15:52:30 +01:00
821717c3fe lavc/cbs: APV support 2025-04-27 15:52:30 +01:00
0c79a091e4 lavc: APV codec ID and descriptor 2025-04-27 15:52:30 +01:00
fb36f170de avcodec/ffv1enc: Eliminate fabs()
Fixes: warning: using floating point absolute value function 'fabs' when argument is of integer type
No change in output
Changing variables to float worsens compression significantly

Found-by: ePirat
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-27 05:04:35 +02:00
716c3986c6 fate: add stripetest
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-27 05:04:34 +02:00
342869ad7c tests: Add libpostproc blocktest
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-27 05:04:34 +02:00
142eb90f07 postproc/postprocess_template: fix handling of first row of dering_C
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-27 05:04:34 +02:00
0118f392be postproc/postprocess_template: Fix reading uninitialized pixels in dering_C()
This issue was found through the new blocktest

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-27 05:04:19 +02:00
8bb682d454 avcodec/x86/constants: add pd_64
Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-25 23:20:58 -03:00
6dd83fab44 avformat: Use ffio_read_size() where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:22:20 +02:00
122f86d859 avcodec/magicyuv: Simplify check for RGB
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:01:38 +02:00
7c7e161437 avcodec/magicyuv: Set properties via AVPixFmtDescriptor
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:01:38 +02:00
c33f16db1b avcodec/webp: Avoid loop
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:01:38 +02:00
e0a05456cd avcodec/webp: Combine allocations
Or avoid them altogether for the small stage-one VLC.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:01:37 +02:00
1fc0ee484f avcodec/webp: Check before allocations
Avoids freeing lateron.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:01:37 +02:00
e0df21b8c3 avcodec/webp: Switch to ff_vlc_init_from_lengths()
The earlier code would traverse over the code lengths
mutliple times (namely max_length + 1 times - once to get
the maximum length and once for each max_length to assign
codes) before calling ff_vlc_init_sparse() (which may traverse
them twice and sort them). The new code only traverses them once
(+ the one time in ff_vlc_init_from_lengths()).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:01:37 +02:00
d60445258c avcodec/webp: Check more directly for invalid codes
Don't rely on invalid codes leading to get_vlc2() returning
-1, which then gets converted to an uint8_t, i.e. to 255
and runs afoul of a length check later. After all, get_vlc2()
could be changed to return something else which may
be valid when cast to uint8_t.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:01:37 +02:00
6676038b23 avcodec/cbs: Use put_bits63()
It is better when BUF_BITS == 64 (i.e. on x64), because
the underlying put_bits can then handle 0..63 bits naturally.
It does not worsen the code when BUF_BITS != 64, because
the compiler can optimize this to the same code as now
(due to the assert).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:01:37 +02:00
a2acb46a6e avcodec/vp6: Forward error codes
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:01:37 +02:00
be7495c32c avcodec/vp6: Use fewer number of bits in run VLCs
Given that these trees have only nine elements and are complete,
their depth is <= eight.

Also remove the now unused FF_HUFFMAN_BITS constant.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:01:37 +02:00
e946ba64bf avcodec/vp6: Don't reload unnecessarily often in get_vlc2()
The VLC trees used here have very few different codes
and are therefore guaranteed to not be very deep: The AC/DC
VLCs have 12 elements and therefore a depth <= 11 whereas
the run VLCs have only nine elements and therefore a depth <= 8.
This allows to reduce the worst-case number of reloads for
reading a VLC code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:01:37 +02:00
57b7783c22 avcodec/vp6: Don't initialize unused VLC tables
There are only 2*3*4 VLC trees for decoding Huffman encoded
AC coefficients; see section 13.3.2 of the spec.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:01:37 +02:00
3e21df2353 avcodec/huffman: Switch to ff_vlc_init_from_lengths()
Avoids having to create the codes ourselves.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 23:01:37 +02:00
e73c59c6c3 tools/target_dec_fuzzer: Assert on AVERROR_BUG
This will bring these bugs to our attention.

Reviewed-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 12:35:48 +02:00
40544b4854 avcodec/ftr: Replace AVERROR_BUG that can be triggered
Return AVERROR_DECODER_NOT_FOUND.
(This can be triggered because this decoder tries to be
generic and work with multiple underlying AAC decoders,
so that there is no configure dependency for any decoder.)

Reviewed-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 12:35:45 +02:00
0279eb9c93 avcodec/imm5: Reference H.264/HEVC decoders directly
This is simpler and allows to fuzz them -- up until now,
the linker did not see the dependency and fuzzing them
returned AVERROR_BUG during init.
It took just a few seconds here to run into an assert
due to a return value of AVERROR(EAGAIN) in the decode
callback...

Reviewed-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 12:35:40 +02:00
0d9b0015ba tools/target_dec_fuzzer: Remove mjpeg hack
ff_mjpeg_decoder is now referenced directly by the relevant
decoders, so that the linker sees the dependency and
just does the desired thing. So remove the hack.

(Btw: The preprocessor does not do string comparisons, instead
undefined tokens in #if checks evaluate to 0, making the check
true regardless of the actual codec fuzzed (and leading to
linker errors if the mjpeg decoder is disabled).)

Reviewed-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 12:35:28 +02:00
289cb3beff avcodec/cri,tdsc,tiff: Use ff_mjpeg_decoder directly
This is simpler than calling avcodec_find_decoder().
Notice that av_codec_init_static() has already been called
by the time we reach these decoders' init functions,
so it is not necessary to call avcodec_find_decoder()
for it (which doesn't do anything for the mjpeg decoder
anyway).

Reviewed-by: Kacper Michajlow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-04-25 12:31:54 +02:00
25b0a8e295 avcodec/h264_slice: insert LCEVC side data before get_buffer() call
Otherwise it will not be taken into account or applied at all.

Signed-off-by: James Almer <jamrial@gmail.com>
2025-04-23 09:41:03 -03:00
37bd915042 vulkan: use _KHR suffix for push descriptor properties struct ID 2025-04-23 01:46:37 +02:00
09a83e095d rtpdec_mpeg4: Add fmtp parsing of bitrate value
According to RFC 6416 the audio stream sender can pass the data rate
for the audio bitstream as "bitrate=" media format parameter.

Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2025-04-22 21:09:10 +02:00
cacc68f3b5 ffbuild: fix include path for uninstalled .pc files 2025-04-22 21:04:36 +02:00
0ea83e65aa avfilter/drawutils: narrow variable scopes 2025-04-22 20:59:16 +02:00
d0bcf62597 tools/aviocat: use av_err2str
There is no need to explicitly specify the buffer, as it
is only ever passed to fprintf, so av_err2str can be used.
2025-04-22 20:45:57 +02:00
da38b2fcd2 tools/sidxindex: use av_err2str
There is no need to explicitly specify the buffer, as it
is only ever passed to fprintf, so av_err2str can be used.
2025-04-22 20:45:57 +02:00