39 #define OFFSET(x) offsetof(GBlurContext, x) 40 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM 67 float nu,
float bscale)
71 for (y = 0; y <
height; y++) {
72 for (step = 0; step < steps; step++) {
73 ptr = buffer + width * y;
77 for (x = 1; x <
width; x++)
78 ptr[x] += nu * ptr[x - 1];
79 ptr[x = width - 1] *= bscale;
83 ptr[x - 1] += nu * ptr[x];
94 const int slice_start = (height * jobnr ) / nb_jobs;
95 const int slice_end = (height * (jobnr+1)) / nb_jobs;
97 const int steps = s->
steps;
98 const float nu = s->
nu;
101 s->
horiz_slice(buffer + width * slice_start, width, slice_end - slice_start,
102 steps, nu, boundaryscale);
108 int column_begin,
int column_end,
int steps,
109 float nu,
float boundaryscale,
int column_step)
111 const int numpixels = width *
height;
114 for (x = column_begin; x < column_end;) {
115 for (step = 0; step < steps; step++) {
117 for (k = 0; k < column_step; k++) {
118 ptr[k] *= boundaryscale;
121 for (i = width; i < numpixels; i +=
width) {
122 for (k = 0; k < column_step; k++) {
123 ptr[i + k] += nu * ptr[i - width + k];
126 i = numpixels -
width;
128 for (k = 0; k < column_step; k++)
129 ptr[i + k] *= boundaryscale;
132 for (; i > 0; i -=
width) {
133 for (k = 0; k < column_step; k++)
134 ptr[i - width + k] += nu * ptr[i + k];
147 const int slice_start = (width * jobnr ) / nb_jobs;
148 const int slice_end = (width * (jobnr+1)) / nb_jobs;
150 const int steps = s->
steps;
151 const float nu = s->
nuV;
155 aligned_end = slice_start + (((slice_end - slice_start) >> 3) << 3);
158 steps, nu, boundaryscale, 8);
162 steps, nu, boundaryscale, 1);
170 const float max = s->
flt ? FLT_MAX : (1 << s->
depth) - 1;
171 const float min = s->
flt ? -FLT_MAX : 0.f;
174 const int awidth =
FFALIGN(width, 64);
175 const int slice_start = (height * jobnr ) / nb_jobs;
176 const int slice_end = (height * (jobnr+1)) / nb_jobs;
178 const int slice_size = slice_end - slice_start;
181 slice_size * awidth, postscale, min, max);
271 lambda = (sigma * sigma) / (2.0 * steps);
272 dnu = (1.0 + 2.0 * lambda - sqrt(1.0 + 4.0 * lambda)) / (2.0 * lambda);
273 *postscale = pow(dnu / lambda, steps);
274 *boundaryscale = 1.0 / (1.0 - dnu);
300 for (plane = 0; plane < s->
nb_planes; plane++) {
305 const uint16_t *src16 = (
const uint16_t *)in->
data[plane];
307 uint16_t *dst16 = (uint16_t *)out->
data[
plane];
314 width * ((s->
depth + 7) / 8), height);
321 width *
sizeof(
float), height);
322 }
else if (s->
depth == 8) {
323 for (y = 0; y <
height; y++) {
324 for (x = 0; x <
width; x++) {
331 for (y = 0; y <
height; y++) {
332 for (x = 0; x <
width; x++) {
345 (
uint8_t *)bptr, width *
sizeof(
float),
346 width *
sizeof(
float), height);
347 }
else if (s->
depth == 8) {
348 for (y = 0; y <
height; y++) {
349 for (x = 0; x <
width; x++) {
356 for (y = 0; y <
height; y++) {
357 for (x = 0; x <
width; x++) {
400 .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
static void postscale_c(float *buffer, int length, float postscale, float min, float max)
#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)
static const struct @322 planes[]
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)
#define AV_PIX_FMT_FLAG_FLOAT
The pixel format contains IEEE-754 floating point values.
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)
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
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
#define AV_PIX_FMT_YUV422P9
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...
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
#define AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P10
#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)
#define AV_PIX_FMT_GRAYF32
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
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
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.
#define AV_PIX_FMT_GBRPF32
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define AV_PIX_FMT_GBRAPF32
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
void(* postscale_slice)(float *buffer, int length, float postscale, float min, float max)
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
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.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
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)