Commit Graph

118086 Commits

Author SHA1 Message Date
Leo Izen
c1e3d55f99
avcodec/png{dec,enc}: update mDCV and cLLI chunk capitalization
The PNGv3 Specification Draft [1] has changed the capitalization
of mDCV and cLLI chunks (formerly mDCv and cLLi). This patch updates
FFmpeg to work with the new chunk names while retaining decode-side
compatibility with files created using the old names.

[1]: https://w3c.github.io/png/

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2024-12-09 15:16:59 -05:00
Manuel Lauss
d21134313f avformat/smush: read ANIMv2 a/v parameters
SMUSH ANIM files with subversion 2 provide additional fields for
framerate and samplerate, use them if available, otherwise
default to 12 fps which is the default for almost all ANIMv2
since 1995.

Fixes the too-fast playback of test files from LucasArts games
released 1995-1997.  It was not noticed since Audio for
those isn't decoded by ffmpeg.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-12-09 02:05:18 +01:00
Marth64
3b0e6c0ecc avformat/mov: use dvdclut for YUV to RGB conversion of DVD subtitle palettes
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-12-08 16:30:17 -06:00
James Almer
e2953fedf9 avformat/hevc: also print NALU ids
Signed-off-by: James Almer <jamrial@gmail.com>
2024-12-08 19:13:34 -03:00
James Almer
68ee3faf48 avformat/hevc: add a log context to ff_isom_write_{hvcc,lhvc}
Signed-off-by: James Almer <jamrial@gmail.com>
2024-12-08 19:12:19 -03:00
llyyr
550c662a1f
avformat/mpegts: correctly skip TP_extra_header in m2ts
instead of just resyncing and skipping a bunch of TS packets, leading to
a loss of frames.

Before this, a stray byte with the value of 0x47 in TP_extra_header
would throw off the detection of where TS packets start.

A typical file that could cause issues would look like this:

    00000300: 238f 4780 4750 1110 0000 01e0 0000 84c0
                   ^^   ^^
The first four bytes here are TP_extra_header and the actual TS packet
starts at offset 0x304

FFmpeg would try to read a packet at 0x300 but since nothing skips the
4 byte TP_extra_header, find that the first byte is not 0x47 and
immediately go into mpegts_resync, and incorrectly detect the stray 0x47
in the TP_extra_header at 0x302 as the new sync byte.

Fix this by correctly skipping the first 4 bytes if the source packet
is 192 bytes.

Signed-off-by: llyyr <llyyr.public@gmail.com>
Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
2024-12-08 10:54:26 +01:00
Osamu Watanabe
c893dcce31
avcodec/jpeg2000: Fix undefined behaviour in left shift operations
Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com>
2024-12-07 15:41:30 -08:00
Paul B Mahol
8050a7955e avformat/mm: fix packets pts generation and add seek support
Signed-off-by: Peter Ross <pross@xvid.org>
2024-12-08 09:32:35 +11:00
Kacper Michajłow
7902702762
avfilter/af_ashowinfo: fix scaling factor of replaygain peak values
Commit 8542f9c4f1 changed replaygain peak
values to use 100k instead of UINT32_MAX as peak, with possibility of
overflow. af_ashowinfo was never updated to reflect this, so we update
it now.

Fixes: 8542f9c4f1
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2024-12-07 12:03:53 -05:00
Hendrik Leppkes
5215ec677c
avutil/tests/color_utils: reduce accuracy threshold to pass to 1e-7
Fixes FATE on a variety of configurations due to accuracy problems in
floating point math. Most constants tested against here are not even
specified with 7 decimal digits.

Reviewed-by: Niklas Haas <git@haasn.dev>
2024-12-07 14:51:49 +01:00
Frank Plowman
34c6ad0a07 lavc/vvc: Use a bitfield to store MIP information
Reduces memory consumption by ~4MB for 1080p video with a maximum delay
of 16 frames by packing various information related to MIP:
* intra_mip_flag, 1 bit
* intra_mip_transposed_flag, 1 bit
* intra_mip_mode, 4 bits
Into a single byte.

