FFmpeg: libavfilter/af_aap.c Source File
Go to the documentation of this file. 1 /*
2 * Copyright (c) 2023 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
25
31
39 };
40
43
50
63
66
68
70
73
74 #define OFFSET(x) offsetof(AudioAPContext, x)
75 #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
76 #define AT AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
77
89 {
"precision",
"set processing precision",
OFFSET(precision),
AV_OPT_TYPE_INT, {.i64=0}, 0, 2,
A, .unit =
"precision" },
90 {
"auto",
"set auto processing precision", 0,
AV_OPT_TYPE_CONST, {.i64=0}, 0, 0,
A, .unit =
"precision" },
91 {
"float",
"set single-floating point processing precision", 0,
AV_OPT_TYPE_CONST, {.i64=1}, 0, 0,
A, .unit =
"precision" },
92 {
"double",
"set double-floating point processing precision", 0,
AV_OPT_TYPE_CONST, {.i64=2}, 0, 0,
A, .unit =
"precision" },
94 };
95
97
99 {
105 };
107
110
113
115 }
116
118 {
121 int nb_samples;
123
125
128 for (
i = 0;
i <
ctx->nb_inputs && nb_samples > 0;
i++) {
130 continue;
131
136 }
137 }
138
139 if (
s->frame[0] &&
s->frame[1]) {
141
147 }
148
151
152 out->pts =
s->frame[0]->pts;
153 out->duration =
s->frame[0]->duration;
154
157
161 }
162
163 if (!nb_samples) {
164 for (
i = 0;
i < 2;
i++) {
167 return 0;
168 }
169 }
170 }
171
173 for (
i = 0;
i < 2;
i++) {
175 continue;
177 return 0;
178 }
179 }
180 return 0;
181 }
182
183 #define DEPTH 32
185
186 #undef DEPTH
189
191 {
195
197
220
225
226 if (!
s->offset || !
s->delay || !
s->dcoeffs || !
s->coeffs || !
s->tmpmp || !
s->itmpmp ||
227 !
s->e || !
s->p || !
s->x || !
s->w || !
s->tmp || !
s->tmpm || !
s->itmpm)
229
230 switch (outlink->
format) {
232 for (
int ch = 0; ch <
channels; ch++) {
233 double *itmpm = (
double *)
s->itmpm->extended_data[ch];
234 double *tmpm = (
double *)
s->tmpm->extended_data[ch];
235 double **itmpmp = (
double **)&
s->itmpmp[
s->projection * ch];
236 double **tmpmp = (
double **)&
s->tmpmp[
s->projection * ch];
237
238 for (
int i = 0;
i <
s->projection;
i++) {
239 itmpmp[
i] = &itmpm[
i *
s->projection];
240 tmpmp[
i] = &tmpm[
i *
s->projection];
241 }
242 }
243
244 s->filter_channels = filter_channels_double;
245 break;
247 for (
int ch = 0; ch <
channels; ch++) {
248 float *itmpm = (
float *)
s->itmpm->extended_data[ch];
249 float *tmpm = (
float *)
s->tmpm->extended_data[ch];
250 float **itmpmp = (
float **)&
s->itmpmp[
s->projection * ch];
251 float **tmpmp = (
float **)&
s->tmpmp[
s->projection * ch];
252
253 for (
int i = 0;
i <
s->projection;
i++) {
254 itmpmp[
i] = &itmpm[
i *
s->projection];
255 tmpmp[
i] = &tmpm[
i *
s->projection];
256 }
257 }
258
259 s->filter_channels = filter_channels_float;
260 break;
261 }
262
263 return 0;
264 }
265
267 {
269
273
274 return 0;
275 }
276
278 {
280
282
294
297 }
298
300 {
303 },
304 {
305 .name = "desired",
307 },
308 };
309
311 {
315 },
316 };
317
320 .description =
NULL_IF_CONFIG_SMALL(
"Apply Affine Projection algorithm to first audio stream."),
322 .priv_class = &aap_class,
332 };
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
@ AV_SAMPLE_FMT_FLTP
float, planar
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static enum AVSampleFormat sample_fmts[]
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
#define FILTER_QUERY_FUNC(func)
static int activate(AVFilterContext *ctx)
const char * name
Filter name.
static const AVFilterPad inputs[]
int nb_channels
Number of channels in this layout.
A link between two filters.
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
static const AVOption aap_options[]
int(* filter_channels)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
A filter pad used for either input or output.
int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min)
Test if enough samples are available on the link.
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
#define FILTER_INPUTS(array)
Describe the class of an AVClass context structure.
int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Take samples from the link's FIFO and update the link's stats.
AVFILTER_DEFINE_CLASS(aap)
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int config_output(AVFilterLink *outlink)
int format
agreed upon media format
AVFilterContext * src
source filter
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
#define i(width, name, range_min, range_max)
static int query_formats(AVFilterContext *ctx)
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
AVSampleFormat
Audio sample formats.
static av_cold int init(AVFilterContext *ctx)
const char * name
Pad name.
int ff_inlink_queued_samples(AVFilterLink *link)
void * av_calloc(size_t nmemb, size_t size)
static const AVFilterPad outputs[]
@ AV_SAMPLE_FMT_DBLP
double, planar
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
AVChannelLayout ch_layout
channel layout of current buffer (see libavutil/channel_layout.h)
#define FILTER_OUTPUTS(array)
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the ff_outlink_frame_wanted() function. If this function returns true
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
static av_cold void uninit(AVFilterContext *ctx)
Generated on Thu Sep 26 2024 23:15:28 for FFmpeg by
doxygen
1.8.17