mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-13 15:32:53 +01:00
get_disto: fix the r/g/b order for luma calculation
Change-Id: I62be556f6254031e8c1f1a572cfdc4ea2641483b
This commit is contained in:
parent
9310d19258
commit
fb01743a53
@ -186,9 +186,9 @@ static void ConvertToGray(WebPPicture* const pic) {
|
|||||||
uint32_t* const row = &pic->argb[y * pic->argb_stride];
|
uint32_t* const row = &pic->argb[y * pic->argb_stride];
|
||||||
for (x = 0; x < pic->width; ++x) {
|
for (x = 0; x < pic->width; ++x) {
|
||||||
const uint32_t argb = row[x];
|
const uint32_t argb = row[x];
|
||||||
const uint32_t r = (argb >> 0) & 0xff;
|
const uint32_t r = (argb >> 16) & 0xff;
|
||||||
const uint32_t g = (argb >> 8) & 0xff;
|
const uint32_t g = (argb >> 8) & 0xff;
|
||||||
const uint32_t b = (argb >> 16) & 0xff;
|
const uint32_t b = (argb >> 0) & 0xff;
|
||||||
// We use BT.709 for converting to luminance.
|
// We use BT.709 for converting to luminance.
|
||||||
const uint32_t Y = (uint32_t)(0.2126 * r + 0.7152 * g + 0.0722 * b + .5);
|
const uint32_t Y = (uint32_t)(0.2126 * r + 0.7152 * g + 0.0722 * b + .5);
|
||||||
row[x] = (argb & 0xff000000u) | (Y * 0x010101u);
|
row[x] = (argb & 0xff000000u) | (Y * 0x010101u);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user