ffmpeg/libavutil
Philip Langdale ed83a3a5bd lavu/pixdesc: favour formats where depth and subsampling exactly match
Since introducing the various packed formats used by VAAPI (and p012),
we've noticed that there's actually a gap in how
av_find_best_pix_fmt_of_2 works. It doesn't actually assign any value
to having the same bit depth as the source format, when comparing
against formats with a higher bit depth. This usually doesn't matter,
because av_get_padded_bits_per_pixel() will account for it.

However, as many of these formats use padding internally, we find that
av_get_padded_bits_per_pixel() actually returns the same value for the
10 bit, 12 bit, 16 bit flavours, etc. In these tied situations, we end
up just picking the first of the two provided formats, even if the
second one should be preferred because it matches the actual bit depth.

This bug already existed if you tried to compare yuv420p10 against p016
and p010, for example, but it simply hadn't come up before so we never
noticed.

But now, we actually got a situation in the VAAPI VP9 decoder where it
offers both p010 and p012 because Profile 3 could be either depth and
ends up picking p012 for 10 bit content due to the ordering of the
testing.

In addition, in the process of testing the fix, I realised we have the
same gap when it comes to chroma subsampling - we do not favour a
format that has exactly the same subsampling vs one with less
subsampling when all else is equal.

To fix this, I'm introducing a small score penalty if the bit depth or
subsampling doesn't exactly match the source format. This will break
the tie in favour of the format with the exact match, but not offset
any of the other scoring penalties we already have.

