]> git.sesse.net Git - ffmpeg/blob - libavcodec/aac.h
Check available size before writing in decode_frame()
[ffmpeg] / libavcodec / aac.h
1 /*
2  * AAC definitions and structures
3  * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
4  * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22
23 /**
24  * @file aac.h
25  * AAC definitions and structures
26  * @author Oded Shimon  ( ods15 ods15 dyndns org )
27  * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
28  */
29
30 #ifndef FFMPEG_AAC_H
31 #define FFMPEG_AAC_H
32
33 #include "avcodec.h"
34 #include "dsputil.h"
35 #include "mpeg4audio.h"
36
37 #include <stdint.h>
38
39 #define AAC_INIT_VLC_STATIC(num, size) \
40     INIT_VLC_STATIC(&vlc_spectral[num], 6, ff_aac_spectral_sizes[num], \
41          ff_aac_spectral_bits[num], sizeof( ff_aac_spectral_bits[num][0]), sizeof( ff_aac_spectral_bits[num][0]), \
42         ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), sizeof(ff_aac_spectral_codes[num][0]), \
43         size);
44
45 #define IVQUANT_SIZE 1024
46
47 enum WindowSequence {
48     ONLY_LONG_SEQUENCE,
49     LONG_START_SEQUENCE,
50     EIGHT_SHORT_SEQUENCE,
51     LONG_STOP_SEQUENCE,
52 };
53
54 enum ChannelType {
55     AAC_CHANNEL_FRONT = 1,
56     AAC_CHANNEL_SIDE  = 2,
57     AAC_CHANNEL_BACK  = 3,
58     AAC_CHANNEL_LFE   = 4,
59     AAC_CHANNEL_CC    = 5,
60 };
61
62 /**
63  * main AAC context
64  */
65 typedef struct {
66     AVCodecContext * avccontext;
67
68     /**
69      * @defgroup tables   Computed / set up during initialization.
70      * @{
71      */
72     MDCTContext mdct;
73     MDCTContext mdct_small;
74     DSPContext dsp;
75     /** @} */
76
77     /**
78      * @defgroup output   Members used for output interleaving and down-mixing.
79      * @{
80      */
81     float add_bias;                                   ///< offset for dsp.float_to_int16
82     float sf_scale;                                   ///< Pre-scale for correct IMDCT and dsp.float_to_int16.
83     int sf_offset;                                    ///< offset into pow2sf_tab as appropriate for dsp.float_to_int16
84     /** @} */
85
86 } AACContext;
87
88 #endif /* FFMPEG_AAC_H */