Co-authored-by: Nuo Mi <nuomi2021@gmail.com>
Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-12-07 17:37:45 +08:00
Gyan Doshi
914f89dbc6 avformat/movenc: log stream index for invalid pkt duration 2024-12-07 10:07:35 +05:30
Zhao Zhili
018ec4fe5f tests/checkasm: Simplify logic for WASI signal handling
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Martin Storsjö <martin@martin.st>
2024-12-06 10:48:11 +08:00
Ramiro Polla
ca889b1328 swscale/aarch64: add neon {lum,chr}ConvertRange16
aarch64 A55:
chrRangeFromJpeg16_1920_c:    32684.2
chrRangeFromJpeg16_1920_neon:  8431.2 (3.88x)
chrRangeToJpeg16_1920_c:      24996.8
chrRangeToJpeg16_1920_neon:    9395.0 (2.66x)
lumRangeFromJpeg16_1920_c:    17305.2
lumRangeFromJpeg16_1920_neon:  4586.5 (3.77x)
lumRangeToJpeg16_1920_c:      21144.8
lumRangeToJpeg16_1920_neon:    5069.8 (4.17x)

aarch64 A76:
chrRangeFromJpeg16_1920_c:    11523.8
chrRangeFromJpeg16_1920_neon:  3367.5 (3.42x)
chrRangeToJpeg16_1920_c:      11655.2
chrRangeToJpeg16_1920_neon:    4087.2 (2.85x)
lumRangeFromJpeg16_1920_c:     5762.0
lumRangeFromJpeg16_1920_neon:  1815.8 (3.17x)
lumRangeToJpeg16_1920_c:       5946.2
lumRangeToJpeg16_1920_neon:    2148.2 (2.77x)
2024-12-05 21:10:29 +01:00
Ramiro Polla
87052c0933 swscale/x86: add sse4 and avx2 {lum,chr}ConvertRange16
chrRangeFromJpeg16_1920_c:    3153.9
chrRangeFromJpeg16_1920_sse4: 1770.0 (1.78x)
chrRangeFromJpeg16_1920_avx2:  891.5 (3.54x)
chrRangeToJpeg16_1920_c:      3165.0
chrRangeToJpeg16_1920_sse4:   1953.2 (1.62x)
chrRangeToJpeg16_1920_avx2:    973.0 (3.25x)
lumRangeFromJpeg16_1920_c:    1298.5
lumRangeFromJpeg16_1920_sse4:  886.5 (1.46x)
lumRangeFromJpeg16_1920_avx2:  447.7 (2.90x)
lumRangeToJpeg16_1920_c:      1905.0
lumRangeToJpeg16_1920_sse4:    993.0 (1.92x)
lumRangeToJpeg16_1920_avx2:    498.9 (3.82x)
2024-12-05 21:10:29 +01:00
Ramiro Polla
6fe4a4ffb6 swscale/aarch64/range_convert: update neon range_convert functions to new API
aarch64 A55:
chrRangeFromJpeg8_1920_c:    28835.2 (1.00x)
chrRangeFromJpeg8_1920_neon:  5313.9 (5.43x)  5308.4 (5.43x)
chrRangeToJpeg8_1920_c:      23074.7 (1.00x)
chrRangeToJpeg8_1920_neon:    5551.3 (4.16x)  5549.2 (4.16x)
lumRangeFromJpeg8_1920_c:    15389.7 (1.00x)
lumRangeFromJpeg8_1920_neon:  3152.3 (4.88x)  3147.7 (4.89x)
lumRangeToJpeg8_1920_c:      19227.8 (1.00x)
lumRangeToJpeg8_1920_neon:    3628.7 (5.30x)  3630.2 (5.30x)

