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

Public Member Functions

 image_pattern_bars (string const &init)
 
- 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 Member Functions

enum generator_depth fill (int width, int height, unsigned char *data) override
 

Private Attributes

string annotate
 

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 161 of file video_pattern_generator.cpp.

Constructor & Destructor Documentation

◆ image_pattern_bars()

image_pattern_bars::image_pattern_bars ( string const & init)
inlineexplicit

Definition at line 163 of file video_pattern_generator.cpp.

163 {
164 if (init == "help"s) {
165 col() << "Testcard bar usage:\n\t" << SBOLD(SRED("-t testcard:pattern=bars") << "[=text]") << " - optionally annotate with text" << "\n";
166 throw 1;
167 }
168 annotate = init;
169 }
auto init(int width, int height, enum generator_depth depth) noexcept
#define SRED(x)
Definition color_out.h:85
#define SBOLD(x)
Definition color_out.h:80

References annotate, image_pattern::init(), SBOLD, and SRED.

Here is the call graph for this function:

Member Function Documentation

◆ fill()

enum generator_depth image_pattern_bars::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 171 of file video_pattern_generator.cpp.

171 {
172 int col_num = 0;
173 int rect_size = COL_NUM;
174 struct testcard_rect r{};
175 struct testcard_pixmap pixmap{};
176 pixmap.w = width;
177 pixmap.h = height;
178 pixmap.data = data;
179 rect_size = (width + rect_size - 1) / rect_size;
180 for (int j = 0; j < height; j += rect_size) {
181 uint32_t grey = 0xFF010101U;
182 if (j == rect_size * 2) {
183 r.w = width;
184 r.h = rect_size / 4;
185 r.x = 0;
186 r.y = j;
187 testcard_fillRect(&pixmap, &r, 0xFFFFFFFFU);
188 r.h = rect_size - (rect_size * 3 / 4);
189 r.y = j + rect_size * 3 / 4;
190 testcard_fillRect(&pixmap, &r, 0xFF000000U);
191 }
192 for (int i = 0; i < width; i += rect_size) {
193 r.x = i;
194 r.y = j;
195 r.w = rect_size;
196 r.h = min<int>(rect_size, height - r.y);
197 LOG(LOG_LEVEL_DEBUG) << MOD_NAME << "Fill rect at " << r.x << "," << r.y << "\n";
198 if (j != rect_size * 2) {
199 testcard_fillRect(&pixmap, &r,
200 rect_colors[col_num]);
201 col_num = (col_num + 1) % COL_NUM;
202 } else {
203 r.h = rect_size / 2;
204 r.y += rect_size / 4;
205 testcard_fillRect(&pixmap, &r, grey);
206 grey += 0x00010101U * (255 / COL_NUM);
207 }
208 }
209 }
210 if (!annotate.empty()) {
211 draw_line((char *) data, width * 4, annotate.c_str(), 0xFFFFFFFF, true);
212 }
214 }
#define LOG(level)
Definition debug.h:313
#define LOG_LEVEL_DEBUG
Definition kernels.cu:48
#define min(a, b)
Definition rtp.c:99
const uint32_t rect_colors[]
void testcard_fillRect(struct testcard_pixmap *s, struct testcard_rect *r, uint32_t color)
#define COL_NUM
bool draw_line(char *buf, int pitch, const char *text, uint32_t color, bool solid)
Definition text.c:271
#define MOD_NAME

References annotate, bits8, COL_NUM, testcard_pixmap::data, draw_line(), testcard_pixmap::h, testcard_rect::h, LOG, LOG_LEVEL_DEBUG, min, MOD_NAME, rect_colors, testcard_fillRect(), testcard_pixmap::w, testcard_rect::w, testcard_rect::x, and testcard_rect::y.

Here is the call graph for this function:

Member Data Documentation

◆ annotate

string image_pattern_bars::annotate
private

Definition at line 215 of file video_pattern_generator.cpp.

Referenced by image_pattern_bars(), and fill().


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