summaryrefslogtreecommitdiff
path: root/libavutil/tx.h
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2020-02-08 23:13:28 +0000
committerLynne <dev@lynne.ee>2020-02-13 17:10:34 +0000
commite8f054b095baa194623b3852f06fc507ae697503 (patch)
tree32fc6a24fb5747e5a11ee74fb8aaf6d62a517882 /libavutil/tx.h
parente007059d6617ca966380810fe03c571566ecd9c3 (diff)
downloadffmpeg-e8f054b095baa194623b3852f06fc507ae697503.tar.gz
lavu/tx: implement 32 bit fixed point FFT and MDCT
Required minimal changes to the code so made sense to implement. FFT and MDCT tested, the output of both was properly rounded. Fun fact: the non-power-of-two fixed-point FFT and MDCT are the fastest ever non-power-of-two fixed-point FFT and MDCT written. This can replace the power of two integer MDCTs in aac and ac3 if the MIPS optimizations are ported across. Unfortunately the ac3 encoder uses a 16-bit fixed point forward transform, unlike the encoder which uses a 32bit inverse transform, so some modifications might be required there. The 3-point FFT is somewhat less accurate than it otherwise could be, having minor rounding errors with bigger transforms. However, this could be improved later, and the way its currently written is the way one would write assembly for it. Similar rounding errors can also be found throughout the power of two FFTs as well, though those are more difficult to correct. Despite this, the integer transforms are more than accurate enough.
Diffstat (limited to 'libavutil/tx.h')
-rw-r--r--libavutil/tx.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavutil/tx.h b/libavutil/tx.h
index 8b405c0021..53018c84e6 100644
--- a/libavutil/tx.h
+++ b/libavutil/tx.h
@@ -32,6 +32,10 @@ typedef struct AVComplexDouble {
double re, im;
} AVComplexDouble;
+typedef struct AVComplexInt32 {
+ int32_t re, im;
+} AVComplexInt32;
+
enum AVTXType {
/**
* Standard complex to complex FFT with sample data type AVComplexFloat.
@@ -51,6 +55,15 @@ enum AVTXType {
* Same as AV_TX_FLOAT_MDCT with data and scale type of double.
*/
AV_TX_DOUBLE_MDCT = 3,
+ /**
+ * Same as AV_TX_FLOAT_FFT with a data type of AVComplexInt32.
+ */
+ AV_TX_INT32_FFT = 4,
+ /**
+ * Same as AV_TX_FLOAT_MDCT with data type of int32_t and scale type of float.
+ * Only scale values less than or equal to 1.0 are supported.
+ */
+ AV_TX_INT32_MDCT = 5,
};
/**