37 #define OFFSET(x) offsetof(GBlurContext, x) 38 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM 56 float nu,
float bscale)
60 for (y = 0; y <
height; y++) {
61 for (step = 0; step < steps; step++) {
62 ptr = buffer + width * y;
66 for (x = 1; x <
width; x++)
67 ptr[x] += nu * ptr[x - 1];
68 ptr[x = width - 1] *= bscale;
72 ptr[x - 1] += nu * ptr[x];
83 const int slice_start = (height * jobnr ) / nb_jobs;
84 const int slice_end = (height * (jobnr+1)) / nb_jobs;
86 const int steps = s->
steps;
87 const float nu = s->
nu;
90 s->
horiz_slice(buffer + width * slice_start, width, slice_end - slice_start,
91 steps, nu, boundaryscale);
97 int column_begin,
int column_end,
int steps,
98 float nu,
float boundaryscale,
int column_step)
100 const int numpixels = width *
height;
103 for (x = column_begin; x < column_end;) {
104 for (step = 0; step < steps; step++) {
106 for (k = 0; k < column_step; k++) {
107 ptr[k] *= boundaryscale;
110 for (i = width; i < numpixels; i +=
width) {
111 for (k = 0; k < column_step; k++) {
112 ptr[i + k] += nu * ptr[i - width + k];
115 i = numpixels -
width;
117 for (k = 0; k < column_step; k++)
118 ptr[i + k] *= boundaryscale;
121 for (; i > 0; i -=
width) {
122 for (k = 0; k < column_step; k++)
123 ptr[i - width + k] += nu * ptr[i + k];
136 const int slice_start = (width * jobnr ) / nb_jobs;
137 const int slice_end = (width * (jobnr+1)) / nb_jobs;
139 const int steps = s->
steps;
140 const float nu = s->
nuV;
144 aligned_end = slice_start + (((slice_end - slice_start) >> 3) << 3);
147 steps, nu, boundaryscale, 8);
151 steps, nu, boundaryscale, 1);
160 const float max = (1 << s->
depth) - 1;
163 const int64_t numpixels = width * (int64_t)height;
164 const unsigned slice_start = (numpixels * jobnr ) / nb_jobs;
165 const unsigned slice_end = (numpixels * (jobnr+1)) / nb_jobs;
170 for (i = slice_start; i <
slice_end; i++) {
172 buffer[
i] = av_clipf(buffer[i], 0.
f, max);
259 lambda = (sigma * sigma) / (2.0 * steps);
260 dnu = (1.0 + 2.0 * lambda - sqrt(1.0 + 4.0 * lambda)) / (2.0 * lambda);
261 *postscale = pow(dnu / lambda, steps);
262 *boundaryscale = 1.0 / (1.0 - dnu);
288 for (plane = 0; plane < s->
nb_planes; plane++) {
293 const uint16_t *src16 = (
const uint16_t *)in->
data[plane];
295 uint16_t *dst16 = (uint16_t *)out->
data[
plane];
302 width * ((s->
depth + 7) / 8), height);
307 for (y = 0; y <
height; y++) {
308 for (x = 0; x <
width; x++) {
315 for (y = 0; y <
height; y++) {
316 for (x = 0; x <
width; x++) {
328 for (y = 0; y <
height; y++) {
329 for (x = 0; x <
width; x++) {
336 for (y = 0; y <
height; y++) {
337 for (x = 0; x <
width; x++) {
380 .priv_class = &gblur_class,
static const AVFilterPad gblur_inputs[]
#define AV_PIX_FMT_YUVA422P16
static int filter_horizontally(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define AV_PIX_FMT_YUVA422P9
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
static int filter_vertically(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
This structure describes decoded (raw) audio or video data.
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_YUVA422P10
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Main libavfilter public API header.
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
int h
agreed upon image height
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV420P12
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
static int config_input(AVFilterLink *inlink)
static void do_vertical_columns(float *buffer, int width, int height, int column_begin, int column_end, int steps, float nu, float boundaryscale, int column_step)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
#define AV_PIX_FMT_GRAY10
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
const char * name
Pad name.
#define AV_PIX_FMT_GRAY12
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
void ff_gblur_init_x86(GBlurContext *s)
static av_cold void uninit(AVFilterContext *ctx)
#define AV_PIX_FMT_YUVA420P9
static int query_formats(AVFilterContext *ctx)
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUVA420P16
void(* horiz_slice)(float *buffer, int width, int height, int steps, float nu, float bscale)
A filter pad used for either input or output.
A link between two filters.
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define i(width, name, range_min, range_max)
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static const FLOAT postscale[64]
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options...
void * priv
private data for use by the filter
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_YUV444P10
AVFILTER_DEFINE_CLASS(gblur)
#define AV_PIX_FMT_GBRAP16
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
#define AV_PIX_FMT_YUV422P9
static const struct @315 planes[]
static void gaussianiir2d(AVFilterContext *ctx, int plane)
#define AV_PIX_FMT_GBRP16
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
#define AV_PIX_FMT_GRAY16
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P10
static const AVFilterPad inputs[]
#define AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_GBRP14
static const AVFilterPad outputs[]
int format
agreed upon media format
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P14
static int filter_postscale(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Used for passing data between threads.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define AV_PIX_FMT_GRAY14
void ff_gblur_init(GBlurContext *s)
#define AV_PIX_FMT_YUV420P10
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static const AVFilterPad gblur_outputs[]
static void set_params(float sigma, int steps, float *postscale, float *boundaryscale, float *nu)
const char * name
Filter name.
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV420P9
AVFilterLink ** outputs
array of pointers to output links
static enum AVPixelFormat pix_fmts[]
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_GBRP12
#define flags(name, subs,...)
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P12
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static const AVOption gblur_options[]
planar GBRA 4:4:4:4 32bpp
#define AV_PIX_FMT_YUVA444P9
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
avfilter_execute_func * execute
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
AVFilterContext * dst
dest filter
const AVPixFmtDescriptor * desc
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
#define av_malloc_array(a, b)
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
int depth
Number of bits in the component.
static void horiz_slice_c(float *buffer, int width, int height, int steps, float nu, float bscale)
AVPixelFormat
Pixel format.
#define AV_PIX_FMT_YUV422P16
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_PIX_FMT_YUVA422P12
#define AV_CEIL_RSHIFT(a, b)