[FFmpeg-devel] [PATCH 5/8] avfft: add AV prefixes to RDFTransformType enum.

Anton Khirnov anton
Sun Mar 13 14:48:36 CET 2011


also add a missing 'T' to the name (RDFT_T_ransformType).
---
 ffplay.c               |    2 +-
 libavcodec/avfft.c     |    2 +-
 libavcodec/avfft.h     |   18 ++++++++++++------
 libavcodec/binkaudio.c |    2 +-
 libavcodec/fft-test.c  |    6 +++---
 libavcodec/fft.h       |    2 +-
 libavcodec/qdm2.c      |    2 +-
 libavcodec/rdft.c      |   12 ++++++------
 libavcodec/wmavoice.c  |    4 ++--
 9 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 8a30b5a..ed8512d 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -878,7 +878,7 @@ static void video_audio_display(VideoState *s)
         if(rdft_bits != s->rdft_bits){
             av_rdft_end(s->rdft);
             av_free(s->rdft_data);
-            s->rdft = av_rdft_init(rdft_bits, DFT_R2C);
+            s->rdft = av_rdft_init(rdft_bits, AV_DFT_R2C);
             s->rdft_bits= rdft_bits;
             s->rdft_data= av_malloc(4*nb_freq*sizeof(*s->rdft_data));
         }
diff --git a/libavcodec/avfft.c b/libavcodec/avfft.c
index 1338443..11bc117 100644
--- a/libavcodec/avfft.c
+++ b/libavcodec/avfft.c
@@ -89,7 +89,7 @@ void av_mdct_end(AVFFTContext *s)
 
 #if CONFIG_RDFT
 
-RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
+RDFTContext *av_rdft_init(int nbits, enum AVRDFTTransformType trans)
 {
     RDFTContext *s = av_malloc(sizeof(*s));
 
diff --git a/libavcodec/avfft.h b/libavcodec/avfft.h
index a4eda6b..f3dda73 100644
--- a/libavcodec/avfft.h
+++ b/libavcodec/avfft.h
@@ -58,11 +58,11 @@ void av_mdct_end(AVFFTContext *s);
 
 /* Real Discrete Fourier Transform */
 
-enum RDFTransformType {
-    DFT_R2C,
-    IDFT_C2R,
-    IDFT_R2C,
-    DFT_C2R,
+enum AVRDFTTransformType {
+    AV_DFT_R2C,
+    AV_IDFT_C2R,
+    AV_IDFT_R2C,
+    AV_DFT_C2R,
 };
 
 typedef struct RDFTContext RDFTContext;
@@ -72,7 +72,7 @@ typedef struct RDFTContext RDFTContext;
  * @param nbits           log2 of the length of the input array
  * @param trans           the type of transform
  */
-RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
+RDFTContext *av_rdft_init(int nbits, enum AVRDFTTransformType trans);
 void av_rdft_calc(RDFTContext *s, AVFFTSample *data);
 void av_rdft_end(RDFTContext *s);
 
@@ -103,6 +103,12 @@ void av_dct_end (DCTContext *s);
 typedef attribute_deprecated AVFFTSample FFTSample;
 typedef attribute_deprecated AVFFTComplex FFTComplex;
 typedef attribute_deprecated AVFFTContext FFTContext;
+attribute_deprecated enum RDFTransformType {
+    DFT_R2C,
+    IDFT_C2R,
+    IDFT_R2C,
+    DFT_C2R,
+};
 #endif
 
 #endif /* AVCODEC_AVFFT_H */
diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c
index 48cec1b..22b41ae 100644
--- a/libavcodec/binkaudio.c
+++ b/libavcodec/binkaudio.c
@@ -129,7 +129,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
         s->coeffs_ptr[i] = s->coeffs + i * s->frame_len;
 
     if (CONFIG_BINKAUDIO_RDFT_DECODER && avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT)
-        ff_rdft_init(&s->trans.rdft, frame_len_bits, DFT_C2R);
+        ff_rdft_init(&s->trans.rdft, frame_len_bits, AV_DFT_C2R);
     else if (CONFIG_BINKAUDIO_DCT_DECODER)
         ff_dct_init(&s->trans.dct, frame_len_bits, DCT_III);
     else
diff --git a/libavcodec/fft-test.c b/libavcodec/fft-test.c
index df3ccfb..9e3264d 100644
--- a/libavcodec/fft-test.c
+++ b/libavcodec/fft-test.c
@@ -297,10 +297,10 @@ int main(int argc, char **argv)
         break;
     case TRANSFORM_RDFT:
         if (do_inverse)
-            av_log(NULL, AV_LOG_INFO,"IDFT_C2R");
+            av_log(NULL, AV_LOG_INFO,"AV_IDFT_C2R");
         else
-            av_log(NULL, AV_LOG_INFO,"DFT_R2C");
-        ff_rdft_init(r, fft_nbits, do_inverse ? IDFT_C2R : DFT_R2C);
+            av_log(NULL, AV_LOG_INFO,"AV_DFT_R2C");
+        ff_rdft_init(r, fft_nbits, do_inverse ? AV_IDFT_C2R : AV_DFT_R2C);
         fft_ref_init(fft_nbits, do_inverse);
         break;
     case TRANSFORM_DCT:
diff --git a/libavcodec/fft.h b/libavcodec/fft.h
index f741a3f..adc7408 100644
--- a/libavcodec/fft.h
+++ b/libavcodec/fft.h
@@ -208,7 +208,7 @@ struct RDFTContext {
  * @param nbits           log2 of the length of the input array
  * @param trans           the type of transform
  */
-int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans);
+int ff_rdft_init(RDFTContext *s, int nbits, enum AVRDFTTransformType trans);
 void ff_rdft_end(RDFTContext *s);
 
 void ff_rdft_init_arm(RDFTContext *s);
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index e31de2e..41a6e84 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -1862,7 +1862,7 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
         return -1;
     }
 
-    ff_rdft_init(&s->rdft_ctx, s->fft_order, IDFT_C2R);
+    ff_rdft_init(&s->rdft_ctx, s->fft_order, AV_IDFT_C2R);
 
     qdm2_init(s);
 
diff --git a/libavcodec/rdft.c b/libavcodec/rdft.c
index 05c4830..ff5e205 100644
--- a/libavcodec/rdft.c
+++ b/libavcodec/rdft.c
@@ -96,25 +96,25 @@ static void ff_rdft_calc_c(RDFTContext* s, AVFFTSample* data)
     }
 }
 
