FFmpeg
Loading...
Searching...
No Matches
af_arnndn.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/file_open.h"
#include "libavutil/float_dsp.h"
#include "libavutil/mem.h"
#include "libavutil/mem_internal.h"
#include "libavutil/opt.h"
#include "libavutil/tx.h"
#include "avfilter.h"
#include "audio.h"
#include "filters.h"
#include "formats.h"

Go to the source code of this file.

Data Structures

struct  DenseLayer
 
struct  GRULayer
 
struct  RNNModel
 
struct  RNNState
 
struct  DenoiseState
 
struct  AudioRNNContext
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

#define FRAME_SIZE_SHIFT   2
 
#define FRAME_SIZE   (120<<FRAME_SIZE_SHIFT)
 
#define WINDOW_SIZE   (2*FRAME_SIZE)
 
#define FREQ_SIZE   (FRAME_SIZE + 1)
 
#define PITCH_MIN_PERIOD   60
 
#define PITCH_MAX_PERIOD   768
 
#define PITCH_FRAME_SIZE   960
 
#define PITCH_BUF_SIZE   (PITCH_MAX_PERIOD+PITCH_FRAME_SIZE)
 
#define SQUARE(x)
 
#define NB_BANDS   22
 
#define CEPS_MEM   8
 
#define NB_DELTA_CEPS   6
 
#define NB_FEATURES   (NB_BANDS+3*NB_DELTA_CEPS+2)
 
#define WEIGHTS_SCALE   (1.f/256)
 
#define MAX_NEURONS   128
 
#define ACTIVATION_TANH   0
 
#define ACTIVATION_SIGMOID   1
 
#define ACTIVATION_RELU   2
 
#define Q15ONE   1.0f
 
#define F_ACTIVATION_TANH   0
 
#define F_ACTIVATION_SIGMOID   1
 
#define F_ACTIVATION_RELU   2
 
#define FREE_MAYBE(ptr)
 
#define FREE_DENSE(name)
 
#define FREE_GRU(name)
 
#define ALLOC_LAYER(type, name)
 
#define INPUT_VAL(name)
 
#define INPUT_ACTIVATION(name)
 
#define INPUT_ARRAY(name, len)
 
#define INPUT_ARRAY3(name, len0, len1, len2)
 
#define NEW_LINE()
 
#define INPUT_DENSE(name)
 
#define INPUT_GRU(name)
 
#define RNN_MOVE(dst, src, n)
 
#define RNN_CLEAR(dst, n)
 
#define RNN_COPY(dst, src, n)
 
#define INPUT_SIZE   42
 
#define OFFSET(x)
 
#define AF   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 

Functions

static void rnnoise_model_free (RNNModel *model)
 
static int rnnoise_model_from_file (FILE *f, RNNModel **rnn)
 
