Changeset 310 for libmpc/trunk/libmpcdec
- Timestamp:
- 05/04/07 14:10:51 (18 years ago)
- Location:
- libmpc/trunk/libmpcdec
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/trunk/libmpcdec/mpc_bits_reader.h
r296 r310 44 44 extern const mpc_uint32_t Cnk_lost[MAX_ENUM / 2][MAX_ENUM]; 45 45 46 // can read up to 31 bits 46 47 static mpc_inline mpc_uint32_t mpc_bits_read(mpc_bits_reader * r, const unsigned int nb_bits) 47 48 { … … 58 59 } 59 60 60 return ret & ( -1u >> (32 - nb_bits));61 return ret & ((1 << nb_bits) - 1); 61 62 } 62 63 -
libmpc/trunk/libmpcdec/mpc_decoder.c
r301 r310 369 369 d->Res_L[0] = mpc_bits_read(r, 4); 370 370 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 } 373 376 374 377 // consecutive subbands … … 383 386 if (d->ms) 384 387 d->MS_Flag[n] = mpc_bits_read(r, 1); 385 Max_used_Band = n ;388 Max_used_Band = n + 1; 386 389 } 387 390 } 391 388 392 /****************************** SCFI ******************************/ 389 for ( n = 0; n < =Max_used_Band; n++ ) {393 for ( n = 0; n < Max_used_Band; n++ ) { 390 394 if (d->Res_L[n]) 391 395 d->SCFI_L[n] = mpc_bits_huff_dec(r, mpc_table_HuffSCFI); … … 395 399 396 400 /**************************** SCF/DSCF ****************************/ 397 for ( n = 0; n < =Max_used_Band; n++ ) {401 for ( n = 0; n < Max_used_Band; n++ ) { 398 402 mpc_int32_t * SCF = d->SCF_Index_L[n]; 399 403 mpc_uint32_t Res = d->Res_L[n], SCFI = d->SCFI_L[n]; … … 448 452 449 453 /***************************** Samples ****************************/ 450 for ( n = 0; n < =Max_used_Band; n++ ) {454 for ( n = 0; n < Max_used_Band; n++ ) { 451 455 mpc_int32_t *q = d->Q[n].L, Res = d->Res_L[n]; 452 456 do { … … 554 558 for( n = Max_used_Band; n <= d->max_band; n++) 555 559 d->Res_L[n] = d->Res_R[n] = 0; 556 557 558 560 559 561 /****************************** SCFI ******************************/ -
libmpc/trunk/libmpcdec/streaminfo.c
r298 r310 105 105 106 106 si->bitrate = 0; 107 frames = mpc_bits_read(r, 32);107 frames = (mpc_bits_read(r, 16) << 16) | mpc_bits_read(r, 16); 108 108 mpc_bits_read(r, 1); // intensity stereo : should be 0 109 109 si->ms = mpc_bits_read(r, 1); … … 185 185 mpc_bits_reader r = *r_in; 186 186 187 CRC = mpc_bits_read(&r, 32);187 CRC = (mpc_bits_read(&r, 16) << 16) | mpc_bits_read(&r, 16); 188 188 if (CRC != crc32(r.buff + 1 - (r.count >> 3), (int)block_size - 4)) 189 189 return MPC_STATUS_FILE;
Note: See TracChangeset
for help on using the changeset viewer.