Commit Graph

117841 Commits

Author SHA1 Message Date
Zhao Zhili
a8375346eb fftools/ffplay_renderer: Fix a typo
The typo has no real effect except confusing.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reported-by: Chen Haibo
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
2024-11-20 19:17:37 +08:00
Lynne
aad40fed33
vulkan: fix sw_frame_deps counter
The code used as a basis was the buffer dependency code, where the
counter was incremented after each buffer, but for the sw_frame dep
API, we only support adding individual frames at a time.
2024-11-20 05:47:41 +01:00
Lynne
4d3e96c90c
lavc/vulkan/common: fix reverse4's incorrect swizzle
The function is responsible for converting little to big endian.
It had an incorrect swizzle for the last 2 bytes.
2024-11-20 05:23:36 +01:00
Lynne
9691ac6af2
ffv1enc_vulkan: increase max outstanding byte count to 16bit
The issue is that at higher resolutions, the outstanding byte counter
overflowed in case the image had a lot of blank areas.
2024-11-20 05:23:35 +01:00
Lynne
ebf5264c93
ffv1enc_vulkan: fix PCM encoding
This line was mysteriously deleted.
2024-11-20 05:23:35 +01:00
Lynne
eb536d97a0
ffv1enc_vulkan: support buffers larger than 4GiB
Unlike the software FFv1 encoder, none of our buffers are allocated by
FFmpeg, which supports at most 4GiB large allocations.

For really large sizes, the maximum size of the buffer can exceed 4GiB,
which the software encoder optimistically tries to allocate as 4GiB
in the hopes that the encoder will compress to under that amount.

We can just let Vulkan allocate us a larger buffer, and switch to
64-bit offsets.
2024-11-20 05:23:05 +01:00
Leandro Santiago
69cbda5770 lavfi/vf_drawtext: fix memory management when destroying font face
Ref https://trac.ffmpeg.org/ticket/11152

According to harfbuzz docs, hb_ft_font_set_funcs() does not need to be
called, as, quoted:

```
An #hb_font_t object created with hb_ft_font_create()
is preconfigured for FreeType font functions and does not
require this function to be used.
```

Using this function seems to cause memory management issues between
harfbuzz and freetype, and could be eliminated.

This commit also call hb_ft_font_changed() when the underlying FC_Face
changes size, as stated on hardbuzz:

```
HarfBuzz also provides a utility function called hb_ft_font_changed() that you should call
whenever you have altered the properties of your underlying FT_Face, as well as a hb_ft_get_face()
that you can call on an hb_font_t font object to fetch its underlying FT_Face.
```

Finally, the execution order between hb_font_destroy() and
hb_buffer_destroy() is flipped to match the order of creation of
the respective objects.

Signed-off-by: Leandro Santiago <leandrosansilva@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-11-19 23:50:49 +01:00
James Almer
9d8f7bf4b8 tests/checkasm/diracdsp: fix alignment for src and ombc_weight buffers
They are supposed to be 16 byte aligned, not 8.
Should fix crashes in some systems.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-19 12:32:49 -03:00
Eugene Zemtsov
e9c3698ed2 avcodec/decode: Fix incorrect enum type used in side_data_map()
It's AVPacketSideDataType, not AVFrameSideDataType.

Reviewed-by: Ted (Chromium) Meyer <tmathmeyer@chromium.org>
Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-18 15:55:57 -06:00
James Almer
d6b39373a2 avcodec/ffv1enc: restore header writing behavior for version > 1
Broken by accident in a6c58353ac.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-18 18:21:54 -03:00
Brad Smith
f3eca3f387 libavutil/riscv: Make use of elf_aux_info() on FreeBSD / OpenBSD riscv
libavutil/riscv: Make use of elf_aux_info() on FreeBSD / OpenBSD riscv

FreeBSD/OpenBSD riscv have elf_aux_info().

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2024-11-18 22:09:07 +02:00
Rémi Denis-Courmont
607d4cca8e riscv/h264dsp: remove spurious instruction 2024-11-18 22:02:19 +02:00
Lynne
66093c5b94 ffv1enc_vulkan: restrict number of execution contexts to 1
This only leads to wasting memory in a single-threaded operation.
Limit this to 1 for now and leave a comment.
2024-11-18 20:04:24 +01:00
Rémi Denis-Courmont
b75dff0e20 lavc/h264dsp: fix R-V V weight_pixels pointer arithmetic
As of 459a1512f1,
the code is unrolled to process two rows per iteration.
The output cursor thus needs to be incremented by twice the
stride, which is taken care of with SH1ADD. However the original
ADD from the original implemetation was incorrectly left over.
2024-11-18 20:04:58 +02:00
Rémi Denis-Courmont
e29432e6bb lavu/riscv: fix compilation without Vector support
The half-baked assembler in Clang 16 and earlier can't process our
RISC-V assembler. This adds yet another work around that.

