1 /* 2 * Copyright (c) 2017 Paul B Mahol 3 * 4 * This file is part of FFmpeg. 5 * 6 * FFmpeg is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * FFmpeg is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with FFmpeg; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #ifndef AVFILTER_AFIR_H 22 #define AVFILTER_AFIR_H 23 24 #include "libavutil/common.h" 25 #include "libavutil/float_dsp.h" 26 #include "libavutil/opt.h" 27 #include "libavcodec/avfft.h" 28 29 #include "audio.h" 30 #include "avfilter.h" 31 #include "formats.h" 32 #include "internal.h" 33 34 typedef struct AudioFIRSegment { 35 int nb_partitions; 36 int part_size; 37 int block_size; 38 int fft_length; 39 int coeff_size; 40 int input_size; 41 int input_offset; 42 43 int *output_offset; 44 int *part_index; 45 46 AVFrame *sum; 47 AVFrame *block; 48 AVFrame *buffer; 49 AVFrame *coeff; 50 AVFrame *input; 51 AVFrame *output; 52 53 RDFTContext **rdft, **irdft; 54 } AudioFIRSegment; 55 56 typedef struct AudioFIRDSPContext { 57 void (*fcmul_add)(float *sum, const float *t, const float *c, 58 ptrdiff_t len); 59 } AudioFIRDSPContext; 60 61 typedef struct AudioFIRContext { 62 const AVClass *class; 63 64 float wet_gain; 65 float dry_gain; 66 float length; 67 int gtype; 68 float ir_gain; 69 int ir_format; 70 float max_ir_len; 71 int response; 72 int w, h; 73 AVRational frame_rate; 74 int ir_channel; 75 int minp; 76 int maxp; 77 int nb_irs; 78 int selir; 79 80 float gain; 81 82 int eof_coeffs[32]; 83 int have_coeffs; 84 int nb_taps; 85 int nb_channels; 86 int nb_coef_channels; 87 int one2many; 88 89 AudioFIRSegment seg[1024]; 90 int nb_segments; 91 92 AVFrame *in; 93 AVFrame *ir[32]; 94 AVFrame *video; 95 int min_part_size; 96 int64_t pts; 97 98 AudioFIRDSPContext afirdsp; 99 AVFloatDSPContext *fdsp; 100 101 } AudioFIRContext; 102 103 void ff_afir_init(AudioFIRDSPContext *s); 104 void ff_afir_init_x86(AudioFIRDSPContext *s); 105 106 #endif /* AVFILTER_AFIR_H */ 107