7074 Commits

Author SHA1 Message Date
marcos ashton 2f779272e0 libavformat/img2enc: add update_filemtime option
Add a new boolean option -update_filemtime to the image2 muxer that
sets each output file's modification time based on the creation_time
metadata plus the frame's PTS offset.

This is useful when extracting frames from dashcam or action camera
footage where wall-clock timestamps should be preserved on the output
files, allowing photo management tools to sort frames by capture time
without post-processing.

The option requires creation_time metadata to be set (via -metadata
creation_time=...). If not present, a warning is logged and the
option is silently disabled. When PTS is unavailable, the creation
time is used as-is without frame offset.

Uses utimes() on POSIX and _utime() on Windows to set file timestamps
with microsecond and second precision respectively.

Includes a FATE roundtrip test that writes frames with a known
creation_time, reads them back using the demuxer's -ts_from_file
option, and verifies the PTS values match the expected timestamps.

Closes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/22537
Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-07-03 19:47:10 +00:00
James Almer a37171bed5 tests/fate/hevc: add scale filter dependency to fate-hevc-bsf-mp4toannexb-new-extradata
Should fix failures when said filter is not compiled in.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-07-03 15:43:12 -03:00
Andreas Rheinhardt fad2e0bc50 tests/checkasm/motion: Improve randomizing buffers
Randomize four bytes at a time and only do it if needed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-07-03 16:09:57 +02:00
Andreas Rheinhardt f3343f51b1 tests/checkasm/motion: Improve reporting
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-07-03 16:09:57 +02:00
James Almer 9011e7083e tests/fate/ffmpeg: remove audio stream from fate-autorotate
It's not relevant to the test, and it's often affected by unrelated changes to the
ac3 encoder.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-07-03 09:53:23 -03:00
James Almer d8c1dd4233 tests/fate/ac3: add a test to check correct encoder sample output
Signed-off-by: James Almer <jamrial@gmail.com>
2026-07-02 17:53:21 -03:00
James Almer b5bfb7716c avcodec/ac3enc: drain the buffered samples at the end of encoding
When encoding a stream with an amount of samples multiple of a block, the last
the last 256 samples would be lost as the encoders were not marked as
AV_CODEC_CAP_DELAY.

This can be easily reproduced with:

ffmpeg -f lavfi -i sine -ac 2 -af atrim=start_sample=0:end_sample=4608 -c:a eac3 -f framecrc -

Signed-off-by: James Almer <jamrial@gmail.com>
2026-07-02 17:53:20 -03:00
Andreas Rheinhardt cd9e6996af swscale/uops: Move stuff for generating uops_macros.h out
It is not used for normal builds and is more an auxiliary
dev tool; move the code into a new file, uops_macros_gen.c
to be built as a DEVPROG.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-07-02 20:39:29 +02:00
marcos ashton 784ab15589 tests/fate/libavutil: add FATE test for video_hint
Test av_video_hint_alloc with 0, 1, and 4 rects, and
av_video_hint_create_side_data. Verifies that av_video_hint_rects
and av_video_hint_get_rect return pointers consistent with
rect_offset and rect_size, write/read-back of rect coordinates,
both hint type values, and OOM paths via av_max_alloc.

Coverage for libavutil/video_hint.c: 0.00% -> 82.05%

The remaining uncovered lines are the nb_rects overflow guard and
the av_buffer_create / av_frame_new_side_data_from_buf failure
cleanup paths, which av_max_alloc() cannot reach since it forces
the first allocation to fail.
2026-07-02 13:48:58 +00:00
marcos ashton 7ea44ca6a6 tests/fate/libavutil: add FATE test for mastering_display_metadata
Test all 5 public functions: av_mastering_display_metadata_alloc,
av_mastering_display_metadata_alloc_size, the create_side_data
variant, av_content_light_metadata_alloc, and its create_side_data
variant. Verifies the {0,1} rational defaults set by get_defaults(),
write/read-back of HDR metadata fields, frame side data attachment
for both mastering display and content light metadata, and OOM
paths via av_max_alloc.

Coverage for libavutil/mastering_display_metadata.c: 86.49% -> 100.00%
2026-07-02 13:48:58 +00:00
marcos ashton 324617b26f tests/fate/libavutil: add FATE test for dovi_meta
Test av_dovi_alloc, av_dovi_metadata_alloc, and av_dovi_find_level.
Verifies that the four inline offset-based accessors (get_header,
get_mapping, get_color, get_ext) return pointers consistent with
the offset fields, that find_level returns the first matching ext
block or NULL for a missing level, and OOM paths via av_max_alloc.

