Commit Graph

113363 Commits

Author SHA1 Message Date
Clément Bœsch d269f84199 avcodec/proresenc_anatoliy: remove IS_NEGATIVE() macro
This makes the function closer to encode_acs() in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 9c7f6d89fd avcodec/proresenc_anatoliy: rename new_dc to dc
This makes the function closer to encode_dcs() in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 9258f4eaf9 avcodec/proresenc_anatoliy: compute sign only once
This makes the function closer to encode_dcs() in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 17392ca84f avcodec/proresenc_anatoliy: import GET_SIGN() macro from Kostya encoder and use it 2024-01-10 14:08:00 +01:00
Clément Bœsch 273f591a3d avcodec/proresenc_anatoliy: directly work with blocks in encode_dcs()
This makes the function closer to encode_dcs() in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch dadc5ac24a avcodec/proresenc_anatoliy: reduce DC encoding function prototype differences with Kostya encoder 2024-01-10 14:08:00 +01:00
Clément Bœsch 8e42d3aba0 avcodec/proresenc_anatoliy: execute codebook FFMIN() at assignment
This makes the function closer to encode_dcs() in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 43baba4647 avcodec/proresenc_anatoliy: rename new_code/code to code/codebook
This makes the function closer to encode_dcs() in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch c44cd371ca avcodec/proresenc_anatoliy: inline QSCALE()
Also replaces 16384 with 0x4000.

This makes the function slightly closer to same function in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 1574475033 avcodec/proresenc_anatoliy: rework encode_codeword() prototype
This matches the function of the same name in proresenc_kostya.
2024-01-10 14:08:00 +01:00
Clément Bœsch 1832bd7838 avcodec/proresenc_anatoliy: shuffle encode_codeword() code to match Kostya encoder
Code is functionally identical, it's just rename of variables, cosmetics
and branch logic shuffling.
2024-01-10 14:08:00 +01:00
Clément Bœsch 3885d2493d avcodec/proresenc_anatoliy: use FRAME_ID defined in proresdata.h 2024-01-10 14:08:00 +01:00
Clément Bœsch d6e0fb7c92 avcodec/proresenc_kostya: simplify quantization matrix bytestream writing 2024-01-10 14:08:00 +01:00
Clément Bœsch cbee015867 avcodec/proresenc_kostya: fix chroma quantisation matrix in frame header
Most of the time the quantisation matrices are the same, it only matters
with the proxy profile.
2024-01-10 14:08:00 +01:00
Clément Bœsch 631fa19ee0 avcodec/proresenc_kostya: save a few operations in DC encoding
This matches the logic from proresenc_anatoliy.
2024-01-10 14:08:00 +01:00
Clément Bœsch f06f2cf16a avcodec/proresenc_anatoliy: move DC codebook LUT to shared proresdata
This is going to be shared with proresenc_kostya in the upcoming commit.
2024-01-10 14:08:00 +01:00
Clément Bœsch 9f547e2f15 avcodec/proresenc_anatoliy: remove duplicated define
This is already defined in proresdata.h
2024-01-10 14:08:00 +01:00
Clément Bœsch c35733006a avcodec/proresenc_kostya: remove one LUT indirection for run/level to codebook mapping
This is following the same logic as proresenc_anatoliy.
2024-01-10 14:08:00 +01:00
Clément Bœsch 3ba52f18e4 avcodec/proresenc_anatoliy: move run/lev to codebook LUT to shared proresdata
This is going to be shared with proresenc_kostya in the upcoming commit.
2024-01-10 14:08:00 +01:00
Clément Bœsch e940baa65b avcodec/proresenc_kostya: remove redundant codebook assignments
This is already assigned at declaration.
2024-01-10 14:08:00 +01:00
Clément Bœsch e453efcfbc avcodec/proresenc_kostya: remove unused plane factor variables 2024-01-10 14:08:00 +01:00
Clément Bœsch 2ac88c1362 avcodec/proresenc_kostya: remove an unnecessary parenthesis level in MAKE_CODE() macro 2024-01-10 14:08:00 +01:00
James Almer 6d2f64534d fate/mov: force the native av1 decoder for the avif tests
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-09 20:45:01 -03:00
Vignesh Venkatasubramanian via ffmpeg-devel a0821345eb avformat/mov: Add support for demuxing still HEIC images
They are similar to AVIF images (both use the HEIF container).
The only additional work needed is to parse the hvcC box and put
it in the extradata.

With this patch applied, ffmpeg (when built with an HEVC decoder)
is able to decode the files in
https://github.com/nokiatech/heif/tree/gh-pages/content/images

Also add a couple of fate tests with samples from
https://github.com/nokiatech/heif_conformance/tree/master/conformance_files

Partially fixes trac ticket #6521.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-09 16:44:14 -03:00
James Almer bb819a4ef8 fate/mov: enable the AVIF tests
The samples were uploaded long ago, but this was forgotten.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-09 09:33:57 -03:00
Haihao Xiang 440e08e4bb configure: autodetect libdrm
option kernel_driver for vaapi device creation can be used to choose the
desired device on Linux, which is more convenient than DRM render node
in a multiple-device system (e.g. Intel iGPU + AMD dGPU or inverse), but
this option requires libdrm works. vaapi is autodetected at
configuration time, let's make libdrm autodetected too.

Reviewed-by: Zhao Zhili <quinkblack@foxmail.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-01-09 09:47:56 +08:00
Marton Balint 90bef6390f fftools/ffmpeg_filter: log an information message about filter graph reconfigurations
Filter graph reconfigurations can cause nontrivial issues, e.g. PTS
discontinuities, so it is better to warn the user about them.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-01-07 22:47:22 +01:00
Marton Balint 324be730fc fftools/ffmpeg_filter: honor -reinit_filters 0 even on changed display matrix
Not sure about honoring it also in case of a hwaccel change, so left that as is
for now.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-01-07 22:47:22 +01:00
Marton Balint 363b3ec98a all: use av_channel_layout_describe_bprint instead of av_channel_layout_describe in a few places
Where an AVBPrint buffer is used later anyway.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-01-07 22:47:22 +01:00
Marth64 e4c96dc96c doc/filters/idet: add example
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-07 15:42:54 +01:00
Marth64 b98d87376b doc/encoders/opus: fix typo
Signed-off-by: Marth64 <marth64@proxyid.net>
2024-01-07 15:42:40 +01:00
Thilo Borgmann c03c675d89 avfilter/fsync: Fix memory leak
Fixes a leak if s->last_frame is still set at the end of filtering.

Found-by: James Almer
2024-01-07 13:59:02 +01:00
James Almer b95ccfcada avcodec/vvc_thread: don't use an anonymous union
Should fix compilation with old GCC.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-01-06 23:28:03 -03:00
Nuo Mi 02d600c568 vvcdec: add TODO for combining transform, lmcs_scale_chroma, and add_residual
Thanks for the suggestion from Lynne.
2024-01-07 09:01:04 +08:00
Nuo Mi 26769024d1 avcodec/vvcdec: decode extradata to support container formats
For example:
wget https://www.elecard.com/storage/video/NovosobornayaSquare_1920x1080.mp4
./ffplay NovosobornayaSquare_1920x1080.mp4
2024-01-07 08:58:43 +08:00
Sam James 2f24f10d9c libavcodec: fix -Wint-conversion in vulkan
FIx warnings (soon to be errors in GCC 14, already so in Clang 15):
```
src/libavcodec/vulkan_av1.c: In function ‘vk_av1_create_params’:
src/libavcodec/vulkan_av1.c:183:43: error: initialization of ‘long long unsigned int’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
  183 |         .videoSessionParametersTemplate = NULL,
      |                                           ^~~~
src/libavcodec/vulkan_av1.c:183:43: note: (near initialization for ‘(anonymous).videoSessionParametersTemplate’)
```

Use Vulkan's VK_NULL_HANDLE instead of bare NULL.

Fix Trac ticket #10724.

Was reported downstream in Gentoo at https://bugs.gentoo.org/919067.

Signed-off-by: Sam James <sam@gentoo.org>
2024-01-06 22:38:55 +01:00
Clément Bœsch 9109273e3b avcodec/proresenc: fix alpha plane encoding bitstream
These functions encode a slice of alpha (1 to 8 macroblocks) which are
expected to be encoded as a repeated sequence of "[diff][run-1]", where
diff is the running difference of the alpha value and run is how many
times that value is expected to be duplicated (within the limit of a
grand total of 2048 unpacked samples, corresponding to a slice of 8 MB).

Even when run==0 (the run variable semantic is actually "run minus 1"),
there is always a diff previously encoded that needs a counter of at
least 1. This means we need to call put_alpha_run() unconditionally at
the end of the bitstream to account for the last running diff.

This commit fixes glitchy playbacks on QuickTime with M2 and M3 hardware
(but not M1 for some mysterious reason) with files generated with
commands such as:

  ffmpeg -f lavfi -i testsrc2=d=5:s=912x320,chromakey -c:v prores_aw -profile:v 4    -y aw.mov
  ffmpeg -f lavfi -i testsrc2=d=5:s=912x320,chromakey -c:v prores_ks -profile:v 4444 -y ks.mov

The glitch expresses itself deterministically as blinking black
rectangles on random frames (for example on frame 21, 54, 71, 79, ...).

Even with the proresdec from FFmpeg, overreads actually happens while
reading the run-minus-1 value (around val = get_bits(gb, 4) in
unpack_alpha()). This doesn't seem to cause any particular issue because
it simply overreads into the next slice, and because the decoder is
resilient, but it's still a problem.

