[FFmpeg-trac] #9772(avfilter:new): colorspace filter fails on trc=linear
FFmpeg
trac at avcodec.org
Thu May 12 12:16:17 EEST 2022
#9772: colorspace filter fails on trc=linear
-------------------------------------+-------------------------------------
Reporter: Llyw | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: avfilter
Version: unspecified | Resolution:
Keywords: colorspace | Blocked By:
conversion linear gamma |
resampling |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by Llyw):
I did some more digging around on my own and please correct me if I'm
wrong, but it seems that the current situation regarding gamma-aware
resampling is as follows:
swscale's `scale` filter is apparently hard-coded to assume a gamma of
2.2, see,
https://github.com/FFmpeg/FFmpeg/blob/n5.0.1/libswscale/utils.c#L1614, so
my above `colorspace=[...],scale=[...],colorspace=[...]` filter chain
would absolutely not do what I want and it's probably a good thing that
the bug reported in this issue prevents me from using such a filter chain.
z.lib/zimg's `zscale` filter can do resampling in a linear gamma domain
but requires explicit conversion to a linear transfer characteristic using
up to three zscale filters, see comments in https://github.com/sekrit-
twc/zimg/issues/141. While the performance is not as good as the scale
filter in the release/5.0 branch, there seems to have been significant
improvements in git-master.
So while I still think that you will probably want to investigate the
`colorspace` issue with `trc=linear`, it seems that for gamma-aware
resampling my best bet is to wait for the performance improvements for
`zscale` being available in a release branch and using that instead, with
one `zscale` instance converting to a linear transfer characteristic, the
next one doing the resamling, and the final one converting to the output
color encoding.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9772#comment:5>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list