tpg->planes = 1;
tpg->buffers = 1;
tpg->recalc_colors = true;
+ tpg->vdownsampling[0] = 1;
+ tpg->hdownsampling[0] = 1;
switch (fourcc) {
case V4L2_PIX_FMT_RGB565:
break;
case V4L2_PIX_FMT_NV16M:
case V4L2_PIX_FMT_NV61M:
+ tpg->vdownsampling[1] = 1;
+ tpg->hdownsampling[1] = 1;
tpg->buffers = 2;
tpg->planes = 2;
/* fall-through */
tpg->compose.width = width;
tpg->compose.height = tpg->buf_height;
for (p = 0; p < tpg->planes; p++)
- tpg->bytesperline[p] = width * tpg->twopixelsize[p] / 2;
+ tpg->bytesperline[p] = (width * tpg->twopixelsize[p]) /
+ (2 * tpg->hdownsampling[p]);
tpg->recalc_square_border = true;
}
extern const char * const tpg_aspect_strings[];
-#define TPG_MAX_PLANES 2
+#define TPG_MAX_PLANES 3
#define TPG_MAX_PAT_LINES 8
struct tpg_data {
unsigned real_rgb_range;
unsigned buffers;
unsigned planes;
+ u8 vdownsampling[TPG_MAX_PLANES];
+ u8 hdownsampling[TPG_MAX_PLANES];
/* Used to store the colors in native format, either RGB or YUV */
u8 colors[TPG_COLOR_MAX][3];
u8 textfg[TPG_MAX_PLANES][8], textbg[TPG_MAX_PLANES][8];
for (p = 0; p < tpg->planes; p++) {
unsigned plane_w = bpl * tpg->twopixelsize[p] / tpg->twopixelsize[0];
- tpg->bytesperline[p] = plane_w;
+ tpg->bytesperline[p] = plane_w / tpg->hdownsampling[p];
}
}
+
static inline unsigned tpg_g_line_width(const struct tpg_data *tpg, unsigned plane)
{
unsigned w = 0;
for (p = 0; p < tpg->planes; p++) {
unsigned plane_w = tpg_g_bytesperline(tpg, p);
- w += plane_w;
+ w += plane_w / tpg->vdownsampling[p];
}
return w;
}
for (p = 0; p < tpg->planes; p++) {
unsigned plane_w = bpl * tpg->twopixelsize[p] / tpg->twopixelsize[0];
- w += plane_w;
+ plane_w /= tpg->hdownsampling[p];
+ w += plane_w / tpg->vdownsampling[p];
}
return w;
}
if (plane >= tpg->planes)
return 0;
- return tpg_g_bytesperline(tpg, plane) * tpg->buf_height;
+ return tpg_g_bytesperline(tpg, plane) * tpg->buf_height /
+ tpg->vdownsampling[plane];
}
static inline void tpg_s_buf_height(struct tpg_data *tpg, unsigned h)