Commit Graph

113032 Commits

Author SHA1 Message Date
Martin Storsjö d0e215fffc fate: Allow overriding what targets to make for running the tests
This can be useful if doing testing of uncommon CPU extensions by
running tests with QEMU (by configuring with e.g.
"target_exec=qemu-aarch64"), by only running the checkasm tests,
to get a reasonable test coverage without excessive test runtime.

For such a config, setting fate_targets="fate-checkasm fate-cpu"
can be a good tradeoff.

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-19 13:34:23 +02:00
Frank Plowman 7d7ba2175c libavformat/vvc: Make probe more conservative
Reduce false positives for VVC files by adding additional checks in
`vvc_probe`. Specifically, `nuh_temporal_id_plus1` is tested for valid
values in extra cases depending on the NAL unit type, as per ITU-T H.266
section 7.4.2.2.

Resolves trac #10703.

Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-12-19 19:44:38 +08:00
Michael Niedermayer a6a553ba94
avcodec/cbs_vp8: fix GetBitContext setup
Fixes: abort()
Fixes: 64232/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5417957987319808

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>
2023-12-19 00:27:26 +01:00
Martin Storsjö f80b2ce9fa gdigrab: Fix hwnd parameter issues
Converting from an integer to HWND (which is a pointer) requires
an explicit cast, otherwise Clang errors out like this:

    src/libavdevice/gdigrab.c:280:14: error: incompatible integer to pointer conversion assigning to 'HWND' (aka 'struct HWND__ *') from 'long' [-Wint-conversion]
      280 |         hwnd = strtol(name, &p, 0);
          |              ^ ~~~~~~~~~~~~~~~~~~~

(With GCC and MSVC, this was a mere warning, but with recent Clang,
this is an error.)

After adding a cast, all compilers also warn something like this:

    src/libavdevice/gdigrab.c:280:16: warning: cast to 'HWND' (aka 'struct HWND__ *') from smaller integer type 'long' [-Wint-to-pointer-cast]
      280 |         hwnd = (HWND) strtol(name, &p, 0);
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~

On Windows, long types are 32 bit, so to get a usable pointer, we
need to use long long. And interpret it as unsigned long long
while at it - i.e. using strtoull.

Finally, right above it, the code triggered the following warning:

    src/libavdevice/gdigrab.c:278:15: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement]
      278 |         char *p;
          |               ^

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-19 00:07:26 +02:00
Kalev Lember b391fdbf1a lavc/libopenh264: Drop openh264 runtime version checks
With the way the runtime checks are currently set up, every single
openh264 release, no matter how minor, is considered an ABI break and
requires ffmpeg recompilation. This is unnecessarily strict because it
doesn't allow downstream distributions to ship any openh264 bug fix
version updates without breaking ffmpeg's openh264 support.

Years ago, at the time when ffmpeg's openh264 support was merged,
openh264 releases were done without a versioned soname (the library was
just libopenh264.so, unversioned). Since then, starting with version
1.3.0, openh264 has started using versioned sonames and the intent has
been to bump the soname every time there's a new release with an ABI
change.

This patch drops the exact version check and instead adds a minimum
requirement on 1.3.0 to the configure script.

Signed-off-by: Kalev Lember <klember@redhat.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-18 23:59:51 +02:00
James Almer 25835e2593 avformat: Immersive Audio Model and Formats muxer
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:21:47 -03:00
James Almer 4ee05182b7 avformat: Immersive Audio Model and Formats demuxer
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:20:59 -03:00
James Almer 7f9308380f avformat/aviobuf: add ffio_read_leb() and ffio_write_leb()
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:19:36 -03:00
James Almer 0cc0d8c0b5 avcodec/get_bits: add get_leb()
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:19:36 -03:00
James Almer 12eac23637 avcodec/packet: add IAMF Parameters side data types
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:19:30 -03:00
James Almer ed670b9b98 ffmpeg: add support for muxing AVStreamGroups
Starting with IAMF support.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:18:09 -03:00
James Almer 556b596d1d avformat: introduce AVStreamGroup
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:18:05 -03:00
James Almer d2af93bbef avutil: introduce an Immersive Audio Model and Formats API
Signed-off-by: James Almer <jamrial@gmail.com>
2023-12-18 15:07:11 -03:00
Gyan Doshi be8a4f80b9 swr/swresample: avoid reapplication of firstpts
During a resampling operation where