If you must use Clang, please use version 17 or later.
2024-11-18 20:04:38 +02:00
Lynne
970d57988d
lavc: bump minor version for FFv1 Vulkan encoder 2024-11-18 08:00:26 +01:00
Lynne
ed2391d341
ffv1enc: add a Vulkan encoder
This commit implements a standard, compliant, version 3 and version 4
FFv1 encoder, entirely in Vulkan. The encoder is written in standard
GLSL and requires a Vulkan 1.3 supporting GPU with the BDA extension.

The encoder can use any amount of slices, but nominally, should use
32x32 slices (1024 in total) to maximize parallelism.

All features are supported, as well as all pixel formats.
This includes:
 - Rice
 - Range coding with a custom quantization table
 - PCM encoding

CRC calculation is also massively parallelized on the GPU.

Encoding of unaligned dimensions on subsampled data requires
version 4, or requires oversizing the image to 64-pixel alignment
and cropping out the padding via container flags.

Performance-wise, this makes 1080p real-time screen capture possible
at 60fps on even modest GPUs.
2024-11-18 07:54:22 +01:00
Lynne
a6c58353ac
ffv1enc: move slice allocation out of generic encode init 2024-11-18 07:54:22 +01:00
Lynne
12ea1cde57
ffv1enc: move plane info init into a separate function 2024-11-18 07:54:21 +01:00
Lynne
f4b5068c3b
ffv1enc: expose ff_ffv1_write_extradata 2024-11-18 07:54:21 +01:00
Lynne
a13ef376da
ffv1enc: split off encoder initialization into a separate function 2024-11-18 07:54:21 +01:00
Lynne
91a4f1539f
.gitignore: add exclusions for shader .c files 2024-11-18 07:54:21 +01:00
Lynne
d0ab49e3e7
hwcontext_vulkan: add the mapped software frame as an upload dependency
We do uploads asynchronously, and we map the software frames in
order to avoid 2-stage copying. However, whilst we added a dependency
upon the mapped buffers, we did not add the original frame backing
those buffers as a dependency.

This caused issues on RADV, particularly with RGB images.
2024-11-18 07:54:20 +01:00
Lynne
1876026f83
vulkan: add ff_vk_exec_add_dep_sw_frame
Some software frames may be mapped, and we'd like to have
them as proper dependencies.
2024-11-18 07:54:20 +01:00
Lynne
c918b42dcd
vulkan: retrieve Vulkan 1.1 properties
Required to know the subgroup size.
2024-11-18 07:45:46 +01:00
Lynne
16fa710340
vulkan: fix printing descriptors to shader for shaders with no descriptors 2024-11-18 07:45:46 +01:00
Lynne
a516b2da22
vulkan: add support for 10-bit planar RGB 2024-11-18 07:45:46 +01:00
Lynne
eb8f3b8460
hwcontext_vulkan: fix planar RGB images
They were non-working for quite a while.
2024-11-18 07:45:41 +01:00
Rémi Denis-Courmont
bbb0fdedb7 lavc/h264idct: fix RISC-V group multiplier
After the branch, the expected SEW/LMUL ratio is 1 byte/vector.
So we have to set the same ratio before branching (QEMU does not care,
but real hardware does).
2024-11-17 16:35:27 +02:00
tangsha
8a5b74f98b delete unused variable ret 2024-11-17 20:56:41 +08:00
Rémi Denis-Courmont
1912c86af6 sws/range_convert: fix RISC-V chrFromJpeg 2024-11-17 11:28:21 +02:00
Rémi Denis-Courmont
55aa81d5cc checkasm: add RISC-V vector width to arch info 2024-11-17 11:28:21 +02:00
Rémi Denis-Courmont
42dd1f1cf1 tests/cpu: print the RISC-V Vector length 2024-11-17 11:28:21 +02:00
Rémi Denis-Courmont
fd8cbfec3d lavc/vp8dsp: remove RISC-V table alignment
These values are bytes and need not be aligned.
2024-11-17 11:28:21 +02:00
Rémi Denis-Courmont
690c015758 lavc/h264dsp: remove RISC-V table alignment
These values are bytes and need not be aligned.
2024-11-17 11:28:21 +02:00
Marth64
1d55f54846 avformat/dvdvideodec: don't allow seeking beyond dvdnav reported duration
There is no reason to accept timestamp values beyond what dvdnav
reported as the duration of the title.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
0912407b9d avformat/dvdvideodec: discard duplicate or partial AC3 samples
Some DVD muxers signal segments to start with duplicate audio samples
when starting extraction from a chapter marker or terminate seamless PGs
on partial audio samples (causing corrupt AC3 frames). Clean up after
these muxers by tracking frames with duplicate PTS and eliminating
partial AC3 frames.

