FFmpeg  4.2.2
tx.h
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVUTIL_TX_H
20 #define AVUTIL_TX_H
21 
22 #include <stdint.h>
23 #include <stddef.h>
24 
25 typedef struct AVTXContext AVTXContext;
26 
27 typedef struct AVComplexFloat {
28  float re, im;
30 
31 enum AVTXType {
32  /**
33  * Standard complex to complex FFT with sample data type AVComplexFloat.
34  * Scaling currently unsupported
35  */
37  /**
38  * Standard MDCT with sample data type of float and a scale type of
39  * float. Length is the frame size, not the window size (which is 2x frame)
40  */
42 };
43 
44 /**
45  * Function pointer to a function to perform the transform.
46  *
47  * @note Using a different context than the one allocated during av_tx_init()
48  * is not allowed.
49  *
50  * @param s the transform context
51  * @param out the output array
52  * @param in the input array
53  * @param stride the input or output stride (depending on transform direction)
54  * in bytes, currently implemented for all MDCT transforms
55  */
56 typedef void (*av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride);
57 
58 /**
59  * Initialize a transform context with the given configuration
60  * Currently power of two lengths from 4 to 131072 are supported, along with
61  * any length decomposable to a power of two and either 3, 5 or 15.
62  *
63  * @param ctx the context to allocate, will be NULL on error
64  * @param tx pointer to the transform function pointer to set
65  * @param type type the type of transform
66  * @param inv whether to do an inverse or a forward transform
67  * @param len the size of the transform in samples
68  * @param scale pointer to the value to scale the output if supported by type
69  * @param flags currently unused
70  *
71  * @return 0 on success, negative error code on failure
72  */
73 int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type,
74  int inv, int len, const void *scale, uint64_t flags);
75 
76 /**
77  * Frees a context and sets ctx to NULL, does nothing when ctx == NULL
78  */
79 void av_tx_uninit(AVTXContext **ctx);
80 
81 #endif /* AVUTIL_TX_H */
struct AVTXContext AVTXContext
Definition: tx.h:25
float re
Definition: tx.h:28
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
Definition: tx.h:56
AVTXType
Definition: tx.h:31
Standard complex to complex FFT with sample data type AVComplexFloat.
Definition: tx.h:36
void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets ctx to NULL, does nothing when ctx == NULL.
float im
Definition: tx.h:28
int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration Currently power of two lengths from 4 to ...
Standard MDCT with sample data type of float and a scale type of float.
Definition: tx.h:41