The investigation leading to this fix was made possible because of paid
work for Jitter (https://jitter.video).

Fixes ticket #10255.
2024-01-06 17:29:59 +01:00
Clément Bœsch 2142141a16 avcodec/proresenc: make transparency honored in mov/QT
In the mov muxer (in mov_write_video_tag()), bits_per_coded_sample will
be written under certain conditions and is required to be 32 for the
transparency to be honored in QuickTime.

prores_kostya already has this setting but prores_anatoliy and
prores_videotoolbox didn't.
2024-01-06 17:29:59 +01:00
Martin Storsjö de9bc4f205 configure: Don't pass -mfp16-format to MSVC on ARM
The check for this option does succeed - MSVC accepts the option,
but prints a warning about it being unknown and ignored, for
each compiled object file:

    cl : Command line warning D9002 : ignoring unknown option '-mfp16-format=ieee'

The configure script only attempts to add this option on ARM,
therefore this warning isn't seen by the majority of people
building with MSVC.

Making this option into a no-op probably isn't entirely right,
but on the other hand, we don't want to litter the code that
checks for support for the option with compiler specific
conditions either.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-01-05 13:47:57 +02:00
Martin Storsjö 102045028e configure: Disable inline assembly with nonlocal labels with LTO on Clang on Windows
The file libavcodec/x86/mlpdsp_init.c uses inline assembly with
nonlocal labels that are referenced outside of the assembly in C.
This fails to link with LTO when built with Clang when targeting
Windows.

The root cause has been reported upstream at
https://github.com/llvm/llvm-project/issues/76046.

Fixes: https://trac.ffmpeg.org/ticket/10548
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-01-05 13:46:01 +02:00
Thilo Borgmann cb6b165b16 fate: Add fsync filter tests 2024-01-05 09:29:05 +01:00
Thilo Borgmann 7ec4835386 avfilter: Add fsync filter 2024-01-05 09:29:05 +01:00
Wu Jianhua 94949d4770 avcodec/d3d12va_decode: don't change the resource state if the referenced frame is the same as the current frame
This commit removes the follow warning and error:

D3D12 WARNING: ID3D12CommandList::ResourceBarrier: Called on the same subresource(s) of
Resource(0x000002236E0E00D0:'Unnamed ID3D12Resource Object') in separate Barrier Descs
which is inefficient and likely unintentional. Desc[0] and Desc[1] on (subresource :
4294967295). [RESOURCE_MANIPULATION WARNING #1008: RESOURCE_BARRIER_DUPLICATE_SUBRESOURCE_TRANSITIONS]

D3D12 ERROR: ID3D12CommandList::ResourceBarrier: Before state (0x0: D3D12_RESOURCE_STATE_[COMMON|PRESENT])
of resource (0x000002236E0E00D0:'Unnamed ID3D12Resource Object') (subresource: 0) specified
by transition barrier does not match with the state (0x20000: D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE)
specified in the previous call to ResourceBarrier [RESOURCE_MANIPULATION ERROR #527:
RESOURCE_BARRIER_BEFORE_AFTER_MISMATCH]

Tested-by: Tong Wu <tong1.wu@intel.com>
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2024-01-05 11:08:17 +08:00
Tong Wu 270cd14bbb avcodec/dxva2(h264|mpeg2|vc1): use av_assert0 instead of assert
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-01-05 11:06:57 +08:00
Tong Wu 0f01581ccd avcodec/d3d12va_decode|dxva2: add a warning to replace assertion
Previous assertion was not useful. Now a warning is added to replace it.
For get_surface_index, we should return a zero index in case the index is not found.
But a warning is necessary to notify.

Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-01-05 11:06:57 +08:00
Tong Wu 56c671c3b0 avcodec/d3d12va_h264: replace assert with av_assert0
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-01-05 11:06:57 +08:00
Tong Wu 83e0fcbe03 avcodec/d3d12va_decode: delete an empty line and fix a fuction alignment
Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-01-05 11:06:57 +08:00
Tong Wu d18ed2ddb5 avcodec/d3d12va_vp9: fix vp9 max_num_refs value
Previous max_num_refs was based on pp.frame_refs plus 1 and it could possibly
reaches the size limit. Actually it should be the size of pp.ref_frame_map
plus 1.

Signed-off-by: Tong Wu <tong1.wu@intel.com>
2024-01-05 11:06:57 +08:00
Mark Thompson 8b76bae896 avfilter: Temporary hack to fix format negotiation for hw formats
hw_frames_ctx on the input link is only set when the input link is
configured, which hasn't happened yet.  This temporarily hacks around
the problem (in a way no worse than before the format negotiation
changes) until a proper fix can be applied.
2024-01-04 21:47:38 +00:00
Marton Balint d178539532 avutil/imgutils: fix half-float representation of 0.0625
We don't have a 16-bit float Y format, so no fate changes.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-01-04 21:40:22 +01:00