Log in

View Full Version : zimg/z.lib resize line artifacts


poisondeathray
19th January 2018, 04:48
Converting RGB to YUV and downscaling produces artifacts with some resizers under certain conditions


Vapoursynth R42.1

Test source 10bit RGB 2048x960 dpx patttern 0-1023 gradients for R,G,B,greyscale
http://www.mediafire.com/file/71x5rz8feku2bku/RGB_10bit_grad.7z

Lossy preview just to get point across
https://s9.postimg.org/5x35vk6lb/artifact_preview.jpg (https://postimages.org/)


import vapoursynth as vs
core = vs.get_core()
v = core.imwri.Read(r'F:\_Video Tests\10bit Pattern Tests\RGB_10bit_grad.dpx')
v = core.resize.Bicubic(v, width=1024 , height=480, format=vs.YUV420P10, matrix_s="709", range_s="full")
v.set_output()


Observations:

-Bicubic and Spline16 for YUV420P10 affected . Not for other formats like YUV422P10, YUV444P10, P8's not affected

-Super secret "slow" mode switch , cpu_type="none", fixes it

-Other resizers Spline36, Lanczos, Point not affected on this test

-Full vs. limited range YUV does not affect (but "full" was used in this example)

poisondeathray
19th January 2018, 06:59
I can reproduce the same bug in ffmpeg (zeranoe build) zscale

eg

bicubic => artifacts

ffmpeg -i RGB_10bit_grad.dpx -vf zscale=width=1024:height=480:filter=bicubic:matrix=709:range=full,format=yuv420p10le -c:v ffv1 -an bicubic.avi


point => no artifacts

ffmpeg -i RGB_10bit_grad.dpx -vf zscale=width=1024:height=480:filter=point:matrix=709:range=full,format=yuv420p10le -c:v ffv1 -an point.avi


( you used to need to add lutyuv=val:val:val to the end of the filter chain for no clipping, but I tried with/without and it made no difference)

poisondeathray
21st January 2018, 18:38
zimg v2.7.2 using R43 RC1 fixes the issue