-av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)
+av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum AVRDFTTransformType trans)
 {
     int n = 1 << nbits;
     int i;
-    const double theta = (trans == DFT_R2C || trans == DFT_C2R ? -1 : 1)*2*M_PI/n;
+    const double theta = (trans == AV_DFT_R2C || trans == AV_DFT_C2R ? -1 : 1)*2*M_PI/n;
 
     s->nbits           = nbits;
-    s->inverse         = trans == IDFT_C2R || trans == DFT_C2R;
-    s->sign_convention = trans == IDFT_R2C || trans == DFT_C2R ? 1 : -1;
+    s->inverse         = trans == AV_IDFT_C2R || trans == AV_DFT_C2R;
+    s->sign_convention = trans == AV_IDFT_R2C || trans == AV_DFT_C2R ? 1 : -1;
 
     if (nbits < 4 || nbits > 16)
         return -1;
 
-    if (ff_fft_init(&s->fft, nbits-1, trans == IDFT_C2R || trans == IDFT_R2C) < 0)
+    if (ff_fft_init(&s->fft, nbits-1, trans == AV_IDFT_C2R || trans == AV_IDFT_R2C) < 0)
         return -1;
 
     ff_init_ff_cos_tabs(nbits);
     s->tcos = ff_cos_tabs[nbits];
-    s->tsin = ff_sin_tabs[nbits]+(trans == DFT_R2C || trans == DFT_C2R)*(n>>2);
+    s->tsin = ff_sin_tabs[nbits]+(trans == AV_DFT_R2C || trans == AV_DFT_C2R)*(n>>2);
 #if !CONFIG_HARDCODED_TABLES
     for (i = 0; i < (n>>2); i++) {
         s->tsin[i] = sin(i*theta);
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index 13011ec..ccdfe41 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -353,8 +353,8 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
     s->spillover_bitsize = 3 + av_ceil_log2(ctx->block_align);
     s->do_apf            =    flags & 0x1;
     if (s->do_apf) {
-        ff_rdft_init(&s->rdft,  7, DFT_R2C);
-        ff_rdft_init(&s->irdft, 7, IDFT_C2R);
+        ff_rdft_init(&s->rdft,  7, AV_DFT_R2C);
+        ff_rdft_init(&s->irdft, 7, AV_IDFT_C2R);
         ff_dct_init(&s->dct,  6, DCT_I);
         ff_dct_init(&s->dst,  6, DST_I);
 
-- 
1.7.4.1




More information about the ffmpeg-devel mailing list