aarch64 A76:
chrRangeFromJpeg8_1920_c:    6324.4 (1.00x)
chrRangeFromJpeg8_1920_neon: 2344.5 (2.70x) 2304.2 (2.74x)
chrRangeToJpeg8_1920_c:      9656.0 (1.00x)
chrRangeToJpeg8_1920_neon:   2824.2 (3.42x) 2794.2 (3.46x)
lumRangeFromJpeg8_1920_c:    4422.0 (1.00x)
lumRangeFromJpeg8_1920_neon: 1104.5 (4.00x) 1106.2 (4.00x)
lumRangeToJpeg8_1920_c:      5949.1 (1.00x)
lumRangeToJpeg8_1920_neon:   1329.8 (4.47x) 1328.2 (4.48x)
2024-12-05 21:10:29 +01:00
Ramiro Polla
be108ebcf4 swscale/x86/range_convert: update sse2 and avx2 range_convert functions to new API
chrRangeFromJpeg8_1920_c:    2127.4 (1.00x)
chrRangeFromJpeg8_1920_sse2:  816.0 (2.61x)  813.5 (2.62x)
chrRangeFromJpeg8_1920_avx2:  408.9 (5.20x)  405.4 (5.25x)
chrRangeToJpeg8_1920_c:      3166.9 (1.00x)
chrRangeToJpeg8_1920_sse2:    815.0 (3.89x)  815.0 (3.89x)
chrRangeToJpeg8_1920_avx2:    404.5 (7.83x)  405.5 (7.81x)
lumRangeFromJpeg8_1920_c:    1263.0 (1.00x)
lumRangeFromJpeg8_1920_sse2:  411.0 (3.07x)  413.2 (3.06x)
lumRangeFromJpeg8_1920_avx2:  200.5 (6.30x)  201.9 (6.26x)
lumRangeToJpeg8_1920_c:      1886.8 (1.00x)
lumRangeToJpeg8_1920_sse2:    412.0 (4.58x)  408.9 (4.61x)
lumRangeToJpeg8_1920_avx2:    208.5 (9.05x)  205.7 (9.17x)
2024-12-05 21:10:29 +01:00
Ramiro Polla
384fe39623 swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats
There is an issue with the constants used in YUV to YUV range conversion,
where the upper bound is not respected when converting to mpeg range.

With this commit, the constants are calculated at runtime, depending on
the bit depth. This approach also allows us to more easily understand how
the constants are derived.

For bit depths <= 14, the number of fixed point bits has been set to 14
for all conversions, to simplify the code.
For bit depths > 14, the number of fixed points bits has been raised and
set to 18, to allow for the conversion to be accurate enough for the mpeg
range to be respected.

The convert functions now take the conversion constants (coeff and offset)
as function arguments.
For bit depths <= 14, coeff is unsigned 16-bit and offset is 32-bit.
For bit depths > 14, coeff is unsigned 32-bit and offset is 64-bit.

x86_64:
chrRangeFromJpeg8_1920_c:    2127.4   2125.0  (1.00x)
chrRangeFromJpeg16_1920_c:   2325.2   2127.2  (1.09x)
chrRangeToJpeg8_1920_c:      3166.9   3168.7  (1.00x)
chrRangeToJpeg16_1920_c:     2152.4   3164.8  (0.68x)
lumRangeFromJpeg8_1920_c:    1263.0   1302.5  (0.97x)
lumRangeFromJpeg16_1920_c:   1080.5   1299.2  (0.83x)
lumRangeToJpeg8_1920_c:      1886.8   2112.2  (0.89x)
lumRangeToJpeg16_1920_c:     1077.0   1906.5  (0.56x)

aarch64 A55:
chrRangeFromJpeg8_1920_c:   28835.2  28835.6  (1.00x)
chrRangeFromJpeg16_1920_c:  28839.8  32680.8  (0.88x)
chrRangeToJpeg8_1920_c:     23074.7  23075.4  (1.00x)
chrRangeToJpeg16_1920_c:    17318.9  24996.0  (0.69x)
lumRangeFromJpeg8_1920_c:   15389.7  15384.5  (1.00x)
lumRangeFromJpeg16_1920_c:  15388.2  17306.7  (0.89x)
lumRangeToJpeg8_1920_c:     19227.8  19226.6  (1.00x)
lumRangeToJpeg16_1920_c:    15387.0  21146.3  (0.73x)

aarch64 A76:
chrRangeFromJpeg8_1920_c:    6324.4   6268.1  (1.01x)
chrRangeFromJpeg16_1920_c:   6339.9  11521.5  (0.55x)
chrRangeToJpeg8_1920_c:      9656.0   9612.8  (1.00x)
chrRangeToJpeg16_1920_c:     6340.4  11651.8  (0.54x)
lumRangeFromJpeg8_1920_c:    4422.0   4420.8  (1.00x)
lumRangeFromJpeg16_1920_c:   4420.9   5762.0  (0.77x)
lumRangeToJpeg8_1920_c:      5949.1   5977.5  (1.00x)
lumRangeToJpeg16_1920_c:     4446.8   5946.2  (0.75x)

