Files
ffmpeg/tests
Niklas Haas 770a1ef28d swscale/ops_optimizer: eliminate unneeded SWS_OP_MIN/MAX components
The current code only checks to see if the entire operation is a no-op,
but doesn't allow removing unneeded components from the operation.

Results in a large number of minor improvements, e.g.

 rgba 16x16 -> ya8 16x16:
   u8_read_packed_xyzw
   u8_to_f32_xyzw
   f32_linear_x_xxx00
   f32_dither_x_0_16x16
-  f32_min_xw
+  f32_min_x
   f32_to_u8_xw
   u8_permute_xyz_y_w
   u8_write_packed_xy

or:

 rgba 16x16 -> yuva444p10le 16x16:
   u8_read_packed_xyzw
   u8_to_f32_xyzw
   f32_linear_xyzw_xxx0x_xxx0x_xxx0x_000x0
   f32_dither_xyzw_0_3_2_5_16x16
-  f32_min_xyzw
+  f32_min_w
   f32_to_u16_xyzw
   u16_write_planar_xyzw

And some major ones, e.g.

 yuva444p 16x16 -> gbrap 16x16:
-  u8_read_planar_xyzw
-  u8_to_f32_xyzw
+  u8_read_planar_x
+  u8_write_planar_x
+ Sub-pass #1:
+  u8_read_planar_xyz
+  u8_to_f32_xyz
   f32_linear_xyz_x0x0x_xxx0x_xx00x
   f32_dither_xyz_0_3_2_16x16
-  f32_max_xyzw
-  f32_min_xyzw
-  f32_to_u8_xyzw
-  u8_write_planar_xyzw
+  f32_max_xyz
+  f32_min_xyz
+  f32_to_u8_xyz
+  u8_write_planar_xyz

Which is now split between two subpasses, one for the no-op alpha
copy and one for the yuv444 -> gbrp conversion. This has been
previously blocked by the SWS_OP_MIN/MAX clamp on the RGB channels
marking the alpha channel as dirty, even though it should be a no-op
on the alpha channel.

Signed-off-by: Niklas Haas <git@haasn.dev>
2026-08-09 21:03:33 +02:00
..