1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2026-06-19 19:03:00 +02:00

125119 Commits

Author SHA1 Message Date
Lynne 4cf96187e4 prores_raw: set frame crop fields
Some sensors or cameras put junk in the frame boundaries. We should
crop them out.
2026-06-10 02:38:35 +09:00
Lynne 0def4ceb18 prores_raw: export raw camera color data values 2026-06-10 02:38:35 +09:00
Lynne 12dc67b6fe lavu/frame: add camera raw codec side data
Required to correctly present raw video.
Codec-specific since I'd like to support ARRIRAW in the future, which
has a different format.
2026-06-10 02:38:35 +09:00
Niklas Haas 941a35149b swscale/x86/ops_int: switch to SWS_UOP_MOVE
Instead of SWS_UOP_PERMUTE/SWS_UOP_COPY.

No real measurable difference in performance (it just eliminates a few
practically free register renames), but definitely simpler.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 36004d681f swscale/uops: add SWS_UOP_MOVE for optimal register-register swizzles
This decomposes a swizzle mask into a series of optimal register-register
moves, using at most two temporary scratch registers.

This is a better match for ASM-style backends than the existing PERMUTE/COPY
uops that are designed for the needs of the C backend (or other backends which
either apply the swizzle mask directly or permute pointers).

I originally had logic equivalent to this written in NASM macros, but it was
just such a complicated mess that I think it's better to rewrite it in C and
have the resulting metadata be an explicit part of the uop definition.

This commit only adds the uop, I'll update the x86 implementation in the
next step.

Co-authored-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 228ef8d97b swscale/ops: make compile() take const SwsOpList *
The old x86 backend was the only backend that actually mutated the ops list.
With this gone, we can constify this parameter.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas a7c6a5f74e swscale/ops_chain: remove dead code
This is no longer needed now that both C and x86 are ported to uops.
The other ff_sws_setup_*() functions are still used by the aarch64 backend.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 43a8e2da01 swscale/x86/ops: rewrite based on uops_macros.h
This is a ground-up refactor of the existing x86 ops code, using the new
uops macros to auto-generate every single kernel instance without guesswork.

While I was at it, I also cleaned up the file a bit and made sure we have only
a single, consistent way of writing/defining the kernels. This also gets rid
of some of the old boilerplate like decl_pattern.

Most kernels are trivial ports, but a few deserve attention or note:

- SWS_UOP_LINEAR is now generated more efficiently, thanks to the distinction
  between 0/1/arbitrary components. I also rewrote the code to keep track of
  whether the output was initialized yet or not, which lets us skip the
  initial `xorps` and `addps` for the first component.

- SWS_UOP_PERMUTE is generated automatically by using some NASM logic to
  detect permutation cycles and emit the minimal sequence of `mova`
  instructions. SWS_UOP_COPY, on the other hand, is implemented naively. I
  originally had a more complex implementation that could handle both, but
  I decided it really isn't worth the complication just to save 2-3 cycles.

- SWS_UOP_SCALE now has a native 8-bit implementation, which is faster than
  falling back to C code.

- SWS_UOP_SWAP_BYTES is no longer compiled as a type-agnostic pshufb, instead
  we hard-code the shuffle mask

- SWS_UOP_DITHER is now much simpler and avoids branching etc. entirely

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 257f1438a5 swscale/x86/ops: simplify mmsize determination
No reason for this to be a separate function also, it just obscures
the error path for no reason.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 2a09d0346e swscale/x86/ops_include: clarify/fix some comments
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 6deae052a2 swscale/x86/uops: generate NASM macros using uops_macros.h
Rather than hard-coding a separate set of NASM macros, or generating them
with a separate function, we can just leverage the C preprocessor to generate
a NASM source file *from* the existing ops macros.

This is maybe a bit unorthodox, but it avoids unnecessary overhead from
re-generating the macros twice, avoids manual updating of the NASM macros,
and generally does not come with any real downside except being a bit ugly.

The main source of ugliness is the fact that the C preprocessor expands
everything into a single line, whereas NASM expects separate statements to
be on separate lines. Very fortunately, we can work around this by writing a
another NASM macro to take its arguments and dump them onto multiple lines.

It may seem premature, but I went ahead and defined all the macros, since
it was easy enough to do.

I added the %include in this commit to trigger build errors that occur only
as a result of introducing this file in the same commit that introduces it.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 6057759ffc swscale/uops: parametrize filter op result type
The ops.h infrastructure currently hard-codes this as SWS_PIXEL_F32,
but I want to at least properly parametrize this in case we ever
decide to revisit this decision in the future. In particular, it
may become relevant for trivial kernels or kernels whose intermediates
are bounded, exact integers (which could possibly be output directly
as e.g. U16 or U32).

