2008-08-05 22:27:17 +03:00
|
|
|
/*
|
|
|
|
* AAC definitions and structures
|
|
|
|
* Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
|
|
|
|
* Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2010-04-20 17:45:34 +03:00
|
|
|
* @file
|
2008-08-05 22:27:17 +03:00
|
|
|
* AAC definitions and structures
|
|
|
|
* @author Oded Shimon ( ods15 ods15 dyndns org )
|
|
|
|
* @author Maxim Gavrilov ( maxim.gavrilov gmail com )
|
|
|
|
*/
|
|
|
|
|
2008-08-31 10:39:47 +03:00
|
|
|
#ifndef AVCODEC_AAC_H
|
|
|
|
#define AVCODEC_AAC_H
|
2008-08-05 22:27:17 +03:00
|
|
|
|
2015-06-30 11:53:04 +02:00
|
|
|
|
2015-07-20 13:36:17 +02:00
|
|
|
#include "aac_defines.h"
|
2008-08-05 22:27:17 +03:00
|
|
|
|
2008-08-09 13:46:27 +03:00
|
|
|
#define MAX_CHANNELS 64
|
2008-08-11 14:16:06 +03:00
|
|
|
#define MAX_ELEM_ID 16
|
2008-08-09 13:46:27 +03:00
|
|
|
|
2008-08-15 11:01:31 +03:00
|
|
|
#define TNS_MAX_ORDER 20
|
2011-02-14 11:09:43 +02:00
|
|
|
#define MAX_LTP_LONG_SFB 40
|
2008-08-15 11:01:31 +03:00
|
|
|
|
2008-08-11 14:16:06 +03:00
|
|
|
enum RawDataBlockType {
|
|
|
|
TYPE_SCE,
|
|
|
|
TYPE_CPE,
|
|
|
|
TYPE_CCE,
|
|
|
|
TYPE_LFE,
|
|
|
|
TYPE_DSE,
|
|
|
|
TYPE_PCE,
|
|
|
|
TYPE_FIL,
|
|
|
|
TYPE_END,
|
|
|
|
};
|
|
|
|
|
2008-08-09 13:46:27 +03:00
|
|
|
enum ExtensionPayloadID {
|
|
|
|
EXT_FILL,
|
|
|
|
EXT_FILL_DATA,
|
|
|
|
EXT_DATA_ELEMENT,
|
|
|
|
EXT_DYNAMIC_RANGE = 0xb,
|
|
|
|
EXT_SBR_DATA = 0xd,
|
|
|
|
EXT_SBR_DATA_CRC = 0xe,
|
|
|
|
};
|
|
|
|
|
2008-08-05 22:27:17 +03:00
|
|
|
enum WindowSequence {
|
|
|
|
ONLY_LONG_SEQUENCE,
|
|
|
|
LONG_START_SEQUENCE,
|
|
|
|
EIGHT_SHORT_SEQUENCE,
|
|
|
|
LONG_STOP_SEQUENCE,
|
|
|
|
};
|
|
|
|
|
2008-08-09 13:46:27 +03:00
|
|
|
enum BandType {
|
|
|
|
ZERO_BT = 0, ///< Scalefactors and spectral data are all zero.
|
|
|
|
FIRST_PAIR_BT = 5, ///< This and later band types encode two values (rather than four) with one code word.
|
|
|
|
ESC_BT = 11, ///< Spectral data are coded with an escape sequence.
|
2015-06-26 22:16:30 +02:00
|
|
|
RESERVED_BT = 12, ///< Band types following are encoded differently from others.
|
2008-08-09 13:46:27 +03:00
|
|
|
NOISE_BT = 13, ///< Spectral data are scaled white noise not coded in the bitstream.
|
2015-06-26 22:16:30 +02:00
|
|
|
INTENSITY_BT2 = 14, ///< Scalefactor data are intensity stereo positions (out of phase).
|
|
|
|
INTENSITY_BT = 15, ///< Scalefactor data are intensity stereo positions (in phase).
|
2008-08-09 13:46:27 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
enum ChannelPosition {
|
2012-01-07 04:22:45 +03:00
|
|
|
AAC_CHANNEL_OFF = 0,
|
2008-08-05 22:27:17 +03:00
|
|
|
AAC_CHANNEL_FRONT = 1,
|
|
|
|
AAC_CHANNEL_SIDE = 2,
|
|
|
|
AAC_CHANNEL_BACK = 3,
|
|
|
|
AAC_CHANNEL_LFE = 4,
|
|
|
|
AAC_CHANNEL_CC = 5,
|
|
|
|
};
|
|
|
|
|
2008-11-24 02:13:50 +02:00
|
|
|
/**
|
|
|
|
* Predictor State
|
|
|
|
*/
|
2012-09-27 11:19:53 +03:00
|
|
|
typedef struct PredictorState {
|
2015-06-30 11:53:05 +02:00
|
|
|
AAC_FLOAT cor0;
|
|
|
|
AAC_FLOAT cor1;
|
|
|
|
AAC_FLOAT var0;
|
|
|
|
AAC_FLOAT var1;
|
|
|
|
AAC_FLOAT r0;
|
|
|
|
AAC_FLOAT r1;
|
2015-08-21 20:38:05 +02:00
|
|
|
AAC_FLOAT k1;
|
|
|
|
AAC_FLOAT x_est;
|
2008-11-24 02:13:50 +02:00
|
|
|
} PredictorState;
|
|
|
|
|
|
|
|
#define MAX_PREDICTORS 672
|
|
|
|
|
2009-07-08 23:01:31 +03:00
|
|
|
#define SCALE_DIV_512 36 ///< scalefactor difference that corresponds to scale difference in 512 times
|
|
|
|
#define SCALE_ONE_POS 140 ///< scalefactor index that corresponds to scale=1.0
|
|
|
|
#define SCALE_MAX_POS 255 ///< scalefactor index maximum value
|
|
|
|
#define SCALE_MAX_DIFF 60 ///< maximum scalefactor difference allowed by standard
|
|
|
|
#define SCALE_DIFF_ZERO 60 ///< codebook index corresponding to zero scalefactor indices difference
|
|
|
|
|
2015-11-28 00:01:49 +02:00
|
|
|
#define POW_SF2_ZERO 200 ///< ff_aac_pow2sf_tab index corresponding to pow(2, 0);
|
|
|
|
|
2015-04-12 06:50:34 +02:00
|
|
|
#define NOISE_PRE 256 ///< preamble for NOISE_BT, put in bitstream with the first noise band
|
|
|
|
#define NOISE_PRE_BITS 9 ///< length of preamble
|
2015-04-14 01:33:51 +02:00
|
|
|
#define NOISE_OFFSET 90 ///< subtracted from global gain, used as offset for the preamble
|
2015-04-12 06:50:34 +02:00
|
|
|
|
2012-09-27 11:19:53 +03:00
|
|
|
typedef struct Pulse {
|
2008-08-09 13:46:27 +03:00
|
|
|
int num_pulse;
|
2009-07-08 23:01:31 +03:00
|
|
|
int start;
|
2008-08-15 03:19:14 +03:00
|
|
|
int pos[4];
|
2008-08-09 13:46:27 +03:00
|
|
|
int amp[4];
|
|
|
|
} Pulse;
|
|
|
|
|
2008-08-31 10:39:47 +03:00
|
|
|
#endif /* AVCODEC_AAC_H */
|