FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
vf_nnedi.c File Reference
#include <float.h>
#include "libavutil/common.h"
#include "libavutil/float_dsp.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  FrameData
 
struct  NNEDIContext
 

Macros

#define OFFSET(x)   offsetof(NNEDIContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define NUM_NSIZE   7
 
#define NUM_NNS   5
 

Functions

 AVFILTER_DEFINE_CLASS (nnedi)
 
static int config_input (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
static int query_formats (AVFilterContext *ctx)
 
static void copy_pad (const AVFrame *src, FrameData *frame_data, NNEDIContext *s, int fn)
 
static void elliott (float *data, const int n)
 
static void dot_prod (NNEDIContext *s, const float *data, const float *weights, float *vals, const int n, const int len, const float *scale)
 
static void dot_prods (NNEDIContext *s, const float *dataf, const float *weightsf, float *vals, const int n, const int len, const float *scale)
 
static void compute_network0 (NNEDIContext *s, const float *input, const float *weights, uint8_t *d)
 
static void compute_network0_i16 (NNEDIContext *s, const float *inputf, const float *weightsf, uint8_t *d)
 
static void pixel2float48 (const uint8_t *t8, const int pitch, float *p)
 
static void byte2word48 (const uint8_t *t, const int pitch, float *pf)
 
static int32_t process_line0 (const uint8_t *tempu, int width, uint8_t *dstp8, const uint8_t *src3p8, const int src_pitch, const int max_value, const int chroma)
 
static void byte2word64 (const uint8_t *t, const int pitch, float *p)
 
static void compute_network0new (NNEDIContext *s, const float *datai, const float *weights, uint8_t *d)
 
static void evalfunc_0 (NNEDIContext *s, FrameData *frame_data)
 
static void extract_m8 (const uint8_t *srcp8, const int stride, const int xdia, const int ydia, float *mstd, float *input)
 
static void extract_m8_i16 (const uint8_t *srcp, const int stride, const int xdia, const int ydia, float *mstd, float *inputf)
 
static void e2_m16 (float *s, const int n)
 
static void weighted_avg_elliott_mul5_m16 (const float *w, const int n, float *mstd)
 
static void evalfunc_1 (NNEDIContext *s, FrameData *frame_data)
 
static int roundds (const double f)
 
static void select_functions (NNEDIContext *s)
 
static int modnpf (const int m, const int n)
 
static int get_frame (AVFilterContext *ctx, int is_second)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *src)
 
static int request_frame (AVFilterLink *link)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption nnedi_options []
 
static const float exp_lo = -80.0f
 
static const float exp_hi = +80.0f
 
const float min_weight_sum = 1e-10f
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
AVFilter ff_vf_nnedi
 

Macro Definition Documentation

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

Definition at line 104 of file vf_nnedi.c.

Definition at line 105 of file vf_nnedi.c.

#define NUM_NSIZE   7

Definition at line 635 of file vf_nnedi.c.

Referenced by init().

#define NUM_NNS   5

Definition at line 636 of file vf_nnedi.c.

Referenced by init().

Function Documentation

AVFILTER_DEFINE_CLASS ( nnedi  )
static int config_input ( AVFilterLink inlink)
static

Definition at line 150 of file vf_nnedi.c.

static int config_output ( AVFilterLink outlink)
static

Definition at line 167 of file vf_nnedi.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 184 of file vf_nnedi.c.

static void copy_pad ( const AVFrame src,
FrameData frame_data,
NNEDIContext s,
int  fn 
)
static

Definition at line 204 of file vf_nnedi.c.

Referenced by select_functions().

static void elliott ( float *  data,
const int  n 
)
static

Definition at line 260 of file vf_nnedi.c.

Referenced by compute_network0(), and compute_network0_i16().

static void dot_prod ( NNEDIContext s,
const float *  data,
const float *  weights,
float *  vals,
const int  n,
const int  len,
const float *  scale 
)
static

Definition at line 268 of file vf_nnedi.c.

Referenced by compute_network0(), compute_network0_i16(), and select_functions().

static void dot_prods ( NNEDIContext s,
const float *  dataf,
const float *  weightsf,
float *  vals,
const int  n,
const int  len,
const float *  scale 
)
static

Definition at line 281 of file vf_nnedi.c.

Referenced by compute_network0_i16(), and select_functions().

static void compute_network0 ( NNEDIContext s,
const float *  input,
const float *  weights,
uint8_t d 
)
static

Definition at line 297 of file vf_nnedi.c.

Referenced by select_functions().

static void compute_network0_i16 ( NNEDIContext s,
const float *  inputf,
const float *  weightsf,
uint8_t d 
)
static

Definition at line 314 of file vf_nnedi.c.

Referenced by select_functions().

static void pixel2float48 ( const uint8_t t8,
const int  pitch,
float *  p 
)
static

