libplacebo icon indicating copy to clipboard operation
libplacebo copied to clipboard

Sinc filter does not work with videos

Open lextra2 opened this issue 2 years ago • 5 comments

Command used to test: ffmpeg -y -benchmark -init_hw_device vulkan -i "input" -vf "libplacebo=w=iw*2:h=ih*2:upscaler=sinc" -c:v libx264 -preset ultrafast -qp 0 -g 1 -an test123.mkv

Some comparisons:

Spline36 (Avisynth) spline36

Sinc (Avisynth) How it is supposed to look sinc

Bilinear (Avisynth) bilinear

Sinc (libplacebo) Looks blurrier then Bilinear placebo_sinc

The same thing happens with gpu-next in MPV: https://github.com/mpv-player/mpv/issues/13672

lextra2 avatar Mar 12 '24 11:03 lextra2

Can you provide the same source frame you used, as a reference?

Avisynth is using four taps for Sinc, whereas libplacebo uses three taps however, that is unlikely to cause the difference. Within libplacebo itself, Sinc is clearly superior to bilinear.

Chipcraft avatar Mar 16 '24 18:03 Chipcraft

Can you provide the same source frame you used, as a reference?

mpv-shot0001

Within libplacebo itself, Sinc is clearly superior to bilinear.

I've only included bilinear for sharpness comparison

lextra2 avatar Mar 16 '24 19:03 lextra2

Cannot replicate the output with libplacebo e987124b and ffmpeg master ab2173c0a5.

ffmpeg -init_hw_device vulkan -i 313426824-3cc2ca8e-7c87-44b7-978d-e7531ea335e3.png -vf libplacebo=upscaler=sinc:w=iw*2:h=ih*2 -pix_fmt rgb24 Sinc_Out.png

https://nle-chipcraft.com/Git/Sinc_Out.png

Chipcraft avatar Mar 16 '24 21:03 Chipcraft

Cannot replicate the output with libplacebo e987124 and ffmpeg master ab2173c0a5.

ffmpeg -init_hw_device vulkan -i 313426824-3cc2ca8e-7c87-44b7-978d-e7531ea335e3.png -vf libplacebo=upscaler=sinc:w=iw*2:h=ih*2 -pix_fmt rgb24 Sinc_Out.png

https://nle-chipcraft.com/Git/Sinc_Out.png

Yeah weird. That works. And ffmpeg -loop 1 -init_hw_device vulkan -i input.png -c:v libx264 -qp 0 -t 15 -vf libplacebo=upscaler=sinc:w=iw*2:h=ih*2 -pix_fmt yuv420p test.mp4 works too.

But this code ffmpeg -init_hw_device vulkan -i input.mkv -vf "libplacebo=w=iw*2:h=ih*2:upscaler=sinc" -c:v libx264 -preset ultrafast -qp 0 -an test567.mkv does not work.

lextra2 avatar Mar 16 '24 22:03 lextra2

Here, try this 30 seconds snippet. Reference frame is at 0:25.025 (Frame 600)

And this time, encode it as video.

Edit: My guess is it only works with RGB inputs, and YUV fails. Pure speculation. Can't test right now.

lextra2 avatar Mar 16 '24 22:03 lextra2

fixed in https://github.com/haasn/libplacebo/commit/76bb971847a5c7f5a40596edcb071de5ab8b7446

lextra2 avatar Sep 30 '24 08:09 lextra2