Changeset 310


Ignore:
Timestamp:
05/04/07 14:10:51 (17 years ago)
Author:
r2d
Message:
  • corrected a M/S bug in sv8 decoding
  • changed Max_used_band usage in sv7 decoding, so it as the same meaning as in sv8 decoding
Location:
libmpc/trunk/libmpcdec
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libmpc/trunk/libmpcdec/mpc_bits_reader.h

    r296 r310  
    4444extern const mpc_uint32_t Cnk_lost[MAX_ENUM / 2][MAX_ENUM];
    4545
     46// can read up to 31 bits
    4647static mpc_inline mpc_uint32_t mpc_bits_read(mpc_bits_reader * r, const unsigned int nb_bits)
    4748{
     
    5859        }
    5960
    60         return ret & (-1u >> (32 - nb_bits));
     61        return ret & ((1 << nb_bits) - 1);
    6162}
    6263
  • libmpc/trunk/libmpcdec/mpc_decoder.c

    r301 r310  
    369369        d->Res_L[0] = mpc_bits_read(r, 4);
    370370        d->Res_R[0] = mpc_bits_read(r, 4);
    371         if (d->ms && !(d->Res_L[0] == 0 && d->Res_R[0] == 0))
    372         d->MS_Flag[0] = mpc_bits_read(r, 1);
     371        if (!(d->Res_L[0] == 0 && d->Res_R[0] == 0)) {
     372                if (d->ms)
     373                d->MS_Flag[0] = mpc_bits_read(r, 1);
     374                Max_used_Band = 1;
     375        }
    373376
    374377    // consecutive subbands
     
    383386                        if (d->ms)
    384387                d->MS_Flag[n] = mpc_bits_read(r, 1);
    385                         Max_used_Band = n;
     388                        Max_used_Band = n + 1;
    386389                }
    387390    }
     391
    388392    /****************************** SCFI ******************************/
    389     for ( n = 0; n <= Max_used_Band; n++ ) {
     393    for ( n = 0; n < Max_used_Band; n++ ) {
    390394                if (d->Res_L[n])
    391395                        d->SCFI_L[n] = mpc_bits_huff_dec(r, mpc_table_HuffSCFI);
     
    395399
    396400    /**************************** SCF/DSCF ****************************/
    397     for ( n = 0; n <= Max_used_Band; n++ ) {
     401    for ( n = 0; n < Max_used_Band; n++ ) {
    398402                mpc_int32_t * SCF = d->SCF_Index_L[n];
    399403                mpc_uint32_t Res  = d->Res_L[n], SCFI = d->SCFI_L[n];
     
    448452
    449453    /***************************** Samples ****************************/
    450     for ( n = 0; n <= Max_used_Band; n++ ) {
     454    for ( n = 0; n < Max_used_Band; n++ ) {
    451455                mpc_int32_t *q = d->Q[n].L, Res = d->Res_L[n];
    452456                do {
     
    554558        for( n = Max_used_Band; n <= d->max_band; n++)
    555559                d->Res_L[n] = d->Res_R[n] = 0;
    556 
    557 
    558560
    559561        /****************************** SCFI ******************************/
  • libmpc/trunk/libmpcdec/streaminfo.c

    r298 r310  
    105105
    106106        si->bitrate            = 0;
    107         frames                 = mpc_bits_read(r, 32);
     107        frames                 = (mpc_bits_read(r, 16) << 16) | mpc_bits_read(r, 16);
    108108        mpc_bits_read(r, 1); // intensity stereo : should be 0
    109109        si->ms                 = mpc_bits_read(r, 1);
     
    185185        mpc_bits_reader r = *r_in;
    186186
    187         CRC = mpc_bits_read(&r, 32);
     187        CRC = (mpc_bits_read(&r, 16) << 16) | mpc_bits_read(&r, 16);
    188188        if (CRC != crc32(r.buff + 1 - (r.count >> 3), (int)block_size - 4))
    189189                return MPC_STATUS_FILE;
Note: See TracChangeset for help on using the changeset viewer.