Unified · Split
| @@ -107,6 +107,7 @@ typedef struct AudioFFTDeNoiseContext { · 106 unmodified lines | |||
| 107 | 107 | ||
| 108 | int format; | 108 | int format; |
| 109 | size_t sample_size; | 109 | size_t sample_size; |
| 110 | size_t complex_sample_size; | ||
| 110 | 111 | ||
| 111 | float noise_reduction; | 112 | float noise_reduction; |
| 112 | float noise_floor; | 113 | float noise_floor; |
| @@ -627,7 +628,6 @@ static int config_input(AVFilterLink *inlink) · 514 unmodified lines | |||
| 627 | { | 628 | { |
| 628 | AVFilterContext *ctx = inlink->dst; | 629 | AVFilterContext *ctx = inlink->dst; |
| 629 | AudioFFTDeNoiseContext *s = ctx->priv; | 630 | AudioFFTDeNoiseContext *s = ctx->priv; |
| 630 | size_t complex_sample_size; | ||
| 631 | double wscale, sar, sum, sdiv; | 631 | double wscale, sar, sum, sdiv; |
| 632 | int i, j, k, m, n, ret, tx_type; | 632 | int i, j, k, m, n, ret, tx_type; |
| 633 | double dscale = 1.; | 633 | double dscale = 1.; |
| @@ -639,13 +639,13 @@ static int config_input(AVFilterLink *inlink) · 5 unmodified lines | |||
| 639 | switch (s->format) { | 639 | switch (s->format) { |
| 640 | case AV_SAMPLE_FMT_FLTP: | 640 | case AV_SAMPLE_FMT_FLTP: |
| 641 | s->sample_size = sizeof(float); | 641 | s->sample_size = sizeof(float); |
| 642 | complex_sample_size = sizeof(AVComplexFloat); | 642 | s->complex_sample_size = sizeof(AVComplexFloat); |
| 643 | tx_type = AV_TX_FLOAT_RDFT; | 643 | tx_type = AV_TX_FLOAT_RDFT; |
| 644 | scale = &fscale; | 644 | scale = &fscale; |
| 645 | break; | 645 | break; |
| 646 | case AV_SAMPLE_FMT_DBLP: | 646 | case AV_SAMPLE_FMT_DBLP: |
| 647 | s->sample_size = sizeof(double); | 647 | s->sample_size = sizeof(double); |
| 648 | complex_sample_size = sizeof(AVComplexDouble); | 648 | s->complex_sample_size = sizeof(AVComplexDouble); |
| 649 | tx_type = AV_TX_DOUBLE_RDFT; | 649 | tx_type = AV_TX_DOUBLE_RDFT; |
| 650 | scale = &dscale; | 650 | scale = &dscale; |
| 651 | break; | 651 | break; |
| @@ -753,7 +753,7 @@ static int config_input(AVFilterLink *inlink) · 101 unmodified lines | |||
| 753 | dnch->rel_var = av_calloc(s->bin_count, sizeof(*dnch->rel_var)); | 753 | dnch->rel_var = av_calloc(s->bin_count, sizeof(*dnch->rel_var)); |
| 754 | dnch->min_abs_var = av_calloc(s->bin_count, sizeof(*dnch->min_abs_var)); | 754 | dnch->min_abs_var = av_calloc(s->bin_count, sizeof(*dnch->min_abs_var)); |
| 755 | dnch->fft_in = av_calloc(s->fft_length2, s->sample_size); | 755 | dnch->fft_in = av_calloc(s->fft_length2, s->sample_size); |
| 756 | dnch->fft_out = av_calloc(s->fft_length2 + 1, complex_sample_size); | 756 | dnch->fft_out = av_calloc(s->fft_length2 + 1, s->complex_sample_size); |
| 757 | ret = av_tx_init(&dnch->fft, &dnch->tx_fn, tx_type, 0, s->fft_length2, scale, 0); | 757 | ret = av_tx_init(&dnch->fft, &dnch->tx_fn, tx_type, 0, s->fft_length2, scale, 0); |
| 758 | if (ret < 0) | 758 | if (ret < 0) |
| 759 | return ret; | 759 | return ret; |
| @@ -931,7 +931,7 @@ static void sample_noise_block(AudioFFTDeNoiseContext *s, · 171 unmodified lines | |||
| 931 | break; | 931 | break; |
| 932 | } | 932 | } |
| 933 | 933 | ||
| 934 | dnch->tx_fn(dnch->fft, dnch->fft_out, dnch->fft_in, sizeof(s->sample_size)); | 934 | dnch->tx_fn(dnch->fft, dnch->fft_out, dnch->fft_in, s->sample_size); |
| 935 | 935 | ||
| 936 | edge = s->noise_band_edge[0]; | 936 | edge = s->noise_band_edge[0]; |
| 937 | j = edge; | 937 | j = edge; |
| @@ -1074,14 +1074,14 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job · 136 unmodified lines | |||
| 1074 | break; | 1074 | break; |
| 1075 | } | 1075 | } |
| 1076 | 1076 | ||
| 1077 | dnch->tx_fn(dnch->fft, dnch->fft_out, dnch->fft_in, sizeof(s->sample_size)); | 1077 | dnch->tx_fn(dnch->fft, dnch->fft_out, dnch->fft_in, s->sample_size); |
| 1078 | 1078 | ||
| 1079 | process_frame(ctx, s, dnch, | 1079 | process_frame(ctx, s, dnch, |
| 1080 | dnch->prior, | 1080 | dnch->prior, |
| 1081 | dnch->prior_band_excit, | 1081 | dnch->prior_band_excit, |
| 1082 | s->track_noise); | 1082 | s->track_noise); |
| 1083 | 1083 | ||
| 1084 | dnch->itx_fn(dnch->ifft, dnch->fft_in, dnch->fft_out, sizeof(s->sample_size)); | 1084 | dnch->itx_fn(dnch->ifft, dnch->fft_in, dnch->fft_out, s->complex_sample_size); |
| 1085 | 1085 | ||
| 1086 | switch (s->format) { | 1086 | switch (s->format) { |
| 1087 | case AV_SAMPLE_FMT_FLTP: | 1087 | case AV_SAMPLE_FMT_FLTP: |