52 unsigned int x_count,
unsigned int y_count,
int preallocate)
54 unsigned int tile_idx, line_idx;
55 struct tile *cur_tiles;
56 unsigned int tile_line = 0;
69 assert(x_count * y_count > 0);
70 for(tile_idx = 0u; tile_idx < x_count * y_count; ++tile_idx) {
79 cur_tiles = &out->
tiles[0];
80 for(line_idx = 0u; line_idx <
vf_get_tile(src, 0)->
height; ++line_idx, ++tile_line) {
81 unsigned int cur_tile_idx;
82 unsigned int byte = 0u;
90 for (cur_tile_idx = 0u; cur_tile_idx < x_count;
92 cur_tiles[cur_tile_idx].
data = (
char *)
93 malloc(cur_tiles[cur_tile_idx].
99 for(cur_tile_idx = 0u; cur_tile_idx < x_count; ++cur_tile_idx) {
100 memcpy((
void *) &cur_tiles[cur_tile_idx].
data[
104 src_linesize +
byte],
105 cur_tiles[cur_tile_idx].
width *
121 auto holder =
new shared_ptr<video_frame>(
frame);
135shared_ptr<video_frame>
vf_merge_tiles(std::vector<shared_ptr<video_frame>>
const & tiles)
140 auto holder =
new decay<
decltype(tiles)>
::type(tiles);
147 int64_t t0 = INT64_MAX;
149 for (
unsigned int i = 0; i < tiles.size(); ++i) {
150 ret->tiles[i].data = tiles[i]->tiles[0].data;
151 ret->tiles[i].data_len = tiles[i]->tiles[0].data_len;
152 t0 = tiles[i]->compress_start < t0 ? tiles[i]->compress_start : t0;
153 t1 = tiles[i]->compress_end > t1 ? tiles[i]->compress_end : t1;
156 ret->compress_start = t0;
157 ret->compress_end = t1;
struct video_frame * frame
void vf_free(struct video_frame *buf)
Frees video_frame structure.
struct video_desc video_desc_from_frame(const struct video_frame *frame)
Returns struct video_desc from video frame.
int vc_get_linesize(unsigned int width, codec_t codec)
struct video_frame * vf_alloc_desc(struct video_desc desc)
Allocates video frame accordig given desc.
Struct tile is an area of video_frame.
char * data
Raw tile data. Pointer must be at least 4B aligned.
unsigned int data_len
length of the data
Struct video_frame represents a video frame and contains video description.
struct tile tiles[FLEXIBLE_ARRAY_MEMBER]
void vf_split(struct video_frame *out, struct video_frame *src, unsigned int x_count, unsigned int y_count, int preallocate)
shared_ptr< video_frame > vf_merge_tiles(std::vector< shared_ptr< video_frame > > const &tiles)
vector< shared_ptr< video_frame > > vf_separate_tiles(shared_ptr< video_frame > frame)
This is an umbrella header for video functions.
double get_bpp(codec_t codec)
struct tile * vf_get_tile(struct video_frame *buf, int pos)
Returns pointer to n-th tile from video frame Equivalent to &video_frame::tiles[pos].
void vf_copy_metadata(struct video_frame *dest, const struct video_frame *src)