Skip to content

Commit

Permalink
fix limited range scaling for chroma components in HDR RGB to YCbCr c…
Browse files Browse the repository at this point in the history
…onversion
  • Loading branch information
farindk committed Dec 20, 2022
1 parent 1abe388 commit 643ca81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libheif/heif_colorconversion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2881,8 +2881,8 @@ Op_RRGGBBxx_HDR_to_YCbCr420::convert_colorspace(const std::shared_ptr<const Heif
float cr = r * coeffs.c[2][0] + g * coeffs.c[2][1] + b * coeffs.c[2][2];

if (!full_range_flag) {
cb = cb * 0.85547f; // 0.85547 = 219/256
cr = cr * 0.85547f; // 0.85547 = 219/256
cb = cb * 0.8750f; // 0.8750 = 224/256
cr = cr * 0.8750f; // 0.8750 = 224/256
}

out_cb[(y / 2) * out_cb_stride + (x / 2)] = clip_f_u16(halfRange + cb, fullRange);
Expand Down

0 comments on commit 643ca81

Please sign in to comment.