1) user has specified first_pts
2) SWR_FLAG_RESAMPLE is not set initially (directly or otherwise)
3) first_pts has been fulfilled (always using hard compensation)

then upon first encountering a delay where a soft compensation is
required, swr_set_compensation will lead to another init of swr which
will reset outpts to the specified firstpts thus leading to an output
frame having its pts = firstpts. When the next input frame is received,
swr will see a large delay and inject silence from firstpts to the
current frame's pts. This can lead to severe desync and in worst case,
loss of audio playback.

Parameter firstpts initialized to AV_NOPTS_VALUE in swr_alloc and then
checked in swr_init to avoid resetting outpts, thus avoiding reapplication
of firstpts.

Fixes #4131.
2023-12-18 15:47:04 +05:30
Anton Khirnov 2ad0b8e0ea fftools/ffmpeg: use a mutex for enc_stats_write()
It may be called concurrently from different threads to write into the
same file.
2023-12-18 08:50:02 +01:00
Anton Khirnov 244d2fcc49 fftools/ffmpeg_mux: deduplicate uniniting EncStats 2023-12-18 08:50:02 +01:00
Anton Khirnov 6cb231e378 doc/ffmpeg: drop misleading claims from -stats_*_fmt
The {br}/{abr} directives are not limited to post-encoding, they can
also be used pre-muxing. The already-present {packet} tag describes this
more accurately, so just drop the assertions.
2023-12-18 08:50:02 +01:00
Anton Khirnov 02a4393647 fftools/ffmpeg: print keyframe information with -stats_* 2023-12-18 08:50:02 +01:00
Anton Khirnov 23c00d8c89 fftools/ffmpeg_mux_init: change 1-bit bitfields from int to unsigned
They cannot store 1 as signed, only 0 and -1.

Avoids warnings such as:
  implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
2023-12-18 08:50:02 +01:00
Anton Khirnov ca6f0192f2 fftools/cmdutils: change option flags to (1 << N) style
It is easier to read.
2023-12-18 08:50:02 +01:00
Anton Khirnov 7a7550ec28 fftools/ffmpeg_mux: factor timestamps processing out of write_packet() 2023-12-18 08:50:02 +01:00
Anton Khirnov 3dc319587f fftools/ffmpeg: deprecate -fps_mode/vsync drop
It depends on the ability of muxers to generate timestamps, which is
itself deprecated.
2023-12-18 08:50:02 +01:00
Anton Khirnov 8a11724a02 fftools/ffmpeg_mux: stop logging to AVFormatContext
Only the muxer itself is supposed to do that. Log to OutputStream
instead.

Drop now-redundant information from the logged string.
2023-12-18 08:50:02 +01:00
hung kuishing 6d129d8df5 doc/examples/qsv_transcode: EINVAL is more appropriate and ENAVAIL will fail build with visual studio
Signed-off-by: clarkh <hungkuishing@outlook.com>
2023-12-18 09:39:24 +08:00
Martin Storsjö 8d24a28d06 riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu
The names of the cpu flags, when parsed from a string with
av_parse_cpu_caps, are parsed by the libavutil eval functions. These
interpret dashes as subtractions. Therefore, these previous cpu flag
names haven't been possible to set.

Use the official names for these extensions, as the previous ad-hoc
names wasn't parseable.

libavutil/tests/cpu tests that the cpu flags can be set, and prints
the detected flags.

Acked-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-17 23:47:04 +02:00
Lena d7ac7101ee gdigrab: allow capturing a window by its handle
x11grab can capture windows by their ID, but gdigrab can only capture
windows by their names, internally calling FindWindowW to lookup its
handle.

