UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
image_pattern_strips Struct Reference
Inheritance diagram for image_pattern_strips:
Inheritance graph
Collaboration diagram for image_pattern_strips:
Collaboration graph

Public Member Functions

 image_pattern_strips (string const &config)
 
- Public Member Functions inherited from image_pattern
 image_pattern ()=default
 
 image_pattern (const image_pattern &)=delete
 
 image_pattern (image_pattern &&)=delete
 
virtual ~image_pattern ()=default
 
auto init (int width, int height, enum generator_depth depth) noexcept
 
image_pattern & operator= (const image_pattern &)=delete
 
image_pattern && operator= (image_pattern &&)=delete
 

Private Types

enum  { ROWS , COLS , DIAG }
 

Private Member Functions

enum generator_depth fill (int width, int height, unsigned char *data) override
 
void parse_fmt (string const &config)
 

Private Attributes

int fill_w = 10
 
uint32_t pattern [3+COL_NUM] = { RGBA_WHITE, RGBA_BLACK, RGBA_GRAY }
 
enum image_pattern_strips:: { ... }  type = DIAG
 

Additional Inherited Members

- Static Public Member Functions inherited from image_pattern
static unique_ptr< image_pattern > create (string const &pattern, string const &params)
 

Detailed Description

Definition at line 429 of file video_pattern_generator.cpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ROWS 
COLS 
DIAG 

Definition at line 473 of file video_pattern_generator.cpp.

Constructor & Destructor Documentation

◆ image_pattern_strips()

image_pattern_strips::image_pattern_strips ( string const & config)
inlineexplicit

Definition at line 431 of file video_pattern_generator.cpp.

432 {
433 for (int i = 0; i < COL_NUM; ++i) {
434 pattern[3 + i] = rect_colors[i];
435 }
436 parse_fmt(config);
437 }
pattern
Definition testcard.c:94
void parse_fmt(string const &config)
const uint32_t rect_colors[]
#define COL_NUM

References COL_NUM, parse_fmt(), and rect_colors.

Here is the call graph for this function:

Member Function Documentation

◆ fill()

enum generator_depth image_pattern_strips::fill ( int width,
int height,
unsigned char * data )
inlineoverrideprivatevirtual
Return values
bitdepth used by the generator (either 8 or 16)

Implements image_pattern.

Definition at line 476 of file video_pattern_generator.cpp.

478 {
479 auto *ptr = reinterpret_cast<uint32_t *>(data);
480 for (int j = 0; j < height; j += 1) {
481 for (int i = 0; i < width; i += 1) {
482 const int col_idx = type == DIAG ? i + j
483 : type == ROWS ? i
484 : j;
485 *ptr++ = pattern[(col_idx / fill_w) %
487 }
488 }
490 }
#define ARR_COUNT(arr)
Definition macros.h:60

References ARR_COUNT, bits8, DIAG, fill_w, ROWS, and type.

◆ parse_fmt()

void image_pattern_strips::parse_fmt ( string const & config)
inlineprivate

Definition at line 440 of file video_pattern_generator.cpp.

441 {
442 if (config.empty()) {
443 return;
444 }
445 if (config == "help"s) {
447 "\t" TBOLD("-t "
448 "testcard:patt=strips[=[vert|hor|"
449 "diag][,w[idth]=W]]") "\n");
450 throw 1;
451 }
452 char conf[STR_LEN];
453 snprintf_ch(conf, "%s", config.c_str());
454 char *tmp = conf;
455 char *endptr = nullptr;
456 while (char *item = strtok_r(tmp, ",", &endptr)) {
457 tmp = nullptr;
458 if (strncmp(item, "hor", 3) == 0) {
459 type = COLS;
460 } else if (strncmp(item, "ver", 3) == 0) {
461 type = ROWS;
462 } else if (strncmp(item, "dia", 3) == 0) {
463 type = DIAG;
464 } else if (IS_KEY_PREFIX(item, "width")) {
465 fill_w = stoi(strchr(item, '=') + 1);
466 } else {
467 throw ug_runtime_error(
468 string("Wrong option: ") + config);
469 }
470 }
471 }
int color_printf(const char *format,...)
#define TBOLD(x)
Definition color_out.h:70
#define snprintf_ch(str,...)
shortcut for snprintf(var, sizeof var...), var must be a char array
Definition macros.h:101
#define IS_KEY_PREFIX(tok, key)
expands to true value if <k> from tok in format <k>=<v> is prefix of key
Definition macros.h:138
@ STR_LEN
"standard" string length placeholder
Definition macros.h:134
Definition hd-rum.c:27

References color_printf(), COLS, DIAG, fill_w, IS_KEY_PREFIX, ROWS, snprintf_ch, STR_LEN, TBOLD, and type.

Referenced by image_pattern_strips().

Here is the call graph for this function:

Member Data Documentation

◆ fill_w

int image_pattern_strips::fill_w = 10
private

Definition at line 475 of file video_pattern_generator.cpp.

Referenced by fill(), and parse_fmt().

◆ pattern

uint32_t image_pattern_strips::pattern[3+COL_NUM] = { RGBA_WHITE, RGBA_BLACK, RGBA_GRAY }
private

Definition at line 474 of file video_pattern_generator.cpp.

#define RGBA_WHITE
Definition color.h:199
#define RGBA_GRAY
Definition color.h:198
#define RGBA_BLACK
Definition color.h:197

◆ []

enum { ... } image_pattern_strips::type

Referenced by fill(), and parse_fmt().


The documentation for this struct was generated from the following file: