diff options
author | Michael Roitzsch <mroi@users.sourceforge.net> | 2002-08-28 20:27:56 +0000 |
---|---|---|
committer | Michael Roitzsch <mroi@users.sourceforge.net> | 2002-08-28 20:27:56 +0000 |
commit | 6ee05b430232df905b3413bcf20fe2c60da024fd (patch) | |
tree | d2ac4921038a5871d2859b17071fd24774b42ee3 /src/liba52/bit_allocate.c | |
parent | b5ccc95d14f0937c3096c536165af0e2dbfc10ee (diff) | |
download | xine-lib-6ee05b430232df905b3413bcf20fe2c60da024fd.tar.gz xine-lib-6ee05b430232df905b3413bcf20fe2c60da024fd.tar.bz2 |
sync to latest liba52 release (0.7.4)
CVS patchset: 2543
CVS date: 2002/08/28 20:27:56
Diffstat (limited to 'src/liba52/bit_allocate.c')
-rw-r--r-- | src/liba52/bit_allocate.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/liba52/bit_allocate.c b/src/liba52/bit_allocate.c index 000e6c0dd..0567b2285 100644 --- a/src/liba52/bit_allocate.c +++ b/src/liba52/bit_allocate.c @@ -1,8 +1,10 @@ /* * bit_allocate.c - * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> + * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org> + * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> * * This file is part of a52dec, a free ATSC A-52 stream decoder. + * See http://liba52.sourceforge.net/ for updates. * * a52dec is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -119,9 +121,9 @@ do { \ mask -= floor; \ } while (0) -void bit_allocate (a52_state_t * state, a52_ba_t * ba, int bndstart, - int start, int end, int fastleak, int slowleak, - uint8_t * exp, int8_t * bap) +void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, + int start, int end, int fastleak, int slowleak, + expbap_t * expbap) { static int slowgain[4] = {0x540, 0x4d8, 0x478, 0x410}; static int dbpbtab[4] = {0xc00, 0x500, 0x300, 0x100}; @@ -129,6 +131,8 @@ void bit_allocate (a52_state_t * state, a52_ba_t * ba, int bndstart, 0xa10, 0xa90, 0xb10, 0x1400}; int i, j; + uint8_t * exp; + int8_t * bap; int fdecay, fgain, sdecay, sgain, dbknee, floor, snroffset; int psd, mask; int8_t * deltba; @@ -136,21 +140,24 @@ void bit_allocate (a52_state_t * state, a52_ba_t * ba, int bndstart, int halfrate; halfrate = state->halfrate; - fdecay = (63 + 20 * state->fdcycod) >> halfrate; - fgain = 128 + 128 * ba->fgaincod; - sdecay = (15 + 2 * state->sdcycod) >> halfrate; - sgain = slowgain[state->sgaincod]; - dbknee = dbpbtab[state->dbpbcod]; + fdecay = (63 + 20 * ((state->bai >> 7) & 3)) >> halfrate; /* fdcycod */ + fgain = 128 + 128 * (ba->bai & 7); /* fgaincod */ + sdecay = (15 + 2 * (state->bai >> 9)) >> halfrate; /* sdcycod */ + sgain = slowgain[(state->bai >> 5) & 3]; /* sgaincod */ + dbknee = dbpbtab[(state->bai >> 3) & 3]; /* dbpbcod */ hth = hthtab[state->fscod]; /* * if there is no delta bit allocation, make deltba point to an area * known to contain zeroes. baptab+156 here. */ deltba = (ba->deltbae == DELTA_BIT_NONE) ? baptab + 156 : ba->deltba; - floor = floortab[state->floorcod]; - snroffset = 960 - 64 * state->csnroffst - 4 * ba->fsnroffst + floor; + floor = floortab[state->bai & 7]; /* floorcod */ + snroffset = 960 - 64 * state->csnroffst - 4 * (ba->bai >> 3) + floor; floor >>= 5; + exp = expbap->exp; + bap = expbap->bap; + i = bndstart; j = start; if (start == 0) { /* not the coupling channel */ |