The FATE change is just because the filter op names gained a suffix.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 4a8a1f5b8b swscale/uops: add SWS_UOP_READ_PLANAR_FV_FMA
Analog of SWS_UOP_READ_PLANAR_FV for FMA-enabled backends.
The logic for determining when we can safely use FMA is maybe a bit
obtuse, given that a `return type == SWS_PIXEL_U8` would have just done
the trick as well, but better to be safe than sorry, if we ever decide to
tune this constant in the future.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas dbe961b4cd swscale/uops: add SWS_UOP_LINEAR_FMA and SWS_UOP_FLAG_FMA
This is like SWS_UOP_LINEAR but parametrized by which matrix entries can use
FMA instead of bitexact IEEE mul/add instructions.

I decided to make these a separate uop to avoid bogging down the reference
backend with arch-specific details like FMA. However, I think FMA ops are quite
common/universal so I pre-emptively split it into its own separate flag rather
than defining something like SWS_UOP_FLAG_X86.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 4e18068165 swscale/uops: also generate macros under SWS_BITEXACT
And SWS_BITEXACT|SWS_ACCURATE_RND, for completeness. This roughly doubles
the runtime of the uops macros generation. Let's hope it doesn't explode
further.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 157f586e5c swscale/uops: thread SwsContext through ff_sws_ops_translate()
Needed to access ctx->flags, in particular SWS_BITEXACT.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas f97ba8cbe7 swscale/uops: loop over all flags when generating macros
This list is currently empty but will be expanded by the following commit.

I briefly tested whether it would be worth avoiding the free/realloc on
the uops array, but found the performance difference to be negligible.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 02a168a576 swscale/uops: keep track of input range during op translation
Needed for the FMA decision logic.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 3f9219d605 swscale/uops: add SwsUOpFlags to ff_sws_ops_translate()
These will be used to e.g. enable extra uops during translation.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas b7a80a9f0d swscale/ops_backend: delete ops-based C backend
And make uops_backend.c the new reference.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 100ce4ac41 tests/checkasm/sw_ops: rewrite using uops_macros.h
This ensures 100% coverage of all uop primitives by generating the set of
tests exactly from the list of seen primitives, using the uops macros.

There are some annoying quirks still because of the fact that we have to
essentially "untranslate" the UOPs back to SwsOps that result back in the
intended uop after the translation, but overall it's not too bad and still
much better than the status quo of hand-rolling the list of test cases.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 636b9eda75 swscale/ops_tmpl_float: allow arbitrary values for 1x1 dither
Removes the 1x1 dither fast path, mirroring the previous commit.

This is not really needed nor useful but it will make the transition to
the uops architecture slightly easier, as 1x1 dither gets reinterpreted
as SWS_UOP_ADD there.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas ca8774b9d6 swscale/x86: remove broken and unnecessary 1x1 dither fast path
This is broken because it fails to check dither.y_offset[] to determine if
dithering for a channel is requested or not.

This is unnecessary because the generic dither code already jumps over unused
components, which is cheap enough not to worry about this special case for
now.

This code will, in any case, soon be replaced by a uops_macros.h-derived
approach. This commit is only needed as a stopgap to make checkasm continue
working after the sws_uops refactor.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 19652a83a2 swscale/x86/ops_include: use %assign instead of %xdefine
For numeric 1/0 constants. As an aside, fix the broken comment.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas b328e152a4 swscale/x86: move entry points to ops_common.asm
As well as the packed shuffle solver. These don't really interact with
the rest of the code in ops_int.asm, which is, by name at least, intended for
integer op kernels.

More importantly, these functions will be shared with the uops rewrite.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas c5c9c6d996 swscale/x86: rename ops_common.asm to ops_include.asm
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 8118e964bb swscale/uops: auto-generate reference C backend from uops_macros.h
Instead of choosing by hand which kernels to implement, this rewrite focuses
on leveraging the power of uops_macros.h to auto-generate all needed kernels.
This not only simplifies maintenance, but also improves performance.

I have decided to develop the replacement backend as a separate file, under
a separate prefix, for the explicit purpose of being able to verify the
correctness of the rewrite using the current backend as a checkasm reference.

The code for the kernels themselves has been largely copied from the old
C backend, modified slightly to conform to the uop template style. This does
result in some code duplication, but a following commit will clean it up.
I nonetheless want to preserve this commit for bisection purposes, to ensure
we have one commit that contains both backends side-by-side.

