FFmpeg
|
#include <float.h>
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/float_dsp.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) ((x)*(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) do { if (ptr) free(ptr); } while (0) |
#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 | INPUT_DENSE(name) |
#define | INPUT_GRU(name) |
#define | RNN_MOVE(dst, src, n) (memmove((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) )) |
#define | RNN_CLEAR(dst, n) (memset((dst), 0, (n)*sizeof(*(dst)))) |
#define | RNN_COPY(dst, src, n) (memcpy((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) )) |
#define | INPUT_SIZE 42 |
#define | OFFSET(x) offsetof(AudioRNNContext, x) |
#define | AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM |
Functions | |
static void | rnnoise_model_free (RNNModel *model) |
static RNNModel * | rnnoise_model_from_file (FILE *f) |
static int | query_formats (AVFilterContext *ctx) |
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 av_cold int | init (AVFilterContext *ctx) |
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 AVFilterPad | outputs [] |
static const AVOption | arnndn_options [] |
AVFilter | ff_af_arnndn |
#define FRAME_SIZE_SHIFT 2 |
Definition at line 47 of file af_arnndn.c.
Referenced by compute_band_corr(), compute_band_energy(), and interp_band_gain().
#define FRAME_SIZE (120<<FRAME_SIZE_SHIFT) |
Definition at line 48 of file af_arnndn.c.
Referenced by activate(), compute_frame_features(), filter_frame(), frame_analysis(), frame_synthesis(), init(), and rnnoise_channel().
#define WINDOW_SIZE (2*FRAME_SIZE) |
Definition at line 49 of file af_arnndn.c.
Referenced by compute_frame_features(), config_input(), forward_transform(), frame_analysis(), frame_synthesis(), init(), inverse_transform(), pitch_search(), and rnnoise_channel().
#define FREQ_SIZE (FRAME_SIZE + 1) |
Definition at line 50 of file af_arnndn.c.
Referenced by forward_transform(), interp_band_gain(), inverse_transform(), pitch_filter(), and rnnoise_channel().
#define PITCH_MIN_PERIOD 60 |
Definition at line 52 of file af_arnndn.c.
Referenced by compute_frame_features().
#define PITCH_MAX_PERIOD 768 |
Definition at line 53 of file af_arnndn.c.
Referenced by compute_frame_features(), and remove_doubling().
#define PITCH_FRAME_SIZE 960 |
Definition at line 54 of file af_arnndn.c.
Referenced by compute_frame_features().
#define PITCH_BUF_SIZE (PITCH_MAX_PERIOD+PITCH_FRAME_SIZE) |
Definition at line 55 of file af_arnndn.c.
Referenced by celt_autocorr(), and compute_frame_features().
#define SQUARE | ( | x | ) | ((x)*(x)) |
Definition at line 57 of file af_arnndn.c.
Referenced by compute_band_energy(), and pitch_filter().
#define NB_BANDS 22 |
Definition at line 59 of file af_arnndn.c.
Referenced by compute_band_corr(), compute_band_energy(), compute_frame_features(), dct(), init(), interp_band_gain(), pitch_filter(), and rnnoise_channel().
#define CEPS_MEM 8 |
Definition at line 61 of file af_arnndn.c.
Referenced by compute_frame_features().
#define NB_DELTA_CEPS 6 |
Definition at line 62 of file af_arnndn.c.
Referenced by compute_frame_features().
#define NB_FEATURES (NB_BANDS+3*NB_DELTA_CEPS+2) |
Definition at line 64 of file af_arnndn.c.
Referenced by compute_frame_features(), and rnnoise_channel().
#define WEIGHTS_SCALE (1.f/256) |
Definition at line 66 of file af_arnndn.c.
Referenced by compute_dense(), and compute_gru().
#define MAX_NEURONS 128 |
Definition at line 68 of file af_arnndn.c.
Referenced by compute_gru(), and compute_rnn().
#define ACTIVATION_TANH 0 |
Definition at line 70 of file af_arnndn.c.
Referenced by compute_dense(), and compute_gru().
#define ACTIVATION_SIGMOID 1 |
Definition at line 71 of file af_arnndn.c.
Referenced by compute_dense(), and compute_gru().
#define ACTIVATION_RELU 2 |
Definition at line 72 of file af_arnndn.c.
Referenced by compute_dense(), and compute_gru().
#define Q15ONE 1.0f |
Definition at line 74 of file af_arnndn.c.
Referenced by pitch_downsample(), and remove_doubling().
#define F_ACTIVATION_TANH 0 |
Definition at line 154 of file af_arnndn.c.
#define F_ACTIVATION_SIGMOID 1 |
Definition at line 155 of file af_arnndn.c.
#define F_ACTIVATION_RELU 2 |
Definition at line 156 of file af_arnndn.c.
#define FREE_DENSE | ( | name | ) |
Referenced by rnnoise_model_free().
#define FREE_GRU | ( | name | ) |
Referenced by rnnoise_model_free().
Referenced by rnnoise_model_from_file().
#define INPUT_VAL | ( | name | ) |
#define INPUT_ACTIVATION | ( | name | ) |
#define INPUT_ARRAY3 | ( | name, | |
len0, | |||
len1, | |||
len2 | |||
) |
#define INPUT_DENSE | ( | name | ) |
Referenced by rnnoise_model_from_file().
#define INPUT_GRU | ( | name | ) |
Referenced by rnnoise_model_from_file().
Definition at line 395 of file af_arnndn.c.
Referenced by compute_frame_features().
#define RNN_CLEAR | ( | dst, | |
n | |||
) | (memset((dst), 0, (n)*sizeof(*(dst)))) |
Definition at line 396 of file af_arnndn.c.
Referenced by celt_lpc(), and compute_frame_features().
Definition at line 397 of file af_arnndn.c.
Referenced by compute_frame_features(), compute_gru(), forward_transform(), frame_analysis(), frame_synthesis(), and inverse_transform().
#define INPUT_SIZE 42 |
Definition at line 1320 of file af_arnndn.c.
Referenced by compute_rnn().
#define OFFSET | ( | x | ) | offsetof(AudioRNNContext, x) |
Definition at line 1534 of file af_arnndn.c.
Definition at line 1535 of file af_arnndn.c.
Definition at line 158 of file af_arnndn.c.
Referenced by rnnoise_model_from_file(), and uninit().
|
static |
Definition at line 188 of file af_arnndn.c.
Referenced by init().
|
static |
Definition at line 314 of file af_arnndn.c.
|
static |
Definition at line 345 of file af_arnndn.c.
|
static |
Definition at line 381 of file af_arnndn.c.
Referenced by rnnoise_channel().
|
static |
Definition at line 399 of file af_arnndn.c.
Referenced by compute_frame_features(), and frame_analysis().
|
static |
Definition at line 414 of file af_arnndn.c.
Referenced by frame_synthesis().
|
static |
Definition at line 437 of file af_arnndn.c.
Referenced by compute_frame_features(), frame_analysis(), and pitch_filter().
|
static |
Definition at line 462 of file af_arnndn.c.
Referenced by compute_frame_features().
|
static |
Definition at line 487 of file af_arnndn.c.
Referenced by compute_frame_features().
|
static |
Definition at line 499 of file af_arnndn.c.
Referenced by rnnoise_channel().
Definition at line 516 of file af_arnndn.c.
Referenced by celt_pitch_xcorr().
|
inlinestatic |
Definition at line 585 of file af_arnndn.c.
Referenced by celt_pitch_xcorr(), pitch_search(), and remove_doubling().
|
static |
Definition at line 596 of file af_arnndn.c.
Referenced by celt_autocorr(), and pitch_search().
|
static |
Definition at line 617 of file af_arnndn.c.
Referenced by pitch_downsample().
Definition at line 655 of file af_arnndn.c.
Referenced by pitch_downsample().
Definition at line 688 of file af_arnndn.c.
Referenced by pitch_downsample().
Definition at line 731 of file af_arnndn.c.
Referenced by compute_frame_features().
|
inlinestatic |
Definition at line 773 of file af_arnndn.c.
Referenced by remove_doubling().
|
static |
Definition at line 787 of file af_arnndn.c.
Referenced by remove_doubling().
|
static |
Definition at line 793 of file af_arnndn.c.
Referenced by compute_frame_features().
|
static |
Definition at line 896 of file af_arnndn.c.
Referenced by pitch_search().
|
static |
Definition at line 943 of file af_arnndn.c.
Referenced by compute_frame_features().
|
static |
Definition at line 1000 of file af_arnndn.c.
Referenced by compute_frame_features(), dct_sad8x8_c(), and ff_mpadsp_init().
|
static |
Definition at line 1010 of file af_arnndn.c.
Referenced by rnnoise_channel().
|
static |
Definition at line 1118 of file af_arnndn.c.
Referenced by pitch_filter(), and rnnoise_channel().
|
static |
Definition at line 1133 of file af_arnndn.c.
Referenced by rnnoise_channel().
|
inlinestatic |
Definition at line 1208 of file af_arnndn.c.
Referenced by compute_dense(), compute_gru(), and sigmoid_approx().
|
inlinestatic |
Definition at line 1236 of file af_arnndn.c.
Referenced by compute_dense(), and compute_gru().
|
static |
Definition at line 1241 of file af_arnndn.c.
Referenced by compute_rnn().
|
static |
Definition at line 1269 of file af_arnndn.c.
Referenced by compute_rnn().
|
static |
Definition at line 1322 of file af_arnndn.c.
Referenced by rnnoise_channel().
|
static |
Definition at line 1350 of file af_arnndn.c.
Referenced by rnnoise_channels().
|
static |
Definition at line 1398 of file af_arnndn.c.
Referenced by filter_frame().
|
static |
Definition at line 1417 of file af_arnndn.c.
Referenced by activate().
|
static |
Definition at line 1439 of file af_arnndn.c.
|
static |
Definition at line 1461 of file af_arnndn.c.
|
static |
Definition at line 1497 of file af_arnndn.c.
AVFILTER_DEFINE_CLASS | ( | arnndn | ) |
|
static |
Definition at line 432 of file af_arnndn.c.
Referenced by compute_band_corr(), compute_band_energy(), and interp_band_gain().
|
static |
Definition at line 792 of file af_arnndn.c.
Referenced by remove_doubling().
|
static |
Definition at line 1164 of file af_arnndn.c.
Referenced by tansig_approx().
|
static |
Definition at line 1517 of file af_arnndn.c.
|
static |
Definition at line 1526 of file af_arnndn.c.
|
static |
Definition at line 1537 of file af_arnndn.c.
AVFilter ff_af_arnndn |
Definition at line 1546 of file af_arnndn.c.