FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
vf_dctdnoiz.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/eval.h"
#include "libavutil/opt.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  DCTdnoizContext
 
struct  ThreadData
 

Macros

#define MAX_THREADS   8
 
#define MIN_NBITS   3 /* blocksize = 1<<3 = 8 */
 
#define MAX_NBITS   4 /* blocksize = 1<<4 = 16 */
 
#define DEFAULT_NBITS   3
 
#define OFFSET(x)   offsetof(DCTdnoizContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define DEF_FILTER_FREQ_FUNCS(bsize)
 
#define DCT3X3_0_0   0.5773502691896258f /* 1/sqrt(3) */
 
#define DCT3X3_0_1   0.5773502691896258f /* 1/sqrt(3) */
 
#define DCT3X3_0_2   0.5773502691896258f /* 1/sqrt(3) */
 
#define DCT3X3_1_0   0.7071067811865475f /* 1/sqrt(2) */
 
#define DCT3X3_1_2   -0.7071067811865475f /* -1/sqrt(2) */
 
#define DCT3X3_2_0   0.4082482904638631f /* 1/sqrt(6) */
 
#define DCT3X3_2_1   -0.8164965809277261f /* -2/sqrt(6) */
 
#define DCT3X3_2_2   0.4082482904638631f /* 1/sqrt(6) */
 
#define DECLARE_COLOR_FUNCS(name, r, g, b)
 

Enumerations

enum  { VAR_C, VAR_VARS_NB }
 

Functions

 AVFILTER_DEFINE_CLASS (dctdnoiz)
 
static void av_always_inline fdct8_1d (float *dst, const float *src, int dst_stridea, int dst_strideb, int src_stridea, int src_strideb)
 
static void av_always_inline idct8_1d (float *dst, const float *src, int dst_stridea, int dst_strideb, int src_stridea, int src_strideb, int add)
 
static void av_always_inline fdct16_1d (float *dst, const float *src, int dst_stridea, int dst_strideb, int src_stridea, int src_strideb)
 
static void av_always_inline idct16_1d (float *dst, const float *src, int dst_stridea, int dst_strideb, int src_stridea, int src_strideb, int add)
 
static av_always_inline void color_decorrelation (float **dst, int dst_linesize, const uint8_t *src, int src_linesize, int w, int h, int r, int g, int b)
 
static av_always_inline void color_correlation (uint8_t *dst, int dst_linesize, float **src, int src_linesize, int w, int h, int r, int g, int b)
 
static int config_input (AVFilterLink *inlink)
 
