diff options
author | Zdenek Kabelac <kabi@informatics.muni.cz> | 2003-02-11 16:35:48 +0000 |
---|---|---|
committer | Zdenek Kabelac <kabi@informatics.muni.cz> | 2003-02-11 16:35:48 +0000 |
commit | 0c1a9edad463bd6e22b30c19b700b099c7093fc1 (patch) | |
tree | d16ccbe29c8dbfc2cdc4e92cac31b22c181ed940 /libavcodec/ac3enc.c | |
parent | 4596673c062e3834b6d31d1e8e210b64d74ce26b (diff) | |
download | ffmpeg-0c1a9edad463bd6e22b30c19b700b099c7093fc1.tar.gz |
* UINTX -> uintx_t INTX -> intx_t
Originally committed as revision 1578 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3enc.c')
-rw-r--r-- | libavcodec/ac3enc.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 7abc5f3971..bd29b2b46d 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -63,7 +63,7 @@ typedef struct AC3EncodeContext { static void fft_init(int ln); static void ac3_crc_init(void); -static inline INT16 fix15(float a) +static inline int16_t fix15(float a) { int v; v = (int)(a * (float)(1 << 15)); @@ -110,18 +110,18 @@ static inline int calc_lowcomp(int a, int b0, int b1, int bin) /* AC3 bit allocation. The algorithm is the one described in the AC3 spec. */ -void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, UINT8 *bap, - INT8 *exp, int start, int end, +void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap, + int8_t *exp, int start, int end, int snroffset, int fgain, int is_lfe, int deltbae,int deltnseg, - UINT8 *deltoffst, UINT8 *deltlen, UINT8 *deltba) + uint8_t *deltoffst, uint8_t *deltlen, uint8_t *deltba) { int bin,i,j,k,end1,v,v1,bndstrt,bndend,lowcomp,begin; int fastleak,slowleak,address,tmp; - INT16 psd[256]; /* scaled exponents */ - INT16 bndpsd[50]; /* interpolated exponents */ - INT16 excite[50]; /* excitation */ - INT16 mask[50]; /* masking value */ + int16_t psd[256]; /* scaled exponents */ + int16_t bndpsd[50]; /* interpolated exponents */ + int16_t excite[50]; /* excitation */ + int16_t mask[50]; /* masking value */ /* exponent mapping to PSD */ for(bin=start;bin<end;bin++) { @@ -404,10 +404,10 @@ static void fft(IComplex *z, int ln) } /* do a 512 point mdct */ -static void mdct512(INT32 *out, INT16 *in) +static void mdct512(int32_t *out, int16_t *in) { int i, re, im, re1, im1; - INT16 rot[N]; + int16_t rot[N]; IComplex x[N/4]; /* shift to simplify computations */ @@ -436,7 +436,7 @@ static void mdct512(INT32 *out, INT16 *in) } /* XXX: use another norm ? */ -static int calc_exp_diff(UINT8 *exp1, UINT8 *exp2, int n) +static int calc_exp_diff(uint8_t *exp1, uint8_t *exp2, int n) { int sum, i; sum = 0; @@ -446,8 +446,8 @@ static int calc_exp_diff(UINT8 *exp1, UINT8 *exp2, int n) return sum; } -static void compute_exp_strategy(UINT8 exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS], - UINT8 exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], +static void compute_exp_strategy(uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS], + uint8_t exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], int ch, int is_lfe) { int i, j; @@ -493,7 +493,7 @@ static void compute_exp_strategy(UINT8 exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS] } /* set exp[i] to min(exp[i], exp1[i]) */ -static void exponent_min(UINT8 exp[N/2], UINT8 exp1[N/2], int n) +static void exponent_min(uint8_t exp[N/2], uint8_t exp1[N/2], int n) { int i; @@ -505,13 +505,13 @@ static void exponent_min(UINT8 exp[N/2], UINT8 exp1[N/2], int n) /* update the exponents so that they are the ones the decoder will decode. Return the number of bits used to code the exponents */ -static int encode_exp(UINT8 encoded_exp[N/2], - UINT8 exp[N/2], +static int encode_exp(uint8_t encoded_exp[N/2], + uint8_t exp[N/2], int nb_exps, int exp_strategy) { int group_size, nb_groups, i, j, k, recurse, exp_min, delta; - UINT8 exp1[N/2]; + uint8_t exp1[N/2]; switch(exp_strategy) { case EXP_D15: @@ -586,7 +586,7 @@ static int encode_exp(UINT8 encoded_exp[N/2], } /* return the size in bits taken by the mantissa */ -static int compute_mantissa_size(AC3EncodeContext *s, UINT8 *m, int nb_coefs) +static int compute_mantissa_size(AC3EncodeContext *s, uint8_t *m, int nb_coefs) { int bits, mant, i; @@ -637,9 +637,9 @@ static int compute_mantissa_size(AC3EncodeContext *s, UINT8 *m, int nb_coefs) static int bit_alloc(AC3EncodeContext *s, - UINT8 bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], - UINT8 encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], - UINT8 exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS], + uint8_t bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], + uint8_t encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], + uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS], int frame_bits, int csnroffst, int fsnroffst) { int i, ch; @@ -651,7 +651,7 @@ static int bit_alloc(AC3EncodeContext *s, s->mant4_cnt = 0; for(ch=0;ch<s->nb_all_channels;ch++) { ac3_parametric_bit_allocation(&s->bit_alloc, - bap[i][ch], (INT8 *)encoded_exp[i][ch], + bap[i][ch], (int8_t *)encoded_exp[i][ch], 0, s->nb_coefs[ch], (((csnroffst-15) << 4) + fsnroffst) << 2, @@ -673,14 +673,14 @@ static int bit_alloc(AC3EncodeContext *s, #define SNR_INC1 4 static int compute_bit_allocation(AC3EncodeContext *s, - UINT8 bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], - UINT8 encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], - UINT8 exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS], + uint8_t bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], + uint8_t encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], + uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS], int frame_bits) { int i, ch; int csnroffst, fsnroffst; - UINT8 bap1[NB_BLOCKS][AC3_MAX_CHANNELS][N/2]; + uint8_t bap1[NB_BLOCKS][AC3_MAX_CHANNELS][N/2]; static int frame_bits_inc[8] = { 0, 0, 2, 2, 2, 4, 2, 4 }; /* init default parameters */ @@ -816,7 +816,7 @@ static int AC3_encode_init(AVCodecContext *avctx) AC3EncodeContext *s = avctx->priv_data; int i, j, ch; float alpha; - static const UINT8 acmod_defs[6] = { + static const uint8_t acmod_defs[6] = { 0x01, /* C */ 0x02, /* L R */ 0x03, /* L C R */ @@ -966,19 +966,19 @@ static inline int asym_quant(int c, int e, int qbits) /* Output one audio block. There are NB_BLOCKS audio blocks in one AC3 frame */ static void output_audio_block(AC3EncodeContext *s, - UINT8 exp_strategy[AC3_MAX_CHANNELS], - UINT8 encoded_exp[AC3_MAX_CHANNELS][N/2], - UINT8 bap[AC3_MAX_CHANNELS][N/2], - INT32 mdct_coefs[AC3_MAX_CHANNELS][N/2], - INT8 global_exp[AC3_MAX_CHANNELS], + uint8_t exp_strategy[AC3_MAX_CHANNELS], + uint8_t encoded_exp[AC3_MAX_CHANNELS][N/2], + uint8_t bap[AC3_MAX_CHANNELS][N/2], + int32_t mdct_coefs[AC3_MAX_CHANNELS][N/2], + int8_t global_exp[AC3_MAX_CHANNELS], int block_num) { int ch, nb_groups, group_size, i, baie; - UINT8 *p; - UINT16 qmant[AC3_MAX_CHANNELS][N/2]; + uint8_t *p; + uint16_t qmant[AC3_MAX_CHANNELS][N/2]; int exp0, exp1; int mant1_cnt, mant2_cnt, mant4_cnt; - UINT16 *qmant1_ptr, *qmant2_ptr, *qmant4_ptr; + uint16_t *qmant1_ptr, *qmant2_ptr, *qmant4_ptr; int delta0, delta1, delta2; for(ch=0;ch<s->nb_channels;ch++) @@ -1244,7 +1244,7 @@ static void ac3_crc_init(void) } } -static unsigned int ac3_crc(UINT8 *data, int n, unsigned int crc) +static unsigned int ac3_crc(uint8_t *data, int n, unsigned int crc) { int i; for(i=0;i<n;i++) { @@ -1284,7 +1284,7 @@ static unsigned int pow_poly(unsigned int a, unsigned int n, unsigned int poly) /* compute log2(max(abs(tab[]))) */ -static int log2_tab(INT16 *tab, int n) +static int log2_tab(int16_t *tab, int n) { int i, v; @@ -1295,7 +1295,7 @@ static int log2_tab(INT16 *tab, int n) return av_log2(v); } -static void lshift_tab(INT16 *tab, int n, int lshift) +static void lshift_tab(int16_t *tab, int n, int lshift) { int i; @@ -1315,7 +1315,7 @@ static void lshift_tab(INT16 *tab, int n, int lshift) static int output_frame_end(AC3EncodeContext *s) { int frame_size, frame_size_58, n, crc1, crc2, crc_inv; - UINT8 *frame; + uint8_t *frame; frame_size = s->frame_size; /* frame size in words */ /* align to 8 bits */ @@ -1350,24 +1350,24 @@ static int AC3_encode_frame(AVCodecContext *avctx, AC3EncodeContext *s = avctx->priv_data; short *samples = data; int i, j, k, v, ch; - INT16 input_samples[N]; - INT32 mdct_coef[NB_BLOCKS][AC3_MAX_CHANNELS][N/2]; - UINT8 exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2]; - UINT8 exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS]; - UINT8 encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2]; - UINT8 bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2]; - INT8 exp_samples[NB_BLOCKS][AC3_MAX_CHANNELS]; + int16_t input_samples[N]; + int32_t mdct_coef[NB_BLOCKS][AC3_MAX_CHANNELS][N/2]; + uint8_t exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2]; + uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS]; + uint8_t encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2]; + uint8_t bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2]; + int8_t exp_samples[NB_BLOCKS][AC3_MAX_CHANNELS]; int frame_bits; frame_bits = 0; for(ch=0;ch<s->nb_all_channels;ch++) { /* fixed mdct to the six sub blocks & exponent computation */ for(i=0;i<NB_BLOCKS;i++) { - INT16 *sptr; + int16_t *sptr; int sinc; /* compute input samples */ - memcpy(input_samples, s->last_samples[ch], N/2 * sizeof(INT16)); + memcpy(input_samples, s->last_samples[ch], N/2 * sizeof(int16_t)); sinc = s->nb_all_channels; sptr = samples + (sinc * (N/2) * i) + ch; for(j=0;j<N/2;j++) { @@ -1432,7 +1432,7 @@ static int AC3_encode_frame(AVCodecContext *avctx, /* copy encoded exponents for reuse case */ for(k=i+1;k<j;k++) { memcpy(encoded_exp[k][ch], encoded_exp[i][ch], - s->nb_coefs[ch] * sizeof(UINT8)); + s->nb_coefs[ch] * sizeof(uint8_t)); } i = j; } @@ -1492,8 +1492,8 @@ void fft_test(void) void mdct_test(void) { - INT16 input[N]; - INT32 output[N/2]; + int16_t input[N]; + int32_t output[N/2]; float input1[N]; float output1[N/2]; float s, a, err, e, emax; |