Skip to content

Commit

Permalink
graph: fix fullrange grey to RGB conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
sekrit-twc committed May 25, 2021
1 parent c8153de commit 55a0f1f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/zimg/graph/graphbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,15 @@ class GraphBuilder::impl {
});
}

void reinterpret_limited_to_full(internal_state &target, plane_mask mask)
{
apply_mask(mask, [&](int p)
{
m_state.planes[p].format.fullrange = true;
target.planes[p].format.fullrange = true;
});
}

PixelFormat choose_resize_format(const internal_state &target, const params &params, int p)
{
if (params.unresize)
Expand Down Expand Up @@ -812,6 +821,7 @@ class GraphBuilder::impl {
void connect_plane(internal_state &target, const params &params, FilterObserver &observer, ConnectMode mode, bool reinterpret_range)
{
plane_mask mask{};
bool reinterpreted = false;
int p;

if (mode == ConnectMode::LUMA) {
Expand All @@ -834,6 +844,7 @@ class GraphBuilder::impl {
src_format.depth == dst_format.depth)
{
reinterpret_full_to_limited(target, mask);
reinterpreted = true;
}
}

Expand All @@ -846,6 +857,10 @@ class GraphBuilder::impl {
if (m_state.planes[p].format != target.planes[p].format)
convert_pixel_format(target.planes[p].format, params, observer, mask, p);

// Undo temporary changes.
if (reinterpreted)
reinterpret_limited_to_full(target, mask);

iassert(m_state.planes[p] == target.planes[p]);
}

Expand Down

0 comments on commit 55a0f1f

Please sign in to comment.