Commit Graph

112610 Commits

Author SHA1 Message Date
Lynne
9ee4f47c94
vulkan_decode: use coded_width/height instead of the non-coded width and height
Partially fixes https://streams.videolan.org/issues/19938/20000_20180305-15.04.59.ts
The is coded as 1920x1080, meant to be rendered at 1440x1080 with cropping,
or 1680x1080 before cropping. Currently, the created DPB is 1440x1080, which results
in the image being decoded incorrectly, as the decoder overwrites output memory.
This commit fixes this.
2023-10-25 20:51:05 +02:00
James Almer
3c5bceb751 avformat/options: add missing disposition flag to AVStream class options
Signed-off-by: James Almer <jamrial@gmail.com>
2023-10-25 09:28:14 -03:00
Martin Storsjö
a4877f1ec1 aarch64: Only enable extensions in the intended files/regions
This eases actual development of the assembly functions, by only
allowing extension instructions within the sections that explicitly
enable them, instead of having all extensions enabled everywhere.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-24 14:46:20 +03:00
Martin Storsjö
0679e85331 aarch64: Stop using asm/hwcap.h for the HWCAP_* detection
Including sys/auxv.h should be enough (it pulls in bits/hwcap.h,
which provides the same defines).

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-24 14:46:14 +03:00
Lynne
c258623c0a
hwcontext_vulkan: improve queue family init code
When users zero-init'd the struct, or left it as-is, the encode
queue family matched the graphics queue family, which led it to be
incorrectly logged as being used for encode.

This just improves the logging so this isn't printed anymore.
2023-10-24 06:07:09 +02:00
Martin Storsjö
ff5a3575fe fftools: Check HAVE_GETSTDHANDLE before using GetStdHandle
GetStdHandle is unavailable outside of the desktop API subset.

This didn't use to be a problem with earlier WinSDKs, as kbhit also
used to be available only for desktop apps, and this whole section is
wrapped in #if HAVE_KBHIT. With newer WinSDKs, kbhit() is available also
for non-desktop apps, while GetStdHandle still isn't.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-23 13:08:39 +03:00
Martin Storsjö
1762975ba1 libavcodec/aarch64/hevc: Require consistent use of trailing semicolon
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-23 10:39:12 +03:00
Andreas Rheinhardt
6e4030a07b avcodec/av1dec, vaapi_av1: Remove excessive logmessages
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-22 22:11:37 +02:00
Andreas Rheinhardt
315c956cbd avcodec/pthread_frame: Remove ff_thread_release_buffer()
It is unnecessary since the removal of non-thread-safe callbacks
in e0786a8eeb. Since then, the
AVCodecContext has only been used as logcontext.

Removing ff_thread_release_buffer() allowed to remove AVCodecContext*
parameters from several other functions (not only unref functions,
but also e.g. ff_h264_ref_picture() which calls ff_h264_unref_picture()
on error).

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-22 22:09:59 +02:00
Leo Izen
86ed68420d
avcodec/librsvgdec: fix memory leaks and deprecated functions
At various points through the function librsvg_decode_frame, errors are
returned from immediately without deallocating any allocated structs.
This patch both fixes those leaks, and also fixes the use of functions
that are deprecated since librsvg version 2.52.0. The older calls are
still used, guarded by #ifdefs while the newer replacements are used if
librsvg >= 2.52.0. One of the deprecated functions is used as a check
for the configure shell script, so it was replaced with a different
function.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-10-22 15:18:13 -04:00
Martin Storsjö
a76b409dd0 aarch64: Reindent all assembly to 8/24 column indentation
libavcodec/aarch64/vc1dsp_neon.S is skipped here, as it intentionally
uses a layered indentation style to visually show how different
unrolled/interleaved phases fit together.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-21 23:25:54 +03:00
Martin Storsjö
cada4597ca aarch64: Manually tweak vertical alignment/indentation in tx_float_neon.S
Favour left aligned columns over right aligned columns.

In principle either style should be ok, but some of the cases
easily lead to incorrect indentation in the surrounding code (see
a couple of cases fixed up in the preceding patch), and show up in
automatic indentation correction attempts.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-21 23:25:39 +03:00
Martin Storsjö
7f905f3672 aarch64: Make the indentation more consistent
Some functions have slightly different indentation styles; try
to match the surrounding code.