I have added a set of tests around these formats which will fail
without this fix.
2022-09-17 15:11:13 -07:00
..
aarch64 aarch64/tx_float: fix compilation 2022-09-06 05:42:32 +02:00
arm arm: relax byte-swap assembler constraints 2022-09-03 23:54:05 +03:00
avr32
bfin
loongarch Revert "avcodec/loongarch/h264chroma, vc1dsp_lasx: Add wrapper for __lasx_xvldx" 2022-09-14 14:09:26 +02:00
mips
ppc avutil/ppc/cpu: Use proper header for OpenBSD PPC CPU detection 2022-06-25 12:16:51 +02:00
riscv lavu/riscv: fix off-by-one in bit-magnitude clip 2022-09-15 18:11:12 -03:00
sh4
tests lavu/pixdesc: favour formats where depth and subsampling exactly match 2022-09-17 15:11:13 -07:00
tomi
x86 x86/float_dsp: use three operand form for some instructions 2022-09-13 13:50:09 -03:00
.gitignore
adler32.c
adler32.h
aes_ctr.c
aes_ctr.h
aes_internal.h
aes.c
aes.h
attributes_internal.h libavcodec: Set hidden visibility on global symbols accessed from AArch64 assembly 2022-09-02 23:13:29 +03:00
attributes.h avutil/attributes: add support for clang in AV_NOWARN_DEPRECATED 2022-03-16 12:29:37 -03:00
audio_fifo.c
audio_fifo.h
avassert.h
avsscanf.c
avstring.c
avstring.h
avutil.h libavutil: Deprecate av_fopen_utf8, provide an avpriv version 2022-05-23 13:52:26 +03:00
avutilres.rc
base64.c
base64.h
blowfish.c
blowfish.h
bprint.c
bprint.h
bswap.h lavu/riscv: byte-swap operations 2022-09-13 16:50:43 -03:00
buffer_internal.h
buffer.c avutil/buffer: Never poison returned buffers 2022-08-10 18:49:35 +02:00
buffer.h
camellia.c
camellia.h
cast5.c
cast5.h
channel_layout.c Revert "avutil/channel_layout: av_channel_layout_describe_bprint: Check for buffer end" 2022-07-04 14:04:54 -03:00
channel_layout.h
color_utils.c
color_utils.h
colorspace.h
common.h
cpu_internal.h avutil/cpu_internal: Fix check for SSE2SLOW 2022-06-18 19:25:03 +02:00
cpu.c all: Replace if (ARCH_FOO) checks by #if ARCH_FOO 2022-06-15 04:56:37 +02:00
cpu.h
crc.c
crc.h
csp.c avutil/csp: create public API for colorspace structs 2022-06-01 13:52:38 -04:00
csp.h avutil/csp: create public API for colorspace structs 2022-06-01 13:52:38 -04:00
cuda_check.h
des.c
des.h
detection_bbox.c
detection_bbox.h
dict_internal.h avutil/dict: Move avpriv_dict_set_timestamp() to a header of its own 2022-09-03 15:41:44 +02:00
dict.c avutil/dict: Improve appending values 2022-09-14 19:01:02 +02:00
dict.h
display.c
display.h
dovi_meta.c
dovi_meta.h
downmix_info.c
downmix_info.h
dynarray.h
encryption_info.c
encryption_info.h
error.c
error.h
eval.c
eval.h
ffmath.h
fifo.c
fifo.h lavu/fifo: clarify interaction of AV_FIFO_FLAG_AUTO_GROW with av_fifo_write() 2022-09-05 08:59:36 +02:00
file_open.c avutil/internal: Move avpriv-file API to a header of its own 2022-09-03 15:41:44 +02:00
file_open.h avutil/internal: Move avpriv-file API to a header of its own 2022-09-03 15:41:44 +02:00
file.c avutil/file: Properly deprecate av_tempfile() 2022-09-03 15:42:40 +02:00
file.h avutil/file: Properly deprecate av_tempfile() 2022-09-03 15:42:40 +02:00
film_grain_params.c
film_grain_params.h
fixed_dsp.c all: Replace if (ARCH_FOO) checks by #if ARCH_FOO 2022-06-15 04:56:37 +02:00
fixed_dsp.h
float2half.c avutil/half2float: use native _Float16 if available 2022-08-19 22:09:36 +02:00
float2half.h avutil/half2float: use native _Float16 if available 2022-08-19 22:09:36 +02:00
float_dsp.c all: Replace if (ARCH_FOO) checks by #if ARCH_FOO 2022-06-15 04:56:37 +02:00
float_dsp.h
frame.c lavu/frame: allow calling av_frame_make_writable() on non-refcounted frames 2022-08-02 10:44:37 +02:00
frame.h lavu/frame: allow calling av_frame_make_writable() on non-refcounted frames 2022-08-02 10:44:37 +02:00
getenv_utf8.h libavutil: Add wchartoutf8(), wchartoansi(), utf8toansi(), getenv_utf8(), freeenv_utf8() and getenv_dup() 2022-06-21 13:27:46 +03:00
half2float.c avutil/half2float: use native _Float16 if available 2022-08-19 22:09:36 +02:00
half2float.h avutil/half2float: use native _Float16 if available 2022-08-19 22:09:36 +02:00
hash.c
hash.h
hdr_dynamic_metadata.c
hdr_dynamic_metadata.h
hdr_dynamic_vivid_metadata.c
hdr_dynamic_vivid_metadata.h
hmac.c
hmac.h
hwcontext_cuda_internal.h
hwcontext_cuda.c
hwcontext_cuda.h
hwcontext_d3d11va.c avutil/hwcontext_d3d11va: add support for rgbaf16 pixel format 2022-08-13 15:21:59 +02:00
hwcontext_d3d11va.h
hwcontext_drm.c
hwcontext_drm.h
hwcontext_dxva2.c
hwcontext_dxva2.h
hwcontext_internal.h
hwcontext_mediacodec.c
hwcontext_mediacodec.h
hwcontext_opencl.c qsv: remove mfx/ prefix from mfx headers 2022-08-12 10:43:39 +08:00
hwcontext_opencl.h
hwcontext_qsv.c lavu/hwcontext_qsv: add support for AV_PIX_FMT_VUYX on Linux 2022-09-07 14:04:12 +08:00
hwcontext_qsv.h lavu/hwcontext_qsv: add loader field to AVQSVDeviceContext 2022-08-12 10:43:39 +08:00
hwcontext_stub.c )hwcontext: add a stub implementation for Vulkan functions 2022-07-05 15:20:08 +02:00
hwcontext_vaapi.c lavc/vaapi: Add support for remaining 10/12bit profiles 2022-09-03 16:19:40 -07:00
hwcontext_vaapi.h
hwcontext_vdpau.c
hwcontext_vdpau.h
hwcontext_videotoolbox.c avutil/hwcontext_videotoolbox: create real buffer pool 2022-04-29 17:27:37 +08:00
hwcontext_videotoolbox.h avutil/hwcontext_videotoolbox: add missing include for AVFrame 2022-08-08 11:08:55 +08:00
hwcontext_vulkan.c lavu/hwcontext_vulkan: support mapping VUYX, P012, and XV36 2022-09-03 16:19:40 -07:00
hwcontext_vulkan.h
hwcontext.c
hwcontext.h
imgutils_internal.h
imgutils.c
imgutils.h
integer.c
integer.h
internal.h avcodec/codec_internal: Add macros for update_thread_context(_for_user) 2022-09-03 15:42:57 +02:00
intfloat.h
intmath.c
intmath.h lavu/riscv: add <intmath.h> optimisations 2022-09-13 16:50:43 -03:00
intreadwrite.h
lfg.c
lfg.h avutil/lfg: fix comment typo 2022-09-15 20:56:23 +05:30
libavutil.v
libm.h
lls.c all: Replace if (ARCH_FOO) checks by #if ARCH_FOO 2022-06-15 04:56:37 +02:00
lls.h
log2_tab.c
log.c
log.h
lzo.c
lzo.h
macos_kperf.c
macos_kperf.h
macros.h
Makefile configure: always enable gnu_windres if available 2022-08-13 14:42:36 +02:00
mastering_display_metadata.c
mastering_display_metadata.h
mathematics.c
mathematics.h
md5.c
md5.h
mem_internal.h avutil/mem_internal: Fix headers 2022-08-24 03:43:52 +02:00
mem.c avutil/mem: Handle fast allocations near UINT_MAX properly 2022-07-06 22:53:15 +02:00
mem.h avutil/mem: fix doc for reallocs 2022-05-26 17:18:23 +08:00
motion_vector.h
murmur3.c
murmur3.h
objc.h
opt.c avutil/opt: Combine multiple av_log statements 2022-08-03 21:09:24 +02:00
opt.h
parseutils.c
parseutils.h
pca.c
pca.h
pixdesc.c lavu/pixdesc: favour formats where depth and subsampling exactly match 2022-09-17 15:11:13 -07:00
pixdesc.h lavu/pixdesc: favour formats where depth and subsampling exactly match 2022-09-17 15:11:13 -07:00
pixelutils.c
pixelutils.h
pixfmt.h lavu/pixfmt: Add P012, Y212, XV30, and XV36 formats 2022-09-03 16:19:40 -07:00
qsort.h
random_seed.c avutil/internal: Move avpriv-file API to a header of its own 2022-09-03 15:41:44 +02:00
random_seed.h
rational.c
rational.h
rc4.c
rc4.h
replaygain.h
reverse.c
reverse.h
ripemd.c
ripemd.h
samplefmt.c
samplefmt.h
sha512.c
sha512.h
sha.c
sha.h
slicethread.c slicethread: Limit the automatic number of threads to 16 2022-09-06 18:46:44 +03:00
slicethread.h
softfloat_ieee754.h
softfloat_tables.h
softfloat.h
spherical.c
spherical.h
stereo3d.c
stereo3d.h
tablegen.h
tea.c
tea.h
thread.h
threadmessage.c
threadmessage.h
time_internal.h
time.c
time.h
timecode.c avutil/timecode: use timecode fps for number of frame digits 2022-04-22 22:54:58 +02:00
timecode.h
timer.h lavu/riscv: AV_READ_TIME cycle counter 2022-09-13 16:50:43 -03:00
timestamp.h
tree.c
tree.h
twofish.c
twofish.h
tx_double.c
tx_float.c
tx_int32.c
tx_priv.h x86/tx_float: implement inverse MDCT AVX2 assembly 2022-09-06 04:21:46 +02:00
tx_template.c lavu/tx: remove av_cold from table definitions 2022-09-11 03:18:40 +02:00
tx.c lavu/tx: propagate the codelet flags into the context 2022-09-10 02:37:11 +02:00
tx.h
utils.c lib*/version: Move library version functions into files of their own 2022-05-10 06:49:32 +02:00
uuid.c avutil/uuid: add utility library for manipulating UUIDs as specified in RFC 4122 2022-06-12 18:34:28 +10:00
uuid.h avutil/uuid: add utility library for manipulating UUIDs as specified in RFC 4122 2022-06-12 18:34:28 +10:00
version_major.h Fix libversion.sh for split version headers, to unbreak shared library builds 2022-03-17 11:11:17 +02:00
version.c lib*/version: Move library version functions into files of their own 2022-05-10 06:49:32 +02:00
version.h lavu/pixdesc: favour formats where depth and subsampling exactly match 2022-09-17 15:11:13 -07:00
video_enc_params.c
video_enc_params.h
vulkan_functions.h
vulkan_glslang.c
vulkan_loader.h
vulkan_shaderc.c
vulkan.c
vulkan.h
wchar_filename.h avutil/wchar_filename: Make the header C++ compatible 2022-06-28 10:59:31 +02:00
xga_font_data.c
xga_font_data.h
xtea.c
xtea.h