static int query_formats (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
static int config_input (AVFilterLink *inlink)
 
static void biquad (float *y, float mem[2], const float *x, const float *b, const float *a, int N)
 
static void forward_transform (DenoiseState *st, AVComplexFloat *out, const float *in)
 
static void inverse_transform (DenoiseState *st, float *out, const AVComplexFloat *in)
 
static void compute_band_energy (float *bandE, const AVComplexFloat *X)
 
static void compute_band_corr (float *bandE, const AVComplexFloat *X, const AVComplexFloat *P)
 
static void frame_analysis (AudioRNNContext *s, DenoiseState *st, AVComplexFloat *X, float *Ex, const float *in)
 
static void frame_synthesis (AudioRNNContext *s, DenoiseState *st, float *out, const AVComplexFloat *y)
 
static void xcorr_kernel (const float *x, const float *y, float sum[4], int len)
 
static float celt_inner_prod (const float *x, const float *y, int N)
 
static void celt_pitch_xcorr (const float *x, const float *y, float *xcorr, int len, int max_pitch)
 
static int celt_autocorr (const float *x, float *ac, const float *window, int overlap, int lag, int n)
 
static void celt_lpc (float *lpc, const float *ac, int p)
 
static void celt_fir5 (const float *x, const float *num, float *y, int N, float *mem)
 
static void pitch_downsample (float *x[], float *x_lp, int len, int C)
 
static void dual_inner_prod (const float *x, const float *y01, const float *y02, int N, float *xy1, float *xy2)
 
static float compute_pitch_gain (float xy, float xx, float yy)
 
static float remove_doubling (float *x, int maxperiod, int minperiod, int N, int *T0_, int prev_period, float prev_gain)
 
static void find_best_pitch (float *xcorr, float *y, int len, int max_pitch, int *best_pitch)
 
static void pitch_search (const float *x_lp, float *y, int len, int max_pitch, int *pitch)
 
static void dct (AudioRNNContext *s, float *out, const float *in)
 
static int compute_frame_features (AudioRNNContext *s, DenoiseState *st, AVComplexFloat *X, AVComplexFloat *P, float *Ex, float *Ep, float *Exp, float *features, const float *in)
 
static void interp_band_gain (float *g, const float *bandE)
 
static void pitch_filter (AVComplexFloat *X, const AVComplexFloat *P, const float *Ex, const float *Ep, const float *Exp, const float *g)
 
static float tansig_approx (float x)
 
static float sigmoid_approx (float x)
 
static void compute_dense (const DenseLayer *layer, float *output, const float *input)
 
static void compute_gru (AudioRNNContext *s, const GRULayer *gru, float *state, const float *input)
 
static void compute_rnn (AudioRNNContext *s, RNNState *rnn, float *gains, float *vad, const float *input)
 
static float rnnoise_channel (AudioRNNContext *s, DenoiseState *st, float *out, const float *in, int disabled)
 
static int rnnoise_channels (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int activate (AVFilterContext *ctx)
 
static int open_model (AVFilterContext *ctx, RNNModel **model)
 
static av_cold int init (AVFilterContext *ctx)
 
static void free_model (AVFilterContext *ctx, int n)
 
static int process_command (AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
 
static av_cold void uninit (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS (arnndn)
 

Variables

static const uint8_t eband5ms []
 
static const uint8_t second_check [16] = {0, 0, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 5, 2, 3, 2}
 
static const float tansig_table [201]
 
static const AVFilterPad inputs []
 
static const AVOption arnndn_options []
 
const FFFilter ff_af_arnndn
 

Macro Definition Documentation

◆ FRAME_SIZE_SHIFT

#define FRAME_SIZE_SHIFT   2

Definition at line 46 of file af_arnndn.c.

Referenced by compute_band_corr(), compute_band_energy(), and interp_band_gain().

◆ FRAME_SIZE

#define FRAME_SIZE   (120<<FRAME_SIZE_SHIFT)

Definition at line 47 of file af_arnndn.c.

◆ WINDOW_SIZE

◆ FREQ_SIZE

#define FREQ_SIZE   (FRAME_SIZE + 1)

◆ PITCH_MIN_PERIOD

#define PITCH_MIN_PERIOD   60

Definition at line 51 of file af_arnndn.c.

Referenced by compute_frame_features().

◆ PITCH_MAX_PERIOD

#define PITCH_MAX_PERIOD   768

Definition at line 52 of file af_arnndn.c.

Referenced by compute_frame_features(), and remove_doubling().

◆ PITCH_FRAME_SIZE

#define PITCH_FRAME_SIZE   960

Definition at line 53 of file af_arnndn.c.

Referenced by compute_frame_features().

◆ PITCH_BUF_SIZE

#define PITCH_BUF_SIZE   (PITCH_MAX_PERIOD+PITCH_FRAME_SIZE)

Definition at line 54 of file af_arnndn.c.

Referenced by celt_autocorr(), and compute_frame_features().

◆ SQUARE

#define SQUARE ( x)
Value:
((x)*(x))

Definition at line 56 of file af_arnndn.c.

Referenced by compute_band_energy(), lfo_get_value(), and pitch_filter().

◆ NB_BANDS

◆ CEPS_MEM

#define CEPS_MEM   8

Definition at line 60 of file af_arnndn.c.

Referenced by compute_frame_features().

◆ NB_DELTA_CEPS

#define NB_DELTA_CEPS   6

Definition at line 61 of file af_arnndn.c.

Referenced by compute_frame_features().

◆ NB_FEATURES

#define NB_FEATURES   (NB_BANDS+3*NB_DELTA_CEPS+2)

Definition at line 63 of file af_arnndn.c.

Referenced by compute_frame_features(), and rnnoise_channel().

◆ WEIGHTS_SCALE

#define WEIGHTS_SCALE   (1.f/256)

Definition at line 65 of file af_arnndn.c.

Referenced by compute_dense(), and compute_gru().

◆ MAX_NEURONS

#define MAX_NEURONS   128

Definition at line 67 of file af_arnndn.c.

Referenced by compute_gru(), and compute_rnn().

◆ ACTIVATION_TANH

#define ACTIVATION_TANH   0

Definition at line 69 of file af_arnndn.c.

Referenced by compute_dense(), and compute_gru().

◆ ACTIVATION_SIGMOID

#define ACTIVATION_SIGMOID   1

Definition at line 70 of file af_arnndn.c.

Referenced by compute_dense(), and compute_gru().

◆ ACTIVATION_RELU

#define ACTIVATION_RELU   2

Definition at line 71 of file af_arnndn.c.

Referenced by compute_dense(), and compute_gru().

◆ Q15ONE

#define Q15ONE   1.0f

Definition at line 73 of file af_arnndn.c.

Referenced by pitch_downsample(), and remove_doubling().

◆ F_ACTIVATION_TANH

#define F_ACTIVATION_TANH   0

Definition at line 153 of file af_arnndn.c.

◆ F_ACTIVATION_SIGMOID

#define F_ACTIVATION_SIGMOID   1

Definition at line 154 of file af_arnndn.c.

◆ F_ACTIVATION_RELU

#define F_ACTIVATION_RELU   2

Definition at line 155 of file af_arnndn.c.

◆ FREE_MAYBE

#define FREE_MAYBE ( ptr)
Value:
do { if (ptr) free(ptr); } while (0)

◆ FREE_DENSE

#define FREE_DENSE ( name)
Value:
do { \
if (model->name) { \
av_free((void *) model->name->input_weights); \
av_free((void *) model->name->bias); \
av_free((void *) model->name); \
} \
} while (0)

Referenced by rnnoise_model_free().

◆ FREE_GRU

#define FREE_GRU ( name)
Value:
do { \
if (model->name) { \
av_free((void *) model->name->input_weights); \
av_free((void *) model->name->recurrent_weights); \
av_free((void *) model->name->bias); \
av_free((void *) model->name); \
} \
} while (0)

Referenced by rnnoise_model_free().

◆ ALLOC_LAYER

#define ALLOC_LAYER ( type,
name )
Value:
name = av_calloc(1, sizeof(type)); \
if (!name) { \
rnnoise_model_free(ret); \
return AVERROR(ENOMEM); \
} \
ret->name = name
#define AVERROR(e)
Definition error.h:45
cl_device_type type
void * av_calloc(size_t nmemb, size_t size)
Definition mem.c:264
const char * name
Definition qsvenc.c:142

Referenced by rnnoise_model_from_file().

◆ INPUT_VAL

#define INPUT_VAL ( name)
Value:
do { \
if (fscanf(f, "%d", &in) != 1 || in < 0 || in > 128) { \
rnnoise_model_free(ret); \
return AVERROR(EINVAL); \
} \
name = in; \
} while (0)
#define f(width, name)
Definition cbs_vp8.c:236

◆ INPUT_ACTIVATION

#define INPUT_ACTIVATION ( name)
Value:
do { \
int activation; \
INPUT_VAL(activation); \
switch (activation) { \
break; \
break; \
default: \
} \
} while (0)
#define F_ACTIVATION_RELU
Definition af_arnndn.c:155
#define ACTIVATION_TANH
Definition af_arnndn.c:69
#define F_ACTIVATION_SIGMOID
Definition af_arnndn.c:154
#define ACTIVATION_SIGMOID
Definition af_arnndn.c:70
#define ACTIVATION_RELU
Definition af_arnndn.c:71

◆ INPUT_ARRAY

#define INPUT_ARRAY ( name,
len )
Value:
do { \
float *values = av_calloc((len), sizeof(float)); \
if (!values) { \
rnnoise_model_free(ret); \
return AVERROR(ENOMEM); \
} \
name = values; \
for (int i = 0; i < (len); i++) { \
if (fscanf(f, "%d", &in) != 1) { \
rnnoise_model_free(ret); \
return AVERROR(EINVAL); \
} \
values[i] = in; \
} \
} while (0)
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
int len

◆ INPUT_ARRAY3

#define INPUT_ARRAY3 ( name,
len0,
len1,
len2 )
Value:
do { \
float *values = av_calloc(FFALIGN((len0), 4) * FFALIGN((len1), 4) * (len2), sizeof(float)); \
if (!values) { \
rnnoise_model_free(ret); \
return AVERROR(ENOMEM); \
} \
name = values; \
for (int k = 0; k < (len0); k++) { \
for (int i = 0; i < (len2); i++) { \
for (int j = 0; j < (len1); j++) { \
if (fscanf(f, "%d", &in) != 1) { \
rnnoise_model_free(ret); \
return AVERROR(EINVAL); \
} \
values[j * (len2) * FFALIGN((len0), 4) + i * FFALIGN((len0), 4) + k] = in; \
} \
} \
} \
} while (0)
#define FFALIGN(x, a)
Definition macros.h:78

◆ NEW_LINE

#define NEW_LINE ( )
Value:
do { \
int c; \
while ((c = fgetc(f)) != EOF) { \
if (c == '\n') \
break; \
} \
} while (0)
static double c[64]

◆ INPUT_DENSE

#define INPUT_DENSE ( name)
Value:
do { \
INPUT_VAL(name->nb_inputs); \
INPUT_VAL(name->nb_neurons); \
ret->name ## _size = name->nb_neurons; \
INPUT_ACTIVATION(name->activation); \
NEW_LINE(); \
INPUT_ARRAY(name->input_weights, name->nb_inputs * name->nb_neurons); \
NEW_LINE(); \
INPUT_ARRAY(name->bias, name->nb_neurons); \
NEW_LINE(); \
} while (0)

Referenced by rnnoise_model_from_file().

◆ INPUT_GRU

#define INPUT_GRU ( name)
Value:
do { \
INPUT_VAL(name->nb_inputs); \
INPUT_VAL(name->nb_neurons); \
ret->name ## _size = name->nb_neurons; \
INPUT_ACTIVATION(name->activation); \
NEW_LINE(); \
INPUT_ARRAY3(name->input_weights, name->nb_inputs, name->nb_neurons, 3); \
NEW_LINE(); \
INPUT_ARRAY3(name->recurrent_weights, name->nb_neurons, name->nb_neurons, 3); \
NEW_LINE(); \
INPUT_ARRAY(name->bias, name->nb_neurons * 3); \
NEW_LINE(); \
} while (0)

Referenced by rnnoise_model_from_file().

◆ RNN_MOVE

#define RNN_MOVE ( dst,
src,
n )
Value:
(memmove((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) ))
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
#define src
Definition vp8dsp.c:248

