53#define MOD_NAME "[matrix cap. f.] "
65 if (strlen(cfg) == 0 || strcmp(cfg,
"help") == 0) {
66 printf(
"Performs matrix transformation on input pixels.\n\n"
69 printf(
"where numbers a-i are members of 3x3 transformation matrix [a b c; d e f; g h i], decimals.\n"
70 "Coefficients are applied at unpacked pixels (eg. on Y Cb and Cr channels of UYVY). Result is marked as RGB.\n"
71 "Currently only RGB and UYVY is supported on input. No additional color transformation is performed.\n");
72 printf(
"\nOptional \"no-bounds-check\" options disables check for overflows/underflows which improves performance\n"
73 "but may give incorrect results if operation oveflows or underflows.\n");
78 char *cfg_c = strdup(cfg);
80 char *save_ptr = NULL;
83 while ((
item = strtok_r(tmp,
":", &save_ptr)) != NULL) {
85 if (strcmp(
item,
"no-bound-check") == 0) {
95 if (errno != 0 || *endptr !=
'\0') {
135 unsigned char *in_data = (
unsigned char *) in->
tiles[0].
data;
136 unsigned char *out_data = (
unsigned char *) out->
tiles[0].
data;
138 for (
unsigned int i = 0; i < in->
tiles[0].
data_len; i += 4) {
141 a[1] = b[1] = *in_data++;
143 a[2] = b[2] = *in_data++;
171 unsigned char *in_data = (
unsigned char *) in->
tiles[0].
data;
172 unsigned char *out_data = (
unsigned char *) out->
tiles[0].
data;
174 for (
unsigned int i = 0; i < in->
tiles[0].
data_len; i += 3) {
193 uint16_t *in_data = (uint16_t *)(
void *) in->
tiles[0].
data;
194 uint16_t *out_data = (uint16_t *)(
void *) out->
tiles[0].
data;
196 for (
unsigned int i = 0; i < in->
tiles[0].
data_len; i += 6) {
222 unsigned char *in_data = (
unsigned char *) in->
tiles[0].
data;
223 unsigned char *out_data = (
unsigned char *) out->
tiles[0].
data;
225 for (
unsigned int i = 0; i < in->
tiles[0].
data_len; i += 4) {
228 a[1] = b[1] = *in_data++;
230 a[2] = b[2] = *in_data++;
252 unsigned char *in_data = (
unsigned char *) in->
tiles[0].
data;
253 unsigned char *out_data = (
unsigned char *) out->
tiles[0].
data;
255 for (
unsigned int i = 0; i < in->
tiles[0].
data_len; i += 3) {
271 uint16_t *in_data = (uint16_t *)(
void *) in->
tiles[0].
data;
272 uint16_t *out_data = (uint16_t *)(
void *) out->
tiles[0].
data;
274 for (
unsigned int i = 0; i < in->
tiles[0].
data_len; i += 6) {
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.
void vf_data_deleter(struct video_frame *buf)
struct video_frame * vf_alloc_desc(struct video_desc desc)
Allocates video frame accordig given desc.
#define CAPTURE_FILTER_ABI_VERSION
#define ADD_VO_PP_CAPTURE_FILTER_WRAPPER(name, init, filter, done, set_out_buf, get_prop_callb)
int color_printf(const char *format,...)
void log_msg(int level, const char *format,...)
#define LOG_LEVEL_ERROR
general errors
#define LOG_LEVEL_WARNING
less severe errors
@ LIBRARY_CLASS_CAPTURE_FILTER
#define REGISTER_MODULE(name, info, lclass, abi)
Registers module to global modules' registry.
#define CLAMP(x, low, high)
static struct video_frame * filter(void *state, struct video_frame *in)
static void vo_pp_set_out_buffer(void *state, char *buffer)
static const struct capture_filter_info capture_filter_matrix
static void done(void *state)
static int init(struct module *parent, const char *cfg, void **state)
double transform_matrix[9]
void * vo_pp_out_buffer
buffer to write to if we use vo_pp wrapper (otherwise unused)
char * data
Raw tile data. Pointer must be at least 4B aligned.
unsigned int data_len
length of the data
void(* data_deleter)(struct video_frame *)
void(* dispose)(struct video_frame *)
Struct video_frame represents a video frame and contains video description.
struct tile tiles[FLEXIBLE_ARRAY_MEMBER]
struct video_frame_callbacks callbacks
@ RGB
RGB 8-bit (packed into 24-bit word)
@ UYVY
YCbCr 422 8-bit - Cb Y0 Cr Y1.
@ RG48
16-bit RGB little-endian (RlRhGl...)
This is an umbrella header for video functions.
#define VIDEO_FRAME_DISPOSE(frame)