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()
269 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
273 tpg->buffers = 3; in tpg_s_fourcc()
277 tpg->vdownsampling[1] = 2; in tpg_s_fourcc()
278 tpg->vdownsampling[2] = 2; in tpg_s_fourcc()
279 tpg->hdownsampling[1] = 2; in tpg_s_fourcc()
280 tpg->hdownsampling[2] = 2; in tpg_s_fourcc()
281 tpg->planes = 3; in tpg_s_fourcc()
282 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
286 tpg->buffers = 3; in tpg_s_fourcc()
289 tpg->vdownsampling[1] = 1; in tpg_s_fourcc()
290 tpg->vdownsampling[2] = 1; in tpg_s_fourcc()
291 tpg->hdownsampling[1] = 2; in tpg_s_fourcc()
292 tpg->hdownsampling[2] = 2; in tpg_s_fourcc()
293 tpg->planes = 3; in tpg_s_fourcc()
294 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
298 tpg->buffers = 2; in tpg_s_fourcc()
302 tpg->vdownsampling[1] = 1; in tpg_s_fourcc()
303 tpg->hdownsampling[1] = 1; in tpg_s_fourcc()
304 tpg->hmask[1] = ~1; in tpg_s_fourcc()
305 tpg->planes = 2; in tpg_s_fourcc()
306 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
310 tpg->buffers = 2; in tpg_s_fourcc()
314 tpg->vdownsampling[1] = 2; in tpg_s_fourcc()
315 tpg->hdownsampling[1] = 1; in tpg_s_fourcc()
316 tpg->hmask[1] = ~1; in tpg_s_fourcc()
317 tpg->planes = 2; in tpg_s_fourcc()
318 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
322 tpg->buffers = 3; in tpg_s_fourcc()
323 tpg->planes = 3; in tpg_s_fourcc()
324 tpg->vdownsampling[1] = 1; in tpg_s_fourcc()
325 tpg->vdownsampling[2] = 1; in tpg_s_fourcc()
326 tpg->hdownsampling[1] = 1; in tpg_s_fourcc()
327 tpg->hdownsampling[2] = 1; in tpg_s_fourcc()
328 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
332 tpg->vdownsampling[1] = 1; in tpg_s_fourcc()
333 tpg->hdownsampling[1] = 1; in tpg_s_fourcc()
334 tpg->planes = 2; in tpg_s_fourcc()
335 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
341 tpg->hmask[0] = ~1; in tpg_s_fourcc()
342 tpg->color_enc = TGP_COLOR_ENC_YCBCR; in tpg_s_fourcc()
346 tpg->color_enc = TGP_COLOR_ENC_HSV; in tpg_s_fourcc()
355 tpg->twopixelsize[0] = 2; in tpg_s_fourcc()
392 tpg->twopixelsize[0] = 2 * 2; in tpg_s_fourcc()
397 tpg->twopixelsize[0] = 2 * 3; in tpg_s_fourcc()
416 tpg->twopixelsize[0] = 2 * 4; in tpg_s_fourcc()
430 tpg->twopixelsize[0] = 2; in tpg_s_fourcc()
431 tpg->twopixelsize[1] = 2; in tpg_s_fourcc()
445 tpg->twopixelsize[0] = 4; in tpg_s_fourcc()
446 tpg->twopixelsize[1] = 4; in tpg_s_fourcc()
457 tpg->twopixelsize[0] = 2; in tpg_s_fourcc()
458 tpg->twopixelsize[1] = 2; in tpg_s_fourcc()
459 tpg->twopixelsize[2] = 2; in tpg_s_fourcc()
463 tpg->twopixelsize[0] = 2; in tpg_s_fourcc()
464 tpg->twopixelsize[1] = 4; in tpg_s_fourcc()
471 void tpg_s_crop_compose(struct tpg_data *tpg, const struct v4l2_rect *crop, in tpg_s_crop_compose() argument
474 tpg->crop = *crop; in tpg_s_crop_compose()
475 tpg->compose = *compose; in tpg_s_crop_compose()
476 tpg->scaled_width = (tpg->src_width * tpg->compose.width + in tpg_s_crop_compose()
477 tpg->crop.width - 1) / tpg->crop.width; in tpg_s_crop_compose()
478 tpg->scaled_width &= ~1; in tpg_s_crop_compose()
479 if (tpg->scaled_width > tpg->max_line_width) in tpg_s_crop_compose()
480 tpg->scaled_width = tpg->max_line_width; in tpg_s_crop_compose()
481 if (tpg->scaled_width < 2) in tpg_s_crop_compose()
482 tpg->scaled_width = 2; in tpg_s_crop_compose()
483 tpg->recalc_lines = true; in tpg_s_crop_compose()
487 void tpg_reset_source(struct tpg_data *tpg, unsigned width, unsigned height, in tpg_reset_source() argument
492 tpg->src_width = width; in tpg_reset_source()
493 tpg->src_height = height; in tpg_reset_source()
494 tpg->field = field; in tpg_reset_source()
495 tpg->buf_height = height; in tpg_reset_source()
497 tpg->buf_height /= 2; in tpg_reset_source()
498 tpg->scaled_width = width; in tpg_reset_source()
499 tpg->crop.top = tpg->crop.left = 0; in tpg_reset_source()
500 tpg->crop.width = width; in tpg_reset_source()
501 tpg->crop.height = height; in tpg_reset_source()
502 tpg->compose.top = tpg->compose.left = 0; in tpg_reset_source()
503 tpg->compose.width = width; in tpg_reset_source()
504 tpg->compose.height = tpg->buf_height; in tpg_reset_source()
505 for (p = 0; p < tpg->planes; p++) in tpg_reset_source()
506 tpg->bytesperline[p] = (width * tpg->twopixelsize[p]) / in tpg_reset_source()
507 (2 * tpg->hdownsampling[p]); in tpg_reset_source()
508 tpg->recalc_square_border = true; in tpg_reset_source()
512 static enum tpg_color tpg_get_textbg_color(struct tpg_data *tpg) in tpg_get_textbg_color() argument
514 switch (tpg->pattern) { in tpg_get_textbg_color()
524 static enum tpg_color tpg_get_textfg_color(struct tpg_data *tpg) in tpg_get_textfg_color() argument
526 switch (tpg->pattern) { in tpg_get_textfg_color()
549 static void color_to_hsv(struct tpg_data *tpg, int r, int g, int b, in color_to_hsv() argument
582 third_size = (tpg->real_hsv_enc == V4L2_HSV_ENC_180) ? 60 : 85; in color_to_hsv()
602 if (tpg->real_hsv_enc == V4L2_HSV_ENC_180) { in color_to_hsv()
622 static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b, in color_to_ycbcr() argument
676 bool full = tpg->real_quantization == V4L2_QUANTIZATION_FULL_RANGE; in color_to_ycbcr()
680 switch (tpg->real_ycbcr_enc) { in color_to_ycbcr()
736 static void ycbcr_to_color(struct tpg_data *tpg, int y, int cb, int cr, in ycbcr_to_color() argument
790 bool full = tpg->real_quantization == V4L2_QUANTIZATION_FULL_RANGE; in ycbcr_to_color()
795 switch (tpg->real_ycbcr_enc) { in ycbcr_to_color()
847 static void precalculate_color(struct tpg_data *tpg, int k) in precalculate_color() argument
857 col = tpg_get_textbg_color(tpg); in precalculate_color()
863 col = tpg_get_textfg_color(tpg); in precalculate_color()
868 } else if (tpg->pattern == TPG_PAT_NOISE) { in precalculate_color()
871 r = g = b = tpg->qual_offset + prandom_u32_max(196); in precalculate_color()
876 if (tpg->pattern == TPG_PAT_CSC_COLORBAR && col <= TPG_COLOR_CSC_BLACK) { in precalculate_color()
877 r = tpg_csc_colors[tpg->colorspace][tpg->real_xfer_func][col].r; in precalculate_color()
878 g = tpg_csc_colors[tpg->colorspace][tpg->real_xfer_func][col].g; in precalculate_color()
879 b = tpg_csc_colors[tpg->colorspace][tpg->real_xfer_func][col].b; in precalculate_color()
886 if (tpg->qual == TPG_QUAL_GRAY || in precalculate_color()
887 tpg->color_enc == TGP_COLOR_ENC_LUMA) { in precalculate_color()
900 if (tpg->real_rgb_range == V4L2_DV_RGB_RANGE_LIMITED && in precalculate_color()
901 tpg->rgb_range == V4L2_DV_RGB_RANGE_FULL && in precalculate_color()
902 tpg->color_enc == TGP_COLOR_ENC_RGB) { in precalculate_color()
911 } else if (tpg->real_rgb_range != V4L2_DV_RGB_RANGE_LIMITED && in precalculate_color()
912 tpg->rgb_range == V4L2_DV_RGB_RANGE_LIMITED && in precalculate_color()
913 tpg->color_enc == TGP_COLOR_ENC_RGB) { in precalculate_color()
927 if ((tpg->brightness != 128 || tpg->contrast != 128 || in precalculate_color()
928 tpg->saturation != 128 || tpg->hue) && in precalculate_color()
929 tpg->color_enc != TGP_COLOR_ENC_LUMA) { in precalculate_color()
935 color_to_ycbcr(tpg, r, g, b, &y, &cb, &cr); in precalculate_color()
937 y = (16 << 4) + ((y - (16 << 4)) * tpg->contrast) / 128; in precalculate_color()
938 y += (tpg->brightness << 4) - (128 << 4); in precalculate_color()
942 tmp_cb = (cb * cos(128 + tpg->hue)) / 127 + (cr * sin[128 + tpg->hue]) / 127; in precalculate_color()
943 tmp_cr = (cr * cos(128 + tpg->hue)) / 127 - (cb * sin[128 + tpg->hue]) / 127; in precalculate_color()
945 cb = (128 << 4) + (tmp_cb * tpg->contrast * tpg->saturation) / (128 * 128); in precalculate_color()
946 cr = (128 << 4) + (tmp_cr * tpg->contrast * tpg->saturation) / (128 * 128); in precalculate_color()
947 if (tpg->color_enc == TGP_COLOR_ENC_YCBCR) in precalculate_color()
950 ycbcr_to_color(tpg, y, cb, cr, &r, &g, &b); in precalculate_color()
951 } else if ((tpg->brightness != 128 || tpg->contrast != 128) && in precalculate_color()
952 tpg->color_enc == TGP_COLOR_ENC_LUMA) { in precalculate_color()
953 r = (16 << 4) + ((r - (16 << 4)) * tpg->contrast) / 128; in precalculate_color()
954 r += (tpg->brightness << 4) - (128 << 4); in precalculate_color()
957 switch (tpg->color_enc) { in precalculate_color()
962 color_to_hsv(tpg, r, g, b, &h, &s, &v); in precalculate_color()
963 tpg->colors[k][0] = h; in precalculate_color()
964 tpg->colors[k][1] = s; in precalculate_color()
965 tpg->colors[k][2] = v; in precalculate_color()
972 color_to_ycbcr(tpg, r, g, b, &y, &cb, &cr); in precalculate_color()
982 if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE && in precalculate_color()
983 tpg->real_ycbcr_enc != V4L2_YCBCR_ENC_XV601 && in precalculate_color()
984 tpg->real_ycbcr_enc != V4L2_YCBCR_ENC_XV709) { in precalculate_color()
993 switch (tpg->fourcc) { in precalculate_color()
1010 tpg->colors[k][0] = y; in precalculate_color()
1011 tpg->colors[k][1] = cb; in precalculate_color()
1012 tpg->colors[k][2] = cr; in precalculate_color()
1017 tpg->colors[k][0] = r >> 4; in precalculate_color()
1022 if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE) { in precalculate_color()
1027 switch (tpg->fourcc) { in precalculate_color()
1080 tpg->colors[k][0] = r; in precalculate_color()
1081 tpg->colors[k][1] = g; in precalculate_color()
1082 tpg->colors[k][2] = b; in precalculate_color()
1088 static void tpg_precalculate_colors(struct tpg_data *tpg) in tpg_precalculate_colors() argument
1093 precalculate_color(tpg, k); in tpg_precalculate_colors()
1097 static void gen_twopix(struct tpg_data *tpg, in gen_twopix() argument
1100 unsigned offset = odd * tpg->twopixelsize[0] / 2; in gen_twopix()
1101 u8 alpha = tpg->alpha_component; in gen_twopix()
1104 if (tpg->alpha_red_only && color != TPG_COLOR_CSC_RED && in gen_twopix()
1109 precalculate_color(tpg, color); in gen_twopix()
1110 r_y_h = tpg->colors[color][0]; /* R or precalculated Y, H */ in gen_twopix()
1111 g_u_s = tpg->colors[color][1]; /* G or precalculated U, V */ in gen_twopix()
1112 b_v = tpg->colors[color][2]; /* B or precalculated V */ in gen_twopix()
1114 switch (tpg->fourcc) { in gen_twopix()
1507 unsigned tpg_g_interleaved_plane(const struct tpg_data *tpg, unsigned buf_line) in tpg_g_interleaved_plane() argument
1509 switch (tpg->fourcc) { in tpg_g_interleaved_plane()
1534 static unsigned tpg_get_pat_lines(const struct tpg_data *tpg) in tpg_get_pat_lines() argument
1536 switch (tpg->pattern) { in tpg_get_pat_lines()
1556 static unsigned tpg_get_pat_line(const struct tpg_data *tpg, unsigned line) in tpg_get_pat_line() argument
1558 switch (tpg->pattern) { in tpg_get_pat_line()
1570 return (line * 8) / tpg->src_height; in tpg_get_pat_line()
1572 return line == tpg->src_height / 2; in tpg_get_pat_line()
1574 return (line + 1) / 2 == tpg->src_height / 4; in tpg_get_pat_line()
1576 return (line + 10) / 20 == tpg->src_height / 40; in tpg_get_pat_line()
1586 static enum tpg_color tpg_get_color(const struct tpg_data *tpg, in tpg_get_color() argument
1609 switch (tpg->pattern) { in tpg_get_color()
1613 return bars[tpg->pattern][((x * 8) / tpg->src_width) % 8]; in tpg_get_color()
1615 return bars[1][(pat_line + (x * 8) / tpg->src_width) % 8]; in tpg_get_color()
1648 if (pat_line || (x % tpg->src_width) == tpg->src_width / 2) in tpg_get_color()
1652 if (pat_line || ((x % tpg->src_width) + 1) / 2 == tpg->src_width / 4) in tpg_get_color()
1656 if (pat_line || ((x % tpg->src_width) + 10) / 20 == tpg->src_width / 40) in tpg_get_color()
1660 return TPG_COLOR_RAMP + ((x % tpg->src_width) * 256) / tpg->src_width; in tpg_get_color()
1672 static void tpg_calculate_square_border(struct tpg_data *tpg) in tpg_calculate_square_border() argument
1674 unsigned w = tpg->src_width; in tpg_calculate_square_border()
1675 unsigned h = tpg->src_height; in tpg_calculate_square_border()
1682 tpg->square.width = sq_w; in tpg_calculate_square_border()
1683 if (tpg->vid_aspect == TPG_VIDEO_ASPECT_16X9_ANAMORPHIC) { in tpg_calculate_square_border()
1688 tpg->square.width = ana_sq_w; in tpg_calculate_square_border()
1690 tpg->square.left = (w - tpg->square.width) / 2; in tpg_calculate_square_border()
1691 if (tpg->pix_aspect == TPG_PIXEL_ASPECT_NTSC) in tpg_calculate_square_border()
1693 else if (tpg->pix_aspect == TPG_PIXEL_ASPECT_PAL) in tpg_calculate_square_border()
1695 tpg->square.height = sq_h; in tpg_calculate_square_border()
1696 tpg->square.top = (h - sq_h) / 2; in tpg_calculate_square_border()
1697 tpg->border.left = 0; in tpg_calculate_square_border()
1698 tpg->border.width = w; in tpg_calculate_square_border()
1699 tpg->border.top = 0; in tpg_calculate_square_border()
1700 tpg->border.height = h; in tpg_calculate_square_border()
1701 switch (tpg->vid_aspect) { in tpg_calculate_square_border()
1703 if (tpg->pix_aspect) in tpg_calculate_square_border()
1706 tpg->border.width = ((4 * h) / 3) & ~1; in tpg_calculate_square_border()
1707 if (((w - tpg->border.width) / 2) & ~1) in tpg_calculate_square_border()
1708 tpg->border.width -= 2; in tpg_calculate_square_border()
1709 tpg->border.left = (w - tpg->border.width) / 2; in tpg_calculate_square_border()
1712 tpg->border.height = ((3 * w) / 4) & ~1; in tpg_calculate_square_border()
1713 tpg->border.top = (h - tpg->border.height) / 2; in tpg_calculate_square_border()
1716 if (tpg->pix_aspect) { in tpg_calculate_square_border()
1717 tpg->border.height = tpg->pix_aspect == TPG_PIXEL_ASPECT_NTSC ? 420 : 506; in tpg_calculate_square_border()
1718 tpg->border.top = (h - tpg->border.height) / 2; in tpg_calculate_square_border()
1722 tpg->border.width = ((14 * h) / 9) & ~1; in tpg_calculate_square_border()
1723 if (((w - tpg->border.width) / 2) & ~1) in tpg_calculate_square_border()
1724 tpg->border.width -= 2; in tpg_calculate_square_border()
1725 tpg->border.left = (w - tpg->border.width) / 2; in tpg_calculate_square_border()
1728 tpg->border.height = ((9 * w) / 14) & ~1; in tpg_calculate_square_border()
1729 tpg->border.top = (h - tpg->border.height) / 2; in tpg_calculate_square_border()
1732 if (tpg->pix_aspect) { in tpg_calculate_square_border()
1733 tpg->border.height = tpg->pix_aspect == TPG_PIXEL_ASPECT_NTSC ? 368 : 442; in tpg_calculate_square_border()
1734 tpg->border.top = (h - tpg->border.height) / 2; in tpg_calculate_square_border()
1738 tpg->border.width = ((16 * h) / 9) & ~1; in tpg_calculate_square_border()
1739 if (((w - tpg->border.width) / 2) & ~1) in tpg_calculate_square_border()
1740 tpg->border.width -= 2; in tpg_calculate_square_border()
1741 tpg->border.left = (w - tpg->border.width) / 2; in tpg_calculate_square_border()
1744 tpg->border.height = ((9 * w) / 16) & ~1; in tpg_calculate_square_border()
1745 tpg->border.top = (h - tpg->border.height) / 2; in tpg_calculate_square_border()
1752 static void tpg_precalculate_line(struct tpg_data *tpg) in tpg_precalculate_line() argument
1760 switch (tpg->pattern) { in tpg_precalculate_line()
1772 for (pat = 0; pat < tpg_get_pat_lines(tpg); pat++) { in tpg_precalculate_line()
1774 unsigned int_part = tpg->src_width / tpg->scaled_width; in tpg_precalculate_line()
1775 unsigned fract_part = tpg->src_width % tpg->scaled_width; in tpg_precalculate_line()
1779 for (x = 0; x < tpg->scaled_width * 2; x += 2) { in tpg_precalculate_line()
1783 real_x = tpg->hflip ? tpg->src_width * 2 - real_x - 2 : real_x; in tpg_precalculate_line()
1784 color1 = tpg_get_color(tpg, pat, real_x); in tpg_precalculate_line()
1788 if (error >= tpg->scaled_width) { in tpg_precalculate_line()
1789 error -= tpg->scaled_width; in tpg_precalculate_line()
1794 real_x = tpg->hflip ? tpg->src_width * 2 - real_x - 2 : real_x; in tpg_precalculate_line()
1795 color2 = tpg_get_color(tpg, pat, real_x); in tpg_precalculate_line()
1799 if (error >= tpg->scaled_width) { in tpg_precalculate_line()
1800 error -= tpg->scaled_width; in tpg_precalculate_line()
1804 gen_twopix(tpg, pix, tpg->hflip ? color2 : color1, 0); in tpg_precalculate_line()
1805 gen_twopix(tpg, pix, tpg->hflip ? color1 : color2, 1); in tpg_precalculate_line()
1806 for (p = 0; p < tpg->planes; p++) { in tpg_precalculate_line()
1807 unsigned twopixsize = tpg->twopixelsize[p]; in tpg_precalculate_line()
1808 unsigned hdiv = tpg->hdownsampling[p]; in tpg_precalculate_line()
1809 u8 *pos = tpg->lines[pat][p] + tpg_hdiv(tpg, p, x); in tpg_precalculate_line()
1816 if (tpg->vdownsampling[tpg->planes - 1] > 1) { in tpg_precalculate_line()
1817 unsigned pat_lines = tpg_get_pat_lines(tpg); in tpg_precalculate_line()
1822 for (p = 1; p < tpg->planes; p++) { in tpg_precalculate_line()
1823 unsigned w = tpg_hdiv(tpg, p, tpg->scaled_width * 2); in tpg_precalculate_line()
1824 u8 *pos1 = tpg->lines[pat][p]; in tpg_precalculate_line()
1825 u8 *pos2 = tpg->lines[next_pat][p]; in tpg_precalculate_line()
1826 u8 *dest = tpg->downsampled_lines[pat][p]; in tpg_precalculate_line()
1834 gen_twopix(tpg, pix, contrast, 0); in tpg_precalculate_line()
1835 gen_twopix(tpg, pix, contrast, 1); in tpg_precalculate_line()
1836 for (p = 0; p < tpg->planes; p++) { in tpg_precalculate_line()
1837 unsigned twopixsize = tpg->twopixelsize[p]; in tpg_precalculate_line()
1838 u8 *pos = tpg->contrast_line[p]; in tpg_precalculate_line()
1840 for (x = 0; x < tpg->scaled_width; x += 2, pos += twopixsize) in tpg_precalculate_line()
1844 gen_twopix(tpg, pix, TPG_COLOR_100_BLACK, 0); in tpg_precalculate_line()
1845 gen_twopix(tpg, pix, TPG_COLOR_100_BLACK, 1); in tpg_precalculate_line()
1846 for (p = 0; p < tpg->planes; p++) { in tpg_precalculate_line()
1847 unsigned twopixsize = tpg->twopixelsize[p]; in tpg_precalculate_line()
1848 u8 *pos = tpg->black_line[p]; in tpg_precalculate_line()
1850 for (x = 0; x < tpg->scaled_width; x += 2, pos += twopixsize) in tpg_precalculate_line()
1854 for (x = 0; x < tpg->scaled_width * 2; x += 2) { in tpg_precalculate_line()
1855 gen_twopix(tpg, pix, TPG_COLOR_RANDOM, 0); in tpg_precalculate_line()
1856 gen_twopix(tpg, pix, TPG_COLOR_RANDOM, 1); in tpg_precalculate_line()
1857 for (p = 0; p < tpg->planes; p++) { in tpg_precalculate_line()
1858 unsigned twopixsize = tpg->twopixelsize[p]; in tpg_precalculate_line()
1859 u8 *pos = tpg->random_line[p] + x * twopixsize / 2; in tpg_precalculate_line()
1865 gen_twopix(tpg, tpg->textbg, TPG_COLOR_TEXTBG, 0); in tpg_precalculate_line()
1866 gen_twopix(tpg, tpg->textbg, TPG_COLOR_TEXTBG, 1); in tpg_precalculate_line()
1867 gen_twopix(tpg, tpg->textfg, TPG_COLOR_TEXTFG, 0); in tpg_precalculate_line()
1868 gen_twopix(tpg, tpg->textfg, TPG_COLOR_TEXTFG, 1); in tpg_precalculate_line()
1875 unsigned vdiv = tpg->vdownsampling[p]; \
1876 unsigned hdiv = tpg->hdownsampling[p]; \
1880 memcpy(&fg, tpg->textfg[p], sizeof(PIXTYPE)); \
1881 memcpy(&bg, tpg->textbg[p], sizeof(PIXTYPE)); \
1884 int l = tpg->vflip ? 15 - line : line; \
1886 ((y * step + l) / (vdiv * div)) * tpg->bytesperline[p] + \
1893 if (hdiv == 2 && tpg->hflip) { \
1903 } else if (tpg->hflip) { \
1923 pos += (tpg->hflip ? -8 : 8) / (int)hdiv; \
1928 static noinline void tpg_print_str_2(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2], in tpg_print_str_2() argument
1935 static noinline void tpg_print_str_4(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2], in tpg_print_str_4() argument
1942 static noinline void tpg_print_str_6(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2], in tpg_print_str_6() argument
1949 static noinline void tpg_print_str_8(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2], in tpg_print_str_8() argument
1956 void tpg_gen_text(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2], in tpg_gen_text() argument
1959 unsigned step = V4L2_FIELD_HAS_T_OR_B(tpg->field) ? 2 : 1; in tpg_gen_text()
1971 if (y + 16 >= tpg->compose.height || x + 8 >= tpg->compose.width) in tpg_gen_text()
1974 if (len > (tpg->compose.width - x) / 8) in tpg_gen_text()
1975 len = (tpg->compose.width - x) / 8; in tpg_gen_text()
1976 if (tpg->vflip) in tpg_gen_text()
1977 y = tpg->compose.height - y - 16; in tpg_gen_text()
1978 if (tpg->hflip) in tpg_gen_text()
1979 x = tpg->compose.width - x - 8; in tpg_gen_text()
1980 y += tpg->compose.top; in tpg_gen_text()
1981 x += tpg->compose.left; in tpg_gen_text()
1982 if (tpg->field == V4L2_FIELD_BOTTOM) in tpg_gen_text()
1984 else if (tpg->field == V4L2_FIELD_SEQ_TB || tpg->field == V4L2_FIELD_SEQ_BT) in tpg_gen_text()
1987 for (p = 0; p < tpg->planes; p++) { in tpg_gen_text()
1989 switch (tpg->twopixelsize[p]) { in tpg_gen_text()
1991 tpg_print_str_2(tpg, basep, p, first, div, step, y, x, in tpg_gen_text()
1995 tpg_print_str_4(tpg, basep, p, first, div, step, y, x, in tpg_gen_text()
1999 tpg_print_str_6(tpg, basep, p, first, div, step, y, x, in tpg_gen_text()
2003 tpg_print_str_8(tpg, basep, p, first, div, step, y, x, in tpg_gen_text()
2011 const char *tpg_g_color_order(const struct tpg_data *tpg) in tpg_g_color_order() argument
2013 switch (tpg->pattern) { in tpg_g_color_order()
2035 void tpg_update_mv_step(struct tpg_data *tpg) in tpg_update_mv_step() argument
2037 int factor = tpg->mv_hor_mode > TPG_MOVE_NONE ? -1 : 1; in tpg_update_mv_step()
2039 if (tpg->hflip) in tpg_update_mv_step()
2041 switch (tpg->mv_hor_mode) { in tpg_update_mv_step()
2044 tpg->mv_hor_step = ((tpg->src_width + 319) / 320) * 4; in tpg_update_mv_step()
2048 tpg->mv_hor_step = ((tpg->src_width + 639) / 640) * 4; in tpg_update_mv_step()
2052 tpg->mv_hor_step = 2; in tpg_update_mv_step()
2055 tpg->mv_hor_step = 0; in tpg_update_mv_step()
2059 tpg->mv_hor_step = tpg->src_width - tpg->mv_hor_step; in tpg_update_mv_step()
2061 factor = tpg->mv_vert_mode > TPG_MOVE_NONE ? -1 : 1; in tpg_update_mv_step()
2062 switch (tpg->mv_vert_mode) { in tpg_update_mv_step()
2065 tpg->mv_vert_step = ((tpg->src_width + 319) / 320) * 4; in tpg_update_mv_step()
2069 tpg->mv_vert_step = ((tpg->src_width + 639) / 640) * 4; in tpg_update_mv_step()
2073 tpg->mv_vert_step = 1; in tpg_update_mv_step()
2076 tpg->mv_vert_step = 0; in tpg_update_mv_step()
2080 tpg->mv_vert_step = tpg->src_height - tpg->mv_vert_step; in tpg_update_mv_step()
2085 static unsigned tpg_calc_frameline(const struct tpg_data *tpg, unsigned src_y, in tpg_calc_frameline() argument
2090 return tpg->crop.top + src_y * 2; in tpg_calc_frameline()
2092 return tpg->crop.top + src_y * 2 + 1; in tpg_calc_frameline()
2094 return src_y + tpg->crop.top; in tpg_calc_frameline()
2102 static unsigned tpg_calc_buffer_line(const struct tpg_data *tpg, unsigned y, in tpg_calc_buffer_line() argument
2105 y += tpg->compose.top; in tpg_calc_buffer_line()
2109 return tpg->buf_height / 2 + y / 2; in tpg_calc_buffer_line()
2114 return tpg->buf_height / 2 + y / 2; in tpg_calc_buffer_line()
2120 static void tpg_recalc(struct tpg_data *tpg) in tpg_recalc() argument
2122 if (tpg->recalc_colors) { in tpg_recalc()
2123 tpg->recalc_colors = false; in tpg_recalc()
2124 tpg->recalc_lines = true; in tpg_recalc()
2125 tpg->real_xfer_func = tpg->xfer_func; in tpg_recalc()
2126 tpg->real_ycbcr_enc = tpg->ycbcr_enc; in tpg_recalc()
2127 tpg->real_hsv_enc = tpg->hsv_enc; in tpg_recalc()
2128 tpg->real_quantization = tpg->quantization; in tpg_recalc()
2130 if (tpg->xfer_func == V4L2_XFER_FUNC_DEFAULT) in tpg_recalc()
2131 tpg->real_xfer_func = in tpg_recalc()
2132 V4L2_MAP_XFER_FUNC_DEFAULT(tpg->colorspace); in tpg_recalc()
2134 if (tpg->ycbcr_enc == V4L2_YCBCR_ENC_DEFAULT) in tpg_recalc()
2135 tpg->real_ycbcr_enc = in tpg_recalc()
2136 V4L2_MAP_YCBCR_ENC_DEFAULT(tpg->colorspace); in tpg_recalc()
2138 if (tpg->quantization == V4L2_QUANTIZATION_DEFAULT) in tpg_recalc()
2139 tpg->real_quantization = in tpg_recalc()
2141 tpg->color_enc != TGP_COLOR_ENC_YCBCR, in tpg_recalc()
2142 tpg->colorspace, tpg->real_ycbcr_enc); in tpg_recalc()
2144 tpg_precalculate_colors(tpg); in tpg_recalc()
2146 if (tpg->recalc_square_border) { in tpg_recalc()
2147 tpg->recalc_square_border = false; in tpg_recalc()
2148 tpg_calculate_square_border(tpg); in tpg_recalc()
2150 if (tpg->recalc_lines) { in tpg_recalc()
2151 tpg->recalc_lines = false; in tpg_recalc()
2152 tpg_precalculate_line(tpg); in tpg_recalc()
2156 void tpg_calc_text_basep(struct tpg_data *tpg, in tpg_calc_text_basep() argument
2159 unsigned stride = tpg->bytesperline[p]; in tpg_calc_text_basep()
2160 unsigned h = tpg->buf_height; in tpg_calc_text_basep()
2162 tpg_recalc(tpg); in tpg_calc_text_basep()
2166 h /= tpg->vdownsampling[p]; in tpg_calc_text_basep()
2167 if (tpg->field == V4L2_FIELD_SEQ_TB) in tpg_calc_text_basep()
2169 else if (tpg->field == V4L2_FIELD_SEQ_BT) in tpg_calc_text_basep()
2171 if (p == 0 && tpg->interleaved) in tpg_calc_text_basep()
2172 tpg_calc_text_basep(tpg, basep, 1, vbuf); in tpg_calc_text_basep()
2176 static int tpg_pattern_avg(const struct tpg_data *tpg, in tpg_pattern_avg() argument
2179 unsigned pat_lines = tpg_get_pat_lines(tpg); in tpg_pattern_avg()
2205 void tpg_log_status(struct tpg_data *tpg) in tpg_log_status() argument
2208 tpg->src_width, tpg->src_height, in tpg_log_status()
2209 tpg_color_enc_str(tpg->color_enc)); in tpg_log_status()
2210 pr_info("tpg field: %u\n", tpg->field); in tpg_log_status()
2211 pr_info("tpg crop: %ux%u@%dx%d\n", tpg->crop.width, tpg->crop.height, in tpg_log_status()
2212 tpg->crop.left, tpg->crop.top); in tpg_log_status()
2213 pr_info("tpg compose: %ux%u@%dx%d\n", tpg->compose.width, tpg->compose.height, in tpg_log_status()
2214 tpg->compose.left, tpg->compose.top); in tpg_log_status()
2215 pr_info("tpg colorspace: %d\n", tpg->colorspace); in tpg_log_status()
2216 pr_info("tpg transfer function: %d/%d\n", tpg->xfer_func, tpg->real_xfer_func); in tpg_log_status()
2217 if (tpg->color_enc == TGP_COLOR_ENC_HSV) in tpg_log_status()
2219 tpg->hsv_enc, tpg->real_hsv_enc); in tpg_log_status()
2220 else if (tpg->color_enc == TGP_COLOR_ENC_YCBCR) in tpg_log_status()
2222 tpg->ycbcr_enc, tpg->real_ycbcr_enc); in tpg_log_status()
2223 pr_info("tpg quantization: %d/%d\n", tpg->quantization, tpg->real_quantization); in tpg_log_status()
2224 pr_info("tpg RGB range: %d/%d\n", tpg->rgb_range, tpg->real_rgb_range); in tpg_log_status()
2257 static void tpg_fill_params_pattern(const struct tpg_data *tpg, unsigned p, in tpg_fill_params_pattern() argument
2261 tpg_hscale_div(tpg, p, tpg->mv_hor_count % tpg->src_width); in tpg_fill_params_pattern()
2263 tpg_hscale_div(tpg, p, (tpg->mv_hor_count + tpg->mv_hor_step) % in tpg_fill_params_pattern()
2264 tpg->src_width); in tpg_fill_params_pattern()
2265 params->mv_vert_old = tpg->mv_vert_count % tpg->src_height; in tpg_fill_params_pattern()
2267 (tpg->mv_vert_count + tpg->mv_vert_step) % tpg->src_height; in tpg_fill_params_pattern()
2270 static void tpg_fill_params_extras(const struct tpg_data *tpg, in tpg_fill_params_extras() argument
2277 params->wss_width = tpg->crop.left < tpg->src_width / 2 ? in tpg_fill_params_extras()
2278 tpg->src_width / 2 - tpg->crop.left : 0; in tpg_fill_params_extras()
2279 if (params->wss_width > tpg->crop.width) in tpg_fill_params_extras()
2280 params->wss_width = tpg->crop.width; in tpg_fill_params_extras()
2281 params->wss_width = tpg_hscale_div(tpg, p, params->wss_width); in tpg_fill_params_extras()
2283 params->twopixsize * prandom_u32_max(tpg->src_width / 2); in tpg_fill_params_extras()
2285 if (tpg->crop.left < tpg->border.left) { in tpg_fill_params_extras()
2286 left_pillar_width = tpg->border.left - tpg->crop.left; in tpg_fill_params_extras()
2287 if (left_pillar_width > tpg->crop.width) in tpg_fill_params_extras()
2288 left_pillar_width = tpg->crop.width; in tpg_fill_params_extras()
2289 left_pillar_width = tpg_hscale_div(tpg, p, left_pillar_width); in tpg_fill_params_extras()
2293 if (tpg->crop.left + tpg->crop.width > in tpg_fill_params_extras()
2294 tpg->border.left + tpg->border.width) { in tpg_fill_params_extras()
2296 tpg->border.left + tpg->border.width - tpg->crop.left; in tpg_fill_params_extras()
2298 tpg_hscale_div(tpg, p, right_pillar_start); in tpg_fill_params_extras()
2304 params->sav_eav_f = tpg->field == in tpg_fill_params_extras()
2308 static void tpg_fill_plane_extras(const struct tpg_data *tpg, in tpg_fill_plane_extras() argument
2315 const struct v4l2_rect *sq = &tpg->square; in tpg_fill_plane_extras()
2316 const struct v4l2_rect *b = &tpg->border; in tpg_fill_plane_extras()
2317 const struct v4l2_rect *c = &tpg->crop; in tpg_fill_plane_extras()
2325 u8 *wss = tpg->random_line[p] + params->wss_random_offset; in tpg_fill_plane_extras()
2330 if (tpg->show_border && frame_line >= b->top && in tpg_fill_plane_extras()
2338 memcpy(vbuf + left, tpg->contrast_line[p], in tpg_fill_plane_extras()
2344 tpg->contrast_line[p], twopixsize); in tpg_fill_plane_extras()
2348 tpg->contrast_line[p], twopixsize); in tpg_fill_plane_extras()
2351 if (tpg->qual != TPG_QUAL_NOISE && frame_line >= b->top && in tpg_fill_plane_extras()
2353 memcpy(vbuf, tpg->black_line[p], params->left_pillar_width); in tpg_fill_plane_extras()
2354 memcpy(vbuf + params->right_pillar_start, tpg->black_line[p], in tpg_fill_plane_extras()
2357 if (tpg->show_square && frame_line >= sq->top && in tpg_fill_plane_extras()
2371 left = tpg_hscale_div(tpg, p, left); in tpg_fill_plane_extras()
2372 width = tpg_hscale_div(tpg, p, width); in tpg_fill_plane_extras()
2373 memcpy(vbuf + left, tpg->contrast_line[p], width); in tpg_fill_plane_extras()
2375 if (tpg->insert_sav) { in tpg_fill_plane_extras()
2376 unsigned offset = tpg_hdiv(tpg, p, tpg->compose.width / 3); in tpg_fill_plane_extras()
2390 if (tpg->insert_eav) { in tpg_fill_plane_extras()
2391 unsigned offset = tpg_hdiv(tpg, p, tpg->compose.width * 2 / 3); in tpg_fill_plane_extras()
2407 static void tpg_fill_plane_pattern(const struct tpg_data *tpg, in tpg_fill_plane_pattern() argument
2419 unsigned line_offset = tpg_hscale_div(tpg, p, tpg->crop.left); in tpg_fill_plane_pattern()
2432 if (params->hmax == tpg->compose.height) in tpg_fill_plane_pattern()
2434 if (!tpg->perc_fill_blank) in tpg_fill_plane_pattern()
2439 if (tpg->vflip) { in tpg_fill_plane_pattern()
2440 frame_line = tpg->src_height - frame_line - 1; in tpg_fill_plane_pattern()
2441 frame_line_next = tpg->src_height - frame_line_next - 1; in tpg_fill_plane_pattern()
2445 linestart_older = tpg->contrast_line[p]; in tpg_fill_plane_pattern()
2446 linestart_newer = tpg->contrast_line[p]; in tpg_fill_plane_pattern()
2447 } else if (tpg->qual != TPG_QUAL_NOISE && in tpg_fill_plane_pattern()
2448 (frame_line < tpg->border.top || in tpg_fill_plane_pattern()
2449 frame_line >= tpg->border.top + tpg->border.height)) { in tpg_fill_plane_pattern()
2450 linestart_older = tpg->black_line[p]; in tpg_fill_plane_pattern()
2451 linestart_newer = tpg->black_line[p]; in tpg_fill_plane_pattern()
2452 } else if (tpg->pattern == TPG_PAT_NOISE || tpg->qual == TPG_QUAL_NOISE) { in tpg_fill_plane_pattern()
2453 linestart_older = tpg->random_line[p] + in tpg_fill_plane_pattern()
2454 twopixsize * prandom_u32_max(tpg->src_width / 2); in tpg_fill_plane_pattern()
2455 linestart_newer = tpg->random_line[p] + in tpg_fill_plane_pattern()
2456 twopixsize * prandom_u32_max(tpg->src_width / 2); in tpg_fill_plane_pattern()
2459 (frame_line + mv_vert_old) % tpg->src_height; in tpg_fill_plane_pattern()
2461 (frame_line + mv_vert_new) % tpg->src_height; in tpg_fill_plane_pattern()
2465 pat_line_old = tpg_get_pat_line(tpg, frame_line_old); in tpg_fill_plane_pattern()
2466 pat_line_new = tpg_get_pat_line(tpg, frame_line_new); in tpg_fill_plane_pattern()
2467 linestart_older = tpg->lines[pat_line_old][p] + mv_hor_old; in tpg_fill_plane_pattern()
2468 linestart_newer = tpg->lines[pat_line_new][p] + mv_hor_new; in tpg_fill_plane_pattern()
2470 if (tpg->vdownsampling[p] > 1 && frame_line != frame_line_next) { in tpg_fill_plane_pattern()
2477 pat_line_next_old = tpg_get_pat_line(tpg, in tpg_fill_plane_pattern()
2478 (frame_line_next + mv_vert_old) % tpg->src_height); in tpg_fill_plane_pattern()
2479 pat_line_next_new = tpg_get_pat_line(tpg, in tpg_fill_plane_pattern()
2480 (frame_line_next + mv_vert_new) % tpg->src_height); in tpg_fill_plane_pattern()
2482 switch (tpg->field) { in tpg_fill_plane_pattern()
2486 avg_pat = tpg_pattern_avg(tpg, pat_line_old, pat_line_new); in tpg_fill_plane_pattern()
2489 linestart_older = tpg->downsampled_lines[avg_pat][p] + mv_hor_old; in tpg_fill_plane_pattern()
2497 avg_pat = tpg_pattern_avg(tpg, pat_line_old, pat_line_next_old); in tpg_fill_plane_pattern()
2499 linestart_older = tpg->downsampled_lines[avg_pat][p] + in tpg_fill_plane_pattern()
2501 avg_pat = tpg_pattern_avg(tpg, pat_line_new, pat_line_next_new); in tpg_fill_plane_pattern()
2503 linestart_newer = tpg->downsampled_lines[avg_pat][p] + in tpg_fill_plane_pattern()
2511 if (tpg->field_alternate) { in tpg_fill_plane_pattern()
2521 switch (tpg->field) { in tpg_fill_plane_pattern()
2550 void tpg_fill_plane_buffer(struct tpg_data *tpg, v4l2_std_id std, in tpg_fill_plane_buffer() argument
2554 unsigned factor = V4L2_FIELD_HAS_T_OR_B(tpg->field) ? 2 : 1; in tpg_fill_plane_buffer()
2557 unsigned int_part = (tpg->crop.height / factor) / tpg->compose.height; in tpg_fill_plane_buffer()
2558 unsigned fract_part = (tpg->crop.height / factor) % tpg->compose.height; in tpg_fill_plane_buffer()
2563 tpg_recalc(tpg); in tpg_fill_plane_buffer()
2567 params.twopixsize = tpg->twopixelsize[p]; in tpg_fill_plane_buffer()
2568 params.img_width = tpg_hdiv(tpg, p, tpg->compose.width); in tpg_fill_plane_buffer()
2569 params.stride = tpg->bytesperline[p]; in tpg_fill_plane_buffer()
2570 params.hmax = (tpg->compose.height * tpg->perc_fill) / 100; in tpg_fill_plane_buffer()
2572 tpg_fill_params_pattern(tpg, p, ¶ms); in tpg_fill_plane_buffer()
2573 tpg_fill_params_extras(tpg, p, ¶ms); in tpg_fill_plane_buffer()
2575 vbuf += tpg_hdiv(tpg, p, tpg->compose.left); in tpg_fill_plane_buffer()
2577 for (h = 0; h < tpg->compose.height; h++) { in tpg_fill_plane_buffer()
2580 params.frame_line = tpg_calc_frameline(tpg, src_y, tpg->field); in tpg_fill_plane_buffer()
2582 buf_line = tpg_calc_buffer_line(tpg, h, tpg->field); in tpg_fill_plane_buffer()
2585 if (error >= tpg->compose.height) { in tpg_fill_plane_buffer()
2586 error -= tpg->compose.height; in tpg_fill_plane_buffer()
2594 if (tpg_g_interleaved(tpg)) in tpg_fill_plane_buffer()
2595 p = tpg_g_interleaved_plane(tpg, buf_line); in tpg_fill_plane_buffer()
2597 if (tpg->vdownsampling[p] > 1) { in tpg_fill_plane_buffer()
2606 if (tpg->field == V4L2_FIELD_SEQ_BT || in tpg_fill_plane_buffer()
2607 tpg->field == V4L2_FIELD_SEQ_TB) { in tpg_fill_plane_buffer()
2613 if (error + fract_part >= tpg->compose.height) in tpg_fill_plane_buffer()
2616 tpg_calc_frameline(tpg, next_src_y, tpg->field); in tpg_fill_plane_buffer()
2621 tpg_calc_frameline(tpg, src_y, tpg->field); in tpg_fill_plane_buffer()
2624 buf_line /= tpg->vdownsampling[p]; in tpg_fill_plane_buffer()
2626 tpg_fill_plane_pattern(tpg, ¶ms, p, h, in tpg_fill_plane_buffer()
2628 tpg_fill_plane_extras(tpg, ¶ms, p, h, in tpg_fill_plane_buffer()
2634 void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std, unsigned p, u8 *vbuf) in tpg_fillbuffer() argument
2639 if (tpg->buffers > 1) { in tpg_fillbuffer()
2640 tpg_fill_plane_buffer(tpg, std, p, vbuf); in tpg_fillbuffer()
2644 for (i = 0; i < tpg_g_planes(tpg); i++) { in tpg_fillbuffer()
2645 tpg_fill_plane_buffer(tpg, std, i, vbuf + offset); in tpg_fillbuffer()
2646 offset += tpg_calc_plane_size(tpg, i); in tpg_fillbuffer()