#include <math.h>
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "filters.h"
#include "video.h"
Go to the source code of this file.
|
static av_cold int | init (AVFilterContext *ctx) |
|
static av_cold void | uninit (AVFilterContext *ctx) |
|
static int | config_input (AVFilterLink *inlink) |
|
static int | is_full_range (AVFrame *frame) |
|
static uint16_t | convert_full_range (int factor, uint16_t y) |
|
static void | convolve_sobel (SiTiContext *s, const uint8_t *src, float *dst, int linesize) |
|
static void | calculate_motion (SiTiContext *s, const uint8_t *curr, float *motion_matrix, int linesize) |
|
static float | std_deviation (float *img_metrics, int width, int height) |
|
static void | set_meta (AVDictionary **metadata, const char *key, float d) |
|
static int | filter_frame (AVFilterLink *inlink, AVFrame *frame) |
|
| AVFILTER_DEFINE_CLASS (siti) |
|
Calculate Spatial Info (SI) and Temporal Info (TI) scores
Definition in file vf_siti.c.
◆ CONVOLVE
Value: { \
for (
int j = 1; j <
s->height - 1; j++) { \
for (
int i = 1;
i <
s->width - 1;
i++) { \
x_conv_sum = 0.0; \
y_conv_sum = 0.0; \
for (int k = 0; k < filter_size; k++) { \
ki = k % filter_width - 1; \
kj =
floor(k / filter_width) - 1; \
index = (j + kj) *
stride + (
i + ki); \
} \
gradient = sqrt(x_conv_sum * x_conv_sum + y_conv_sum * y_conv_sum); \
dst[(j - 1) * (
s->width - 2) + (
i - 1)] = gradient; \
} \
} \
}
◆ CALCULATE
Value: { \
uint##
bps##_t *vsrc = (uint##
bps##_t*)curr; \
uint##
bps##_t *vdst = (uint##
bps##_t*)
s->prev_frame; \
for (
int j = 0; j <
s->height; j++) { \
for (
int i = 0;
i <
s->width;
i++) { \
motion = 0; \
prev_index = j *
s->width +
i; \
motion = curr_data - vdst[prev_index]; \
vdst[prev_index] = curr_data; \
motion_matrix[j *
s->width +
i] = motion; \
} \
} \
}
◆ OFFSET
◆ FLAGS
◆ init()
◆ uninit()
◆ config_input()
◆ is_full_range()
static int is_full_range |
( |
AVFrame * |
frame | ) |
|
|
static |
◆ convert_full_range()
static uint16_t convert_full_range |
( |
int |
factor, |
|
|
uint16_t |
y |
|
) |
| |
|
static |
◆ convolve_sobel()
static void convolve_sobel |
( |
SiTiContext * |
s, |
|
|
const uint8_t * |
src, |
|
|
float * |
dst, |
|
|
int |
linesize |
|
) |
| |
|
static |
◆ calculate_motion()
static void calculate_motion |
( |
SiTiContext * |
s, |
|
|
const uint8_t * |
curr, |
|
|
float * |
motion_matrix, |
|
|
int |
linesize |
|
) |
| |
|
static |
◆ std_deviation()
static float std_deviation |
( |
float * |
img_metrics, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
|
static |
◆ set_meta()
◆ filter_frame()
◆ AVFILTER_DEFINE_CLASS()
AVFILTER_DEFINE_CLASS |
( |
siti |
| ) |
|
◆ X_FILTER
Initial value:= {
1, 0, -1,
2, 0, -2,
1, 0, -1
}
Definition at line 38 of file vf_siti.c.
◆ Y_FILTER
Initial value:= {
1, 2, 1,
0, 0, 0,
-1, -2, -1
}
Definition at line 44 of file vf_siti.c.
◆ pix_fmts
Initial value:
Definition at line 68 of file vf_siti.c.
◆ siti_options
◆ avfilter_vf_siti_inputs
Initial value:= {
{
.name = "default",
},
}
Definition at line 322 of file vf_siti.c.
◆ ff_vf_siti
Initial value:= {
.name = "siti",
.description =
NULL_IF_CONFIG_SMALL(
"Calculate spatial information (SI) and temporal information (TI)."),
.priv_class = &siti_class,
}
Definition at line 331 of file vf_siti.c.
static const AVFilterPad avfilter_vf_siti_inputs[]
#define FILTER_PIXFMTS_ARRAY(array)
static const int X_FILTER[9]
#define FILTER_INPUTS(array)
#define AV_PIX_FMT_YUV420P10
static uint16_t convert_full_range(int factor, uint16_t y)
static int config_input(AVFilterLink *inlink)
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
static __device__ float floor(float a)
static enum AVPixelFormat pix_fmts[]
static av_cold void uninit(AVFilterContext *ctx)
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FILTER_OUTPUTS(array)
static const int Y_FILTER[9]
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define AV_PIX_FMT_YUV422P10
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
static av_cold int init(AVFilterContext *ctx)
#define i(width, name, range_min, range_max)
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
static const int factor[16]
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#define flags(name, subs,...)