NOTE: all simd optimizations for range_convert have been disabled.
      they will be re-enabled when they are fixed for each architecture.

NOTE2: the same issue still exists in rgb2yuv conversions, which is not
       addressed in this commit.
2024-12-05 21:10:29 +01:00
Ramiro Polla
58bcdeb742 swscale/aarch64/range_convert: saturate output instead of limiting input
aarch64 A55:
chrRangeFromJpeg8_1920_c:    28836.2 (1.00x)
chrRangeFromJpeg8_1920_neon:  5312.6 (5.43x)  5313.9 (5.43x)
chrRangeToJpeg8_1920_c:      44196.2 (1.00x)
chrRangeToJpeg8_1920_neon:    6034.6 (7.32x)  5551.3 (7.96x)
lumRangeFromJpeg8_1920_c:    15388.5 (1.00x)
lumRangeFromJpeg8_1920_neon:  3150.7 (4.88x)  3152.3 (4.88x)
lumRangeToJpeg8_1920_c:      23069.7 (1.00x)
lumRangeToJpeg8_1920_neon:    3873.2 (5.96x)  3628.7 (6.36x)

aarch64 A76:
chrRangeFromJpeg8_1920_c:     6334.7 (1.00x)
chrRangeFromJpeg8_1920_neon:  2264.5 (2.80x)  2344.5 (2.70x)
chrRangeToJpeg8_1920_c:      11474.5 (1.00x)
chrRangeToJpeg8_1920_neon:    2646.5 (4.34x)  2824.2 (4.06x)
lumRangeFromJpeg8_1920_c:     4453.2 (1.00x)
lumRangeFromJpeg8_1920_neon:  1104.8 (4.03x)  1104.5 (4.03x)
lumRangeToJpeg8_1920_c:       6645.0 (1.00x)
lumRangeToJpeg8_1920_neon:    1310.5 (5.07x)  1329.8 (5.00x)
2024-12-05 21:10:29 +01:00
Ramiro Polla
2d1358a84d swscale/range_convert: saturate output instead of limiting input
For bit depths <= 14, the result is saturated to 15 bits.
For bit depths > 14, the result is saturated to 19 bits.

x86_64:
chrRangeFromJpeg8_1920_c:    2126.5   2127.4  (1.00x)
chrRangeFromJpeg16_1920_c:   2331.4   2325.2  (1.00x)
chrRangeToJpeg8_1920_c:      3163.0   3166.9  (1.00x)
chrRangeToJpeg16_1920_c:     3163.7   2152.4  (1.47x)
lumRangeFromJpeg8_1920_c:    1262.2   1263.0  (1.00x)
lumRangeFromJpeg16_1920_c:   1079.5   1080.5  (1.00x)
lumRangeToJpeg8_1920_c:      1860.5   1886.8  (0.99x)
lumRangeToJpeg16_1920_c:     1910.2   1077.0  (1.77x)

aarch64 A55:
chrRangeFromJpeg8_1920_c:   28836.2  28835.2  (1.00x)
chrRangeFromJpeg16_1920_c:  28840.1  28839.8  (1.00x)
chrRangeToJpeg8_1920_c:     44196.2  23074.7  (1.92x)
chrRangeToJpeg16_1920_c:    36527.3  17318.9  (2.11x)
lumRangeFromJpeg8_1920_c:   15388.5  15389.7  (1.00x)
lumRangeFromJpeg16_1920_c:  15389.3  15388.2  (1.00x)
lumRangeToJpeg8_1920_c:     23069.7  19227.8  (1.20x)
lumRangeToJpeg16_1920_c:    19227.8  15387.0  (1.25x)

aarch64 A76:
chrRangeFromJpeg8_1920_c:    6334.7   6324.4  (1.00x)
chrRangeFromJpeg16_1920_c:   6336.0   6339.9  (1.00x)
chrRangeToJpeg8_1920_c:     11474.5   9656.0  (1.19x)
chrRangeToJpeg16_1920_c:     9640.5   6340.4  (1.52x)
lumRangeFromJpeg8_1920_c:    4453.2   4422.0  (1.01x)
lumRangeFromJpeg16_1920_c:   4414.2   4420.9  (1.00x)
lumRangeToJpeg8_1920_c:      6645.0   5949.1  (1.12x)
lumRangeToJpeg16_1920_c:     6005.2   4446.8  (1.35x)

