📄 coder.h
字号:
/* ***** BEGIN LICENSE BLOCK *****
*
* Portions Copyright (c) 1995-2005 RealNetworks, Inc. All Rights Reserved.
*
* The contents of this file, and the files included with this file,
* are subject to the current version of the RealNetworks Public
* Source License (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
* the file under the current version of the RealNetworks Community
* Source License (the "RCSL") available at
* http://www.helixcommunity.org/content/rcsl, in which case the RCSL
* will apply. You may also obtain the license terms directly from
* RealNetworks. You may not use this file except in compliance with
* the RPSL or, if you have a valid RCSL with RealNetworks applicable
* to this file, the RCSL. Please see the applicable RPSL or RCSL for
* the rights, obligations and limitations governing use of the
* contents of the file.
*
* This file is part of the Helix DNA Technology. RealNetworks is the
* developer of the Original Code and owns the copyrights in the
* portions it created.
*
* This file, and the files included with this file, is distributed
* and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
* ENJOYMENT OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* http://www.helixcommunity.org/content/tck
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** */
/**************************************************************************************
* Fixed-point HE-AAC decoder
* Jon Recker (jrecker@real.com)
* February 2005
*
* coder.h - definitions of platform-specific data structures, functions, and tables
**************************************************************************************/
#ifndef _CODER_H
#define _CODER_H
#include "aaccommon.h"
#include "bitstream.h"
#ifndef ASSERT
#if defined(_WIN32) && defined(_M_IX86) && (defined (_DEBUG) || defined (REL_ENABLE_ASSERTS))
#define ASSERT(x) if (!(x)) __asm int 3;
#else
#define ASSERT(x) /* do nothing */
#endif
#endif
#ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
#define NWINDOWS_LONG 1
#define NWINDOWS_SHORT 8
#define DATA_BUF_SIZE 510 /* max count = 255 + 255 */
#define FILL_BUF_SIZE 269 /* max count = 15 + 255 - 1*/
#define ADIF_COPYID_SIZE 9
#define MAX_COMMENT_BYTES 255
#define MAX_NUM_FCE 15
#define MAX_NUM_SCE 15
#define MAX_NUM_BCE 15
#define MAX_NUM_LCE 3
#define MAX_NUM_ADE 7
#define MAX_NUM_CCE 15
#define CHAN_ELEM_IS_CPE(x) (((x) & 0x10) >> 4) /* bit 4 = SCE/CPE flag */
#define CHAN_ELEM_GET_TAG(x) (((x) & 0x0f) >> 0) /* bits 3-0 = instance tag */
#define CHAN_ELEM_SET_CPE(x) (((x) & 0x01) << 4) /* bit 4 = SCE/CPE flag */
#define CHAN_ELEM_SET_TAG(x) (((x) & 0x0f) << 0) /* bits 3-0 = instance tag */
#define MAX_HUFF_BITS 20
#define HUFFTAB_SPEC_OFFSET 1
/* do y <<= n, clipping to range [-2^30, 2^30 - 1] (i.e. output has one guard bit) */
#define CLIP_2N_SHIFT(y, n) { \
int sign = (y) >> 31; \
if (sign != (y) >> (30 - (n))) { \
(y) = sign ^ (0x3fffffff); \
} else { \
(y) = (y) << (n); \
} \
}
/* clip to [-2^n, 2^n-1], valid range of n = [1, 30] */
#define CLIP_2N(val, n) { \
if ((val) >> 31 != (val) >> (n)) \
(val) = ((val) >> 31) ^ ((1 << (n)) - 1); \
}
#define SF_DQ_OFFSET 15
#define FBITS_OUT_DQ 20
#define FBITS_OUT_DQ_OFF (FBITS_OUT_DQ - SF_DQ_OFFSET) /* number of fraction bits out of dequant, including 2^15 bias */
#define FBITS_IN_IMDCT FBITS_OUT_DQ_OFF /* number of fraction bits into IMDCT */
#define GBITS_IN_DCT4 4 /* min guard bits in for DCT4 */
#define FBITS_LOST_DCT4 1 /* number of fraction bits lost (>> out) in DCT-IV */
#define FBITS_LOST_WND 1 /* number of fraction bits lost (>> out) in synthesis window (neg = gain frac bits) */
#define FBITS_LOST_IMDCT (FBITS_LOST_DCT4 + FBITS_LOST_WND)
#define FBITS_OUT_IMDCT (FBITS_IN_IMDCT - FBITS_LOST_IMDCT)
#define NUM_IMDCT_SIZES 2
/* additional external symbols to name-mangle for static linking */
#define DecodeProgramConfigElement STATNAME(DecodeProgramConfigElement)
#define DecodeHuffmanScalar STATNAME(DecodeHuffmanScalar)
#define DecodeSpectrumLong STATNAME(DecodeSpectrumLong)
#define DecodeSpectrumShort STATNAME(DecodeSpectrumShort)
#define DecodeICSInfo STATNAME(DecodeICSInfo)
#define DCT4 STATNAME(DCT4)
#define R4FFT STATNAME(R4FFT)
#define DecWindowOverlapNoClip STATNAME(DecWindowOverlapNoClip)
#define DecWindowOverlapLongStartNoClip STATNAME(DecWindowOverlapLongStartNoClip)
#define DecWindowOverlapLongStopNoClip STATNAME(DecWindowOverlapLongStopNoClip)
#define DecWindowOverlapShortNoClip STATNAME(DecWindowOverlapShortNoClip)
#define huffTabSpecInfo STATNAME(huffTabSpecInfo)
#define huffTabSpec STATNAME(huffTabSpec)
#define huffTabScaleFactInfo STATNAME(huffTabScaleFactInfo)
#define huffTabScaleFact STATNAME(huffTabScaleFact)
#define cos4sin4tab STATNAME(cos4sin4tab)
#define cos4sin4tabOffset STATNAME(cos4sin4tabOffset)
#define cos1sin1tab STATNAME(cos1sin1tab)
#define sinWindow STATNAME(sinWindow)
#define sinWindowOffset STATNAME(sinWindowOffset)
#define kbdWindow STATNAME(kbdWindow)
#define kbdWindowOffset STATNAME(kbdWindowOffset)
#define bitrevtab STATNAME(bitrevtab)
#define bitrevtabOffset STATNAME(bitrevtabOffset)
#define uniqueIDTab STATNAME(uniqueIDTab)
#define twidTabEven STATNAME(twidTabEven)
#define twidTabOdd STATNAME(twidTabOdd)
typedef struct _HuffInfo {
int maxBits; /* number of bits in longest codeword */
unsigned char count[MAX_HUFF_BITS]; /* count[i] = number of codes with length i+1 bits */
int offset; /* offset into symbol table */
} HuffInfo;
typedef struct _PulseInfo {
unsigned char pulseDataPresent;
unsigned char numPulse;
unsigned char startSFB;
unsigned char offset[MAX_PULSES];
unsigned char amp[MAX_PULSES];
} PulseInfo;
typedef struct _TNSInfo {
unsigned char tnsDataPresent;
unsigned char numFilt[MAX_TNS_FILTERS]; /* max 1 filter each for 8 short windows, or 3 filters for 1 long window */
unsigned char coefRes[MAX_TNS_FILTERS];
unsigned char length[MAX_TNS_FILTERS];
unsigned char order[MAX_TNS_FILTERS];
unsigned char dir[MAX_TNS_FILTERS];
signed char coef[MAX_TNS_COEFS]; /* max 3 filters * 20 coefs for 1 long window, or 1 filter * 7 coefs for each of 8 short windows */
} TNSInfo;
typedef struct _GainControlInfo {
unsigned char gainControlDataPresent;
unsigned char maxBand;
unsigned char adjNum[MAX_GAIN_BANDS][MAX_GAIN_WIN];
unsigned char alevCode[MAX_GAIN_BANDS][MAX_GAIN_WIN][MAX_GAIN_ADJUST];
unsigned char alocCode[MAX_GAIN_BANDS][MAX_GAIN_WIN][MAX_GAIN_ADJUST];
} GainControlInfo;
typedef struct _ICSInfo {
unsigned char icsResBit;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -