USB: Fix CaptureEye corruption on dark images

This commit is contained in:
Florin9doi 2024-08-20 22:25:40 +03:00 committed by lightningterror
parent 64e17fce3f
commit 517fba3686
1 changed files with 2 additions and 2 deletions

View File

@ -435,7 +435,7 @@ namespace usb_eyetoy
float r = src[2];
float g = src[1];
float b = src[0];
comprBuf[in_pos++] = 0.299f * r + 0.587f * g + 0.114f * b;
comprBuf[in_pos++] = std::clamp<u8>(0.299f * r + 0.587f * g + 0.114f * b, 1, 255);
}
}
comprBuf.resize(80 * 64);
@ -498,7 +498,7 @@ namespace usb_eyetoy
{
for (int x = 0; x < 80; x++)
{
comprBuf[80 * y + x] = 255 * y / 80;
comprBuf[80 * y + x] = std::clamp<u8>(255 * y / 80, 1, 255);
}
}
}