Overall speedup=1.182x faster, min=0.197x max=3.450x

The big slowdowns are flukes caused by tiny deviations in the runtime of
a noop memcpy conversion.

As a nice side benefit, the compiled binary is now also ~10% smaller, and
the code ~50% smaller.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 1e268fbedf swscale/ops_chain: add uop-based helpers to assemble SwsOpChain
This will eventually replace the existing op_match() and
ff_sws_op_compile_tables(), but I've decided to introduce it separately first
so that I can incrementally update the backends to use the new API, at the
cost of some temporary code duplication.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas adaf142647 swscale/uops: generate uop helper macros
This follows the same approach as is used currently by ops_entries_aarch64,
except I decided to have the generation logic live directly in uops.c
to allow re-using internal helpers and move it closer to the other helpers
that depend on the exact set of uops and their fields.

Unlike libswscale/tests/sws_ops.c, we make an effort to actually test all
relevant flag combinations, since these can affect the generated op lists.

I will use these macros to auto-generate both the C template-based kernels,
as well as the entire x86 backend, in the near future, hence their excessive
flexibility.

Re-use the libswscale/tests/sws_ops.c that we already compile. We could put it
in its own file but this is just as convenient, and it's easily moved anyways.
Having it be a FATE test ensures that it is always up-to-date.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 18:27:20 +02:00
Niklas Haas 8ad7cc6ccd swscale/tests/sws_ops: also print/test micro-op list
Tests for changes or regressions in the generated micro-ops. This will be
instrumental in my development of the micro-ops optimizer, and my plans to
phase out some of the macro-op optimization passes in favor of doing those
optimizations on the uop level instead.

 rgb24 16x16 -> rgb24 16x32:
   [ u8 +++X] SWS_OP_READ         : 3 elem(s) packed >> 0
     min: {0 0 0 _}, max: {255 255 255 _}
   [ u8 ...X] SWS_OP_FILTER_V     : 16 -> 32 bilinear (2 taps)
     min: {0 0 0 _}, max: {255 255 255 _}
   [f32 ...X] SWS_OP_DITHER       : 16x16 matrix + {0 3 2 -1}
     min: {1/512 1/512 1/512 _}, max: {255.998047 255.998047 255.998047 _}
   [f32 ...X] SWS_OP_MIN          : x <= {255 255 255 _}
     min: {1/512 1/512 1/512 _}, max: {255 255 255 _}
   [f32 +++X] SWS_OP_CONVERT      : f32 -> u8
     min: {0 0 0 _}, max: {255 255 255 _}
   [ u8 XXXX] SWS_OP_WRITE        : 3 elem(s) packed >> 0
     (X = unused, z = byteswapped, + = exact, 0 = zero)
  Retrying with split passes:
   [ u8 +++X] SWS_OP_READ         : 3 elem(s) packed >> 0
     min: {0 0 0 _}, max: {255 255 255 _}
   [ u8 XXXX] SWS_OP_WRITE        : 3 elem(s) planar >> 0
     (X = unused, z = byteswapped, + = exact, 0 = zero)
+ translated micro-ops:
+    u8_read_packed_xyz
+    u8_write_planar_xyz
  Sub-pass #1:
   [ u8 ...X] SWS_OP_READ         : 3 elem(s) planar >> 0 + 2 tap bilinear filter (V)
     min: {0 0 0 _}, max: {255 255 255 _}
   [f32 ...X] SWS_OP_DITHER       : 16x16 matrix + {0 3 2 -1}
     min: {1/512 1/512 1/512 _}, max: {255.998047 255.998047 255.998047 _}
   [f32 ...X] SWS_OP_MIN          : x <= {255 255 255 _}
     min: {1/512 1/512 1/512 _}, max: {255 255 255 _}
   [f32 +++X] SWS_OP_CONVERT      : f32 -> u8
     min: {0 0 0 _}, max: {255 255 255 _}
   [ u8 XXXX] SWS_OP_WRITE        : 3 elem(s) packed >> 0
     (X = unused, z = byteswapped, + = exact, 0 = zero)
+ translated micro-ops:
+    u8_read_planar_fv_xyz
+    f32_dither_xyz_0_3_2_16x16
+    f32_min_xyz
+    f32_to_u8_xyz
+    u8_write_packed_xyz
...

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 01:11:01 +02:00
Niklas Haas 3a7331d311 swscale/ops: remove unused function ff_sws_enum_ops()
Users can trivially recreate this logic anyways.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 01:10:57 +02:00
Niklas Haas 6b75166758 swscale/tests/sws_ops: minor cleanup / consistency
Clean up after the previous revert.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 01:10:54 +02:00
Niklas Haas dcfe3d3b90 Revert "swscale/tests/sws_ops: add option for summarizing all operation patterns"
This reverts commit f76aa4e408.

