aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/tx.h
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2022-01-21 07:50:53 +0100
committerLynne <dev@lynne.ee>2022-01-26 04:12:46 +0100
commitaf94ab7c7c004786084903bcf82b7617e88e3aa9 (patch)
tree022db61a65adcac1dce40157c341352dd0ed2ced /libavutil/tx.h
parentef4bd8161575a79f0ac247ad0aa2f05b8c20052b (diff)
downloadffmpeg-af94ab7c7c004786084903bcf82b7617e88e3aa9.tar.gz
lavu/tx: add an RDFT implementation
RDFTs are full of conventions that vary between implementations. What I've gone for here is what's most common between both fftw, avcodec's rdft and what we use, the equivalent of which is DFT_R2C for forward and IDFT_C2R for inverse. The other 2 conventions (IDFT_R2C and DFT_C2R) were not used at all in our code, and their names are also not appropriate. If there's a use for either, we can easily add a flag which would just flip the sign on one exptab. For some unknown reason, possibly to allow reusing FFT's exp tables, av_rdft's C2R output is 0.5x lower than what it should be to ensure a proper back-and-forth conversion. This code outputs its real samples at the correct level, which matches FFTW's level, and allows the user to change the level and insert arbitrary multiplies for free by setting the scale option.
Diffstat (limited to 'libavutil/tx.h')
-rw-r--r--libavutil/tx.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavutil/tx.h b/libavutil/tx.h
index 0e57874376..087355f10d 100644
--- a/libavutil/tx.h
+++ b/libavutil/tx.h
@@ -69,6 +69,26 @@ enum AVTXType {
AV_TX_DOUBLE_MDCT = 3,
AV_TX_INT32_MDCT = 5,
+ /**
+ * Real to complex and complex to real DFTs.
+ * For the float and int32 variants, the scale type is 'float', while for
+ * the double variant, it's a 'double'. If scale is NULL, 1.0 will be used
+ * as a default.
+ *
+ * The stride parameter must be set to the size of a single sample in bytes.
+ *
+ * The forward transform performs a real-to-complex DFT of N samples to
+ * N/2+1 complex values.
+ *
+ * The inverse transform performs a complex-to-real DFT of N/2+1 complex
+ * values to N real samples. The output is not normalized, but can be
+ * made so by setting the scale value to 1.0/len.
+ * NOTE: the inverse transform always overwrites the input.
+ */
+ AV_TX_FLOAT_RDFT = 6,
+ AV_TX_DOUBLE_RDFT = 7,
+ AV_TX_INT32_RDFT = 8,
+
/* Not part of the API, do not use */
AV_TX_NB,
};