Definition at line 405 of file af_arnndn.c.

Referenced by compute_frame_features().

◆ RNN_CLEAR

#define RNN_CLEAR ( dst,
n )
Value:
(memset((dst), 0, (n)*sizeof(*(dst))))

Definition at line 406 of file af_arnndn.c.

Referenced by celt_lpc(), and compute_frame_features().

◆ RNN_COPY

#define RNN_COPY ( dst,
src,
n )
Value:
(memcpy((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) ))

Definition at line 407 of file af_arnndn.c.

Referenced by compute_frame_features(), compute_gru(), forward_transform(), frame_analysis(), frame_synthesis(), and inverse_transform().

◆ INPUT_SIZE

#define INPUT_SIZE   42

Definition at line 1332 of file af_arnndn.c.

Referenced by check_yuv2packed1(), check_yuv2packed2(), check_yuv2packedX(), and compute_rnn().

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 1589 of file af_arnndn.c.

◆ AF

Function Documentation

◆ rnnoise_model_free()

static void rnnoise_model_free ( RNNModel * model)
static

Definition at line 157 of file af_arnndn.c.

Referenced by free_model(), and rnnoise_model_from_file().

◆ rnnoise_model_from_file()

static int rnnoise_model_from_file ( FILE * f,
RNNModel ** rnn )
static

