From a7a1ac7c5e5a499ea0ebe625b21ff16477b1059a Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Thu, 18 Aug 2022 19:58:16 +0200 Subject: [PATCH] TV: Add individual test image for selected color of color bar --- src/tv/bas.c | 13 ++++++++++--- src/tv/bas.h | 7 +++++++ src/tv/color.c | 34 ++++++++++++++++++++++++++++++++-- src/tv/color.h | 2 +- src/tv/main.c | 25 +++++++++++++++++++++++-- 5 files changed, 73 insertions(+), 8 deletions(-) diff --git a/src/tv/bas.c b/src/tv/bas.c index 55ffa58..cd197e4 100644 --- a/src/tv/bas.c +++ b/src/tv/bas.c @@ -119,12 +119,19 @@ int bas_generate(bas_t *bas, sample_t *sample) /* render color convergence test image */ convergence_gen_line(sample, x, bas->samplerate, H_LINE_START, H_LINE_END, middlefield_line, (bas->grid_width) > 1 ? 1.0: 0.5); break; + case BAS_BLACK: + case BAS_BLUE: case BAS_RED: - /* render (thin) color convergence test image */ - color_gen_line(sample, x, bas->samplerate, color_u, color_v, bas->v_polarity, H_LINE_START, H_LINE_END); + case BAS_MAGENTA: + case BAS_GREEN: + case BAS_CYAN: + case BAS_YELLOW: + case BAS_WHITE: + /* single color test image */ + color_gen_line(sample, x, bas->samplerate, color_u, color_v, bas->v_polarity, H_LINE_START, H_LINE_END, bas->type); break; case BAS_EBU: - /* render (thin) color convergence test image */ + /* EBU test image */ ebu_gen_line(sample, x, bas->samplerate, color_u, color_v, bas->v_polarity, H_LINE_START, H_LINE_END); break; case BAS_IMAGE: { diff --git a/src/tv/bas.h b/src/tv/bas.h index 7a0074e..6d6309f 100644 --- a/src/tv/bas.h +++ b/src/tv/bas.h @@ -2,7 +2,14 @@ enum bas_type { BAS_FUBK, BAS_CONVERGENCE, + BAS_BLACK, + BAS_BLUE, BAS_RED, + BAS_MAGENTA, + BAS_GREEN, + BAS_CYAN, + BAS_YELLOW, + BAS_WHITE, BAS_EBU, BAS_VCR, BAS_IMAGE, diff --git a/src/tv/color.c b/src/tv/color.c index 0a0e8c7..9751ece 100644 --- a/src/tv/color.c +++ b/src/tv/color.c @@ -21,6 +21,8 @@ #include #include #include "../libsample/sample.h" +#include "../libfilter/iir_filter.h" +#include "bas.h" #include "color.h" #define RAMP_WIDTH 0.0000002 @@ -38,13 +40,41 @@ static struct color_bar { {0.0, 0.0}, }; -int color_gen_line(sample_t *sample, double x, double samplerate, sample_t *color_u, sample_t *color_v, int v_polarity, double line_start, double line_end) +int color_gen_line(sample_t *sample, double x, double samplerate, sample_t *color_u, sample_t *color_v, int v_polarity, double line_start, double line_end, enum bas_type type) { - int b = 5; + int b; double step = 1.0 / samplerate; int i = 0; double amplitude, Y, U, V, colorphase; + switch (type) { + case BAS_WHITE: + b = 0; + break; + case BAS_YELLOW: + b = 1; + break; + case BAS_CYAN: + b = 2; + break; + case BAS_GREEN: + b = 3; + break; + case BAS_MAGENTA: + b = 4; + break; + case BAS_RED: + b = 5; + break; + case BAS_BLUE: + b = 6; + break; + case BAS_BLACK: + default: + b = 7; + break; + } + /* skip x to line_start */ while (x < line_start && x < line_end) { i++; diff --git a/src/tv/color.h b/src/tv/color.h index f6231ee..0fb8be1 100644 --- a/src/tv/color.h +++ b/src/tv/color.h @@ -1,3 +1,3 @@ -int color_gen_line(sample_t *sample, double x, double samplerate, sample_t *color_u, sample_t *color_v, int v_polarity, double frame_start, double line_end); +int color_gen_line(sample_t *sample, double x, double samplerate, sample_t *color_u, sample_t *color_v, int v_polarity, double frame_start, double line_end, enum bas_type type); diff --git a/src/tv/main.c b/src/tv/main.c index c46b9d6..0bb6aca 100644 --- a/src/tv/main.c +++ b/src/tv/main.c @@ -90,8 +90,15 @@ void print_help(const char *arg0) printf(" tx-fubk Transmit FUBK test image (German PAL image)\n"); printf(" tx-ebu Transmit EBU test image (color bars)\n"); printf(" tx-convergence Transmit convergence grid for color adjustemnt\n"); - printf(" tx-red Transmit single color image for DY adjustment\n"); - printf(" tx-vcr Transmit VCR calibration pattern\n"); + printf(" tx-black Transmit single color image\n"); + printf(" tx-blue Transmit single color image\n"); + printf(" tx-red Transmit single color image (for DY adjustment)\n"); + printf(" tx-magenta Transmit single color image\n"); + printf(" tx-green Transmit single color image\n"); + printf(" tx-cyan Transmit single color image\n"); + printf(" tx-yellow Transmit single color image\n"); + printf(" tx-white Transmit single color image\n"); + printf(" tx-vcr Transmit Jolly's VCR test pattern\n"); printf(" tx-img [] Transmit natural image or given image file\n"); printf(" Use 4:3 image with 574 lines for best result.\n"); printf("\ngeneral options:\n"); @@ -528,8 +535,22 @@ int main(int argc, char *argv[]) tx_test_picture(BAS_EBU); } else if (!strcmp(argv[argi], "tx-convergence")) { tx_test_picture(BAS_CONVERGENCE); + } else if (!strcmp(argv[argi], "tx-black")) { + tx_test_picture(BAS_BLACK); + } else if (!strcmp(argv[argi], "tx-blue")) { + tx_test_picture(BAS_BLUE); } else if (!strcmp(argv[argi], "tx-red")) { tx_test_picture(BAS_RED); + } else if (!strcmp(argv[argi], "tx-magenta")) { + tx_test_picture(BAS_MAGENTA); + } else if (!strcmp(argv[argi], "tx-green")) { + tx_test_picture(BAS_GREEN); + } else if (!strcmp(argv[argi], "tx-cyan")) { + tx_test_picture(BAS_CYAN); + } else if (!strcmp(argv[argi], "tx-yellow")) { + tx_test_picture(BAS_YELLOW); + } else if (!strcmp(argv[argi], "tx-white")) { + tx_test_picture(BAS_WHITE); } else if (!strcmp(argv[argi], "tx-vcr")) { tx_test_picture(BAS_VCR); } else if (!strcmp(argv[argi], "tx-img")) {