FFmpeg  4.3
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
 Used for passing data between threads. More...
 

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 av_always_inline void color_decorrelation_gbrp (float **dst, int dst_linesize, const uint8_t **src, int src_linesize, int w, int h)
 
static av_always_inline void color_correlation_gbrp (uint8_t **dst, int dst_linesize, float **src, int src_linesize, int w, int h)
 
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

◆ MAX_THREADS

#define MAX_THREADS   8

Definition at line 39 of file vf_dctdnoiz.c.

◆ MIN_NBITS

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

Definition at line 73 of file vf_dctdnoiz.c.

◆ MAX_NBITS

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

Definition at line 74 of file vf_dctdnoiz.c.

◆ DEFAULT_NBITS

#define DEFAULT_NBITS   3

Definition at line 75 of file vf_dctdnoiz.c.

◆ OFFSET

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

Definition at line 77 of file vf_dctdnoiz.c.

◆ FLAGS

Definition at line 78 of file vf_dctdnoiz.c.

◆ DEF_FILTER_FREQ_FUNCS

#define DEF_FILTER_FREQ_FUNCS (   bsize)

Definition at line 352 of file vf_dctdnoiz.c.

◆ DCT3X3_0_0

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

Definition at line 401 of file vf_dctdnoiz.c.

◆ DCT3X3_0_1

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

Definition at line 402 of file vf_dctdnoiz.c.

◆ DCT3X3_0_2

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

Definition at line 403 of file vf_dctdnoiz.c.

◆ DCT3X3_1_0

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

Definition at line 404 of file vf_dctdnoiz.c.

◆ DCT3X3_1_2

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

Definition at line 405 of file vf_dctdnoiz.c.

◆ DCT3X3_2_0

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

Definition at line 406 of file vf_dctdnoiz.c.

◆ DCT3X3_2_1

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

Definition at line 407 of file vf_dctdnoiz.c.

◆ DCT3X3_2_2

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

Definition at line 408 of file vf_dctdnoiz.c.

◆ DECLARE_COLOR_FUNCS

#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); \
}

Definition at line 460 of file vf_dctdnoiz.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
VAR_C 
VAR_VARS_NB 

Definition at line 37 of file vf_dctdnoiz.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( dctdnoiz  )

◆ fdct8_1d()

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.

◆ idct8_1d()

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.

◆ fdct16_1d()

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.

◆ idct16_1d()

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.

◆ color_decorrelation()

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.

◆ color_correlation()

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 435 of file vf_dctdnoiz.c.

◆ color_decorrelation_gbrp()

static av_always_inline void color_decorrelation_gbrp ( float **  dst,
int  dst_linesize,
const uint8_t **  src,
int  src_linesize,
int  w,
int  h 
)
static

Definition at line 478 of file vf_dctdnoiz.c.

Referenced by config_input().

◆ color_correlation_gbrp()

static av_always_inline void color_correlation_gbrp ( uint8_t **  dst,
int  dst_linesize,
float **  src,
int  src_linesize,
int  w,
int  h 
)
static

Definition at line 505 of file vf_dctdnoiz.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 532 of file vf_dctdnoiz.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 619 of file vf_dctdnoiz.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 653 of file vf_dctdnoiz.c.

◆ filter_slice()

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

Definition at line 670 of file vf_dctdnoiz.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 718 of file vf_dctdnoiz.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 789 of file vf_dctdnoiz.c.

Variable Documentation

◆ var_names

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().

◆ dctdnoiz_options

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 }
}

Definition at line 79 of file vf_dctdnoiz.c.

◆ dctdnoiz_inputs

const AVFilterPad dctdnoiz_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
{ NULL }
}

Definition at line 806 of file vf_dctdnoiz.c.

◆ dctdnoiz_outputs

const AVFilterPad dctdnoiz_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}

Definition at line 816 of file vf_dctdnoiz.c.

◆ ff_vf_dctdnoiz

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,
}

Definition at line 824 of file vf_dctdnoiz.c.

DCTdnoizContext
Definition: vf_dctdnoiz.c:41
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_dctdnoiz.c:619
FLAGS
#define FLAGS
Definition: vf_dctdnoiz.c:78
OFFSET
#define OFFSET(x)
Definition: vf_dctdnoiz.c:77
DEFAULT_NBITS
#define DEFAULT_NBITS
Definition: vf_dctdnoiz.c:75
b
#define b
Definition: input.c:41
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_dctdnoiz.c:789
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_dctdnoiz.c:532
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_dctdnoiz.c:653
dctdnoiz_outputs
static const AVFilterPad dctdnoiz_outputs[]
Definition: vf_dctdnoiz.c:816
thread_data::src_linesize
int src_linesize
Definition: vf_colorlevels.c:112
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_dctdnoiz.c:718
g
const char * g
Definition: vf_curves.c:115
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
NULL
#define NULL
Definition: coverity.c:32
thread_data::dst_linesize
int dst_linesize
Definition: vf_colorlevels.c:111
src
#define src
Definition: vp8dsp.c:254
inputs
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
Definition: filter_design.txt:243
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:186
MAX_NBITS
#define MAX_NBITS
Definition: vf_dctdnoiz.c:74
r
#define r
Definition: input.c:40
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#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:125
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:226
uint8_t
uint8_t
Definition: audio_convert.c:194
w
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo ug o o w
Definition: fate.txt:150
dctdnoiz_inputs
static const AVFilterPad dctdnoiz_inputs[]
Definition: vf_dctdnoiz.c:806
MIN_NBITS
#define MIN_NBITS
Definition: vf_dctdnoiz.c:73
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:564
h
h
Definition: vp9dsp_template.c:2038
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:227