summaryrefslogtreecommitdiff
path: root/lib/igt_fb.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2018-06-06 20:36:44 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2018-06-07 15:05:26 +0300
commitd1a93aa7e1507de76c6c71be15931cc4b90111bb (patch)
tree322efec007ba8d6732a3ee4859d846fd767a54b6 /lib/igt_fb.c
parent170195b5e744629c334bc8da8d52ee25e4d4cbe4 (diff)
lib/igt_fb: Round to nearest when clamping rgb
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@linux.intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'lib/igt_fb.c')
-rw-r--r--lib/igt_fb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index a926a08d..6ff90d53 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)