Skip to content

renderer: don't unpremultiply before decoding colors

Niklas Haas requested to merge haasn/libplacebo:unpremultiply_fix into master

Alpha premultiplication canonically happens in RGB space, before conversion to YUV. So we should avoid touching the alpha mode before any colorspace conversions, and only fix the alpha mode once the color has been fully decoded to RGB.

Ditto for the inverse (encoding) case, where we similarly want to avoid touching the premultiplied state after encoding the colors.

It's worth pointing out that this does affect the behavior of PL_LUT_NATIVE, since it operates directly on the native colorspace and has no way of knowing whether the colors are premultiplied or not. But there's no real good solution to that fundamental issue.

Merge request reports

Loading