This patch simply allows the user to specify a window handle directly.
Signed-off-by: Lena <lena@nihil.gay>
2023-12-17 19:14:08 +01:00
Rémi Denis-Courmont 419145c11b lavc/vc1dsp: fix R-V V vector lengths
The 8x4 and 4x4 use a needlessly large multiplier (unless/until we care
about embedded 64-bit-vector hardware). This is merely suboptimal.

The 8x4 case also uses an incorrect vector length, which leads to incorrect
behaviour on future/hypothetical hardware with 256-bit or larger vectors.

Pointed-out-by: Martin Storsjö <martin@martin.st>
2023-12-17 09:27:52 +02:00
Zhao Zhili eddac2aed4 configure: check VTPixelTransferSessionCreate for scale_vt
It's available on macOS since 10.8, but not available on iOS until
16.0.

Reported and tested by xufuji456.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-12-17 13:52:14 +08:00
Martin Storsjö b51d9eb58e riscv: vc1dsp: Don't check vlenb before checking the CPU flags
We can't call ff_get_rv_vlenb() if we don't have RVV available
at all.

Acked-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-12-16 22:30:26 +02:00
Wenbin Chen 1fa3346c70 libavfilter/vf_dnn_detect: Add yolov4 support
The difference of yolov4 is that sigmoid function needed to be applied
on x, y coordinates. Also make it compatiple with NHWC output as the
yolov4 model from openvino model zoo has NHWC output layout.

Model refer to: https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/yolo-v4-tf

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-16 21:51:52 +08:00
Wenbin Chen a882fc0294 libavfilter/vf_dnn_detect: Add yolov3 support
Add yolov3 support. The difference of yolov3 is that it has multiple
outputs in different scale to perform better on both large and small
object.

The model detail refer to: https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/yolo-v3-tf

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-16 21:50:50 +08:00
Wenbin Chen da02836b9d libavfilter/vf_dnn_detect: Add input pad
Add input pad to get model input resolution. Detection models always
have fixed input size. And the output coordinators are based on the
input resolution, so we need to get input size to map coordinators to
our real output frames.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-16 21:50:37 +08:00
Wenbin Chen 22652b576c libavfiter/dnn_backend_openvino: Add multiple output support
Add multiple output support to openvino backend. You can use '&' to
split different output when you set output name using command line.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-16 21:50:16 +08:00
Leo Izen 1f56bfc986
avformat/hls: use av_strlcopy instead of strncpy
Avoids a -Wstringop-truncation warning by using av_strlcopy instead of
strncpy. Additionally, prints a warning to the log context if this
truncation occurred.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-12-16 04:28:20 -05:00
Rémi Denis-Courmont 918b3ed2d5 lavc/lpc: R-V V compute_autocorr
The loop iterates over the length of the vector, not the order. This is
to avoid reloading the same data for each lag value. However this means
the loop only works if the maximum order is no larger than VLENB.

The loop is roughly equivalent to:

    for (size_t j = 0; j < lag; j++)
        autoc[j] = 1.;

    while (len > lag) {
        for (ptrdiff_t j = 0; j < lag; j++)
            autoc[j] += data[j] * *data;
        data++;
        len--;
    }

    while (len > 0) {
        for (ptrdiff_t j = 0; j < len; j++)
            autoc[j] += data[j] * *data;
        data++;
        len--;
    }

Since register pressure is only at 50%, it should be possible to implement
the same loop for order up to 2xVLENB. But this is left for future work.