NOTE: all simd optimizations for range_convert have been disabled
      except for x86, which already had the same behaviour.
      they will be re-enabled when they are fixed for each architecture.
2024-12-05 21:10:29 +01:00
Ramiro Polla
536a44e8dc checkasm/sw_range_convert: test negative input values 2024-12-05 21:10:29 +01:00
Malek Assaad
6a108d4759 avformat/mov: add support for pssh box
* Enable PSSH box writing to mov & moof.
* Enable senc, saio & saiz writing to moof when writing fragments.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-12-05 14:22:16 -03:00
Niklas Haas
7b73ea501d avutil/tests/color_utils: add tests for av_csp_itu_eotf 2024-12-05 12:27:33 +01:00
Niklas Haas
06f084468e avutil/csp: add EOTF function definitions
The existing av_csp_trc_func_from_id() mostly implements the OETF, except for
PQ. As such, we are currently missing a precise definition of an ITU-R EOTF.
Introduce the new functions av_csp_itu_eotf() and av_csp_itu_eotf_inv(), to fill
this void. Note that this is not possible in all cases, e.g. AVCOL_TRC_LOG which
has no corresponding EOTF definition in any ITU-R standard.

Note that we cannot implement the proper HLG and SMPTE 428 OOTFs without access
to all three color channels, because they are not independent per channel. As a
result, we need to define them on double[3] instead of double (*func)(double).
2024-12-05 12:27:32 +01:00
Niklas Haas
bf0a6c4111 avutil/csp: add av_csp_trc_inv_from_id()
Mathematical inverse of av_csp_trc_from_id(), plus testing to make sure it
roundtrips correctly with the corresponding TRC.
2024-12-05 12:26:49 +01:00
Niklas Haas
28f217780b avutil/tests/color_utils: clean up slightly (cosmetic)
Rewrite this test slightly to fix the formatting, improve the readability of
the output, and eliminate some unnecessary branching.
2024-12-05 11:51:18 +01:00
Niklas Haas
feb5982f43 avutil/csp: eliminate redundant branch 2024-12-05 11:51:18 +01:00
Niklas Haas
ec0489e35c avutil/csp: fix documentation of av_csp_trc_function
This explanation was inaccurate and highly misleading. The new wording is taken
more or less directly from ITU-T H.273, and also matches my understanding of
these functions.
2024-12-05 11:51:18 +01:00
Niklas Haas
2f95bc3cb3 swscale/utils: disable full_chr_h_input optimization for odd width
The basic problem here is that the rgb*ToUV_half_* functions hard-code a
bilinear downsample from src[i] + src[i+1], with no bounds check on the i+1
access.

Due to the signature of the function, we cannot easily plumb the "true" width
into the function body to perform a bounds check. Similarly, we cannot easily
pre-pad the input because it is typically reading from the (const) input
frame, which would require a full memcpy to pad. Either of these solutions are
more trouble than the feature is worth, so just disable it on odd input sizes.

Fixes: use of uninitialized value
Fixes: ticket #11265
Signed-off-by: Niklas Haas <git@haasn.dev>
Sponsored-by: Sovereign Tech Fund
2024-12-04 11:38:47 +01:00
Niklas Haas
79452d382f swscale/graph: fix memleak of cascaded graphs
Just free them directly and discard the parent context.

Fixes: bf738412e8
Signed-off-by: Niklas Haas <git@haasn.dev>
Sponsored-by: Sovereign Tech Fund
2024-12-04 11:38:30 +01:00
Zhao Zhili
40302cc35b avcodec/hevc: Add wasm simd128 idct
Benchmark with wasmtime:
wasmtime checkasm --test=hevc_idct --benchmark

