case V4L2_PIX_FMT_XBGR32:
case V4L2_PIX_FMT_ARGB32:
case V4L2_PIX_FMT_ABGR32:
+ tpg->color_enc = TGP_COLOR_ENC_RGB;
+ break;
case V4L2_PIX_FMT_GREY:
case V4L2_PIX_FMT_Y16:
case V4L2_PIX_FMT_Y16_BE:
- tpg->color_enc = TGP_COLOR_ENC_RGB;
+ tpg->color_enc = TGP_COLOR_ENC_LUMA;
break;
case V4L2_PIX_FMT_YUV444:
case V4L2_PIX_FMT_YUV555:
g <<= 4;
b <<= 4;
}
- if (tpg->qual == TPG_QUAL_GRAY || tpg->fourcc == V4L2_PIX_FMT_GREY ||
- tpg->fourcc == V4L2_PIX_FMT_Y16 ||
- tpg->fourcc == V4L2_PIX_FMT_Y16_BE) {
+
+ if (tpg->qual == TPG_QUAL_GRAY ||
+ tpg->color_enc == TGP_COLOR_ENC_LUMA) {
/* Rec. 709 Luma function */
/* (0.2126, 0.7152, 0.0722) * (255 * 256) */
r = g = b = (13879 * r + 46688 * g + 4713 * b) >> 16;
b = (b - (16 << 4)) * 255 / 219;
}
- if (tpg->brightness != 128 || tpg->contrast != 128 ||
- tpg->saturation != 128 || tpg->hue) {
+ if ((tpg->brightness != 128 || tpg->contrast != 128 ||
+ tpg->saturation != 128 || tpg->hue) &&
+ tpg->color_enc != TGP_COLOR_ENC_LUMA) {
/* Implement these operations */
int y, cb, cr;
int tmp_cb, tmp_cr;
return;
}
ycbcr_to_color(tpg, y, cb, cr, &r, &g, &b);
+ } else if ((tpg->brightness != 128 || tpg->contrast != 128) &&
+ tpg->color_enc == TGP_COLOR_ENC_LUMA) {
+ r = (16 << 4) + ((r - (16 << 4)) * tpg->contrast) / 128;
+ r += (tpg->brightness << 4) - (128 << 4);
}
switch (tpg->color_enc) {
tpg->colors[k][2] = cr;
break;
}
+ case TGP_COLOR_ENC_LUMA:
+ {
+ tpg->colors[k][0] = r >> 4;
+ break;
+ }
case TGP_COLOR_ENC_RGB:
{
if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE) {
return "HSV";
case TGP_COLOR_ENC_YCBCR:
return "Y'CbCr";
+ case TGP_COLOR_ENC_LUMA:
+ return "Luma";
case TGP_COLOR_ENC_RGB:
default:
return "R'G'B";
.fourcc = V4L2_PIX_FMT_GREY,
.vdownsampling = { 1 },
.bit_depth = { 8 },
- .color_enc = TGP_COLOR_ENC_YCBCR,
+ .color_enc = TGP_COLOR_ENC_LUMA,
.planes = 1,
.buffers = 1,
},
.fourcc = V4L2_PIX_FMT_Y16,
.vdownsampling = { 1 },
.bit_depth = { 16 },
- .color_enc = TGP_COLOR_ENC_YCBCR,
+ .color_enc = TGP_COLOR_ENC_LUMA,
.planes = 1,
.buffers = 1,
},
.fourcc = V4L2_PIX_FMT_Y16_BE,
.vdownsampling = { 1 },
.bit_depth = { 16 },
- .color_enc = TGP_COLOR_ENC_YCBCR,
+ .color_enc = TGP_COLOR_ENC_LUMA,
.planes = 1,
.buffers = 1,
},