libavcodec/aarch64/vc1dsp_neon.S is skipped here, as it intentionally
uses a layered indentation style to visually show how different
unrolled/interleaved phases fit together.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-21 23:25:29 +03:00
Martin Storsjö
93cda5a9c2 aarch64: Lowercase UXTW/SXTW and similar flags
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-21 23:25:23 +03:00
Martin Storsjö
184103b310 aarch64: Consistently use lowercase for vector element specifiers
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-21 23:25:18 +03:00
Paul B Mahol
393d1ee541 avcodec/mlpenc: add 2.1 layout support for truehd 2023-10-20 23:29:45 +02:00
Stefano Sabatini
7bf414408e ffprobe: add -output_format as an alias of -of
Currently we have -of and -print_format, which is a bit confusing. Add
-output_format as an alias of -of to match the short name.
2023-10-20 18:42:41 +02:00
Stefano Sabatini
0d11a6bc12 doc/ffprobe.xsd: apply consistent indent
Use 2-spaces indent all over the file.
2023-10-20 18:42:41 +02:00
Stefano Sabatini
bf84ec0049 ffprobe: factorize xml_print_str and xml_print_int
Introduce xml_print_value to avoid logic duplication.
2023-10-20 18:42:41 +02:00
Stefano Sabatini
9dc834e71f ffprobe: reindent after 2b0973d 2023-10-20 18:42:12 +02:00
Stefano Sabatini
2b0973dedb ffprobe: fix XML rendering, review XML layout
Fix rendering of int values within a side data element, which was
broken since commit d2d3a83ad9, where the side data element was
correctly marked as a variable fields element. Logic to render a
string variable was implemented already, but it was not implemented
for the int fields path, which was enabled by that commit.

Also, code and schema is changed in order to account for multiple
variable-fields elements - such as side data, contained within the
same parent. Previously it was assumed that a single variable-fields
element was contained within the parent, which was the case for tags,
but is not the case for side-data.

Previously data was rendered as:
<side_data_list>
    <side_data side_data_type="CPB properties" max_bitrate="0" min_bitrate="0" avg_bitrate="0" buffer_size="327680" vbv_delay="-1"/>
</side_data_list>

Now as:
<side_data_list>
   <side_data type="CPB properties">
       <side_datum key="side_data_type" value="CPB properties"/>
       <side_datum key="max_bitrate" value="0"/>
       <side_datum key="min_bitrate" value="0"/>
       <side_datum key="avg_bitrate" value="0"/>
       <side_datum key="buffer_size" value="49152"/>
       <side_datum key="vbv_delay" value="-1"/>
   </side_data>
</side_data_list>

Variable-fields elements are rendered as a containing element wrapping
generic key/values elements, enabling use of strict XML schema.

Fix trac issue:
https://trac.ffmpeg.org/ticket/10613
2023-10-20 18:42:01 +02:00
Paul B Mahol
79c568dd4e avcodec/mlpenc: add proper support for output bit shift 2023-10-20 17:07:25 +02:00
Paul B Mahol
3f773d8d02 avcodec/mlpenc: add support for TrueHD substreams
Add 3.0 channel layout support for truehd encoder.
2023-10-20 17:07:24 +02:00
Paul B Mahol
98857ece48 avcodec/mlpenc: use ctx->num_substreams when writing headers 2023-10-20 17:07:23 +02:00
Paul B Mahol
94abb4df32 avcodec/mlpenc: add helper function to derive TrueHD ch map from ch_layout 2023-10-20 17:07:22 +02:00
Niklas Haas
2d1aeba8f2 avfilter/vf_scale: fix interlaced chroma for other formats
This logic only covers the case of yuv420p. Extend this logic to cover
*all* vertically subsampled YUV formats, which require the same
interlaced scaling logic.

Fortunately, we can get away with re-using the same code for both JPEG
and MPEG range YUV, because the only difference here is the horizontal
alignment. (Which I omit touching for now, to avoid introducing possibly
unintended changes in default behavior)
2023-10-20 15:20:09 +02:00
Sean McGovern
d799ad2404
libavutil/ppc/cpu.c: check that AT_HWCAP2 is defined
It was not introduced until glibc 2.18.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-19 20:46:55 +02:00
Michael Niedermayer
5feceed008
avcodec/hevc_ps: Check cpb_cnt_minus1 before storing it
Fixes: index 32 out of bounds for type 'uint32_t [32]'
Fixes: 63003/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4685160840560640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-19 20:46:55 +02:00
Michael Niedermayer
70f5fa6325
avformat/mxfdec: Check klv offset
Fixes: Assertion klv_offset >= mxf->run_in failed at libavformat/mxfdec.c:736
Fixes: 62936/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5778404366221312.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-19 20:44:56 +02:00
Elias Carotti
644b2235c5 avcodec/libx264: Add the SSE computation for libx264.
Since libx264 only provides a per-frame per-channel PSNR, this is
inverted to get back the SSE.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-10-19 13:34:37 +02:00
Paul B Mahol
e7a6bba51a avcodec/mlp*: merge flags used by encoder and decoder 2023-10-18 23:01:40 +02:00
Paul B Mahol
be2bbfe71d avcodec/mlpenc: cleanup filtering 2023-10-18 23:01:39 +02:00
Paul B Mahol
c1053e2e35 avcodec/mlpenc: allow smaller shift for LPC 2023-10-18 23:01:38 +02:00
Paul B Mahol
b206056c82 avcodec/mlpenc: implement advanced stereo rematrix 2023-10-18 23:01:37 +02:00
Paul B Mahol
727ee32da7 avcodec/mlpenc: remove TODO comment, sample rate is always fixed 2023-10-18 23:01:36 +02:00
Paul B Mahol
9adc5d8bfe avcodec/mlpenc: restructure code even more
Implement lsb_bypass for lossless rematrix.
2023-10-18 23:01:35 +02:00
Zhao Zhili
2361970880 avcodec/videotoolboxenc: Check and set hevc profile
1. If user don't specify the profile, set it to main10 when pixel
   format is 10 bits. Before the patch, videotoolbox output main
   profile bitstream with 10 bit input, which can be confusing.
