Commit f1eb926d authored by Ricardo Ribalda Delgado's avatar Ricardo Ribalda Delgado Committed by Mauro Carvalho Chehab

[media] vivid: Local optimization

Avoid duplicated clamps when possible.
Suggested-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 7a20f398
...@@ -916,14 +916,18 @@ static void precalculate_color(struct tpg_data *tpg, int k) ...@@ -916,14 +916,18 @@ static void precalculate_color(struct tpg_data *tpg, int k)
if (!ycbcr_valid) if (!ycbcr_valid)
color_to_ycbcr(tpg, r, g, b, &y, &cb, &cr); color_to_ycbcr(tpg, r, g, b, &y, &cb, &cr);
y >>= 4;
cb >>= 4;
cr >>= 4;
if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE) { if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE) {
y = clamp(y, 16 << 4, 235 << 4); y = clamp(y, 16, 235);
cb = clamp(cb, 16 << 4, 240 << 4); cb = clamp(cb, 16, 240);
cr = clamp(cr, 16 << 4, 240 << 4); cr = clamp(cr, 16, 240);
} else {
y = clamp(y, 1, 254);
cb = clamp(cb, 1, 254);
cr = clamp(cr, 1, 254);
} }
y = clamp(y >> 4, 1, 254);
cb = clamp(cb >> 4, 1, 254);
cr = clamp(cr >> 4, 1, 254);
switch (tpg->fourcc) { switch (tpg->fourcc) {
case V4L2_PIX_FMT_YUV444: case V4L2_PIX_FMT_YUV444:
y >>= 4; y >>= 4;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment