57#define OFFSET(x) offsetof(OWDenoiseContext, x)
58#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
71 { 0, 48, 12, 60, 3, 51, 15, 63 },
72 { 32, 16, 44, 28, 35, 19, 47, 31 },
73 { 8, 56, 4, 52, 11, 59, 7, 55 },
74 { 40, 24, 36, 20, 43, 27, 39, 23 },
75 { 2, 50, 14, 62, 1, 49, 13, 61 },
76 { 34, 18, 46, 30, 33, 17, 45, 29 },
77 { 10, 58, 6, 54, 9, 57, 5, 53 },
78 { 42, 26, 38, 22, 41, 25, 37, 21 },
82 uint8_t *
dst,
int dst_linesize,
83 const uint8_t *
src,
int src_linesize,
86 int x, y,
i, j, depth =
s->depth;
91 if (
s->pixel_depth <= 8) {
92 for (y = 0; y <
height; y++)
93 for(x = 0; x <
width; x++)
94 s->plane[0][0][y*
s->linesize + x] =
src[y*src_linesize + x];
96 const uint16_t *src16 = (
const uint16_t *)
src;
99 for (y = 0; y <
height; y++)
100 for(x = 0; x <
width; x++)
101 s->plane[0][0][y*
s->linesize + x] = src16[y*src_linesize + x];
104 for (
i = 0;
i < depth;
i++)
108 for (
i = 0;
i < depth;
i++) {
109 for (j = 1; j < 4; j++) {
110 for (y = 0; y <
height; y++) {
111 for (x = 0; x <
width; x++) {
112 double v =
s->plane[
i + 1][j][y*
s->linesize + x];
113 if (v > strength) v -= strength;
114 else if (v < -strength) v += strength;
116 s->plane[
i + 1][j][x + y*
s->linesize] = v;
121 for (
i = depth-1;
i >= 0;
i--)
125 if (
s->pixel_depth <= 8) {
126 for (y = 0; y <
height; y++) {
127 for (x = 0; x <
width; x++) {
128 i =
s->plane[0][0][y*
s->linesize + x] +
dither[x&7][y&7]*(1.0/64) + 1.0/128;
129 if ((
unsigned)
i > 255U)
i = ~(
i >> 31);
130 dst[y*dst_linesize + x] =
i;
134 uint16_t *dst16 = (uint16_t *)
dst;
137 for (y = 0; y <
height; y++) {
138 for (x = 0; x <
width; x++) {
139 i =
s->plane[0][0][y*
s->linesize + x];
140 dst16[y*dst_linesize + x] =
i;
154 const int bytes_per_sample = (
s->pixel_depth + 7) / 8;
159 if (
s->luma_strength > 0)
161 if (
s->chroma_strength > 0) {
173 if (
s->luma_strength > 0) {
178 if (
s->chroma_strength > 0) {
189 inlink->
w, inlink->
h);
219 s->hsub =
desc->log2_chroma_w;
220 s->vsub =
desc->log2_chroma_h;
221 s->pixel_depth =
desc->comp[0].depth;
224 for (j = 0; j < 4; j++) {
225 for (
i = 0;
i <=
s->depth;
i++) {
239 for (j = 0; j < 4; j++)
240 for (
i = 0;
i <=
s->depth;
i++)
254 .p.name =
"owdenoise",
256 .p.priv_class = &owdenoise_class,
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static int config_input(AVFilterLink *inlink)
const FFFilter ff_vf_owdenoise
static AVFormatContext * ctx
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
#define AV_CEIL_RSHIFT(a, b)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
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.
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FILTER_PIXFMTS_ARRAY(array)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
Memory handling functions.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P14
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P10
Describe the class of an AVClass context structure.
void * priv
private data for use by the filter
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define av_malloc_array(a, b)
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
static const uint16_t dither[8][8]
static const AVFilterPad owdenoise_inputs[]
static int config_input(AVFilterLink *inlink)
static const AVOption owdenoise_options[]
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static av_cold void uninit(AVFilterContext *ctx)
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
const double ff_wavelet97_coeff[2][5]
Undecimated 9/7 wavelet transform.
void ff_wavelet97_decompose(float *dst[4], const float *src, float *temp[2], const double coeff[2][5], int linesize, int step, int w, int h)
One level of undecimated 2D analysis, filters are mirrored at the plane borders.
void ff_wavelet97_compose(float *dst, float *const src[4], float *temp[2], int linesize, int step, int w, int h)
One level of 2D synthesis, the inverse of ff_wavelet97_decompose() with ff_wavelet97_coeff.