Definition at line 187 of file af_arnndn.c.

Referenced by open_model().

◆ query_formats()

static int query_formats ( const AVFilterContext * ctx,
AVFilterFormatsConfig ** cfg_in,
AVFilterFormatsConfig ** cfg_out )
static

Definition at line 330 of file af_arnndn.c.

◆ config_input()

static int config_input ( AVFilterLink * inlink)
static

Definition at line 347 of file af_arnndn.c.

Referenced by process_command().

◆ biquad()

static void biquad ( float * y,
float mem[2],
const float * x,
const float * b,
const float * a,
int N )
static

Definition at line 391 of file af_arnndn.c.

◆ forward_transform()

static void forward_transform ( DenoiseState * st,
AVComplexFloat * out,
const float * in )
static

Definition at line 409 of file af_arnndn.c.

Referenced by compute_frame_features(), and frame_analysis().

◆ inverse_transform()

static void inverse_transform ( DenoiseState * st,
float * out,
const AVComplexFloat * in )
static

Definition at line 424 of file af_arnndn.c.

Referenced by frame_synthesis().

◆ compute_band_energy()

static void compute_band_energy ( float * bandE,
const AVComplexFloat * X )
static

Definition at line 447 of file af_arnndn.c.

Referenced by compute_frame_features(), frame_analysis(), and pitch_filter().