Coverage for libavutil/dovi_meta.c: 63.16% -> 100.00%
2026-07-02 13:48:58 +00:00
Shreesh Adiga e18e229388 checkasm/crc: increase size of input buffer from 8k to 16k
For AArch64, AV_CRC_32_IEEE_LE implementation has codepath which is triggered
when input buffer size is >= 8192. Thus to ensure sufficient test coverage,
size of the input buffer in the test file is being increased from 8192 to 16384.
2026-07-02 09:03:25 +00:00
James Almer 053b2d18fa avcodec/aacenc: export discard padding side data when needed
This is in line with other encoders, and is needed by the matroska muxer
to properly signal end trimming samples.

gaplessenc-pcm-to-mov-aac changes as the mov muxer now uses this information
when writing the edit list, so the shorter frame duration is not needed.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-07-02 02:57:29 +00:00
Thomas Guilbert b3fb13e8dd Guard lpc methods in flacdsp and add tests
This commit adds additional guards for the RISC-V lpc variants.

It also adds tests to exercise the guarded paths in checkasm/flacdsp.c.
2026-07-02 02:49:06 +00:00
Andreas Rheinhardt 45c41d1d1b tests/checkasm/vc1dsp: Fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-07-01 20:00:46 +02:00
Andreas Rheinhardt 296d86c8bb tests/checkasm/vc1dsp: Improve mspel test
Up until now, only the fullpel test (i.e. the test without pixel
interpolation) has been tested at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-07-01 20:00:46 +02:00
James Almer a693a4cd80 tests/fate/generic-tags: use codec copy instead of encoding
Using ac3_fixed output was not enough as there's float to int conversion due to
the fact the mp3float decoder is used.
Instead of playing with codec combinations, just remove encoding from the test
altogheter. Mov supports muxing mp3 just fine.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-07-01 14:35:14 -03:00
James Almer d7d2d9d539 tests/fate/generic-tags: use ac3_fixed encoder instead of float aac
There's no guarantee the aac encoder will be bitexact in its output across platforms.
Use ac3_fixed instead of aac_fixed while at it, so the aac encoder can get improvements
without affecting this test.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-07-01 13:52:48 -03:00
Lynne 38161819e7 fate: update AAC encoder tests 2026-07-01 21:05:27 +09:00
Michael Niedermayer 48f30aa08c checkasm/sw_rgb: also test yuyvtoyuv422
yuyvtoyuv422 reads the trailing odd V sample at src[2w+1], one byte further
than uyvytoyuv422, so the number of extra source bytes an odd width needs is
passed in per format (1 for UYVY, 2 for YUYV) and added to the stride.

uyvytoyuv420 and yuyvtoyuv420 are intentionally not added: their x86 mmxext
chroma averaging uses PAVGB rounding and so is not bit-exact with the C
reference, which truncates, so they cannot be verified this way.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-01 01:48:33 +00:00
Michael Niedermayer ef18ece3f0 checkasm/sw_rgb: test uyvytoyuv422 with odd widths
The SIMD uyvytoyuv422 implementations only handled even widths correctly.
Add odd width and 1x1 entries so the trailing column handling is exercised
against the C reference.

An odd width reads one source byte more than 2*width, the V sample at
src[2w], so the stride is extended by one for odd widths.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-01 01:48:33 +00:00
Michael Niedermayer d5a2ab9c08 checkasm/sw_rgb: fix too small source stride in uyvytoyuv422 test
The planes table stored a source stride smaller than the 2*width bytes a
packed UYVY line occupies (e.g. width 12 with stride 12), and the correct
stride for width 128 would be 256, which does not even fit the uint8_t
field. The test passed only because the oversized source buffer absorbed
the resulting out-of-bounds reads.

