[igt-dev] [PATCH i-g-t 4/4] lib/igt_fb: Round to nearest when clamping rgb
Ville Syrjala
ville.syrjala at linux.intel.com
Wed Jun 6 20:16:42 UTC 2018
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
I think round to nearest is maybe more correct here. Also do the
clamp with integers as it actually makes the resulting code
measurably faster.
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
lib/igt_fb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index a926a08d44e1..6ff90d53f433 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1323,7 +1323,7 @@ struct fb_convert_blit_upload {
static uint8_t clamprgb(float val)
{
- return clamp(val, 0.0f, 255.0f);
+ return clamp((int)(val + 0.5f), 0, 255);
}
static void convert_nv12_to_rgb24(struct igt_fb *fb, struct fb_convert_blit_upload *blit)
--
2.16.4
More information about the igt-dev
mailing list