hevc_idct_4x4_8_c:                                      20.8 ( 1.00x)
hevc_idct_4x4_8_simd128:                                10.2 ( 2.02x)
hevc_idct_4x4_10_c:                                     21.0 ( 1.00x)
hevc_idct_4x4_10_simd128:                               10.2 ( 2.05x)
hevc_idct_8x8_8_c:                                     198.0 ( 1.00x)
hevc_idct_8x8_8_simd128:                                41.5 ( 4.77x)
hevc_idct_8x8_10_c:                                    197.8 ( 1.00x)
hevc_idct_8x8_10_simd128:                               41.8 ( 4.74x)
hevc_idct_16x16_8_c:                                  1385.2 ( 1.00x)
hevc_idct_16x16_8_simd128:                             291.8 ( 4.75x)
hevc_idct_16x16_10_c:                                 1375.0 ( 1.00x)
hevc_idct_16x16_10_simd128:                            281.2 ( 4.89x)
hevc_idct_32x32_8_c:                                 13479.0 ( 1.00x)
hevc_idct_32x32_8_simd128:                            1541.5 ( 8.74x)
hevc_idct_32x32_10_c:                                13448.0 ( 1.00x)
hevc_idct_32x32_10_simd128:                           1541.5 ( 8.72x)

Decoding test:

1. Without the optimization:
$ wasmtime --wasi threads --dir=/ ./ffmpeg -cpuflags 0 -i 265.mp4 -an -t 120 -f null - -benchmark
frame= 2880 fps= 94 q=-0.0 Lsize=N/A time=00:02:00.00 bitrate=N/A speed=3.92x

2. With the optimization:
$ wasmtime --wasi threads --dir=/ ./ffmpeg -i 265.mp4 -an -t 120 -f null - -benchmark
frame= 2880 fps=110 q=-0.0 Lsize=N/A time=00:02:00.00 bitrate=N/A speed=4.58x

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-12-04 16:43:07 +08:00
Zhao Zhili
ea3d21c349 tests/checkasm: Add partial support for wasm
WASI mssing signal and siglongjmp support. This patch workaround
build error and add simd128 flag. Please note that many tests use
large array on stack, so you need to increase the stack size when
build checkasm, e.g., --extra-ldflags='-Wl,-z,stack-size=10485760'

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-12-04 16:43:07 +08:00
Zhao Zhili
2dc55f5993 configure: Add wasm as a fake arch
And add wasm simd128 flag, so we can add simd128 optimizations.
It can be enabled by put -msimd128 to extra cflags. There is
no runtime detection on simd128 support yet. I think that needs to
be done with JavaScript.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-12-04 16:43:06 +08:00
Michael Niedermayer
7c1e732ad2
avcodec/webp: Check ref_x/y
Fixes: 70991/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WEBP_fuzzer-5544067620995072
Fixes: use of uninintailized value

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-12-04 04:23:49 +01:00
Michael Niedermayer
4482218440
avcodec/ilbcdec: Initialize tempbuff2
Fixes: Use of uninitialized value
Fixes: 71350/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ILBC_fuzzer-6322020827070464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-12-04 04:23:49 +01:00
Michael Niedermayer
61cbcaf93f
avcodec/rv60dec: Check qp for intra
The rv60_qp_to_idx table only supports qp up to 31 on intra

Fixes: global-buffer-overflow
Fixes: 377543818/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV60_fuzzer-5160167345291264

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>
2024-12-04 04:23:49 +01:00
Michael Niedermayer
559d435fa3
avcodec/ffv1enc: Add enum for qtable
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-12-04 04:23:48 +01:00
Michael Niedermayer
d32dcc07a7
swscale/swscale_unscaled: Fix odd height with nv24_to_yuv420p_chroma()
Fixes: out of array read
Fixes: 71726/clusterfuzz-testcase-ffmpeg_SWS_fuzzer-5876893532880896
Fixes: 377735917/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6686071112400896

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Approved-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-12-04 04:23:48 +01:00
Scott Theisen
5ba63f0ef1 avformat/mpegts: is_pes_stream() use switch case
also add STREAM_TYPE_PRIVATE_SECTION since a private_section() is not a
PES_packet().

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-12-03 23:09:58 +01:00
Scott Theisen
1259760825 avformat/mpegts*: reduce use of magic numbers
Note ISO/IEC 13818-1 defines an Extension_descriptor with descriptor_tag value
0x3f (63), so I kept the DVB comment.

