Opened 16 months ago

Last modified 16 months ago

#10532 new defect

Color changes at w => 1280, h >= 578 with libplacebo filter on rgb source

Reported by: nicol Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: Up scale, down scale or not scale, color changes with resolution through libplacebo.

rgb24(testsrc), colorchart(gbrp), rgbtestsrc(rgba) are changed,
yuv420p(smptebars) is not changed.

How to reproduce:

% ffmpeg -f lavfi -i colorchart=d=2 -vf scale=w=1278:h=576:flags=lanczos,setsar=1 -crf 18 -pix_fmt yuv420p colorchart_scale.mp4 -y
% ffmpeg -hwaccel_output_format vulkan -init_hw_device vulkan=vk -filter_hw_device vk -f lavfi -i colorchart=d=2 -vf hwupload,libplacebo=inputs=1:w=1278:h=576:upscaler=lanczos:format=yuv420p:range=tv,hwdownload,format=yuv420p -crf 18 -pix_fmt yuv420p colorchart_libplacebo.mp4 -y
Color doesn't change.

% ffmpeg -hwaccel_output_format vulkan -init_hw_device vulkan=vk -filter_hw_device vk -f lavfi -i colorchart=d=2 -vf hwupload,libplacebo=inputs=1:w=1280:h=576:upscaler=lanczos:format=yuv420p:range=tv,hwdownload,format=yuv420p -crf 18 -pix_fmt yuv420p colorchart_libplacebo_w1280.mp4 -y
% ffmpeg -hwaccel_output_format vulkan -init_hw_device vulkan=vk -filter_hw_device vk -f lavfi -i colorchart=d=2 -vf hwupload,libplacebo=inputs=1:w=1278:h=578:upscaler=lanczos:format=yuv420p:range=tv,hwdownload,format=yuv420p -crf 18 -pix_fmt yuv420p colorchart_libplacebo_h578.mp4 -y
Color changes.

ffmpeg version N-111792-gf0b1cab538-20230821
built on ... BtbN Auto-Build 2023-08-22 12:49

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (6)

colorchart_scale.mp4 (8.5 KB ) - added by nicol 16 months ago.
colorchart_libplacebo.mp4 (39.4 KB ) - added by nicol 16 months ago.
colorchart_libplacebo_w1280.mp4 (38.0 KB ) - added by nicol 16 months ago.
colorchart_libplacebo_h578.mp4 (43.7 KB ) - added by nicol 16 months ago.
colorchart_scale_w1280.mp4 (8.2 KB ) - added by nicol 16 months ago.
colorchart_colorspace_libplacebo_w1280.mp4 (13.6 KB ) - added by nicol 16 months ago.

Download all attachments as: .zip

Change History (9)

by nicol, 16 months ago

Attachment: colorchart_scale.mp4 added

by nicol, 16 months ago

Attachment: colorchart_libplacebo.mp4 added

by nicol, 16 months ago

comment:1 by nicol, 16 months ago

Adding -color_primaries bt709 -color_trc bt709 -colorspace bt709 -bsf:v h264_metadata=colour_primaries=1:transfer_characteristics=1:matrix_coefficients=1 -color_range tv chrome, Windows edge display color looks same, but only firefox looks different.

% ffmpeg -hwaccel_output_format vulkan -init_hw_device vulkan=vk -filter_hw_device vk -f lavfi -i colorchart=d=2 -vf hwupload,libplacebo=inputs=1:w=1280:h=576:upscaler=lanczos:format=yuv420p:range=tv,hwdownload,format=yuv420p -crf 18 -pix_fmt yuv420p -color_primaries bt709 -color_trc bt709 -colorspace bt709 -bsf:v h264_metadata=colour_primaries=1:transfer_characteristics=1:matrix_coefficients=1 -color_range tv colorchart_libplacebo_w1280_opt2.mp4 -y

comment:2 by Balling, 16 months ago

but only firefox looks different

Bug in firefox.

comment:3 by nicol, 16 months ago

Adding itrc=srgb and fast=1 in the colorspace filter first gave the same look as resized with the scale filter.

% ffmpeg -f lavfi -i colorchart=d=2 -vf scale=w=1280:h=576:flags=lanczos,setsar=1 -crf 18 -pix_fmt yuv420p -color_primaries bt709 -color_trc bt709 -colorspace bt709 -bsf:v h264_metadata=colour_primaries=1:transfer_characteristics=1:matrix_coefficients=1 -color_range tv colorchart_scale_w1280.mp4

% ffmpeg -hwaccel_output_format vulkan -init_hw_device vulkan=vk -filter_hw_device vk -f lavfi -i colorchart=d=2 -vf hwupload,libplacebo=inputs=1:w=1280:h=576:upscaler=lanczos:format=yuv420p:range=tv,hwdownload,format=yuv420p -crf 18 -pix_fmt yuv420p -color_primaries bt709 -color_trc bt709 -colorspace bt709 -bsf:v h264_metadata=colour_primaries=1:transfer_characteristics=1:matrix_coefficients=1 -color_range tv colorchart_libplacebo_w1280.mp4

% ffmpeg -hwaccel_output_format vulkan -init_hw_device vulkan=vk -filter_hw_device vk -f lavfi -i colorchart=d=2 -vf colorspace=all=bt709:iprimaries=bt709:itrc=srgb:ispace=bt709:fast=1,hwupload,libplacebo=inputs=1:w=1280:h=576:upscaler=lanczos:format=yuv420p:range=tv,hwdownload,format=yuv420p -crf 18 -pix_fmt yuv420p -color_primaries bt709 -color_trc bt709 -colorspace bt709 -bsf:v h264_metadata=colour_primaries=1:transfer_characteristics=1:matrix_coefficients=1 -color_range tv colorchart_colorspace_libplacebo_w1280.mp4

Looks same chrome, edge and firefox.

by nicol, 16 months ago

Attachment: colorchart_scale_w1280.mp4 added
Note: See TracTickets for help on using tickets.