misc/winutils/include/libavcodec/avfft.h
author koda
Wed, 24 Oct 2012 14:55:31 +0100
changeset 7813 7ac83d79b897
permissions -rw-r--r--
support video recording on windows with automation and headers
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7813
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     1
/*
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     2
 * This file is part of Libav.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     3
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     4
 * Libav is free software; you can redistribute it and/or
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     5
 * modify it under the terms of the GNU Lesser General Public
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     6
 * License as published by the Free Software Foundation; either
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     7
 * version 2.1 of the License, or (at your option) any later version.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     8
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
     9
 * Libav is distributed in the hope that it will be useful,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    12
 * Lesser General Public License for more details.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    13
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    14
 * You should have received a copy of the GNU Lesser General Public
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    15
 * License along with Libav; if not, write to the Free Software
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    17
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    18
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    19
#ifndef AVCODEC_AVFFT_H
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    20
#define AVCODEC_AVFFT_H
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    21
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    22
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    23
 * @file
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    24
 * @ingroup lavc_fft
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    25
 * FFT functions
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    26
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    27
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    28
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    29
 * @defgroup lavc_fft FFT functions
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    30
 * @ingroup lavc_misc
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    31
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    32
 * @{
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    33
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    34
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    35
typedef float FFTSample;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    36
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    37
typedef struct FFTComplex {
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    38
    FFTSample re, im;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    39
} FFTComplex;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    40
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    41
typedef struct FFTContext FFTContext;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    42
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    43
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    44
 * Set up a complex FFT.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    45
 * @param nbits           log2 of the length of the input array
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    46
 * @param inverse         if 0 perform the forward transform, if 1 perform the inverse
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    47
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    48
FFTContext *av_fft_init(int nbits, int inverse);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    49
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    50
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    51
 * Do the permutation needed BEFORE calling ff_fft_calc().
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    52
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    53
void av_fft_permute(FFTContext *s, FFTComplex *z);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    54
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    55
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    56
 * Do a complex FFT with the parameters defined in av_fft_init(). The
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    57
 * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    58
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    59
void av_fft_calc(FFTContext *s, FFTComplex *z);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    60
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    61
void av_fft_end(FFTContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    62
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    63
FFTContext *av_mdct_init(int nbits, int inverse, double scale);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    64
void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    65
void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    66
void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    67
void av_mdct_end(FFTContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    68
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    69
/* Real Discrete Fourier Transform */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    70
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    71
enum RDFTransformType {
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    72
    DFT_R2C,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    73
    IDFT_C2R,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    74
    IDFT_R2C,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    75
    DFT_C2R,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    76
};
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    77
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    78
typedef struct RDFTContext RDFTContext;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    79
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    80
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    81
 * Set up a real FFT.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    82
 * @param nbits           log2 of the length of the input array
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    83
 * @param trans           the type of transform
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    84
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    85
RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    86
void av_rdft_calc(RDFTContext *s, FFTSample *data);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    87
void av_rdft_end(RDFTContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    88
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    89
/* Discrete Cosine Transform */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    90
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    91
typedef struct DCTContext DCTContext;
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    92
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    93
enum DCTTransformType {
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    94
    DCT_II = 0,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    95
    DCT_III,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    96
    DCT_I,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    97
    DST_I,
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    98
};
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
    99
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   100
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   101
 * Set up DCT.
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   102
 * @param nbits           size of the input array:
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   103
 *                        (1 << nbits)     for DCT-II, DCT-III and DST-I
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   104
 *                        (1 << nbits) + 1 for DCT-I
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   105
 *
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   106
 * @note the first element of the input of DST-I is ignored
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   107
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   108
DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   109
void av_dct_calc(DCTContext *s, FFTSample *data);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   110
void av_dct_end (DCTContext *s);
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   111
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   112
/**
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   113
 * @}
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   114
 */
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   115
7ac83d79b897 support video recording on windows with automation and headers
koda
parents:
diff changeset
   116
#endif /* AVCODEC_AVFFT_H */