◆ compute_band_corr()

static void compute_band_corr ( float * bandE,
const AVComplexFloat * X,
const AVComplexFloat * P )
static

Definition at line 472 of file af_arnndn.c.

Referenced by compute_frame_features().

◆ frame_analysis()

static void frame_analysis ( AudioRNNContext * s,
DenoiseState * st,
AVComplexFloat * X,
float * Ex,
const float * in )
static

Definition at line 497 of file af_arnndn.c.

Referenced by compute_frame_features().

◆ frame_synthesis()

static void frame_synthesis ( AudioRNNContext * s,
DenoiseState * st,
float * out,
const AVComplexFloat * y )
static

Definition at line 509 of file af_arnndn.c.

Referenced by rnnoise_channel().

◆ xcorr_kernel()

static void xcorr_kernel ( const float * x,
const float * y,
float sum[4],
int len )
inlinestatic

Definition at line 526 of file af_arnndn.c.

Referenced by celt_pitch_xcorr().

◆ celt_inner_prod()

static float celt_inner_prod ( const float * x,
const float * y,
int N )
inlinestatic

Definition at line 595 of file af_arnndn.c.

Referenced by celt_pitch_xcorr(), pitch_search(), and remove_doubling().

◆ celt_pitch_xcorr()

static void celt_pitch_xcorr ( const float * x,
const float * y,
float * xcorr,
int len,
int max_pitch )
static

