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

Public Member Functions

 gray_video_pattern_generator (int w, int h, codec_t c, string const &opts)
 
char * get_next () override
 
- Public Member Functions inherited from video_pattern_generator
virtual ~video_pattern_generator ()
 

Private Attributes

codec_t color_spec
 
int cur_idx = 0
 
vector< vector< unsigned char > > data
 
long data_len = vc_get_datalen(width, height, color_spec)
 
int height
 
int step = DEFAULT_STEP
 
int width
 

Static Private Attributes

static constexpr int DEFAULT_STEP = 1
 

Detailed Description

Definition at line 719 of file video_pattern_generator.cpp.

Constructor & Destructor Documentation

◆ gray_video_pattern_generator()

gray_video_pattern_generator::gray_video_pattern_generator ( int w,
int h,
codec_t c,
string const & opts )
inline

Definition at line 720 of file video_pattern_generator.cpp.

721 : width(w), height(h), color_spec(c)
722 {
723 if (!opts.empty()) {
724 if (opts == "help") {
725 col() << "Usage:\n\t" SBOLD("gray[:step]") << " - interframe color increment (default " << DEFAULT_STEP << ")\n";
726 throw 1;
727 }
728 step = stoi(opts);
729 }
730 int col = 0;
731 while (col < 0xFF) {
733 unsigned char rgba[MAX_PFB_SIZE * 4];
734 for (int i = 0; i < pixels * 4; ++i) {
735 rgba[i] = (i + 1) % 4 != 0 ? col : 0xFFU; // handle alpha
736 }
737 int dst_bs = get_pf_block_bytes(color_spec);
738 unsigned char dst[MAX_PFB_SIZE];
740
741 auto next_frame = vector<unsigned char>(data_len);
742 for (int y = 0; y < height; ++y) {
743 for (int x = 0; x < width / pixels; x += 1) {
744 memcpy(next_frame.data() + y * vc_get_linesize(width, color_spec) + x * dst_bs, dst, dst_bs);
745 }
746 }
747 data.push_back(std::move(next_frame));
748 col += step;
749 }
750 }
int vc_get_linesize(unsigned int width, codec_t codec)
#define SBOLD(x)
Definition color_out.h:80
static unsigned char pixels[]
vector< vector< unsigned char > > data
void testcard_convert_buffer(codec_t in_c, codec_t out_c, unsigned char *out, unsigned const char *in, int width, int height)
@ RGBA
RGBA 8-bit, big-endian.
Definition types.h:70
int get_pf_block_bytes(codec_t codec)
returns codec_info_t::block_size_bytes
int get_pf_block_pixels(codec_t codec)
returns codec_info_t::block_size_pixels
#define MAX_PFB_SIZE
maximal pixfmt block size (R12L - 8 B)
Definition video_codec.h:65

References step.

Member Function Documentation

◆ get_next()

char * gray_video_pattern_generator::get_next ( )
inlineoverridevirtual

Implements video_pattern_generator.

Definition at line 751 of file video_pattern_generator.cpp.

751 {
752 auto *out = (char *) data[cur_idx++].data();
753 if (cur_idx * step >= 0xFF) {
754 cur_idx = 0;
755 }
756
757 return out;
758 }

Member Data Documentation

◆ color_spec

codec_t gray_video_pattern_generator::color_spec
private

Definition at line 764 of file video_pattern_generator.cpp.

◆ cur_idx

int gray_video_pattern_generator::cur_idx = 0
private

Definition at line 765 of file video_pattern_generator.cpp.

◆ data

vector<vector<unsigned char> > gray_video_pattern_generator::data
private

Definition at line 767 of file video_pattern_generator.cpp.

◆ data_len

long gray_video_pattern_generator::data_len = vc_get_datalen(width, height, color_spec)
private

Definition at line 766 of file video_pattern_generator.cpp.

◆ DEFAULT_STEP

int gray_video_pattern_generator::DEFAULT_STEP = 1
staticconstexprprivate

Definition at line 760 of file video_pattern_generator.cpp.

◆ height

int gray_video_pattern_generator::height
private

Definition at line 763 of file video_pattern_generator.cpp.

◆ step

int gray_video_pattern_generator::step = DEFAULT_STEP
private

Definition at line 761 of file video_pattern_generator.cpp.

Referenced by gray_video_pattern_generator().

◆ width

int gray_video_pattern_generator::width
private

Definition at line 762 of file video_pattern_generator.cpp.


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