UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
resize_utils.h File Reference
#include "types.h"
Include dependency graph for resize_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  resize_param
 

Macros

#define RESIZE_ALGO_DFL   (-1)
 
#define RESIZE_ALGO_HELP_SHOWN   (-3)
 
#define RESIZE_ALGO_UNKN   (-2)
 
#define RESIZE_SUPPORTED_PIXFMT_INIT   RGB, RGBA, I420, UYVY, YUYV, RG48
 

Functions

int resize_algo_from_string (const char *str)
 
void resize_frame (char *indata, codec_t in_color, char *outdata, int width, int height, struct resize_param *resize_spec)
 

Macro Definition Documentation

◆ RESIZE_ALGO_DFL

#define RESIZE_ALGO_DFL   (-1)

Definition at line 58 of file resize_utils.h.

Referenced by init(), and resize_frame().

◆ RESIZE_ALGO_HELP_SHOWN

#define RESIZE_ALGO_HELP_SHOWN   (-3)

Definition at line 60 of file resize_utils.h.

Referenced by parse_fmt(), and resize_algo_from_string().

◆ RESIZE_ALGO_UNKN

#define RESIZE_ALGO_UNKN   (-2)

Definition at line 59 of file resize_utils.h.

Referenced by resize_algo_from_string().

◆ RESIZE_SUPPORTED_PIXFMT_INIT

#define RESIZE_SUPPORTED_PIXFMT_INIT   RGB, RGBA, I420, UYVY, YUYV, RG48

Definition at line 56 of file resize_utils.h.

Referenced by reconfigure_if_needed().

Function Documentation

◆ resize_algo_from_string()

int resize_algo_from_string ( const char * str)

Definition at line 224 of file resize_utils.cpp.

225{
226 if (strcmp(str, "help") == 0) {
227 color_printf("Available resize algorithms:\n");
228 for (auto const &i : interp_map) {
229 color_printf("\t" TBOLD("%s") "%s\n", i.name,
230 i.val == DEFAULT_ALGO ? " (default)" : "");
231 }
233 }
234 for (auto const &i : interp_map) {
235 if (strcmp(i.name, str) == 0) {
236 return i.val;
237 }
238 }
239 return RESIZE_ALGO_UNKN;
240}
int color_printf(const char *format,...)
#define TBOLD(x)
Definition color_out.h:70
#define DEFAULT_ALGO
static const struct @12 interp_map[]
#define RESIZE_ALGO_UNKN
#define RESIZE_ALGO_HELP_SHOWN

References color_printf(), DEFAULT_ALGO, interp_map, RESIZE_ALGO_HELP_SHOWN, RESIZE_ALGO_UNKN, and TBOLD.

Referenced by parse_fmt().

Here is the call graph for this function:

◆ resize_frame()

void resize_frame ( char * indata,
codec_t in_color,
char * outdata,
int width,
int height,
struct resize_param * resize_spec )

Definition at line 184 of file resize_utils.cpp.

186{
187 if (resize_spec->algo == RESIZE_ALGO_DFL) {
188 resize_spec->algo = DEFAULT_ALGO;
189 MSG(NOTICE, "using resize algorithm: %s\n",
191 }
192
193 DEBUG_TIMER_START(resize);
194 if (resize_spec->mode == resize_param::USE_FRACTION) {
195 const double factor = resize_spec->factor;
196 Mat rgb = ug_to_rgb_mat(in_color, (int) width, (int) height, indata);
197 Mat out((int) (height * factor), (int) (width * factor),
198 get_out_cv_data_type(in_color), outdata);
199 resize(rgb, out, Size(0, 0), factor, factor, resize_spec->algo);
200 } else if (resize_spec->mode == resize_param::USE_DIMENSIONS) {
201 resize_frame_dimensions(indata, in_color, outdata, width, height,
202 resize_spec->target_width,
203 resize_spec->target_height, resize_spec->algo);
204 } else {
205 abort();
206 }
207 DEBUG_TIMER_STOP(resize);
208}
#define DEBUG_TIMER_START(name)
Definition debug.h:324
#define DEBUG_TIMER_STOP(name)
Definition debug.h:325
#define MSG(l, fmt,...)
Definition debug.h:96
static const char * resize_algo_to_string(int algo)
static Mat ug_to_rgb_mat(codec_t codec, int width, int height, char *indata)
static void resize_frame_dimensions(char *indata, codec_t in_color, char *outdata, int width, int height, int target_width, int target_height, int algo)
static int get_out_cv_data_type(codec_t pixfmt)
#define RESIZE_ALGO_DFL
enum resize_param::resize_mode mode

References resize_param::algo, DEBUG_TIMER_START, DEBUG_TIMER_STOP, DEFAULT_ALGO, resize_param::factor, get_out_cv_data_type(), resize_param::mode, MSG, RESIZE_ALGO_DFL, resize_algo_to_string(), resize_frame_dimensions(), resize_param::target_height, resize_param::target_width, ug_to_rgb_mat(), resize_param::USE_DIMENSIONS, and resize_param::USE_FRACTION.

Referenced by filter().

Here is the call graph for this function: