From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 4/4] lib/igt_fb: Round to nearest when clamping rgb
Date: Thu, 7 Jun 2018 10:20:07 +0200 [thread overview]
Message-ID: <6b2132e4-64bf-b0ff-2849-441707ca223a@linux.intel.com> (raw)
In-Reply-To: <20180606201642.24618-4-ville.syrjala@linux.intel.com>
Op 06-06-18 om 22:16 schreef Ville Syrjala:
> From: Ville Syrjälä <ville.syrjala@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@linux.intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@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)
No algorithm:
real 0m22,052s
Original algorithm:
real 0m26,091s
New algorithm:
real 0m29,342s
Amount of conversions that are 2560x1440: 18. Some smaller 64x64 and 128x128 are done too but not where most time will be spent..
Each conversion (back and forth) approximately takes .405s, which would interpolate to 0.911s for a 4K fb. Just about doable without further optimizations.
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2018-06-07 8:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-06 20:16 [igt-dev] [PATCH i-g-t 1/4] lib/igt_matrix: Unroll and inline igt_matrix_transform() Ville Syrjala
2018-06-06 20:16 ` [igt-dev] [PATCH i-g-t 2/4] lib/igt_color_encoding: Use the m(row, col) macro to address the matrix cells Ville Syrjala
2018-06-06 20:40 ` Chris Wilson
2018-06-06 20:16 ` [igt-dev] [PATCH i-g-t 3/4] lib/igt_color_encoding: Appease c90 Ville Syrjala
2018-06-06 20:42 ` Chris Wilson
2018-06-07 11:43 ` [igt-dev] [PATCH i-g-t v2 " Ville Syrjala
2018-06-07 11:45 ` Chris Wilson
2018-06-07 12:06 ` Ville Syrjälä
2018-06-06 20:16 ` [igt-dev] [PATCH i-g-t 4/4] lib/igt_fb: Round to nearest when clamping rgb Ville Syrjala
2018-06-07 8:20 ` Maarten Lankhorst [this message]
2018-06-06 20:39 ` [igt-dev] [PATCH i-g-t 1/4] lib/igt_matrix: Unroll and inline igt_matrix_transform() Chris Wilson
2018-06-06 20:45 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] " Patchwork
2018-06-06 21:40 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-06-07 12:08 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] lib/igt_matrix: Unroll and inline igt_matrix_transform() (rev2) Patchwork
2018-06-07 16:25 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6b2132e4-64bf-b0ff-2849-441707ca223a@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox