2017-01-26 18:03:08 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Paul B Mahol
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2017-05-10 04:07:26 +02:00
|
|
|
#ifndef AVFILTER_AFIR_H
|
|
|
|
#define AVFILTER_AFIR_H
|
2017-01-26 18:03:08 +02:00
|
|
|
|
|
|
|
#include "libavutil/common.h"
|
|
|
|
#include "libavutil/float_dsp.h"
|
|
|
|
#include "libavutil/opt.h"
|
|
|
|
#include "libavcodec/avfft.h"
|
|
|
|
|
|
|
|
#include "audio.h"
|
|
|
|
#include "avfilter.h"
|
|
|
|
#include "formats.h"
|
|
|
|
#include "internal.h"
|
|
|
|
|
2018-12-28 18:57:24 +02:00
|
|
|
typedef struct AudioFIRSegment {
|
|
|
|
int nb_partitions;
|
|
|
|
int part_size;
|
|
|
|
int block_size;
|
|
|
|
int fft_length;
|
|
|
|
int coeff_size;
|
2018-12-29 12:40:13 +02:00
|
|
|
int input_size;
|
|
|
|
int input_offset;
|
2018-12-28 18:57:24 +02:00
|
|
|
|
2018-12-29 12:40:13 +02:00
|
|
|
int *output_offset;
|
2018-12-29 11:46:25 +02:00
|
|
|
int *part_index;
|
|
|
|
|
2018-12-28 18:57:24 +02:00
|
|
|
AVFrame *sum;
|
|
|
|
AVFrame *block;
|
|
|
|
AVFrame *buffer;
|
2018-12-29 11:17:39 +02:00
|
|
|
AVFrame *coeff;
|
2018-12-29 12:40:13 +02:00
|
|
|
AVFrame *input;
|
|
|
|
AVFrame *output;
|
2018-12-28 18:57:24 +02:00
|
|
|
|
|
|
|
RDFTContext **rdft, **irdft;
|
|
|
|
} AudioFIRSegment;
|
|
|
|
|
2019-01-03 01:54:18 +02:00
|
|
|
typedef struct AudioFIRDSPContext {
|
|
|
|
void (*fcmul_add)(float *sum, const float *t, const float *c,
|
|
|
|
ptrdiff_t len);
|
|
|
|
} AudioFIRDSPContext;
|
|
|
|
|
2017-01-26 18:03:08 +02:00
|
|
|
typedef struct AudioFIRContext {
|
|
|
|
const AVClass *class;
|
|
|
|
|
|
|
|
float wet_gain;
|
|
|
|
float dry_gain;
|
|
|
|
float length;
|
2018-10-03 21:43:40 +02:00
|
|
|
int gtype;
|
|
|
|
float ir_gain;
|
2018-10-04 21:10:47 +02:00
|
|
|
int ir_format;
|
2018-04-16 19:06:09 +02:00
|
|
|
float max_ir_len;
|
2018-05-29 18:24:22 +02:00
|
|
|
int response;
|
|
|
|
int w, h;
|
2018-11-08 13:46:29 +02:00
|
|
|
AVRational frame_rate;
|
2018-05-29 18:24:22 +02:00
|
|
|
int ir_channel;
|
2018-11-08 23:07:14 +02:00
|
|
|
int minp;
|
|
|
|
int maxp;
|
2020-01-09 21:06:57 +02:00
|
|
|
int nb_irs;
|
|
|
|
int selir;
|
2017-01-26 18:03:08 +02:00
|
|
|
|
|
|
|
float gain;
|
|
|
|
|
2020-01-09 21:06:57 +02:00
|
|
|
int eof_coeffs[32];
|
2017-01-26 18:03:08 +02:00
|
|
|
int have_coeffs;
|
|
|
|
int nb_taps;
|
|
|
|
int nb_channels;
|
|
|
|
int nb_coef_channels;
|
|
|
|
int one2many;
|
|
|
|
|
2018-12-29 11:39:19 +02:00
|
|
|
AudioFIRSegment seg[1024];
|
|
|
|
int nb_segments;
|
2017-01-26 18:03:08 +02:00
|
|
|
|
2020-01-08 20:23:45 +02:00
|
|
|
AVFrame *in;
|
|
|
|
AVFrame *ir[32];
|
2018-05-29 18:24:22 +02:00
|
|
|
AVFrame *video;
|
2018-12-29 12:40:13 +02:00
|
|
|
int min_part_size;
|
2017-01-26 18:03:08 +02:00
|
|
|
int64_t pts;
|
|
|
|
|
2019-01-03 01:54:18 +02:00
|
|
|
AudioFIRDSPContext afirdsp;
|
2017-01-26 18:03:08 +02:00
|
|
|
AVFloatDSPContext *fdsp;
|
2019-01-03 01:54:18 +02:00
|
|
|
|
2017-01-26 18:03:08 +02:00
|
|
|
} AudioFIRContext;
|
|
|
|
|
2019-01-03 01:54:18 +02:00
|
|
|
void ff_afir_init(AudioFIRDSPContext *s);
|
|
|
|
void ff_afir_init_x86(AudioFIRDSPContext *s);
|
2017-01-26 18:03:08 +02:00
|
|
|
|
|
|
|
#endif /* AVFILTER_AFIR_H */
|