Derive srcStride from the width (2*width) instead of storing it, so each
line is passed its true size.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-07-01 01:48:33 +00:00
James Almer b1327568b6 avformat/movenc: unify remainder samples signaling
When writing edit lists and the last packet has skip samples side data to
report discard padding, for codecs that have a fixed frame size it's best to
always use the full packet duration to calculate track duration (and thus
bitrate in some cases) and let the edit list be the sole source of triming
information.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-30 22:19:24 -03:00
Martin Storsjö ae4314e2f4 tests: Implicitly set TAG=GEN for data/*.m3u8
This avoids having to declare it for every rule that generates
test input data, and adds such a missing tag for
tests/data/hls-seek.m3u8.

This fixes a case of a missing TAG for data/hls-seek.m3u8, which
caused it to be printed without a tag, like
"        tests/data/hls-seek.m3u8", now printed as
"GEN     tests/data/hls-seek.m3u8" as expected.
2026-06-30 08:23:04 +00:00
Jeongkeun Kim 2be6bf5507 tests/checkasm/llviddsp: fix add_left_pred_int16 buffer compare size
dst0/dst1 are uint16_t* allocated as width * sizeof(uint16_t), but
the memcmp at the end of check_add_left_pred_16 only compared `width`
bytes — missing the second half of each buffer. Same pattern used
correctly in tests/checkasm/huffyuvdsp.c (memcmp with width * sizeof()).

While at it, fix missing whitespace around & and || on the same line.

Fixes: fbe9148779 ("checkasm/llviddsp : add test for other dsp func")
Signed-off-by: Jeongkeun Kim <variety0724@gmail.com>
2026-06-29 21:40:05 +00:00
James Almer 613d65d508 tests/fate/hevc: update ref file for the newest test
A recent change affected what stream_remux() prints, and the CI didn't detect it
because it ran before doing a fast-forward rebase.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-29 14:29:33 +00:00
jiangjie 98c766ec19 avcodec/hevc_mp4toannexb: handle packet-side hvcC extradata
Do not overwrite the output codecpar extradata after init(). Keep the currently active HEVC parameter sets in HEVCBSFContext instead.

When AV_PKT_DATA_NEW_EXTRADATA on an input packet carries hvcC extradata, convert it to Annex B, update the runtime extradata state, and remove the packet side data.

Also add a FATE test covering extradata reloads with hevc_mp4toannexb,hevc_metadata.
2026-06-29 14:06:29 +00:00
Andreas Rheinhardt 90cca8111b tests/checkasm/hevc_pel: Don't test impossible values
denom is in 0..7 (see pred_weight_table() in hevcdec.c).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-27 00:06:08 +02:00
Andreas Rheinhardt baad19d0b5 avcodec/hevc/dsp: Combine offsets early for biweight prediction
Only the sum of the offsets is ever used
(see equation 8-279 in the 2019 version of the H.265 spec).

Tested-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-27 00:06:08 +02:00
Bogdan Lisman b5ef72c16b tests/fate/filter-video: gate mcdeint testsrc tests on scale filter
fate-filter-mcdeint-slow and -slow-edge feed testsrc (RGB24 only) into
mcdeint (YUV420P/YUV444P only), so ffmpeg auto-inserts a scale filter to
convert the pixel format.  That conversion needs swscale, so both tests
fail to configure the filter graph under --disable-swscale:

    Error configuring filter graph: Invalid argument
    Conversion failed!

Reported by the x86_64-archlinux-gcc-disableswscale FATE slot.  Add
SCALE_FILTER to their dependency list so they are skipped when the scale
filter (and thus swscale) is unavailable, matching the existing
convention for conversion-dependent FATE tests.

Signed-off-by: Bogdan Lisman <bogdan@pydevsolutions.com>
2026-06-25 16:39:27 +00:00
Martin Storsjö 93ebde18e1 checkasm: Trim out unused upstream files
We only need the source files themselves; keep them and the
LICENSE file.
2026-06-25 12:47:17 +03:00
Niklas Haas f947bc9c15 tests/fate/swscale: skip fate-sws-uops-macros without int128
This is very slow otherwise (10x slower than with native int128). Developers
can still manually run it if they need to, but we should exclude it from
the default FATE target.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:48 +02:00
Niklas Haas d04f7b17c7 tests/checkasm/sw_ops: eliminate unneeded overflow check
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:48 +02:00
Niklas Haas 3743d2851d swscale/ops: switch from AVRational to AVRational64
This has two immediate consequences:

1. Fixes overflow in the range tracker for some 32-bit packed formats:

 rgb24 -> v30xbe:
   [ u8 +++X] SWS_OP_READ         : 3 elem(s) packed >> 0
     min: {0 0 0 _}, max: {255 255 255 _}
   [ u8 +++X] SWS_OP_CONVERT      : u8 -> f32
     min: {0 0 0 _}, max: {255 255 255 _}
   [f32 ...X] SWS_OP_LINEAR       : matrix3+off3 [...]
     min: {64 64 64 _}, max: {940 960 960 _}
   [f32 ...X] SWS_OP_DITHER       : 16x16 matrix + {0 3 2 -1}
     min: {64.001953 64.001953 64.001953 _}, max: {940.998047 960.998047 960.998047 _}
   [f32 +++X] SWS_OP_CONVERT      : f32 -> u32
     min: {64 64 64 _}, max: {940 960 960 _}
   [u32 +++X] SWS_OP_SWIZZLE      : 2013
     min: {64 64 64 _}, max: {960 940 960 _}
   [u32 ++++] SWS_OP_CLEAR        : {_ _ _ 1}
     min: {64 64 64 1}, max: {960 940 960 1}
   [u32 +XXX] SWS_OP_PACK         : {10 10 10 2}
-    min: {268697857 _ _ _}, max: {-264581375 _ _ _}
+    min: {268697857 _ _ _}, max: {4030385921 _ _ _}
   [u32 zXXX] SWS_OP_SWAP_BYTES
-    min: {268697857 _ _ _}, max: {-264581375 _ _ _}
+    min: {268697857 _ _ _}, max: {4030385921 _ _ _}

2. Slightly increases the accuracy of intermediate values for some linear ops:

 yuv444p10be -> rgb48be:
   [u16 zzzX] SWS_OP_READ         : 3 elem(s) planar >> 0
     min: {0 0 0 _}, max: {1023 1023 1023 _}
   [u16 +++X] SWS_OP_SWAP_BYTES
     min: {0 0 0 _}, max: {1023 1023 1023 _}
   [u16 +++X] SWS_OP_CONVERT      : u16 -> f32
     min: {0 0 0 _}, max: {1023 1023 1023 _}
   [f32 ...X] SWS_OP_LINEAR       : matrix3+off3 [...]
46.813777] [0 0 0 1 0]]
-    min: {-57290.842348 -44341.337325 -71146.813777 _}, max: {124144.718860 111375.162457 137973.627845 _}
+    min: {-57290.842348 -44341.337326 -71146.813777 _}, max: {124144.718860 111375.162457 137973.627845 _}
   [f32 ...X] SWS_OP_MAX          : {0 0 0 _} <= x
     min: {0 0 0 _}, max: {124144.718860 111375.162457 137973.627845 _}
   [f32 ...X] SWS_OP_MIN          : x <= {65535 65535 65535 _}
     min: {0 0 0 _}, max: {65535 65535 65535 _}
   [f32 +++X] SWS_OP_CONVERT      : f32 -> u16
     min: {0 0 0 _}, max: {65535 65535 65535 _}
   [u16 zzzX] SWS_OP_SWAP_BYTES
     min: {0 0 0 _}, max: {65535 65535 65535 _}
   [u16 XXXX] SWS_OP_WRITE        : 3 elem(s) packed >> 0
     (X = unused, z = byteswapped, + = exact, 0 = zero)

Importantly, none of the changes affect the actual operation list, just the
range tracking metadata.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-25 01:20:44 +02:00
Marton Balint 18d164a573 avformat/asfdec_f: do not truncate get_value result
Also change the function to return 0 on error, this is a more sensible error
value for aspect ratios anyway.

Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:54 +02:00
Marton Balint cfb76bc38c tests/fate/id3v2: add ID3 test with alternate asf demuxer
This tests the previously untested alternative ASF demuxer, plus the metadata
is actually a bit different from what is returned by the historical ASF
demuxer.

Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:54 +02:00
Marton Balint c434d0a160 avformat/asfdec_f: set creation time as metadata
Signed-off-by: Marton Balint <cus@passwd.hu>
2026-06-24 23:31:53 +02:00
Kacper Michajłow c3ca443969 tests/fate/seek: exclude hls-seek test without aresample
Fixes build with --disable-swresample.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-06-24 16:04:38 +00:00
Ramiro Polla fde02c904c swscale/ops: remove friendly linear mask names
These names are not really useful and the uops list already shows the
shape of the mask.
2026-06-24 13:14:35 +00:00
James Almer b0919b271b tests/fate/mov: add a test for remainder sample calculation
Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-23 20:07:25 -03:00
James Almer 579edeabec avformat/movenc: look for remainder samples in packet side data
Sometimes the duration itself reflects the remainder samples by being set to a
value lower than the frame size, but in other cases it's done only through
a discard padding value in side data.
Take the latter into account when calculating durations.

Fixes issue #23532.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-23 20:07:25 -03:00
James Almer 0559f92adc avformat/movenc: don't derive tmcd track durations if they were copied
This behavior only applies to tracks created by the muxer.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-23 20:07:25 -03:00
James Almer 92386ba213 tests/fate: print checksum and output file size for stream_remux() tests
This puts the tests in line with transcode(), making it easier to detect affecting changes.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-23 23:05:57 +00:00
Kacper Michajłow e27ad5760c avformat/hls: rebase seek discard threshold to each playlist's DTS baseline
After a seek, hls_read_packet drops packets until each playlist reaches
seek_timestamp. That threshold lives on c->first_timestamp's baseline,
i.e. the DTS of whichever stream produced the very first packet. Streams
can have different DTS baselines though. So comparing one stream's
threshold against another stream's DTS is wrong. A stream whose first
keyframe precedes the global baseline gets its segment keyframe dropped
and resumes a segment (or more) late.

Track the first DTS per playlist and rebase the threshold onto each
playlist's own baseline. Since HLS segments are presentation-aligned
across renditions, every stream then resumes at the same presentation
time. seek_timestamp keeps its meaning on the global timeline, only the
per-playlist comparison value is translated.

This fixes playlists that would be unable to play from the start, and
instead skip one or more segments, before data is output.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-06-23 20:40:28 +02:00
Kacper Michajłow caa3fa6af0 avformat/hls: fix seeking to before the first timestamp
find_timestamp_in_playlist() already selects the first segment when the
target is below the playlist's first timestamp, but returns 0.
hls_read_seek() treats that as a failure, and all seek operation is
failed.

This breaks seeking to the very start whenever the requested timestamp
is slightly below the first one. Clamp such targets to the first segment
and report success instead.

Fixes: https://github.com/mpv-player/mpv/issues/14840#issuecomment-4703186169
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-06-23 20:40:28 +02:00
Kacper Michajłow f699b3a8f5 tests/fate/seek: add HLS multi-playlist seek test
Add a seek test for an HLS master playlist with separate audio and video
media playlists with different DTS baselines.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-06-23 20:40:27 +02:00
Andreas Rheinhardt 0438966d84 avcodec: Remove FF_API_V408_CODECID
Deprecated on 2024-10-12.
The output of the v410enc test changes because padding bits
are now filled with 1s instead of zeroes and because
bits_per_coded_sample changes to 30 (from 32), see
https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22455#issuecomment-46213.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-23 19:13:06 +02:00
Andreas Rheinhardt 1d92e85fcd tests/fate/hlsenc: Make hls-iframes-single-fmp4 bitexact
The mp4 file contained LIBAVFORMAT_IDENT and when it's
length changes (as during a major version bump)
the test output changes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-23 17:14:42 +02:00
James Almer 8f3c62cb6a tests/fate/hlsenc: don't write the segment output to /dev/null
Fixes fate-hls-iframes-single-fmp4 on msys2, where #EXT-X-MAP:URI would print
"nul" instead of "null".

Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-23 12:01:23 -03:00
Niklas Haas 09c0cd6837 swscale/tests/sws_ops: split passes when printing ops lists
This affects a large number of conversions across the board, either:

1. Lifting a constant alpha/chroma clear out from the conversion pass:

 rgb24 16x16 -> yuva444p 16x16:
+  [ u8 $XXX] SWS_OP_CLEAR        : {255 _ _ _}
+  [ u8 XXXX] SWS_OP_WRITE        : 1 elem(s) planar >> 0, via {3}
+    ('X' unused, 'z' byteswapped, '=' copied, '$' const, '+' integer, '0' zero)
+ translated micro-ops:
+    u8_clear_x_1
+    u8_write_planar_x
+ Sub-pass #1:
   [ u8 +++X] SWS_OP_READ         : 3 elem(s) packed >> 0
   [ u8 +++X] SWS_OP_CONVERT      : u8 -> f32
   [f32 ...X] SWS_OP_LINEAR       : matrix3+off3 [...]
   [f32 ...X] SWS_OP_DITHER       : 16x16 matrix + {0 3 2 -1}
   [f32 +++X] SWS_OP_CONVERT      : f32 -> u8
-  [ u8 +++$] SWS_OP_CLEAR        : {_ _ _ 255}
-  [ u8 XXXX] SWS_OP_WRITE        : 4 elem(s) planar >> 0
+  [ u8 XXXX] SWS_OP_WRITE        : 3 elem(s) planar >> 0
     ('X' unused, 'z' byteswapped, '=' copied, '$' const, '+' integer, '0' zero)

 gray 16x16 -> yuv444p 16x16:
+  [ u8 $$XX] SWS_OP_CLEAR        : {128 128 _ _}
+  [ u8 XXXX] SWS_OP_WRITE        : 2 elem(s) planar >> 0, via {2, 1}
+    ('X' unused, 'z' byteswapped, '=' copied, '$' const, '+' integer, '0' zero)
+ translated micro-ops:
+    u8_clear_xy_xx
+    u8_write_planar_xy
+ Sub-pass #1:
   [ u8 =XXX] SWS_OP_READ         : 1 elem(s) planar >> 0
   [ u8 =XXX] SWS_OP_CONVERT      : u8 -> f32
   [f32 .XXX] SWS_OP_LINEAR       : luma [...]
   [f32 .XXX] SWS_OP_DITHER       : 16x16 matrix + {0 -1 -1 -1}
   [f32 +XXX] SWS_OP_CONVERT      : f32 -> u8
-  [ u8 +$$X] SWS_OP_CLEAR        : {_ 128 128 _}
-  [ u8 XXXX] SWS_OP_WRITE        : 3 elem(s) planar >> 0
+  [ u8 XXXX] SWS_OP_WRITE        : 1 elem(s) planar >> 0
     ('X' unused, 'z' byteswapped, '=' copied, '$' const, '+' integer, '0' zero)
  translated micro-ops:
     u8_read_planar_x
     u8_to_f32_x
     f32_linear_x_x000x
     f32_dither_x_0_16x16
     f32_to_u8_x
-    u8_clear_yz_xx
-    u8_write_planar_xyz
+    u8_write_planar_x

or

2. Passing through a plane that was previously unmodified by an ops chain:

 gbrap 16x16 -> yuva444p 16x16:
-  [ u8 ====] SWS_OP_READ         : 4 elem(s) planar >> 0, via {2, 0, 1, 3}
-  [ u8 ====] SWS_OP_CONVERT      : u8 -> f32
-  [f32 ...=] SWS_OP_LINEAR       : matrix3+off3 [...]
-  [f32 ...=] SWS_OP_DITHER       : 16x16 matrix + {0 3 2 -1}
-  [f32 +++=] SWS_OP_CONVERT      : f32 -> u8
-  [ u8 XXXX] SWS_OP_WRITE        : 4 elem(s) planar >> 0
+  [ u8 =XXX] SWS_OP_READ         : 1 elem(s) planar >> 0, via {3}
+  [ u8 XXXX] SWS_OP_WRITE        : 1 elem(s) planar >> 0, via {3}
     ('X' unused, 'z' byteswapped, '=' copied, '$' const, '+' integer, '0' zero)
  translated micro-ops:
-    u8_read_planar_xyzw
-    u8_to_f32_xyzw
+    u8_read_planar_x
+    u8_write_planar_x
+ Sub-pass #1:
+  [ u8 ===X] SWS_OP_READ         : 3 elem(s) planar >> 0, via {2, 0, 1}
+  [ u8 ===X] SWS_OP_CONVERT      : u8 -> f32
+  [f32 ...X] SWS_OP_LINEAR       : matrix3+off3 [...]
+  [f32 ...X] SWS_OP_DITHER       : 16x16 matrix + {0 3 2 -1}
+  [f32 +++X] SWS_OP_CONVERT      : f32 -> u8
+  [ u8 XXXX] SWS_OP_WRITE        : 3 elem(s) planar >> 0
+    ('X' unused, 'z' byteswapped, '=' copied, '$' const, '+' integer, '0' zero)
+ translated micro-ops:
+    u8_read_planar_xyz
+    u8_to_f32_xyz
     f32_linear_xyz_xxx0x_xxx0x_xxx0x
     f32_dither_xyz_0_3_2_16x16
-    f32_to_u8_xyzw
-    u8_write_planar_xyzw
+    f32_to_u8_xyz
+    u8_write_planar_xyz

(Op lists are abridged slightly for brevity)

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-06-23 11:48:13 +00:00