Performance numbers are all over the place from ~1.25x to ~4x speedups,
but at least they are always noticeably better than nothing.
2023-12-16 11:18:01 +02:00
Leo Izen 1a04959532
fate/jpegxl: add multiframe permuted TOC image parser test
This test verifies the parser's handling of multiframe JXL files that
have an entropy-encoded permuted table of contents for each frame. The
testcase is actually six JXL codestreams concatenated together, and the
parser needs to be able to find the boundaries.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
2023-12-15 11:52:43 -05:00
Wenbin Chen 22bebfa5e6 libavfilter/vf_dnn_detect: Set used pointer to NULL
Set used pointer to NULL in case it leaks the storage.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-15 20:04:54 +08:00
Wenbin Chen a1e8892a8a libavfilter/vf_dnn_detect: Fix uninitialized variables error
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-15 20:04:54 +08:00
Wenbin Chen 833722343a libavfilter/vf_dnn_detect: Add NULL pointer check
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-15 20:04:54 +08:00
Wenbin Chen e01afa1c6d libavfilter/vf_dnn_detect: Fix an incorrect expression
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-15 20:04:54 +08:00
Martin Storsjö 081d69b78d avfoundation: Fix version checks
<OS>_VERSION_MAX_ALLOWED indicates what version is available in
the SDK, while <OS>_VERSION_MIN_REQUIRED is the version we can
assume is available, i.e. similar to what is set with e.g.
-miphoneos-version-min on the command line.

This fixes build errors like these:

src/libavdevice/avfoundation.m:788:37: error: 'AVCaptureDeviceTypeContinuityCamera' is only available on macOS 14.0 or newer [-Werror,-Wunguarded-availability-new]
            [deviceTypes addObject: AVCaptureDeviceTypeContinuityCamera];
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureDevice.h:551:38: note: 'AVCaptureDeviceTypeContinuityCamera' has been marked as being introduced in macOS 14.0 here, but the deployment target is macOS 13.0.0
AVF_EXPORT AVCaptureDeviceType const AVCaptureDeviceTypeContinuityCamera API_AVAILABLE(macos(14.0), ios(17.0), macCatalyst(17.0), tvos(17.0)) API_UNAVAILABLE(visionos) API_UNAVAILABLE(watchos);
                                     ^

Alternatively, we could use these more modern APIs, if enclosed
in suitable @available() checks.
2023-12-15 11:27:23 +01:00
Nuo Mi ce0c178a40
avcodec/cbs_h266: more restrictive check on pps_tile_idx_delta_val
Fixes: out of array access
Fixes: 62603/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5837632490569728

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-14 23:53:10 +01:00
Pierre-Anthony Lemieux a1384b4e86
avcodec/jpeg2000htdec: check if block decoding will exceed internal precision
Intended to replace https://patchwork.ffmpeg.org/project/ffmpeg/patch/20230802000135.26482-3-michael@niedermayer.cc/
with a more accurate block decoding magnitude bound.

Fixes: 62433/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5828618092937216
Fixes: 58299/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5828618092937216
Previous-version-reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-14 23:53:10 +01:00
Michael Niedermayer aa1e768120
tools/target_dec_fuzzer: Adjust threshold for VMIX
Fixes: Timeout
Fixes: 62286/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMIX_fuzzer-5155237134204928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-14 23:34:46 +01:00
Paul B Mahol bc45a9c6de
tests/fate: add pixelize filter tests
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-14 23:34:46 +01:00
Paul B Mahol 41ee95dc52
tests/fate: add median filter test
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-14 23:34:46 +01:00
Anton Khirnov 5c5140ded2 fftools/ffmpeg_sched: track dts+duration as last_dts
This should be slightly (probably negligibly) more accurate for
scheduling, but mainly it improves the final reported time.

Reported-by: Paul B Mahol
2023-12-14 20:16:54 +01:00
Anton Khirnov 2305091a3a fftools/ffmpeg: update the reported timestamp at the end
Reported-by: microchip
2023-12-14 20:16:54 +01:00
Anton Khirnov 98d706b818 fftools/ffmpeg_sched: move trailing_dts() higher up
Will be useful in following commit.
2023-12-14 20:16:54 +01:00
Anton Khirnov 4549f20222 fftools/ffmpeg: drop OutputFile.sq_encode
It is unused since d119ae2fd8
2023-12-14 20:16:54 +01:00