static av_cold int init (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int filter_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const char *const var_names [] = { "c", NULL }
 A simple, relatively efficient and slow DCT image denoiser. More...
 
static const AVOption dctdnoiz_options []
 
static const AVFilterPad dctdnoiz_inputs []
 
static const AVFilterPad dctdnoiz_outputs []
 
AVFilter ff_vf_dctdnoiz
 

Macro Definition Documentation

#define MAX_THREADS   8

Definition at line 39 of file vf_dctdnoiz.c.

Referenced by config_input().

#define MIN_NBITS   3 /* blocksize = 1<<3 = 8 */

Definition at line 73 of file vf_dctdnoiz.c.

#define MAX_NBITS   4 /* blocksize = 1<<4 = 16 */

Definition at line 74 of file vf_dctdnoiz.c.

#define DEFAULT_NBITS   3

Definition at line 75 of file vf_dctdnoiz.c.

#define OFFSET (   x)    offsetof(DCTdnoizContext, x)

Definition at line 77 of file vf_dctdnoiz.c.

Definition at line 78 of file vf_dctdnoiz.c.

#define DEF_FILTER_FREQ_FUNCS (   bsize)

Definition at line 352 of file vf_dctdnoiz.c.

#define DCT3X3_0_0   0.5773502691896258f /* 1/sqrt(3) */

Definition at line 401 of file vf_dctdnoiz.c.

Referenced by color_correlation(), and color_decorrelation().

#define DCT3X3_0_1   0.5773502691896258f /* 1/sqrt(3) */

Definition at line 402 of file vf_dctdnoiz.c.

Referenced by color_correlation(), and color_decorrelation().

#define DCT3X3_0_2   0.5773502691896258f /* 1/sqrt(3) */

Definition at line 403 of file vf_dctdnoiz.c.

Referenced by color_correlation(), and color_decorrelation().

#define DCT3X3_1_0   0.7071067811865475f /* 1/sqrt(2) */

Definition at line 404 of file vf_dctdnoiz.c.

Referenced by color_correlation(), and color_decorrelation().

#define DCT3X3_1_2   -0.7071067811865475f /* -1/sqrt(2) */

Definition at line 405 of file vf_dctdnoiz.c.

Referenced by color_correlation(), and color_decorrelation().

#define DCT3X3_2_0   0.4082482904638631f /* 1/sqrt(6) */

Definition at line 406 of file vf_dctdnoiz.c.

Referenced by color_correlation(), and color_decorrelation().

#define DCT3X3_2_1   -0.8164965809277261f /* -2/sqrt(6) */

Definition at line 407 of file vf_dctdnoiz.c.

Referenced by color_correlation(), and color_decorrelation().

#define DCT3X3_2_2   0.4082482904638631f /* 1/sqrt(6) */

Definition at line 408 of file vf_dctdnoiz.c.

Referenced by color_correlation(), and color_decorrelation().

#define DECLARE_COLOR_FUNCS (   name,
  r,
  g,
  b 
)
Value:
static void color_decorrelation_##name(float **dst, int dst_linesize, \
const uint8_t *src, int src_linesize, \
int w, int h) \
{ \
color_decorrelation(dst, dst_linesize, src, src_linesize, w, h, r, g, b); \
} \
\
static void color_correlation_##name(uint8_t *dst, int dst_linesize, \
float **src, int src_linesize, \
int w, int h) \
{ \
color_correlation(dst, dst_linesize, src, src_linesize, w, h, r, g, b); \
}
const char * g
Definition: vf_curves.c:108
const char * b
Definition: vf_curves.c:109
uint8_t
static av_always_inline void color_correlation(uint8_t *dst, int dst_linesize, float **src, int src_linesize, int w, int h, int r, int g, int b)
Definition: vf_dctdnoiz.c:436
const char * r
Definition: vf_curves.c:107
static av_always_inline void color_decorrelation(float **dst, int dst_linesize, const uint8_t *src, int src_linesize, int w, int h, int r, int g, int b)
Definition: vf_dctdnoiz.c:410
#define src
Definition: vp9dsp.c:530
const char * name
Definition: opengl_enc.c:103

Definition at line 462 of file vf_dctdnoiz.c.

Enumeration Type Documentation

anonymous enum
Enumerator
VAR_C 
VAR_VARS_NB 

Definition at line 37 of file vf_dctdnoiz.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( dctdnoiz  )
static void av_always_inline fdct8_1d ( float *  dst,
const float *  src,
int  dst_stridea,
int  dst_strideb,
int  src_stridea,
int  src_strideb 
)
static

Definition at line 91 of file vf_dctdnoiz.c.

static void av_always_inline idct8_1d ( float *  dst,
const float *  src,
int  dst_stridea,
int  dst_strideb,
int  src_stridea,
int  src_strideb,
int  add 
)
static

Definition at line 129 of file vf_dctdnoiz.c.

static void av_always_inline fdct16_1d ( float *  dst,
const float *  src,
int  dst_stridea,
int  dst_strideb,
int  src_stridea,
int  src_strideb 
)
static

Definition at line 173 of file vf_dctdnoiz.c.

static void av_always_inline idct16_1d ( float *  dst,
const float *  src,
int  dst_stridea,
int  dst_strideb,
int  src_stridea,
int  src_strideb,
int  add 
)
static

Definition at line 257 of file vf_dctdnoiz.c.

static av_always_inline void color_decorrelation ( float **  dst,
int  dst_linesize,
const uint8_t src,
int  src_linesize,
int  w,
int  h,
int  r,
int  g,
int  b 
)
static

Definition at line 410 of file vf_dctdnoiz.c.

static av_always_inline void color_correlation ( uint8_t dst,
int  dst_linesize,
float **  src,
int  src_linesize,
int  w,
int  h,
int  r,
int  g,
int  b 
)
static

Definition at line 436 of file vf_dctdnoiz.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 480 of file vf_dctdnoiz.c.

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 563 of file vf_dctdnoiz.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 597 of file vf_dctdnoiz.c.

static int filter_slice ( AVFilterContext ctx,
void arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 613 of file vf_dctdnoiz.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 661 of file vf_dctdnoiz.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 732 of file vf_dctdnoiz.c.

Variable Documentation

const char* const var_names[] = { "c", NULL }
static

A simple, relatively efficient and slow DCT image denoiser.

See Also
http://www.ipol.im/pub/art/2011/ys-dct/

The DCT factorization used is based on "Fast and numerically stable algorithms for discrete cosine transforms" from Gerlind Plonkaa & Manfred Tasche (DOI: 10.1016/j.laa.2004.07.015).

Definition at line 36 of file vf_dctdnoiz.c.

Referenced by config_input().

const AVOption dctdnoiz_options[]
static
Initial value:
= {
{ "sigma", "set noise sigma constant", OFFSET(sigma), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 999, .flags = FLAGS },
{ "s", "set noise sigma constant", OFFSET(sigma), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 999, .flags = FLAGS },
{ "overlap", "set number of block overlapping pixels", OFFSET(overlap), AV_OPT_TYPE_INT, {.i64=-1}, -1, (1<<MAX_NBITS)-1, .flags = FLAGS },
{ "expr", "set coefficient factor expression", OFFSET(expr_str), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
{ "e", "set coefficient factor expression", OFFSET(expr_str), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
{ "n", "set the block size, expressed in bits", OFFSET(n), AV_OPT_TYPE_INT, {.i64=DEFAULT_NBITS}, MIN_NBITS, MAX_NBITS, .flags = FLAGS },
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define FLAGS
Definition: vf_dctdnoiz.c:78
#define MAX_NBITS
Definition: vf_dctdnoiz.c:74
#define OFFSET(x)
Definition: vf_dctdnoiz.c:77
#define MIN_NBITS
Definition: vf_dctdnoiz.c:73
int n
Definition: avisynth_c.h:547
static int flags
Definition: cpu.c:47
#define DEFAULT_NBITS
Definition: vf_dctdnoiz.c:75

Definition at line 79 of file vf_dctdnoiz.c.

const AVFilterPad dctdnoiz_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_dctdnoiz.c:661
static int config_input(AVFilterLink *inlink)
Definition: vf_dctdnoiz.c:480

Definition at line 749 of file vf_dctdnoiz.c.

const AVFilterPad dctdnoiz_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 759 of file vf_dctdnoiz.c.

AVFilter ff_vf_dctdnoiz
Initial value:
= {
.name = "dctdnoiz",
.description = NULL_IF_CONFIG_SMALL("Denoise frames using 2D DCT."),
.priv_size = sizeof(DCTdnoizContext),
.init = init,
.priv_class = &dctdnoiz_class,
}
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:123
static const AVFilterPad dctdnoiz_inputs[]
Definition: vf_dctdnoiz.c:749
static int query_formats(AVFilterContext *ctx)
Definition: vf_dctdnoiz.c:597
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_dctdnoiz.c:732
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:114
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:386
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:376
static int flags
Definition: cpu.c:47
static const AVFilterPad dctdnoiz_outputs[]
Definition: vf_dctdnoiz.c:759
static av_cold int init(AVFilterContext *ctx)
Definition: vf_dctdnoiz.c:563

Definition at line 767 of file vf_dctdnoiz.c.