This is no longer needed once we switch to uops_macros.h, which will do the
same thing except better.
2026-06-09 01:10:49 +02:00
Niklas Haas aaf6a52fe6 swscale/uops: add uop translation logic
This will replace the fuzzy matching logic in op_match() that is used by the
C and x86 implementations, as well as the translation to AARCH64_OP_* that is
used by the NEON asmgen backend.

Down the line, this function will also take a set of flags to enable
backend-specific kernels like FMA variants, but I also decided to keep it
initially simple to ease the transition.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 01:10:39 +02:00
Niklas Haas dc88bcdf8c swscale/uops: add uop definitions
Taken from AARCH64_OP_*, but generalized/simplified a bit and updated to add
missing op types, especially for special cases that already have dedicated
implementations on x86.

This initial definition is kept intentionally simple and close to SwsOp, to
make it easier to port the existing ops backends to the new infrastructure.
However, in the future, this will be refactored dramatically - distinctions
like convert vs expand will cease to exist on the SwsOp level, and will
instead be introduced by separate optimization passes on the uops level.

SWS_UOP_LINEAR in particular will most likely be broken up into multiple
uops. I also took this opportunity to redefine the mask in a more useful way.

I decided to split up SWS_OP_CONVERT as well, because it was making x86
codegen unnecessarily difficult due to the strong interaction between exact
pixel sizes.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-09 01:09:34 +02:00
Niklas Haas ae6f3ce02c swscale/uops: split off from ops.h
Forming what will be the start of a larger helper file for backend-internal
translation of higher-level ops into lower level kernels. This header file
needs to be includable from independent source files, as it will be used to
provide definitions for build-time code generation (e.g. ops_asmgen.c), so
it must be self-contained.

Pulling in all of ops.h from uops.h would be too large dependency, since
ops.h pulls in graph.h, refstruct, bprint, etc. It's easier to start from a
fresh file that is documented as being usable at compile time.

For now, just declare the common types that will be needed by the uops layer.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-08 18:29:02 +02:00
Niklas Haas 48a42b5f21 configure: add -P to $CC_E flag
This suppresses the addition of #line directives in the preprocessed output,
which is what we want when we're invoking the hostcc just to preprocess some
files. (Currently, this variable is only used for configure-internal checks
anyways, but I want to use it to preprocess a NASM file)

On MSVC/Intel, /EP is the equivalent syntax, though we use -EP instead for
consistency.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-08 18:24:45 +02:00
haoyuLiu 6028720d70 avfilter/zmq: initialize send_buf before shared cleanup on parse failure
Found-by: VulnForge Security Research Team
Reported-by: Cloud-LHY <haoyuliu@clouditera.com>
2026-06-08 02:20:53 +00:00
Jun Zhao c75701a62f lavf/mov: read multi-valued metadata tags
When a metadata tag (e.g. ©ART) contains multiple values, either as
multiple 'data' child atoms within one tag or as multiple sibling tag
atoms with the same key, only the first value was read.

Fix by joining multiple values with semicolons using AV_DICT_APPEND,
consistent with Ogg Vorbis Comment handling in oggparsevorbis.c, and
reusing the existing 'goto retry' loop that covr already uses.
Also add the missing atom.size -= str_size to correctly track remaining
bytes in the tag atom, matching the covr path.

Limitation: on remux the joined string is written back as a single
value, same lossy behavior as Ogg Vorbis. Lossless round-trip would
require AV_DICT_MULTIKEY support throughout the metadata pipeline.

Fix #22367
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-06-08 02:18:32 +00:00
Michael Niedermayer 5622d515e8 tools/target_dec_fuzzer: reduce 4XM max pixels to avoid timeout
Fixes: Timeout
Fixes: 511356573/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FOURXM_fuzzer-5010010110492672
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-08 01:21:12 +00:00
Jun Zhao cfa3ceac7a lavc/hevc: add aarch64 NEON for angular modes 10 and 26
Add NEON-optimized implementations for HEVC angular intra prediction
modes 10 (pure horizontal) and 26 (pure vertical) at 8-bit depth.

Mode 10 (Horizontal):
- Broadcasts left[y] to fill each row using ld2r/ld4r for efficiency
- Applies edge smoothing for luma blocks smaller than 32x32

