Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1444803 > unrolled thread
| Started by | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
|---|---|
| First post | 2016-07-16 12:50 +0200 |
| Last post | 2016-07-16 13:00 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v3 9/9] [media] vivid: Local optimization Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> - 2016-07-16 12:50 +0200
Re: [PATCH v3 9/9] [media] vivid: Local optimization Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> - 2016-07-16 13:00 +0200
| From | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
|---|---|
| Date | 2016-07-16 12:50 +0200 |
| Subject | [PATCH v3 9/9] [media] vivid: Local optimization |
| Message-ID | <rVvkt-2JU-9@gated-at.bofh.it> |
Avoid duplicated data shifts when possible.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index 1c862465e335..2c23c458b1a6 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -919,13 +919,14 @@ static void precalculate_color(struct tpg_data *tpg, int k)
color_to_ycbcr(tpg, r, g, b, &y, &cb, &cr);
if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE) {
- y = clamp(y, 16 << 4, 235 << 4);
- cb = clamp(cb, 16 << 4, 240 << 4);
- cr = clamp(cr, 16 << 4, 240 << 4);
+ y = clamp(y >> 4, 16, 235);
+ cb = clamp(cb >> 4, 16, 240);
+ cr = clamp(cr > 4, 16, 240);
+ } else {
+ y = clamp(y >> 4, 1, 254);
+ cb = clamp(cb >> 4, 1, 254);
+ cr = clamp(cr >> 4, 1, 254);
}
- y = clamp(y >> 4, 1, 254);
- cb = clamp(cb >> 4, 1, 254);
- cr = clamp(cr >> 4, 1, 254);
switch (tpg->fourcc) {
case V4L2_PIX_FMT_YUV444:
y >>= 4;
--
2.8.1
[toc] | [next] | [standalone]
| From | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> |
|---|---|
| Date | 2016-07-16 13:00 +0200 |
| Message-ID | <rVvu9-2N9-7@gated-at.bofh.it> |
| In reply to | #1444803 |
Hi On Sat, Jul 16, 2016 at 12:41 PM, Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> wrote: > - cr = clamp(cr, 16 << 4, 240 << 4); > + y = clamp(y >> 4, 16, 235); > + cb = clamp(cb >> 4, 16, 240); > + cr = clamp(cr > 4, 16, 240); This line is obviously wrong, sorry about that. I wait for some more comments and add it to v4. Regards!
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web