Definition at line 332 of file vf_nnedi.c.

Referenced by select_functions().

static void byte2word48 ( const uint8_t t,
const int  pitch,
float *  pf 
)
static

Definition at line 342 of file vf_nnedi.c.

Referenced by select_functions().

static int32_t process_line0 ( const uint8_t tempu,
int  width,
uint8_t dstp8,
const uint8_t src3p8,
const int  src_pitch,
const int  max_value,
const int  chroma 
)
static

Definition at line 352 of file vf_nnedi.c.

Referenced by select_functions().

static void byte2word64 ( const uint8_t t,
const int  pitch,
float *  p 
)
static

Definition at line 373 of file vf_nnedi.c.

Referenced by select_functions().

static void compute_network0new ( NNEDIContext s,
const float *  datai,
const float *  weights,
uint8_t d 
)
static

Definition at line 383 of file vf_nnedi.c.

Referenced by select_functions().

static void evalfunc_0 ( NNEDIContext s,
FrameData frame_data 
)
static

Definition at line 418 of file vf_nnedi.c.

Referenced by select_functions().

static void extract_m8 ( const uint8_t srcp8,
const int  stride,
const int  xdia,
const int  ydia,
float *  mstd,
float *  input 
)
static

Definition at line 487 of file vf_nnedi.c.

Referenced by select_functions().

static void extract_m8_i16 ( const uint8_t srcp,
const int  stride,
const int  xdia,
const int  ydia,
float *  mstd,
float *  inputf 
)
static

Definition at line 520 of file vf_nnedi.c.

Referenced by select_functions().

static void e2_m16 ( float *  s,
const int  n 
)
static

Definition at line 552 of file vf_nnedi.c.

Referenced by select_functions().

static void weighted_avg_elliott_mul5_m16 ( const float *  w,
const int  n,
float *  mstd 
)
static

Definition at line 562 of file vf_nnedi.c.

Referenced by select_functions().

static void evalfunc_1 ( NNEDIContext s,
FrameData frame_data 
)
static

Definition at line 578 of file vf_nnedi.c.

Referenced by select_functions().

static int roundds ( const double  f)
static

Definition at line 638 of file vf_nnedi.c.

Referenced by init().

static void select_functions ( NNEDIContext s)
static

Definition at line 645 of file vf_nnedi.c.

Referenced by init().

static int modnpf ( const int  m,
const int  n 
)
static

Definition at line 682 of file vf_nnedi.c.

Referenced by get_frame().

static int get_frame ( AVFilterContext ctx,
int  is_second 
)
static

Definition at line 689 of file vf_nnedi.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame src 
)
static

Definition at line 794 of file vf_nnedi.c.

Referenced by request_frame().

static int request_frame ( AVFilterLink link)
static

Definition at line 879 of file vf_nnedi.c.

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 907 of file vf_nnedi.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 1159 of file vf_nnedi.c.

Variable Documentation

const AVOption nnedi_options[]
static

Definition at line 107 of file vf_nnedi.c.

const float exp_lo = -80.0f
static

Definition at line 549 of file vf_nnedi.c.

Referenced by e2_m16().

const float exp_hi = +80.0f
static

Definition at line 550 of file vf_nnedi.c.

Referenced by e2_m16().

const float min_weight_sum = 1e-10f

Definition at line 560 of file vf_nnedi.c.

Referenced by weighted_avg_elliott_mul5_m16().

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
{ NULL }
}
static int filter_frame(AVFilterLink *inlink, AVFrame *src)
Definition: vf_nnedi.c:794
#define NULL
Definition: coverity.c:32
static int config_input(AVFilterLink *inlink)
Definition: vf_nnedi.c:150

Definition at line 1179 of file vf_nnedi.c.

const AVFilterPad outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
.request_frame = request_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int request_frame(AVFilterLink *link)
Definition: vf_nnedi.c:879
static int config_output(AVFilterLink *outlink)
Definition: vf_nnedi.c:167

Definition at line 1189 of file vf_nnedi.c.

AVFilter ff_vf_nnedi
Initial value:
= {
.name = "nnedi",
.description = NULL_IF_CONFIG_SMALL("Apply neural network edge directed interpolation intra-only deinterlacer."),
.priv_size = sizeof(NNEDIContext),
.priv_class = &nnedi_class,
.init = init,
}
static const AVFilterPad outputs[]
Definition: vf_nnedi.c:1189
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_nnedi.c:1159
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static int query_formats(AVFilterContext *ctx)
Definition: vf_nnedi.c:184
static const AVFilterPad inputs[]
Definition: vf_nnedi.c:1179
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition: avfilter.h:130
static int flags
Definition: cpu.c:47
static av_cold int init(AVFilterContext *ctx)
Definition: vf_nnedi.c:907

Definition at line 1199 of file vf_nnedi.c.