Definition at line 606 of file af_arnndn.c.

Referenced by celt_autocorr(), and pitch_search().

◆ celt_autocorr()

static int celt_autocorr ( const float * x,
float * ac,
const float * window,
int overlap,
int lag,
int n )
static

Definition at line 627 of file af_arnndn.c.

Referenced by pitch_downsample().

◆ celt_lpc()

static void celt_lpc ( float * lpc,
const float * ac,
int p )
static

Definition at line 665 of file af_arnndn.c.

Referenced by pitch_downsample().

◆ celt_fir5()

static void celt_fir5 ( const float * x,
const float * num,
float * y,
int N,
float * mem )
static

Definition at line 698 of file af_arnndn.c.

Referenced by pitch_downsample().

◆ pitch_downsample()

static void pitch_downsample ( float * x[],
float * x_lp,
int len,
int C )
static

Definition at line 741 of file af_arnndn.c.

Referenced by compute_frame_features().

◆ dual_inner_prod()

static void dual_inner_prod ( const float * x,
const float * y01,
const float * y02,
int N,
float * xy1,
float * xy2 )
inlinestatic

Definition at line 783 of file af_arnndn.c.

Referenced by remove_doubling().

◆ compute_pitch_gain()

static float compute_pitch_gain ( float xy,
float xx,
float yy )
static

Definition at line 797 of file af_arnndn.c.

Referenced by remove_doubling().

◆ remove_doubling()

static float remove_doubling ( float * x,
int maxperiod,
int minperiod,
int N,
int * T0_,
int prev_period,
float prev_gain )
static

Definition at line 803 of file af_arnndn.c.

Referenced by compute_frame_features().

◆ find_best_pitch()

static void find_best_pitch ( float * xcorr,
float * y,
int len,
int max_pitch,
int * best_pitch )
static

Definition at line 906 of file af_arnndn.c.

Referenced by pitch_search().

◆ pitch_search()

static void pitch_search ( const float * x_lp,
float * y,
int len,
int max_pitch,
int * pitch )
static

Definition at line 953 of file af_arnndn.c.

Referenced by compute_frame_features().

◆ dct()

static void dct ( AudioRNNContext * s,
float * out,
const float * in )
static

Definition at line 1010 of file af_arnndn.c.

Referenced by compute_frame_features(), and dct_error().

◆ compute_frame_features()

static int compute_frame_features ( AudioRNNContext * s,
DenoiseState * st,
AVComplexFloat * X,
AVComplexFloat * P,
float * Ex,
float * Ep,
float * Exp,
float * features,
const float * in )
static

Definition at line 1020 of file af_arnndn.c.

Referenced by rnnoise_channel().

◆ interp_band_gain()

static void interp_band_gain ( float * g,
const float * bandE )
static

Definition at line 1130 of file af_arnndn.c.

Referenced by pitch_filter(), and rnnoise_channel().

◆ pitch_filter()

static void pitch_filter ( AVComplexFloat * X,
const AVComplexFloat * P,
const float * Ex,
const float * Ep,
const float * Exp,
const float * g )
static

Definition at line 1145 of file af_arnndn.c.

Referenced by rnnoise_channel().

◆ tansig_approx()

static float tansig_approx ( float x)
inlinestatic

Definition at line 1220 of file af_arnndn.c.

Referenced by compute_dense(), compute_gru(), and sigmoid_approx().

◆ sigmoid_approx()

static float sigmoid_approx ( float x)
inlinestatic

Definition at line 1248 of file af_arnndn.c.

Referenced by compute_dense(), and compute_gru().

◆ compute_dense()

static void compute_dense ( const DenseLayer * layer,
float * output,
const float * input )
static

Definition at line 1253 of file af_arnndn.c.

Referenced by compute_rnn().

◆ compute_gru()

