Only the AudioFIRDSPContext and the functions for its initialization are needed outside of lavfi/af_afir.c. Also rename the header to af_afirdsp.h to reflect the change.
Showing the changes to libavfilter (4 of 5 files). Show all
Unified · Split
| @@ -30,8 +30,11 @@ · 29 unmodified lines | |||
| 30 | #include "libavutil/channel_layout.h" | 30 | #include "libavutil/channel_layout.h" |
| 31 | #include "libavutil/common.h" | 31 | #include "libavutil/common.h" |
| 32 | #include "libavutil/float_dsp.h" | 32 | #include "libavutil/float_dsp.h" |
| 33 | #include "libavutil/frame.h" | ||
| 33 | #include "libavutil/intreadwrite.h" | 34 | #include "libavutil/intreadwrite.h" |
| 35 | #include "libavutil/log.h" | ||
| 34 | #include "libavutil/opt.h" | 36 | #include "libavutil/opt.h" |
| 37 | #include "libavutil/rational.h" | ||
| 35 | #include "libavutil/xga_font_data.h" | 38 | #include "libavutil/xga_font_data.h" |
| 36 | 39 | ||
| 37 | #include "audio.h" | 40 | #include "audio.h" |
| @@ -39,7 +42,73 @@ · 1 unmodified line | |||
| 39 | #include "filters.h" | 42 | #include "filters.h" |
| 40 | #include "formats.h" | 43 | #include "formats.h" |
| 41 | #include "internal.h" | 44 | #include "internal.h" |
| 42 | #include "af_afir.h" | 45 | #include "af_afirdsp.h" |
| 46 | |||
| 47 | typedef struct AudioFIRSegment { | ||
| 48 | int nb_partitions; | ||
| 49 | int part_size; | ||
| 50 | int block_size; | ||
| 51 | int fft_length; | ||
| 52 | int coeff_size; | ||
| 53 | int input_size; | ||
| 54 | int input_offset; | ||
| 55 | |||
| 56 | int *output_offset; | ||
| 57 | int *part_index; | ||
| 58 | |||
| 59 | AVFrame *sumin; | ||
| 60 | AVFrame *sumout; | ||
| 61 | AVFrame *blockin; | ||
| 62 | AVFrame *blockout; | ||
| 63 | AVFrame *buffer; | ||
| 64 | AVFrame *coeff; | ||
| 65 | AVFrame *input; | ||
| 66 | AVFrame *output; | ||
| 67 | |||
| 68 | AVTXContext **tx, **itx; | ||
| 69 | av_tx_fn tx_fn, itx_fn; | ||
| 70 | } AudioFIRSegment; | ||
| 71 | |||
| 72 | typedef struct AudioFIRContext { | ||
| 73 | const AVClass *class; | ||
| 74 | |||
| 75 | float wet_gain; | ||
| 76 | float dry_gain; | ||
| 77 | float length; | ||
| 78 | int gtype; | ||
| 79 | float ir_gain; | ||
| 80 | int ir_format; | ||
| 81 | float max_ir_len; | ||
| 82 | int response; | ||
| 83 | int w, h; | ||
| 84 | AVRational frame_rate; | ||
| 85 | int ir_channel; | ||
| 86 | int minp; | ||
| 87 | int maxp; | ||
| 88 | int nb_irs; | ||
| 89 | int selir; | ||
| 90 | |||
| 91 | float gain; | ||
| 92 | |||
| 93 | int eof_coeffs[32]; | ||
| 94 | int have_coeffs; | ||
| 95 | int nb_taps; | ||
| 96 | int nb_channels; | ||
| 97 | int nb_coef_channels; | ||
| 98 | int one2many; | ||
| 99 | |||
| 100 | AudioFIRSegment seg[1024]; | ||
| 101 | int nb_segments; | ||
| 102 | |||
| 103 | AVFrame *in; | ||
| 104 | AVFrame *ir[32]; | ||
| 105 | AVFrame *video; | ||
| 106 | int min_part_size; | ||
| 107 | int64_t pts; | ||
| 108 | |||
| 109 | AudioFIRDSPContext afirdsp; | ||
| 110 | AVFloatDSPContext *fdsp; | ||
| 111 | } AudioFIRContext; | ||
| 43 | 112 | ||
| 44 | static void fcmul_add_c(float *sum, const float *t, const float *c, ptrdiff_t len) | 113 | static void fcmul_add_c(float *sum, const float *t, const float *c, ptrdiff_t len) |
| 45 | { | 114 | { |
| @@ -1,108 +0,0 @@ | |||
| 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 <stddef.h> | ||
| 25 | #include <stdint.h> | ||
| 26 | |||
| 27 | #include "libavutil/tx.h" | ||
| 28 | #include "libavutil/float_dsp.h" | ||
| 29 | #include "libavutil/frame.h" | ||
| 30 | #include "libavutil/log.h" | ||
| 31 | #include "libavutil/rational.h" | ||
| 32 | |||
| 33 | typedef struct AudioFIRSegment { | ||
| 34 | int nb_partitions; | ||
| 35 | int part_size; | ||
| 36 | int block_size; | ||
| 37 | int fft_length; | ||
| 38 | int coeff_size; | ||
| 39 | int input_size; | ||
| 40 | int input_offset; | ||
| 41 | |||
| 42 | int *output_offset; | ||
| 43 | int *part_index; | ||
| 44 | |||
| 45 | AVFrame *sumin; | ||
| 46 | AVFrame *sumout; | ||
| 47 | AVFrame *blockin; | ||
| 48 | AVFrame *blockout; | ||
| 49 | AVFrame *buffer; | ||
| 50 | AVFrame *coeff; | ||
| 51 | AVFrame *input; | ||
| 52 | AVFrame *output; | ||
| 53 | |||
| 54 | AVTXContext **tx, **itx; | ||
| 55 | av_tx_fn tx_fn, itx_fn; | ||
| 56 | } AudioFIRSegment; | ||
| 57 | |||
| 58 | typedef struct AudioFIRDSPContext { | ||
| 59 | void (*fcmul_add)(float *sum, const float *t, const float *c, | ||
| 60 | ptrdiff_t len); | ||
| 61 | } AudioFIRDSPContext; | ||
| 62 | |||
| 63 | typedef struct AudioFIRContext { | ||
| 64 | const AVClass *class; | ||
| 65 | |||
| 66 | float wet_gain; | ||
| 67 | float dry_gain; | ||
| 68 | float length; | ||
| 69 | int gtype; | ||
| 70 | float ir_gain; | ||
| 71 | int ir_format; | ||
| 72 | float max_ir_len; | ||
| 73 | int response; | ||
| 74 | int w, h; | ||
| 75 | AVRational frame_rate; | ||
| 76 | int ir_channel; | ||
| 77 | int minp; | ||
| 78 | int maxp; | ||
| 79 | int nb_irs; | ||
| 80 | int selir; | ||
| 81 | |||
| 82 | float gain; | ||
| 83 | |||
| 84 | int eof_coeffs[32]; | ||
| 85 | int have_coeffs; | ||
| 86 | int nb_taps; | ||
| 87 | int nb_channels; | ||
| 88 | int nb_coef_channels; | ||
| 89 | int one2many; | ||
| 90 | |||
| 91 | AudioFIRSegment seg[1024]; | ||
| 92 | int nb_segments; | ||
| 93 | |||
| 94 | AVFrame *in; | ||
| 95 | AVFrame *ir[32]; | ||
| 96 | AVFrame *video; | ||
| 97 | int min_part_size; | ||
| 98 | int64_t pts; | ||
| 99 | |||
| 100 | AudioFIRDSPContext afirdsp; | ||
| 101 | AVFloatDSPContext *fdsp; | ||
| 102 | |||
| 103 | } AudioFIRContext; | ||
| 104 | |||
| 105 | void ff_afir_init(AudioFIRDSPContext *s); | ||
| 106 | void ff_afir_init_x86(AudioFIRDSPContext *s); | ||
| 107 | |||
| 108 | #endif /* AVFILTER_AFIR_H */ | ||
| @@ -0,0 +1,34 @@ | |||
| 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_AFIRDSP_H | ||
| 22 | #define AVFILTER_AFIRDSP_H | ||
| 23 | |||
| 24 | #include <stddef.h> | ||
| 25 | |||
| 26 | typedef struct AudioFIRDSPContext { | ||
| 27 | void (*fcmul_add)(float *sum, const float *t, const float *c, | ||
| 28 | ptrdiff_t len); | ||
| 29 | } AudioFIRDSPContext; | ||
| 30 | |||
| 31 | void ff_afir_init(AudioFIRDSPContext *s); | ||
| 32 | void ff_afir_init_x86(AudioFIRDSPContext *s); | ||
| 33 | |||
| 34 | #endif /* AVFILTER_AFIRDSP_H */ | ||
| @@ -20,7 +20,7 @@ · 19 unmodified lines | |||
| 20 | #include "libavutil/attributes.h" | 20 | #include "libavutil/attributes.h" |
| 21 | #include "libavutil/cpu.h" | 21 | #include "libavutil/cpu.h" |
| 22 | #include "libavutil/x86/cpu.h" | 22 | #include "libavutil/x86/cpu.h" |
| 23 | #include "libavfilter/af_afir.h" | 23 | #include "libavfilter/af_afirdsp.h" |
| 24 | 24 | ||
| 25 | void ff_fcmul_add_sse3(float *sum, const float *t, const float *c, | 25 | void ff_fcmul_add_sse3(float *sum, const float *t, const float *c, |
| 26 | ptrdiff_t len); | 26 | ptrdiff_t len); |