This results in smoother chapter extraction and overall seeking experience,
with linear PTS and AC3 delay within 32ms (1 frame) away from the video.

The issue was not apparent until the flushing pattern was replaced with
a full subdemux reset, as the flushing dropped the frames prematurely,
along side others, as such they were never present to begin with.
2024-11-16 14:40:51 -06:00
Marth64
f2f238c3a4 avformat/dvdvideodec: drop packets with unset PTS or DTS
The packets effectively serve no purpose and we are already
dropping packets with PTS less than 0. This also creates
for a smoother seeking experience after the subdemuxer
reset fix.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
3656379d92 avformat/dvdvideodec: remove unnecessary need_parsing argument
The value is always AVSTREAM_PARSE_HEADERS.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
a2c57e27d6 avformat/dvdvideodec: open subdemuxer after initializing IFO headers
It is wasteful to open the subdemuxer if an error occurs while
initializing streams or reading IFO headers.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
60434b483c avformat/dvdvideodec: remove auto value for menu_lu option
The "auto" mode serves no functional purpose except for logging
a message and setting the value to 1. The documentation clearly
explains what the option is for.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
4a03e95ff4 avformat/dvdvideodec: default menu_vts option to 1 and clarify description
Menu 0 is the VIDEO_TS root menu, which does not appear to be used
commonly for menu segments. Instead, default to the menu of VTS 1.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
afc152f564 avformat/dvdvideodec: check the length of a NAV packet when reading titles
Some discs present titles with bogus NAV packets. We apply this check
for menus and for title MPEG blocks, but we should also apply it
for NAV packets during title demuxing.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
a1ae66c827 avformat/dvdvideodec: reset the subdemuxer on discontinuity instead of flushing
DVDs naturally consist of segmented MPEG-PS blobs within a VOB
(i.e. VOBs are not linear). NAV packs set the segment boundaries.
When switching between segments, discontinuities occur and thus
the subdemuxer needs to be reset. The current approach to manage
this is by invoking ff_read_frame_flush() on the subdemuxer context,
via a callback function which is invoked during the menu or dvdnav
block functions. The same subdemuxer context is used throughout
the demux, with a stretched PTS wrap bits value (64) + disabled
overflow correction, and then flushed on each segment. Eventually,
a play_end context variable is set to declare EOF.

However, this approach causes frame drops. The block read flushes the
demuxer before the frame read is complete, causing frames to drop
on discontinuity. The play_end signal likewise ends playback before
the frame read is complete, causing frames to drop at end of the title.
To compound the issue, the PTS wrap bits value of 64 is wrong;
the VOBU limit is actually 32 and the overflow correction should work.

Instead, EOF the MPEG-PS subdemuxer organically when each VOB segment
ends, and re-open it if needed with the offset after the full frame read
is complete. In doing so, correct the PTS wrap behavior to 32 bits and
remove the play_end/segment_started signals and callback pattern.

Note that the timestamps as reported by the NAV packets are known as
"PTMs", so the fields storing the time prior to adjustment are renamed
accordingly. This makes it more clear when we are offsetting the
NAV packet reported timestamps versus what we present as a demuxer.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
1964faa568 avformat/dvdvideodec: simplify dvdvideo_read_packet()
The function has a few branches where it discards frames via
FFERROR_REDO; consolidate is via a goto block to simplify the
function and improve readability. Logging still maintains
all the relevant details for the reason of the discard.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
c1e4b6c676 avformat/dvdvideodec: enable chapter calculation for menus
Menus are generally segmented by cell, so use them as the
marker delimiters. Requires preindex option to be enabled.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
b38ca20bf2 avformat/dvdvideodec: standardize the NAV packet event signal
This consolidates the FFERROR_REDO handling of NAV packets to
dvdvideo_subdemux_read_data(), is a pre-requisite to calculating
chapter markers for menus, and a pre-requisite to fixing the
frame desync issue when the subdemuxer is flushed.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
6bbaa7db49 avformat/dvdvideodec: move memcpy below missed NAV packet warning
Readability improvement; the warning can be bundled beneath
the preceding validations rather than awkwardly between the memcpy
and return.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
e1ace1d314 avformat/dvdvideodec: remove "auto" value for -pg option, default to 1
The default "auto" mode is effectively useless; the reasonable
default use case is to use the first PG (segment) of the
selected PGC for both menus and standard titles. Just
default the value to 1, since the option is irrelevant
unless -pgc is also set.

Note that this should not break users using this advanced option.
The "auto" mode errored and asked for a PG number regardless
for non-menus, and for menus the mode simply defaulted to 1.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00
Marth64
39c662f541 avformat/dvdvideodec: measure duration of the current menu VOBU in state
This will be a pre-requisite to calculating chapter markers
for menus.

Signed-off-by: Marth64 <marth64@proxyid.net>
2024-11-16 14:40:51 -06:00