From a2593b0a8aec9b6f7c5ae9271b37c1d1dfd6ed1d Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Wed, 13 Oct 2021 15:47:09 +0200 Subject: [PATCH] SMPTE bars: fixed column count Smpte bars doesn't have the eight colum as EBU has. Moreover the pattern is not complete - the bottom third contains different data - mention this in help + todo. --- src/utils/video_pattern_generator.cpp | 28 +++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/utils/video_pattern_generator.cpp b/src/utils/video_pattern_generator.cpp index 03ebcc795..36fbef1c1 100644 --- a/src/utils/video_pattern_generator.cpp +++ b/src/utils/video_pattern_generator.cpp @@ -206,21 +206,24 @@ class image_pattern_bars : public image_pattern { } }; -template +/** + * @todo Proper SMPTE test pattern has different in bottom third. + */ +template class image_pattern_ebu_smpte_bars : public image_pattern { static constexpr array bars{ uint32_t{0xFFU << 24U | f << 16U | f << 8U | f }, - uint32_t{0xFFU << 24U | 0U << 16U | f << 8U | f }, - uint32_t{0xFFU << 24U | f << 16U | f << 8U | 0U }, - uint32_t{0xFFU << 24U | 0U << 16U | f << 8U | 0U }, - uint32_t{0xFFU << 24U | f << 16U | 0U << 8U | f }, - uint32_t{0xFFU << 24U | 0U << 16U | 0U << 8U | f }, - uint32_t{0xFFU << 24U | f << 16U | f << 8U | 0U }, - uint32_t{0xFFU << 24U | f << 16U | 0U << 8U | 0U }, + uint32_t{0xFFU << 24U | 0U << 16U | f << 8U | f }, + uint32_t{0xFFU << 24U | f << 16U | f << 8U | 0U }, + uint32_t{0xFFU << 24U | 0U << 16U | f << 8U | 0U }, + uint32_t{0xFFU << 24U | f << 16U | 0U << 8U | f }, + uint32_t{0xFFU << 24U | 0U << 16U | 0U << 8U | f }, + uint32_t{0xFFU << 24U | f << 16U | f << 8U | 0U }, + uint32_t{0xFFU << 24U | f << 16U | 0U << 8U | 0U }, }; enum generator_depth fill(int width, int height, unsigned char *data) override { int col_num = 0; - const int rect_size = (width + bars.size() - 1) / bars.size(); + const int rect_size = (width + columns - 1) / columns; struct testcard_rect r{}; struct testcard_pixmap pixmap{}; pixmap.w = width; @@ -235,7 +238,7 @@ class image_pattern_ebu_smpte_bars : public image_pattern { printf("Fill rect at %d,%d\n", r.x, r.y); testcard_fillRect(&pixmap, &r, bars.at(col_num)); - col_num = (col_num + 1) % bars.size(); + col_num = (col_num + 1) % columns; } } return generator_depth::bits8; @@ -342,6 +345,7 @@ unique_ptr image_pattern::create(string const &config) { cout << "Pattern to use, one of: " << BOLD("bars, blank, ebu_bars, gradient[=0x], gradient2, noise, raw=0xXX[YYZZ..], smpte_bars, 0x\n"); cout << "\t\t- patterns 'gradient2' and 'noise' generate full bit-depth patterns for RG48 and R12L\n"; cout << "\t\t- pattern 'raw' generates repeating sequence of given bytes without any color conversion\n"; + cout << "\t\t- pattern 'smpte' uses the top bars from top 2 thirds only (doesn't render bottom third differently)\n"; return {}; } if (config == "bars") { @@ -351,7 +355,7 @@ unique_ptr image_pattern::create(string const &config) { return make_unique(); } if (config == "ebu_bars") { - return make_unique>(); + return make_unique>(); } if (config.substr(0, "gradient"s.length()) == "gradient") { uint32_t color = image_pattern_gradient::red; @@ -379,7 +383,7 @@ unique_ptr image_pattern::create(string const &config) { return make_unique(config.substr("raw=0x"s.length())); } if (config == "smpte_bars") { - return make_unique>(); + return make_unique>(); } if (config.substr(0, "0x"s.length()) == "0x") { uint32_t blank_color = 0U;