I don't know what defines stream_type value 0x8a as DTS.

I don't have any Blu-ray standards so I don't know where those stream_type
values are defined.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-12-03 23:09:57 +01:00
Frank Plowman
56419fd096 lavc/vvc: Fix overflow in MVD derivation
H.266 (V3) section 7.4.12.8: "The value of lMvd[ compIdx ] shall be in
the range of −2^{17} to 2^{17} − 1, inclusive."

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-12-03 10:22:55 +08:00
Frank Plowman
499896ca2f lavc/vvc: Fix derivation of LmcsMaxBinIdx
Per H.266 (V3) section 7.4.3.19, LmcsMaxBinIdx is set equal to
15 - lmcs_delta_max_bin_idx.  The previous code instead had it equal to
15 - lmcs_min_bin_idx.  This could cause decoder mismatches.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-12-03 10:22:55 +08:00
Frank Plowman
699322519c lavc/vvc: Store MIP information over entire CU area
Previously, the code only stored the MIP mode and transpose flag in the
relevant tables at the top-left corner of the CU.  This information ends
up being retrieved in ff_vvc_intra_pred_* not based on the CU position
but instead the transform unit position (specifically, using the x0 and
y0 from get_luma_predict_unit).  There might be multiple transform units
in a CU, hence the top-left corner of the transform unit might not
coincide with the top-left corner of the CU.  Consequently, we need to
store the MIP information at all positions in the CU, not only its
top-left corner, as we already do for the MIP flag.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-12-03 10:20:51 +08:00
Frank Plowman
7399d9f374 lavc/vvc: Don't check motion estimation region for IBC
The final parameter of check_available determines whether the motion
estimation region constraints imposed in section 8.5.2.3 of H.266 (V3)
on MVP candidates apply to the current candidate or not.  In the case of
IBC spatial merge candidates they do not, as their availability is
dependent only on the criteria described in sections 8.6.2.3 and 6.4.4,
which do not include this constraint on the motion estimation region.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-12-03 10:20:51 +08:00
Frank Plowman
9221cb0443 lavc/vvc: Use second definition of MinQtLog2SizeIntraC if relevant
MinQtLog2SizeIntraC is usually (eq. (51) from VVCv3) defined as

sps_log2_diff_min_qt_min_cb_intra_slice_chroma + MinCbLog2SizeY

However, in the case ph_log2_diff_min_qt_min_cb_intra_slice_chroma is
present, it is instead (eq. (83) from VVCv3) defined as

ph_log2_diff_min_qt_min_cb_intra_slice_chroma + MinCbLog2SizeY

When ph_log2_diff_max_bt_min_qt_intra_slice_chroma and
ph_log2_diff_max_tt_min_qt_intra_slice_chroma are present, so is
ph_log2_diff_min_qt_min_cb_intra_slice_chroma, and so we should use the
second definition of MinQtLog2SizeIntraC, rather than the first, when
calculating the bounds for these syntax elements.

Signed-off-by: Frank Plowman <post@frankplowman.com>
2024-12-03 10:20:51 +08:00
Alexander Strasser
a280e2e646 avcodec/cbs_h266: Fix typo
Introduced in commit 98698ed3c2

Fixes: CID1635788 CID1635789
Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
2024-12-03 10:19:34 +08:00
James Almer
cb27e478f7 doc/codecs: add missing enhancements value for export_side_data
Signed-off-by: James Almer <jamrial@gmail.com>
2024-12-02 12:53:54 -03:00
James Almer
d2c90abab7 doc/filters: add an entry for vf_lcevc
Signed-off-by: James Almer <jamrial@gmail.com>
2024-12-02 12:53:54 -03:00
Zhao Zhili
6e49b86996 avutil/mem_internal: Don't use alignas for MSVC
MSVC messed up standard C features, again.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: James Almer <jamrial@gmail.com>
2024-12-02 20:37:47 +08:00
Michael Niedermayer
4fc43e45f9
avcodec/hevc/hevcdec: initialize qp_y_tab
This does not replicate on my setup, thus this is a blind fix based on ossfuzz trace

Fixes: use of uninitialized value
Fixes: 71747/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5427736120721408

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-12-02 03:14:49 +01:00