static void compute_gru ( AudioRNNContext * s,
const GRULayer * gru,
float * state,
const float * input )
static

Definition at line 1281 of file af_arnndn.c.

Referenced by compute_rnn().

◆ compute_rnn()

static void compute_rnn ( AudioRNNContext * s,
RNNState * rnn,
float * gains,
float * vad,
const float * input )
static

Definition at line 1334 of file af_arnndn.c.

Referenced by rnnoise_channel().

◆ rnnoise_channel()

static float rnnoise_channel ( AudioRNNContext * s,
DenoiseState * st,
float * out,
const float * in,
int disabled )
static

Definition at line 1362 of file af_arnndn.c.

Referenced by rnnoise_channels().

◆ rnnoise_channels()

static int rnnoise_channels ( AVFilterContext * ctx,
void * arg,
int jobnr,
int nb_jobs )
static

Definition at line 1410 of file af_arnndn.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink * inlink,
AVFrame * in )
static

Definition at line 1429 of file af_arnndn.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext * ctx)
static

Definition at line 1451 of file af_arnndn.c.

◆ open_model()

static int open_model ( AVFilterContext * ctx,
RNNModel ** model )
static

Definition at line 1473 of file af_arnndn.c.

Referenced by init(), and process_command().

◆ init()

static av_cold int init ( AVFilterContext * ctx)
static

Definition at line 1495 of file af_arnndn.c.

◆ free_model()

static void free_model ( AVFilterContext * ctx,
int n )
static

Definition at line 1524 of file af_arnndn.c.

Referenced by process_command(), and uninit().

◆ process_command()

static int process_command ( AVFilterContext * ctx,
const char * cmd,
const char * args,
char * res,
int res_len,
int flags )
static

Definition at line 1538 of file af_arnndn.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 1568 of file af_arnndn.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( arnndn )

Variable Documentation

◆ eband5ms

const uint8_t eband5ms[]
static
Initial value:
= {
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 34, 40, 48, 60, 78, 100
}

Definition at line 442 of file af_arnndn.c.

Referenced by compute_band_corr(), compute_band_energy(), and interp_band_gain().

◆ second_check

const uint8_t second_check[16] = {0, 0, 3, 2, 3, 2, 5, 2, 3, 2, 3, 2, 5, 2, 3, 2}
static

Definition at line 802 of file af_arnndn.c.

Referenced by remove_doubling().

◆ tansig_table

const float tansig_table[201]
static

Definition at line 1176 of file af_arnndn.c.

Referenced by tansig_approx().

◆ inputs

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
},
}
static int config_input(AVFilterLink *inlink)
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201

Definition at line 1581 of file af_arnndn.c.

◆ arnndn_options

const AVOption arnndn_options[]
static
Initial value:
= {
{ "model", "set model name", OFFSET(model_name), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, AF },
{ "m", "set model name", OFFSET(model_name), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, AF },
{ "mix", "set output vs input mix", OFFSET(mix), AV_OPT_TYPE_FLOAT, {.dbl=1.0},-1, 1, AF },
{ NULL }
}
#define AF
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition opt.h:270
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
static int mix(int c0, int c1)
Definition 4xm.c:717

Definition at line 1592 of file af_arnndn.c.

◆ ff_af_arnndn

const FFFilter ff_af_arnndn
Initial value:
= {
.p.name = "arnndn",
.p.description = NULL_IF_CONFIG_SMALL("Reduce noise from speech using Recurrent Neural Networks."),
.p.priv_class = &arnndn_class,
.priv_size = sizeof(AudioRNNContext),
.init = init,
.process_command = process_command,
}
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition aeval.c:246
static const AVFilterPad inputs[]
Definition af_aap.c:299
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition audio.c:34
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
#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:204
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_QUERY_FUNC2(func)
Definition filters.h:241
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88

Definition at line 1601 of file af_arnndn.c.