Mode 26 (Vertical):
- Copies top reference row to all output rows
- Applies edge smoothing for luma blocks smaller than 32x32

Edge smoothing uses uhsub+usqadd to compute the filtered result
directly in 8-bit, avoiding widening to 16-bit intermediates.

The C pred_angular wrappers are made non-static with ff_ prefix to
allow the NEON dispatch to fall back to C for modes not yet optimized.
This will be reverted once all angular modes are implemented.

Note: since pred_angular[] is a per-size function pointer (not
per-mode), checkasm benchmarks will show '_neon' for all 33 modes
even though only modes 10/26 are truly accelerated; unoptimized
modes show ~1.0x speedup as they pass through the NEON wrapper to
the C fallback with negligible overhead.

Speedup over C on Apple M4 (checkasm --bench, 15-run average):

  Mode 10 (Horizontal):
    4x4: 4.66x    8x8: 5.80x    16x16: 16.86x    32x32: 24.89x

  Mode 26 (Vertical):
    4x4: 1.16x    8x8: 1.83x    16x16: 2.45x    32x32: 4.50x

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-06-07 23:29:33 +00:00
Jun Zhao 3d71b9ec93 tests/checkasm: hevc_pred: use pixel helpers for diagnostic output
Replace plain memcmp+fail() with checkasm_check_pixel_padded() for
DC, planar, and angular prediction tests. Use PIXEL_RECT for output
buffers instead of flat arrays.

This enables:
- Detailed per-pixel difference output when run with 'checkasm -v'
- Detection of out-of-bounds writes beyond the NxN block area
- Padding violation reporting (writes past block boundary)

Previously, a test failure would only report "FAILED" with no
information about which pixels were wrong, making assembly debugging
difficult. Follows the pattern established in 4d4b301e4a (checkasm:
hevc_pel: Use helpers for checking for writes out of bounds).

Suggested-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-06-07 23:29:33 +00:00
Jun Zhao 3ec0f14f7d avcodec/h264_ps: set default SAR, remove stale workaround
Set sps->vui.sar to {0,1} (unspecified) before the VUI parsing
block, matching the HEVC pattern at hevc_ps.c.  The old
zero-init-to-1 workaround is now unreachable and is removed.

Suggested-by: James Almer <jamrial@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-06-07 18:55:16 +00:00
Jun Zhao e598463b3d avcodec/h2645_vui: interpret a degenerate SAR as unspecified
Per ITU-T H.264 (ISO/IEC 14496-10) Annex E.2.1 and ITU-T H.265
(ISO/IEC 23008-2) Annex E.3.1, when sar_width or sar_height is zero
the sample aspect ratio shall be considered unspecified. Internally
ffmpeg represents an unspecified SAR as 0/1, while fractions with a
zero denominator are not handled properly (den=0 is silently changed
to den=1 in h264_ps.c, turning an invalid 20480/0 into a "valid" but
impossibly extreme 20480/1); so we bridge the gap by replacing x/0
with 0/1 at the VUI parsing layer.

An av_log warning is added so an invalid SAR in the bitstream is
diagnosed rather than silently overwritten.

This fixes a problem with some video files provided by game
OddBallers when executed with Wine/Proton, which report SAR 20480/0.

Based on patch by Giovanni Mascellani <gmascellani@codeweavers.com>.
Fixes: ticket #23321

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-06-07 18:55:16 +00:00
Andreas Rheinhardt bb49197ede avcodec/liboapvenc: Remove dimension change check
If this were to be checked, it should be checked generically,
not in every single encoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-07 17:53:44 +02:00
Andreas Rheinhardt 0faa43ae6c avcodec/liboapvenc: Use av_image_copy2() to avoid cast
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-07 17:53:44 +02:00
Andreas Rheinhardt bf47563bd8 avcodec/liboapvenc: Remove always-false checks
Already checked in encode_preinit_video().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-07 17:53:44 +02:00
Andreas Rheinhardt 80ea2d1487 avcodec/liboapvenc: Return directly when possible
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-07 17:53:44 +02:00
Andreas Rheinhardt 67855a7234 avcodec/liboapvenc: Use av_unreachable for unreachable default cases
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-07 17:53:44 +02:00
Andreas Rheinhardt 9791c4d183 avcodec/liboapvenc: Don't set AVCodec.pix_fmts directly
Instead use CODEC_PIXFMTS. Avoids deprecation warnings
from Clang and simplifies the removal of AVCodec.pix_fmts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-07 17:53:44 +02:00