2. Warning when user set profile to main explicitly with 10 bit
   input. It works, but not the best choice.
3. Reject main 10 profile with 8 bit input, it doesn't work.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-18 23:05:14 +08:00
Zhao Zhili
cbb6199ff8 avcodec/videotoolboxenc: add hw_configs
Will be used in the following patch. With hw_config we can get
avctx->hw_frames_ctx, and with avctx->hw_frames_ctx we get
sw_pix_fmt. Otherwise sw_pix_fmt is none. I need sw_pix_fmt
before get the first frame to set hevc encoder profile.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-18 23:02:12 +08:00
Zhao Zhili
ade0612cfb fate/screen: workaround test failure on mac M1
The last frame is corrupted. It has different results on different
platform.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-10-18 23:01:51 +08:00
Michael Riedl
721857483f avformat/mxfenc: fix static building
MXF muxer requires rangecoder otherwise static linking fails.

Signed-off-by: Michael Riedl <michael.riedl@nativewaves.com>
2023-10-17 14:46:34 +02:00
Leo Izen
95fbb6cce8
MAINTAINERS: add entry for jpegxl*
Adding myself for jpegxl* in avcodec as I'm the maintainer of this
parser.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-10-17 08:44:23 -04:00
Leo Izen
bf814387f4
avcodec/jpegxl_parser: fix OOB read regression
In f7ac3512f5 the size of the dynamically
allocated buffer was shrunk, but it was made too small for very small
alphabet sizes. This patch restores the size to prevent an OOB read.

Reported-by: Cole Dilorenzo <coolkingcole@gmail.com>
Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-10-17 08:40:49 -04:00
Michael Niedermayer
5ddab49d48
avcodec/h2645_parse: Avoid EAGAIN
EAGAIN causes an assertion failure when it is returned from the decoder

Fixes: Assertion consumed != (-(11)) failed at libavcodec/decode.c:462
Fixes: assertion_IOT_instruction_decode_c_462/poc

Found-by: Hardik Shah of Vehere (Dawn Treaders team)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:16:19 +02:00
Michael Niedermayer
f7e5537dc1
avcodec/xvididct: Make c* unsigned to avoid undefined overflows
Fixes: signed integer overflow: 1496950099 + 728014168 cannot be represented in type 'int'
Fixes: 62667/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-6511785170305024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:14:10 +02:00
Michael Niedermayer
61b86add52
avcodec/cbs_h2645: Fix showing bits at the end in cbs_read_se_golomb()
Fixes: Assertion n>0 && n<=25 failed at libavcodec/get_bits.h:375
Fixes: 62618/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_REDUNDANT_PPS_fuzzer-5145745046765568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:14:09 +02:00
Michael Niedermayer
75eb698bdc
avcodec/cbs_h2645: Fix showing bits at the end in cbs_read_ue_golomb()
Fixes: Assertion n>0 && n<=25 failed at libavcodec/get_bits.h:375
Fixes: 62617/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5156555663998976

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:14:08 +02:00
Michael Niedermayer
fff875a7f4
avformat/usmdec: do not return 0 when no packet was produced
Fixes: Assertion pkt->stream_index < (unsigned)s->nb_streams && "Invalid stream index.\n" failed at libavformat/demux.c:617
Fixes: 62498/clusterfuzz-testcase-minimized-ffmpeg_dem_USM_fuzzer-4734740995112960

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:09:09 +02:00
Michael Niedermayer
cd66606a8f
avcodec/bonk: Fix undefined overflow in predictor_calc_error()
Fixes: signed integer overflow: -2146469728 - 1488954 cannot be represented in type 'int'
Fixes: 62490/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5612782399389696

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 01:05:07 +02:00
Michael Niedermayer
ef3b42738b
avcodec/evc_ps: Check chroma_format_idc
Fixes: out of array access
Fixes: 62678/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4858264984354816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-16 00:54:37 +02:00
Michael Niedermayer
b79fc70596
avformat/tmv: Check video chunk size
This check matches the audio chunk check

Fixes: Timeout
Fixes: 62681/clusterfuzz-testcase-minimized-ffmpeg_dem_TMV_fuzzer-5299107876700160

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-15 18:54:37 +02:00