Lines Matching refs:tpg

89 void tpg_init(struct tpg_data *tpg, unsigned w, unsigned h)  in tpg_init()  argument
91 memset(tpg, 0, sizeof(*tpg)); in tpg_init()
92 tpg->scaled_width = tpg->src_width = w; in tpg_init()
93 tpg->src_height = tpg->buf_height = h; in tpg_init()
94 tpg->crop.width = tpg->compose.width = w; in tpg_init()
95 tpg->crop.height = tpg->compose.height = h; in tpg_init()
96 tpg->recalc_colors = true; in tpg_init()
97 tpg->recalc_square_border = true; in tpg_init()
98 tpg->brightness = 128; in tpg_init()
99 tpg->contrast = 128; in tpg_init()
100 tpg->saturation = 128; in tpg_init()
101 tpg->hue = 0; in tpg_init()
102 tpg->mv_hor_mode = TPG_MOVE_NONE; in tpg_init()
103 tpg->mv_vert_mode = TPG_MOVE_NONE; in tpg_init()
104 tpg->field = V4L2_FIELD_NONE; in tpg_init()
105 tpg_s_fourcc(tpg, V4L2_PIX_FMT_RGB24); in tpg_init()
106 tpg->colorspace = V4L2_COLORSPACE_SRGB; in tpg_init()
107 tpg->perc_fill = 100; in tpg_init()
108 tpg->hsv_enc = V4L2_HSV_ENC_180; in tpg_init()
112 int tpg_alloc(struct tpg_data *tpg, unsigned max_w) in tpg_alloc() argument
117 tpg->max_line_width = max_w; in tpg_alloc()
122 tpg->lines[pat][plane] = in tpg_alloc()
124 if (!tpg->lines[pat][plane]) in tpg_alloc()
128 tpg->downsampled_lines[pat][plane] = in tpg_alloc()
130 if (!tpg->downsampled_lines[pat][plane]) in tpg_alloc()
137 tpg->contrast_line[plane] = in tpg_alloc()
139 if (!tpg->contrast_line[plane]) in tpg_alloc()
141 tpg->black_line[plane] = in tpg_alloc()
143 if (!tpg->black_line[plane]) in tpg_alloc()
145 tpg->random_line[plane] = in tpg_alloc()
147 if (!tpg->random_line[plane]) in tpg_alloc()
154 void tpg_free(struct tpg_data *tpg) in tpg_free() argument
161 vfree(tpg->lines[pat][plane]); in tpg_free()
162 tpg->lines[pat][plane] = NULL; in tpg_free()
165 vfree(tpg->downsampled_lines[pat][plane]); in tpg_free()
166 tpg->downsampled_lines[pat][plane] = NULL; in tpg_free()
169 vfree(tpg->contrast_line[plane]); in tpg_free()
170 vfree(tpg->black_line[plane]); in tpg_free()
171 vfree(tpg->random_line[plane]); in tpg_free()
172 tpg->contrast_line[plane] = NULL; in tpg_free()
173 tpg->black_line[plane] = NULL; in tpg_free()
174 tpg->random_line[plane] = NULL; in tpg_free()
179 bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc) in tpg_s_fourcc() argument
181 tpg->fourcc = fourcc; in tpg_s_fourcc()
182 tpg->planes = 1; in tpg_s_fourcc()
183 tpg->buffers = 1; in tpg_s_fourcc()
184 tpg->recalc_colors = true; in tpg_s_fourcc()
185 tpg->interleaved = false; in tpg_s_fourcc()
186 tpg->vdownsampling[0] = 1; in tpg_s_fourcc()
187 tpg->hdownsampling[0] = 1; in tpg_s_fourcc()
188 tpg->hmask[0] = ~0; in tpg_s_fourcc()
189 tpg->hmask[1] = ~0; in tpg_s_fourcc()
190 tpg->hmask[2] = ~0; in tpg_s_fourcc()
209 tpg->interleaved = true; in tpg_s_fourcc()
210 tpg->vdownsampling[1] = 1; in tpg_s_fourcc()
211 tpg->hdownsampling[1] = 1; in tpg_s_fourcc()
212 tpg->planes = 2; in tpg_s_fourcc()
251 tpg->color_enc = TGP_COLOR_ENC_RGB; in tpg_s_fourcc()
259 tpg->color_enc = TGP_COLOR_ENC_LUMA; in tpg_s_fourcc()
271 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
275 tpg->buffers = 3; in tpg_s_fourcc()
279 tpg->vdownsampling[1] = 2; in tpg_s_fourcc()
280 tpg->vdownsampling[2] = 2; in tpg_s_fourcc()
281 tpg->hdownsampling[1] = 2; in tpg_s_fourcc()
282 tpg->hdownsampling[2] = 2; in tpg_s_fourcc()
283 tpg->planes = 3; in tpg_s_fourcc()
284 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
288 tpg->buffers = 3; in tpg_s_fourcc()
291 tpg->vdownsampling[1] = 1; in tpg_s_fourcc()
292 tpg->vdownsampling[2] = 1; in tpg_s_fourcc()
293 tpg->hdownsampling[1] = 2; in tpg_s_fourcc()
294 tpg->hdownsampling[2] = 2; in tpg_s_fourcc()
295 tpg->planes = 3; in tpg_s_fourcc()
296 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
300 tpg->buffers = 2; in tpg_s_fourcc()
304 tpg->vdownsampling[1] = 1; in tpg_s_fourcc()
305 tpg->hdownsampling[1] = 1; in tpg_s_fourcc()
306 tpg->hmask[1] = ~1; in tpg_s_fourcc()
307 tpg->planes = 2; in tpg_s_fourcc()
308 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
312 tpg->buffers = 2; in tpg_s_fourcc()
316 tpg->vdownsampling[1] = 2; in tpg_s_fourcc()
317 tpg->hdownsampling[1] = 1; in tpg_s_fourcc()
318 tpg->hmask[1] = ~1; in tpg_s_fourcc()
319 tpg->planes = 2; in tpg_s_fourcc()
320 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
324 tpg->buffers = 3; in tpg_s_fourcc()
325 tpg->planes = 3; in tpg_s_fourcc()
326 tpg->vdownsampling[1] = 1; in tpg_s_fourcc()
327 tpg->vdownsampling[2] = 1; in tpg_s_fourcc()
328 tpg->hdownsampling[1] = 1; in tpg_s_fourcc()
329 tpg->hdownsampling[2] = 1; in tpg_s_fourcc()
330 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
334 tpg->vdownsampling[1] = 1; in tpg_s_fourcc()
335 tpg->hdownsampling[1] = 1; in tpg_s_fourcc()
336 tpg->planes = 2; in tpg_s_fourcc()
337 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
343 tpg->hmask[0] = ~1; in tpg_s_fourcc()
344 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
348 tpg->color_enc = TGP_COLOR_ENC_HSV; in tpg_s_fourcc()
357 tpg->twopixelsize[0] = 2; in tpg_s_fourcc()
394 tpg->twopixelsize[0] = 2 * 2; in tpg_s_fourcc()
399 tpg->twopixelsize[0] = 2 * 3; in tpg_s_fourcc()
420 tpg->twopixelsize[0] = 2 * 4; in tpg_s_fourcc()
434 tpg->twopixelsize[0] = 2; in tpg_s_fourcc()
435 tpg->twopixelsize[1] = 2; in tpg_s_fourcc()
449 tpg->twopixelsize[0] = 4; in tpg_s_fourcc()
450 tpg->twopixelsize[1] = 4; in tpg_s_fourcc()
461 tpg->twopixelsize[0] = 2; in tpg_s_fourcc()
462 tpg->twopixelsize[1] = 2; in tpg_s_fourcc()
463 tpg->twopixelsize[2] = 2; in tpg_s_fourcc()
467 tpg->twopixelsize[0] = 2; in tpg_s_fourcc()
468 tpg->twopixelsize[1] = 4; in tpg_s_fourcc()
475 void tpg_s_crop_compose(struct tpg_data *tpg, const struct v4l2_rect *crop, in tpg_s_crop_compose() argument
478 tpg->crop = *crop; in tpg_s_crop_compose()
479 tpg->compose = *compose; in tpg_s_crop_compose()
480 tpg->scaled_width = (tpg->src_width * tpg->compose.width + in tpg_s_crop_compose()
481 tpg->crop.width - 1) / tpg->crop.width; in tpg_s_crop_compose()
482 tpg->scaled_width &= ~1; in tpg_s_crop_compose()
483 if (tpg->scaled_width > tpg->max_line_width) in tpg_s_crop_compose()
484 tpg->scaled_width = tpg->max_line_width; in tpg_s_crop_compose()
485 if (tpg->scaled_width < 2) in tpg_s_crop_compose()
486 tpg->scaled_width = 2; in tpg_s_crop_compose()
487 tpg->recalc_lines = true; in tpg_s_crop_compose()
491 void tpg_reset_source(struct tpg_data *tpg, unsigned width, unsigned height, in tpg_reset_source() argument
496 tpg->src_width = width; in tpg_reset_source()
497 tpg->src_height = height; in tpg_reset_source()
498 tpg->field = field; in tpg_reset_source()
499 tpg->buf_height = height; in tpg_reset_source()
501 tpg->buf_height /= 2; in tpg_reset_source()
502 tpg->scaled_width = width; in tpg_reset_source()
503 tpg->crop.top = tpg->crop.left = 0; in tpg_reset_source()
504 tpg->crop.width = width; in tpg_reset_source()
505 tpg->crop.height = height; in tpg_reset_source()
506 tpg->compose.top = tpg->compose.left = 0; in tpg_reset_source()
507 tpg->compose.width = width; in tpg_reset_source()
508 tpg->compose.height = tpg->buf_height; in tpg_reset_source()
509 for (p = 0; p < tpg->planes; p++) in tpg_reset_source()
510 tpg->bytesperline[p] = (width * tpg->twopixelsize[p]) / in tpg_reset_source()
511 (2 * tpg->hdownsampling[p]); in tpg_reset_source()
512 tpg->recalc_square_border = true; in tpg_reset_source()
516 static enum tpg_color tpg_get_textbg_color(struct tpg_data *tpg) in tpg_get_textbg_color() argument
518 switch (tpg->pattern) { in tpg_get_textbg_color()
528 static enum tpg_color tpg_get_textfg_color(struct tpg_data *tpg) in tpg_get_textfg_color() argument
530 switch (tpg->pattern) { in tpg_get_textfg_color()
553 static void color_to_hsv(struct tpg_data *tpg, int r, int g, int b, in color_to_hsv() argument
586 third_size = (tpg->real_hsv_enc == V4L2_HSV_ENC_180) ? 60 : 85; in color_to_hsv()
606 if (tpg->real_hsv_enc == V4L2_HSV_ENC_180) { in color_to_hsv()
626 static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b, in color_to_ycbcr() argument
680 bool full = tpg->real_quantization == V4L2_QUANTIZATION_FULL_RANGE; in color_to_ycbcr()
684 switch (tpg->real_ycbcr_enc) { in color_to_ycbcr()
740 static void ycbcr_to_color(struct tpg_data *tpg, int y, int cb, int cr, in ycbcr_to_color() argument
794 bool full = tpg->real_quantization == V4L2_QUANTIZATION_FULL_RANGE; in ycbcr_to_color()
799 switch (tpg->real_ycbcr_enc) { in ycbcr_to_color()
851 static void precalculate_color(struct tpg_data *tpg, int k) in precalculate_color() argument
861 col = tpg_get_textbg_color(tpg); in precalculate_color()
867 col = tpg_get_textfg_color(tpg); in precalculate_color()
872 } else if (tpg->pattern == TPG_PAT_NOISE) { in precalculate_color()
875 r = g = b = tpg->qual_offset + prandom_u32_max(196); in precalculate_color()
880 if (tpg->pattern == TPG_PAT_CSC_COLORBAR && col <= TPG_COLOR_CSC_BLACK) { in precalculate_color()
881 r = tpg_csc_colors[tpg->colorspace][tpg->real_xfer_func][col].r; in precalculate_color()
882 g = tpg_csc_colors[tpg->colorspace][tpg->real_xfer_func][col].g; in precalculate_color()
883 b = tpg_csc_colors[tpg->colorspace][tpg->real_xfer_func][col].b; in precalculate_color()
890 if (tpg->qual == TPG_QUAL_GRAY || in precalculate_color()
891 tpg->color_enc == TGP_COLOR_ENC_LUMA) { in precalculate_color()
904 if (tpg->real_rgb_range == V4L2_DV_RGB_RANGE_LIMITED && in precalculate_color()
905 tpg->rgb_range == V4L2_DV_RGB_RANGE_FULL && in precalculate_color()
906 tpg->color_enc == TGP_COLOR_ENC_RGB) { in precalculate_color()
915 } else if (tpg->real_rgb_range != V4L2_DV_RGB_RANGE_LIMITED && in precalculate_color()
916 tpg->rgb_range == V4L2_DV_RGB_RANGE_LIMITED && in precalculate_color()
917 tpg->color_enc == TGP_COLOR_ENC_RGB) { in precalculate_color()
931 if ((tpg->brightness != 128 || tpg->contrast != 128 || in precalculate_color()
932 tpg->saturation != 128 || tpg->hue) && in precalculate_color()
933 tpg->color_enc != TGP_COLOR_ENC_LUMA) { in precalculate_color()
939 color_to_ycbcr(tpg, r, g, b, &y, &cb, &cr); in precalculate_color()
941 y = (16 << 4) + ((y - (16 << 4)) * tpg->contrast) / 128; in precalculate_color()
942 y += (tpg->brightness << 4) - (128 << 4); in precalculate_color()
946 tmp_cb = (cb * cos(128 + tpg->hue)) / 127 + (cr * sin[128 + tpg->hue]) / 127; in precalculate_color()
947 tmp_cr = (cr * cos(128 + tpg->hue)) / 127 - (cb * sin[128 + tpg->hue]) / 127; in precalculate_color()
949 cb = (128 << 4) + (tmp_cb * tpg->contrast * tpg->saturation) / (128 * 128); in precalculate_color()
950 cr = (128 << 4) + (tmp_cr * tpg->contrast * tpg->saturation) / (128 * 128); in precalculate_color()
951 if (tpg->color_enc == TGP_COLOR_ENC_YCBCR) in precalculate_color()
954 ycbcr_to_color(tpg, y, cb, cr, &r, &g, &b); in precalculate_color()
955 } else if ((tpg->brightness != 128 || tpg->contrast != 128) && in precalculate_color()
956 tpg->color_enc == TGP_COLOR_ENC_LUMA) { in precalculate_color()
957 r = (16 << 4) + ((r - (16 << 4)) * tpg->contrast) / 128; in precalculate_color()
958 r += (tpg->brightness << 4) - (128 << 4); in precalculate_color()
961 switch (tpg->color_enc) { in precalculate_color()
966 color_to_hsv(tpg, r, g, b, &h, &s, &v); in precalculate_color()
967 tpg->colors[k][0] = h; in precalculate_color()
968 tpg->colors[k][1] = s; in precalculate_color()
969 tpg->colors[k][2] = v; in precalculate_color()
976 color_to_ycbcr(tpg, r, g, b, &y, &cb, &cr); in precalculate_color()
986 if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE && in precalculate_color()
987 tpg->real_ycbcr_enc != V4L2_YCBCR_ENC_XV601 && in precalculate_color()
988 tpg->real_ycbcr_enc != V4L2_YCBCR_ENC_XV709) { in precalculate_color()
997 switch (tpg->fourcc) { in precalculate_color()
1014 tpg->colors[k][0] = y; in precalculate_color()
1015 tpg->colors[k][1] = cb; in precalculate_color()
1016 tpg->colors[k][2] = cr; in precalculate_color()
1021 tpg->colors[k][0] = r >> 4; in precalculate_color()
1026 if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE) { in precalculate_color()
1031 switch (tpg->fourcc) { in precalculate_color()
1084 tpg->colors[k][0] = r; in precalculate_color()
1085 tpg->colors[k][1] = g; in precalculate_color()
1086 tpg->colors[k][2] = b; in precalculate_color()
1092 static void tpg_precalculate_colors(struct tpg_data *tpg) in tpg_precalculate_colors() argument
1097 precalculate_color(tpg, k); in tpg_precalculate_colors()
1101 static void gen_twopix(struct tpg_data *tpg, in gen_twopix() argument
1104 unsigned offset = odd * tpg->twopixelsize[0] / 2; in gen_twopix()
1105 u8 alpha = tpg->alpha_component; in gen_twopix()
1108 if (tpg->alpha_red_only && color != TPG_COLOR_CSC_RED && in gen_twopix()
1113 precalculate_color(tpg, color); in gen_twopix()
1114 r_y_h = tpg->colors[color][0]; /* R or precalculated Y, H */ in gen_twopix()
1115 g_u_s = tpg->colors[color][1]; /* G or precalculated U, V */ in gen_twopix()
1116 b_v = tpg->colors[color][2]; /* B or precalculated V */ in gen_twopix()
1118 switch (tpg->fourcc) { in gen_twopix()
1513 unsigned tpg_g_interleaved_plane(const struct tpg_data *tpg, unsigned buf_line) in tpg_g_interleaved_plane() argument
1515 switch (tpg->fourcc) { in tpg_g_interleaved_plane()
1540 static unsigned tpg_get_pat_lines(const struct tpg_data *tpg) in tpg_get_pat_lines() argument
1542 switch (tpg->pattern) { in tpg_get_pat_lines()
1562 static unsigned tpg_get_pat_line(const struct tpg_data *tpg, unsigned line) in tpg_get_pat_line() argument
1564 switch (tpg->pattern) { in tpg_get_pat_line()
1576 return (line * 8) / tpg->src_height; in tpg_get_pat_line()
1578 return line == tpg->src_height / 2; in tpg_get_pat_line()
1580 return (line + 1) / 2 == tpg->src_height / 4; in tpg_get_pat_line()
1582 return (line + 10) / 20 == tpg->src_height / 40; in tpg_get_pat_line()
1592 static enum tpg_color tpg_get_color(const struct tpg_data *tpg, in tpg_get_color() argument
1615 switch (tpg->pattern) { in tpg_get_color()
1619 return bars[tpg->pattern][((x * 8) / tpg->src_width) % 8]; in tpg_get_color()
1621 return bars[1][(pat_line + (x * 8) / tpg->src_width) % 8]; in tpg_get_color()
1654 if (pat_line || (x % tpg->src_width) == tpg->src_width / 2) in tpg_get_color()
1658 if (pat_line || ((x % tpg->src_width) + 1) / 2 == tpg->src_width / 4) in tpg_get_color()
1662 if (pat_line || ((x % tpg->src_width) + 10) / 20 == tpg->src_width / 40) in tpg_get_color()
1666 return TPG_COLOR_RAMP + ((x % tpg->src_width) * 256) / tpg->src_width; in tpg_get_color()
1678 static void tpg_calculate_square_border(struct tpg_data *tpg) in tpg_calculate_square_border() argument
1680 unsigned w = tpg->src_width; in tpg_calculate_square_border()
1681 unsigned h = tpg->src_height; in tpg_calculate_square_border()
1688 tpg->square.width = sq_w; in tpg_calculate_square_border()
1689 if (tpg->vid_aspect == TPG_VIDEO_ASPECT_16X9_ANAMORPHIC) { in tpg_calculate_square_border()
1694 tpg->square.width = ana_sq_w; in tpg_calculate_square_border()
1696 tpg->square.left = (w - tpg->square.width) / 2; in tpg_calculate_square_border()
1697 if (tpg->pix_aspect == TPG_PIXEL_ASPECT_NTSC) in tpg_calculate_square_border()
1699 else if (tpg->pix_aspect == TPG_PIXEL_ASPECT_PAL) in tpg_calculate_square_border()
1701 tpg->square.height = sq_h; in tpg_calculate_square_border()
1702 tpg->square.top = (h - sq_h) / 2; in tpg_calculate_square_border()
1703 tpg->border.left = 0; in tpg_calculate_square_border()
1704 tpg->border.width = w; in tpg_calculate_square_border()
1705 tpg->border.top = 0; in tpg_calculate_square_border()
1706 tpg->border.height = h; in tpg_calculate_square_border()
1707 switch (tpg->vid_aspect) { in tpg_calculate_square_border()
1709 if (tpg->pix_aspect) in tpg_calculate_square_border()
1712 tpg->border.width = ((4 * h) / 3) & ~1; in tpg_calculate_square_border()
1713 if (((w - tpg->border.width) / 2) & ~1) in tpg_calculate_square_border()
1714 tpg->border.width -= 2; in tpg_calculate_square_border()
1715 tpg->border.left = (w - tpg->border.width) / 2; in tpg_calculate_square_border()
1718 tpg->border.height = ((3 * w) / 4) & ~1; in tpg_calculate_square_border()
1719 tpg->border.top = (h - tpg->border.height) / 2; in tpg_calculate_square_border()
1722 if (tpg->pix_aspect) { in tpg_calculate_square_border()
1723 tpg->border.height = tpg->pix_aspect == TPG_PIXEL_ASPECT_NTSC ? 420 : 506; in tpg_calculate_square_border()
1724 tpg->border.top = (h - tpg->border.height) / 2; in tpg_calculate_square_border()
1728 tpg->border.width = ((14 * h) / 9) & ~1; in tpg_calculate_square_border()
1729 if (((w - tpg->border.width) / 2) & ~1) in tpg_calculate_square_border()
1730 tpg->border.width -= 2; in tpg_calculate_square_border()
1731 tpg->border.left = (w - tpg->border.width) / 2; in tpg_calculate_square_border()
1734 tpg->border.height = ((9 * w) / 14) & ~1; in tpg_calculate_square_border()
1735 tpg->border.top = (h - tpg->border.height) / 2; in tpg_calculate_square_border()
1738 if (tpg->pix_aspect) { in tpg_calculate_square_border()
1739 tpg->border.height = tpg->pix_aspect == TPG_PIXEL_ASPECT_NTSC ? 368 : 442; in tpg_calculate_square_border()
1740 tpg->border.top = (h - tpg->border.height) / 2; in tpg_calculate_square_border()
1744 tpg->border.width = ((16 * h) / 9) & ~1; in tpg_calculate_square_border()
1745 if (((w - tpg->border.width) / 2) & ~1) in tpg_calculate_square_border()
1746 tpg->border.width -= 2; in tpg_calculate_square_border()
1747 tpg->border.left = (w - tpg->border.width) / 2; in tpg_calculate_square_border()
1750 tpg->border.height = ((9 * w) / 16) & ~1; in tpg_calculate_square_border()
1751 tpg->border.top = (h - tpg->border.height) / 2; in tpg_calculate_square_border()
1758 static void tpg_precalculate_line(struct tpg_data *tpg) in tpg_precalculate_line() argument
1766 switch (tpg->pattern) { in tpg_precalculate_line()
1778 for (pat = 0; pat < tpg_get_pat_lines(tpg); pat++) { in tpg_precalculate_line()
1780 unsigned int_part = tpg->src_width / tpg->scaled_width; in tpg_precalculate_line()
1781 unsigned fract_part = tpg->src_width % tpg->scaled_width; in tpg_precalculate_line()
1785 for (x = 0; x < tpg->scaled_width * 2; x += 2) { in tpg_precalculate_line()
1789 real_x = tpg->hflip ? tpg->src_width * 2 - real_x - 2 : real_x; in tpg_precalculate_line()
1790 color1 = tpg_get_color(tpg, pat, real_x); in tpg_precalculate_line()
1794 if (error >= tpg->scaled_width) { in tpg_precalculate_line()
1795 error -= tpg->scaled_width; in tpg_precalculate_line()
1800 real_x = tpg->hflip ? tpg->src_width * 2 - real_x - 2 : real_x; in tpg_precalculate_line()
1801 color2 = tpg_get_color(tpg, pat, real_x); in tpg_precalculate_line()
1805 if (error >= tpg->scaled_width) { in tpg_precalculate_line()
1806 error -= tpg->scaled_width; in tpg_precalculate_line()
1810 gen_twopix(tpg, pix, tpg->hflip ? color2 : color1, 0); in tpg_precalculate_line()
1811 gen_twopix(tpg, pix, tpg->hflip ? color1 : color2, 1); in tpg_precalculate_line()
1812 for (p = 0; p < tpg->planes; p++) { in tpg_precalculate_line()
1813 unsigned twopixsize = tpg->twopixelsize[p]; in tpg_precalculate_line()
1814 unsigned hdiv = tpg->hdownsampling[p]; in tpg_precalculate_line()
1815 u8 *pos = tpg->lines[pat][p] + tpg_hdiv(tpg, p, x); in tpg_precalculate_line()
1822 if (tpg->vdownsampling[tpg->planes - 1] > 1) { in tpg_precalculate_line()
1823 unsigned pat_lines = tpg_get_pat_lines(tpg); in tpg_precalculate_line()
1828 for (p = 1; p < tpg->planes; p++) { in tpg_precalculate_line()
1829 unsigned w = tpg_hdiv(tpg, p, tpg->scaled_width * 2); in tpg_precalculate_line()
1830 u8 *pos1 = tpg->lines[pat][p]; in tpg_precalculate_line()
1831 u8 *pos2 = tpg->lines[next_pat][p]; in tpg_precalculate_line()
1832 u8 *dest = tpg->downsampled_lines[pat][p]; in tpg_precalculate_line()
1840 gen_twopix(tpg, pix, contrast, 0); in tpg_precalculate_line()
1841 gen_twopix(tpg, pix, contrast, 1); in tpg_precalculate_line()
1842 for (p = 0; p < tpg->planes; p++) { in tpg_precalculate_line()
1843 unsigned twopixsize = tpg->twopixelsize[p]; in tpg_precalculate_line()
1844 u8 *pos = tpg->contrast_line[p]; in tpg_precalculate_line()
1846 for (x = 0; x < tpg->scaled_width; x += 2, pos += twopixsize) in tpg_precalculate_line()
1850 gen_twopix(tpg, pix, TPG_COLOR_100_BLACK, 0); in tpg_precalculate_line()
1851 gen_twopix(tpg, pix, TPG_COLOR_100_BLACK, 1); in tpg_precalculate_line()
1852 for (p = 0; p < tpg->planes; p++) { in tpg_precalculate_line()
1853 unsigned twopixsize = tpg->twopixelsize[p]; in tpg_precalculate_line()
1854 u8 *pos = tpg->black_line[p]; in tpg_precalculate_line()
1856 for (x = 0; x < tpg->scaled_width; x += 2, pos += twopixsize) in tpg_precalculate_line()
1860 for (x = 0; x < tpg->scaled_width * 2; x += 2) { in tpg_precalculate_line()
1861 gen_twopix(tpg, pix, TPG_COLOR_RANDOM, 0); in tpg_precalculate_line()
1862 gen_twopix(tpg, pix, TPG_COLOR_RANDOM, 1); in tpg_precalculate_line()
1863 for (p = 0; p < tpg->planes; p++) { in tpg_precalculate_line()
1864 unsigned twopixsize = tpg->twopixelsize[p]; in tpg_precalculate_line()
1865 u8 *pos = tpg->random_line[p] + x * twopixsize / 2; in tpg_precalculate_line()
1871 gen_twopix(tpg, tpg->textbg, TPG_COLOR_TEXTBG, 0); in tpg_precalculate_line()
1872 gen_twopix(tpg, tpg->textbg, TPG_COLOR_TEXTBG, 1); in tpg_precalculate_line()
1873 gen_twopix(tpg, tpg->textfg, TPG_COLOR_TEXTFG, 0); in tpg_precalculate_line()
1874 gen_twopix(tpg, tpg->textfg, TPG_COLOR_TEXTFG, 1); in tpg_precalculate_line()
1881 unsigned vdiv = tpg->vdownsampling[p]; \
1882 unsigned hdiv = tpg->hdownsampling[p]; \
1886 memcpy(&fg, tpg->textfg[p], sizeof(PIXTYPE)); \
1887 memcpy(&bg, tpg->textbg[p], sizeof(PIXTYPE)); \
1890 int l = tpg->vflip ? 15 - line : line; \
1892 ((y * step + l) / (vdiv * div)) * tpg->bytesperline[p] + \
1899 if (hdiv == 2 && tpg->hflip) { \
1909 } else if (tpg->hflip) { \
1929 pos += (tpg->hflip ? -8 : 8) / (int)hdiv; \
1934 static noinline void tpg_print_str_2(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2], in tpg_print_str_2() argument
1941 static noinline void tpg_print_str_4(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2], in tpg_print_str_4() argument
1948 static noinline void tpg_print_str_6(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2], in tpg_print_str_6() argument
1955 static noinline void tpg_print_str_8(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2], in tpg_print_str_8() argument
1962 void tpg_gen_text(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2], in tpg_gen_text() argument
1965 unsigned step = V4L2_FIELD_HAS_T_OR_B(tpg->field) ? 2 : 1; in tpg_gen_text()
1977 if (y + 16 >= tpg->compose.height || x + 8 >= tpg->compose.width) in tpg_gen_text()
1980 if (len > (tpg->compose.width - x) / 8) in tpg_gen_text()
1981 len = (tpg->compose.width - x) / 8; in tpg_gen_text()
1982 if (tpg->vflip) in tpg_gen_text()
1983 y = tpg->compose.height - y - 16; in tpg_gen_text()
1984 if (tpg->hflip) in tpg_gen_text()
1985 x = tpg->compose.width - x - 8; in tpg_gen_text()
1986 y += tpg->compose.top; in tpg_gen_text()
1987 x += tpg->compose.left; in tpg_gen_text()
1988 if (tpg->field == V4L2_FIELD_BOTTOM) in tpg_gen_text()
1990 else if (tpg->field == V4L2_FIELD_SEQ_TB || tpg->field == V4L2_FIELD_SEQ_BT) in tpg_gen_text()
1993 for (p = 0; p < tpg->planes; p++) { in tpg_gen_text()
1995 switch (tpg->twopixelsize[p]) { in tpg_gen_text()
1997 tpg_print_str_2(tpg, basep, p, first, div, step, y, x, in tpg_gen_text()
2001 tpg_print_str_4(tpg, basep, p, first, div, step, y, x, in tpg_gen_text()
2005 tpg_print_str_6(tpg, basep, p, first, div, step, y, x, in tpg_gen_text()
2009 tpg_print_str_8(tpg, basep, p, first, div, step, y, x, in tpg_gen_text()
2017 const char *tpg_g_color_order(const struct tpg_data *tpg) in tpg_g_color_order() argument
2019 switch (tpg->pattern) { in tpg_g_color_order()
2041 void tpg_update_mv_step(struct tpg_data *tpg) in tpg_update_mv_step() argument
2043 int factor = tpg->mv_hor_mode > TPG_MOVE_NONE ? -1 : 1; in tpg_update_mv_step()
2045 if (tpg->hflip) in tpg_update_mv_step()
2047 switch (tpg->mv_hor_mode) { in tpg_update_mv_step()
2050 tpg->mv_hor_step = ((tpg->src_width + 319) / 320) * 4; in tpg_update_mv_step()
2054 tpg->mv_hor_step = ((tpg->src_width + 639) / 640) * 4; in tpg_update_mv_step()
2058 tpg->mv_hor_step = 2; in tpg_update_mv_step()
2061 tpg->mv_hor_step = 0; in tpg_update_mv_step()
2065 tpg->mv_hor_step = tpg->src_width - tpg->mv_hor_step; in tpg_update_mv_step()
2067 factor = tpg->mv_vert_mode > TPG_MOVE_NONE ? -1 : 1; in tpg_update_mv_step()
2068 switch (tpg->mv_vert_mode) { in tpg_update_mv_step()
2071 tpg->mv_vert_step = ((tpg->src_width + 319) / 320) * 4; in tpg_update_mv_step()
2075 tpg->mv_vert_step = ((tpg->src_width + 639) / 640) * 4; in tpg_update_mv_step()
2079 tpg->mv_vert_step = 1; in tpg_update_mv_step()
2082 tpg->mv_vert_step = 0; in tpg_update_mv_step()
2086 tpg->mv_vert_step = tpg->src_height - tpg->mv_vert_step; in tpg_update_mv_step()
2091 static unsigned tpg_calc_frameline(const struct tpg_data *tpg, unsigned src_y, in tpg_calc_frameline() argument
2096 return tpg->crop.top + src_y * 2; in tpg_calc_frameline()
2098 return tpg->crop.top + src_y * 2 + 1; in tpg_calc_frameline()
2100 return src_y + tpg->crop.top; in tpg_calc_frameline()
2108 static unsigned tpg_calc_buffer_line(const struct tpg_data *tpg, unsigned y, in tpg_calc_buffer_line() argument
2111 y += tpg->compose.top; in tpg_calc_buffer_line()
2115 return tpg->buf_height / 2 + y / 2; in tpg_calc_buffer_line()
2120 return tpg->buf_height / 2 + y / 2; in tpg_calc_buffer_line()
2126 static void tpg_recalc(struct tpg_data *tpg) in tpg_recalc() argument
2128 if (tpg->recalc_colors) { in tpg_recalc()
2129 tpg->recalc_colors = false; in tpg_recalc()
2130 tpg->recalc_lines = true; in tpg_recalc()
2131 tpg->real_xfer_func = tpg->xfer_func; in tpg_recalc()
2132 tpg->real_ycbcr_enc = tpg->ycbcr_enc; in tpg_recalc()
2133 tpg->real_hsv_enc = tpg->hsv_enc; in tpg_recalc()
2134 tpg->real_quantization = tpg->quantization; in tpg_recalc()
2136 if (tpg->xfer_func == V4L2_XFER_FUNC_DEFAULT) in tpg_recalc()
2137 tpg->real_xfer_func = in tpg_recalc()
2138 V4L2_MAP_XFER_FUNC_DEFAULT(tpg->colorspace); in tpg_recalc()
2140 if (tpg->ycbcr_enc == V4L2_YCBCR_ENC_DEFAULT) in tpg_recalc()
2141 tpg->real_ycbcr_enc = in tpg_recalc()
2142 V4L2_MAP_YCBCR_ENC_DEFAULT(tpg->colorspace); in tpg_recalc()
2144 if (tpg->quantization == V4L2_QUANTIZATION_DEFAULT) in tpg_recalc()
2145 tpg->real_quantization = in tpg_recalc()
2147 tpg->color_enc != TGP_COLOR_ENC_YCBCR, in tpg_recalc()
2148 tpg->colorspace, tpg->real_ycbcr_enc); in tpg_recalc()
2150 tpg_precalculate_colors(tpg); in tpg_recalc()
2152 if (tpg->recalc_square_border) { in tpg_recalc()
2153 tpg->recalc_square_border = false; in tpg_recalc()
2154 tpg_calculate_square_border(tpg); in tpg_recalc()
2156 if (tpg->recalc_lines) { in tpg_recalc()
2157 tpg->recalc_lines = false; in tpg_recalc()
2158 tpg_precalculate_line(tpg); in tpg_recalc()
2162 void tpg_calc_text_basep(struct tpg_data *tpg, in tpg_calc_text_basep() argument
2165 unsigned stride = tpg->bytesperline[p]; in tpg_calc_text_basep()
2166 unsigned h = tpg->buf_height; in tpg_calc_text_basep()
2168 tpg_recalc(tpg); in tpg_calc_text_basep()
2172 h /= tpg->vdownsampling[p]; in tpg_calc_text_basep()
2173 if (tpg->field == V4L2_FIELD_SEQ_TB) in tpg_calc_text_basep()
2175 else if (tpg->field == V4L2_FIELD_SEQ_BT) in tpg_calc_text_basep()
2177 if (p == 0 && tpg->interleaved) in tpg_calc_text_basep()
2178 tpg_calc_text_basep(tpg, basep, 1, vbuf); in tpg_calc_text_basep()
2182 static int tpg_pattern_avg(const struct tpg_data *tpg, in tpg_pattern_avg() argument
2185 unsigned pat_lines = tpg_get_pat_lines(tpg); in tpg_pattern_avg()
2211 void tpg_log_status(struct tpg_data *tpg) in tpg_log_status() argument
2214 tpg->src_width, tpg->src_height, in tpg_log_status()
2215 tpg_color_enc_str(tpg->color_enc)); in tpg_log_status()
2216 pr_info("tpg field: %u\n", tpg->field); in tpg_log_status()
2217 pr_info("tpg crop: %ux%u@%dx%d\n", tpg->crop.width, tpg->crop.height, in tpg_log_status()
2218 tpg->crop.left, tpg->crop.top); in tpg_log_status()
2219 pr_info("tpg compose: %ux%u@%dx%d\n", tpg->compose.width, tpg->compose.height, in tpg_log_status()
2220 tpg->compose.left, tpg->compose.top); in tpg_log_status()
2221 pr_info("tpg colorspace: %d\n", tpg->colorspace); in tpg_log_status()
2222 pr_info("tpg transfer function: %d/%d\n", tpg->xfer_func, tpg->real_xfer_func); in tpg_log_status()
2223 if (tpg->color_enc == TGP_COLOR_ENC_HSV) in tpg_log_status()
2225 tpg->hsv_enc, tpg->real_hsv_enc); in tpg_log_status()
2226 else if (tpg->color_enc == TGP_COLOR_ENC_YCBCR) in tpg_log_status()
2228 tpg->ycbcr_enc, tpg->real_ycbcr_enc); in tpg_log_status()
2229 pr_info("tpg quantization: %d/%d\n", tpg->quantization, tpg->real_quantization); in tpg_log_status()
2230 pr_info("tpg RGB range: %d/%d\n", tpg->rgb_range, tpg->real_rgb_range); in tpg_log_status()
2263 static void tpg_fill_params_pattern(const struct tpg_data *tpg, unsigned p, in tpg_fill_params_pattern() argument
2267 tpg_hscale_div(tpg, p, tpg->mv_hor_count % tpg->src_width); in tpg_fill_params_pattern()
2269 tpg_hscale_div(tpg, p, (tpg->mv_hor_count + tpg->mv_hor_step) % in tpg_fill_params_pattern()
2270 tpg->src_width); in tpg_fill_params_pattern()
2271 params->mv_vert_old = tpg->mv_vert_count % tpg->src_height; in tpg_fill_params_pattern()
2273 (tpg->mv_vert_count + tpg->mv_vert_step) % tpg->src_height; in tpg_fill_params_pattern()
2276 static void tpg_fill_params_extras(const struct tpg_data *tpg, in tpg_fill_params_extras() argument
2283 params->wss_width = tpg->crop.left < tpg->src_width / 2 ? in tpg_fill_params_extras()
2284 tpg->src_width / 2 - tpg->crop.left : 0; in tpg_fill_params_extras()
2285 if (params->wss_width > tpg->crop.width) in tpg_fill_params_extras()
2286 params->wss_width = tpg->crop.width; in tpg_fill_params_extras()
2287 params->wss_width = tpg_hscale_div(tpg, p, params->wss_width); in tpg_fill_params_extras()
2289 params->twopixsize * prandom_u32_max(tpg->src_width / 2); in tpg_fill_params_extras()
2291 if (tpg->crop.left < tpg->border.left) { in tpg_fill_params_extras()
2292 left_pillar_width = tpg->border.left - tpg->crop.left; in tpg_fill_params_extras()
2293 if (left_pillar_width > tpg->crop.width) in tpg_fill_params_extras()
2294 left_pillar_width = tpg->crop.width; in tpg_fill_params_extras()
2295 left_pillar_width = tpg_hscale_div(tpg, p, left_pillar_width); in tpg_fill_params_extras()
2299 if (tpg->crop.left + tpg->crop.width > in tpg_fill_params_extras()
2300 tpg->border.left + tpg->border.width) { in tpg_fill_params_extras()
2302 tpg->border.left + tpg->border.width - tpg->crop.left; in tpg_fill_params_extras()
2304 tpg_hscale_div(tpg, p, right_pillar_start); in tpg_fill_params_extras()
2310 params->sav_eav_f = tpg->field == in tpg_fill_params_extras()
2314 static void tpg_fill_plane_extras(const struct tpg_data *tpg, in tpg_fill_plane_extras() argument
2321 const struct v4l2_rect *sq = &tpg->square; in tpg_fill_plane_extras()
2322 const struct v4l2_rect *b = &tpg->border; in tpg_fill_plane_extras()
2323 const struct v4l2_rect *c = &tpg->crop; in tpg_fill_plane_extras()
2331 u8 *wss = tpg->random_line[p] + params->wss_random_offset; in tpg_fill_plane_extras()
2336 if (tpg->show_border && frame_line >= b->top && in tpg_fill_plane_extras()
2344 memcpy(vbuf + left, tpg->contrast_line[p], in tpg_fill_plane_extras()
2350 tpg->contrast_line[p], twopixsize); in tpg_fill_plane_extras()
2354 tpg->contrast_line[p], twopixsize); in tpg_fill_plane_extras()
2357 if (tpg->qual != TPG_QUAL_NOISE && frame_line >= b->top && in tpg_fill_plane_extras()
2359 memcpy(vbuf, tpg->black_line[p], params->left_pillar_width); in tpg_fill_plane_extras()
2360 memcpy(vbuf + params->right_pillar_start, tpg->black_line[p], in tpg_fill_plane_extras()
2363 if (tpg->show_square && frame_line >= sq->top && in tpg_fill_plane_extras()
2377 left = tpg_hscale_div(tpg, p, left); in tpg_fill_plane_extras()
2378 width = tpg_hscale_div(tpg, p, width); in tpg_fill_plane_extras()
2379 memcpy(vbuf + left, tpg->contrast_line[p], width); in tpg_fill_plane_extras()
2381 if (tpg->insert_sav) { in tpg_fill_plane_extras()
2382 unsigned offset = tpg_hdiv(tpg, p, tpg->compose.width / 3); in tpg_fill_plane_extras()
2396 if (tpg->insert_eav) { in tpg_fill_plane_extras()
2397 unsigned offset = tpg_hdiv(tpg, p, tpg->compose.width * 2 / 3); in tpg_fill_plane_extras()
2411 if (tpg->insert_hdmi_video_guard_band) { in tpg_fill_plane_extras()
2414 switch (tpg->fourcc) { in tpg_fill_plane_extras()
2451 static void tpg_fill_plane_pattern(const struct tpg_data *tpg, in tpg_fill_plane_pattern() argument
2463 unsigned line_offset = tpg_hscale_div(tpg, p, tpg->crop.left); in tpg_fill_plane_pattern()
2476 if (params->hmax == tpg->compose.height) in tpg_fill_plane_pattern()
2478 if (!tpg->perc_fill_blank) in tpg_fill_plane_pattern()
2483 if (tpg->vflip) { in tpg_fill_plane_pattern()
2484 frame_line = tpg->src_height - frame_line - 1; in tpg_fill_plane_pattern()
2485 frame_line_next = tpg->src_height - frame_line_next - 1; in tpg_fill_plane_pattern()
2489 linestart_older = tpg->contrast_line[p]; in tpg_fill_plane_pattern()
2490 linestart_newer = tpg->contrast_line[p]; in tpg_fill_plane_pattern()
2491 } else if (tpg->qual != TPG_QUAL_NOISE && in tpg_fill_plane_pattern()
2492 (frame_line < tpg->border.top || in tpg_fill_plane_pattern()
2493 frame_line >= tpg->border.top + tpg->border.height)) { in tpg_fill_plane_pattern()
2494 linestart_older = tpg->black_line[p]; in tpg_fill_plane_pattern()
2495 linestart_newer = tpg->black_line[p]; in tpg_fill_plane_pattern()
2496 } else if (tpg->pattern == TPG_PAT_NOISE || tpg->qual == TPG_QUAL_NOISE) { in tpg_fill_plane_pattern()
2497 linestart_older = tpg->random_line[p] + in tpg_fill_plane_pattern()
2498 twopixsize * prandom_u32_max(tpg->src_width / 2); in tpg_fill_plane_pattern()
2499 linestart_newer = tpg->random_line[p] + in tpg_fill_plane_pattern()
2500 twopixsize * prandom_u32_max(tpg->src_width / 2); in tpg_fill_plane_pattern()
2503 (frame_line + mv_vert_old) % tpg->src_height; in tpg_fill_plane_pattern()
2505 (frame_line + mv_vert_new) % tpg->src_height; in tpg_fill_plane_pattern()
2509 pat_line_old = tpg_get_pat_line(tpg, frame_line_old); in tpg_fill_plane_pattern()
2510 pat_line_new = tpg_get_pat_line(tpg, frame_line_new); in tpg_fill_plane_pattern()
2511 linestart_older = tpg->lines[pat_line_old][p] + mv_hor_old; in tpg_fill_plane_pattern()
2512 linestart_newer = tpg->lines[pat_line_new][p] + mv_hor_new; in tpg_fill_plane_pattern()
2514 if (tpg->vdownsampling[p] > 1 && frame_line != frame_line_next) { in tpg_fill_plane_pattern()
2521 pat_line_next_old = tpg_get_pat_line(tpg, in tpg_fill_plane_pattern()
2522 (frame_line_next + mv_vert_old) % tpg->src_height); in tpg_fill_plane_pattern()
2523 pat_line_next_new = tpg_get_pat_line(tpg, in tpg_fill_plane_pattern()
2524 (frame_line_next + mv_vert_new) % tpg->src_height); in tpg_fill_plane_pattern()
2526 switch (tpg->field) { in tpg_fill_plane_pattern()
2530 avg_pat = tpg_pattern_avg(tpg, pat_line_old, pat_line_new); in tpg_fill_plane_pattern()
2533 linestart_older = tpg->downsampled_lines[avg_pat][p] + mv_hor_old; in tpg_fill_plane_pattern()
2541 avg_pat = tpg_pattern_avg(tpg, pat_line_old, pat_line_next_old); in tpg_fill_plane_pattern()
2543 linestart_older = tpg->downsampled_lines[avg_pat][p] + in tpg_fill_plane_pattern()
2545 avg_pat = tpg_pattern_avg(tpg, pat_line_new, pat_line_next_new); in tpg_fill_plane_pattern()
2547 linestart_newer = tpg->downsampled_lines[avg_pat][p] + in tpg_fill_plane_pattern()
2555 if (tpg->field_alternate) { in tpg_fill_plane_pattern()
2565 switch (tpg->field) { in tpg_fill_plane_pattern()
2594 void tpg_fill_plane_buffer(struct tpg_data *tpg, v4l2_std_id std, in tpg_fill_plane_buffer() argument
2598 unsigned factor = V4L2_FIELD_HAS_T_OR_B(tpg->field) ? 2 : 1; in tpg_fill_plane_buffer()
2601 unsigned int_part = (tpg->crop.height / factor) / tpg->compose.height; in tpg_fill_plane_buffer()
2602 unsigned fract_part = (tpg->crop.height / factor) % tpg->compose.height; in tpg_fill_plane_buffer()
2607 tpg_recalc(tpg); in tpg_fill_plane_buffer()
2611 params.twopixsize = tpg->twopixelsize[p]; in tpg_fill_plane_buffer()
2612 params.img_width = tpg_hdiv(tpg, p, tpg->compose.width); in tpg_fill_plane_buffer()
2613 params.stride = tpg->bytesperline[p]; in tpg_fill_plane_buffer()
2614 params.hmax = (tpg->compose.height * tpg->perc_fill) / 100; in tpg_fill_plane_buffer()
2616 tpg_fill_params_pattern(tpg, p, &params); in tpg_fill_plane_buffer()
2617 tpg_fill_params_extras(tpg, p, &params); in tpg_fill_plane_buffer()
2619 vbuf += tpg_hdiv(tpg, p, tpg->compose.left); in tpg_fill_plane_buffer()
2621 for (h = 0; h < tpg->compose.height; h++) { in tpg_fill_plane_buffer()
2624 params.frame_line = tpg_calc_frameline(tpg, src_y, tpg->field); in tpg_fill_plane_buffer()
2626 buf_line = tpg_calc_buffer_line(tpg, h, tpg->field); in tpg_fill_plane_buffer()
2629 if (error >= tpg->compose.height) { in tpg_fill_plane_buffer()
2630 error -= tpg->compose.height; in tpg_fill_plane_buffer()
2638 if (tpg_g_interleaved(tpg)) in tpg_fill_plane_buffer()
2639 p = tpg_g_interleaved_plane(tpg, buf_line); in tpg_fill_plane_buffer()
2641 if (tpg->vdownsampling[p] > 1) { in tpg_fill_plane_buffer()
2650 if (tpg->field == V4L2_FIELD_SEQ_BT || in tpg_fill_plane_buffer()
2651 tpg->field == V4L2_FIELD_SEQ_TB) { in tpg_fill_plane_buffer()
2657 if (error + fract_part >= tpg->compose.height) in tpg_fill_plane_buffer()
2660 tpg_calc_frameline(tpg, next_src_y, tpg->field); in tpg_fill_plane_buffer()
2665 tpg_calc_frameline(tpg, src_y, tpg->field); in tpg_fill_plane_buffer()
2668 buf_line /= tpg->vdownsampling[p]; in tpg_fill_plane_buffer()
2670 tpg_fill_plane_pattern(tpg, &params, p, h, in tpg_fill_plane_buffer()
2672 tpg_fill_plane_extras(tpg, &params, p, h, in tpg_fill_plane_buffer()
2678 void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std, unsigned p, u8 *vbuf) in tpg_fillbuffer() argument
2683 if (tpg->buffers > 1) { in tpg_fillbuffer()
2684 tpg_fill_plane_buffer(tpg, std, p, vbuf); in tpg_fillbuffer()
2688 for (i = 0; i < tpg_g_planes(tpg); i++) { in tpg_fillbuffer()
2689 tpg_fill_plane_buffer(tpg, std, i, vbuf + offset); in tpg_fillbuffer()
2690 offset += tpg_calc_plane_size(tpg, i); in tpg_fillbuffer()