Changeset 107 for libmpcdec/branches/zorg/src/mpc_decoder.c
- Timestamp:
- 11/09/06 13:44:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpcdec/branches/zorg/src/mpc_decoder.c
r104 r107 89 89 void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si) 90 90 { 91 d->StreamVersion = si->stream_version; 92 d->MS_used = si->ms; 93 d->Max_Band = si->max_band; 94 d->OverallFrames = si->frames; 95 d->TrueGaplessPresent = si->is_true_gapless; 96 d->SampleRate = si->sample_freq; 91 d->stream_version = si->stream_version; 92 d->ms = si->ms; 93 d->max_band = si->max_band; 94 d->frames = si->frames; 95 d->is_true_gapless = si->is_true_gapless; 96 d->channels = si->channels; 97 d->last_frame_samples = si->last_frame_samples; 97 98 } 98 99 … … 118 119 mpc_frame_info * i) 119 120 { 120 // FIXME : sauter décodage si d->samples_to_skip > MPC_FRAME_LENGTH pour sv7 121 switch (d->StreamVersion) { 122 case 0x07: 123 case 0x17: 124 case 0x08: 125 i->channels = 2; 126 i->sample_freq = d->SampleRate; 127 i->samples = MPC_FRAME_LENGTH; 128 mpc_decoder_read_bitstream_sv7(d, r); 129 break; 121 d->decoded_frames++; 122 123 if (d->decoded_frames > d->frames && !d->is_true_gapless) { 124 mpc_decoder_reset_y(d); 125 } else { 126 mpc_decoder_read_bitstream_sv7(d, r); 127 mpc_decoder_requantisierung(d); 130 128 } 131 132 // synthesize signal133 mpc_decoder_requantisierung(d);134 129 mpc_decoder_synthese_filter_float(d, i->buffer); 135 130 136 d->DecodedFrames++; 137 138 // // cut off first MPC_DECODER_SYNTH_DELAY zero-samples 139 // if (d->DecodedFrames == d->OverallFrames && d->StreamVersion >= 6) { 140 // // reconstruct exact filelength 141 // mpc_int32_t mod_block = mpc_bits_read(r, 11); 142 // mpc_int32_t FilterDecay; 143 // 144 // if (mod_block == 0) { 145 // // Encoder bugfix 146 // mod_block = 1152; 147 // } 148 // FilterDecay = (mod_block + MPC_DECODER_SYNTH_DELAY) % MPC_FRAME_LENGTH; 149 // 150 // // additional FilterDecay samples are needed for decay of synthesis filter 151 // if (MPC_DECODER_SYNTH_DELAY + mod_block >= MPC_FRAME_LENGTH) { 152 // if (!d->TrueGaplessPresent) { 153 // mpc_decoder_reset_y(d); 154 // } else { 155 // mpc_bits_read(r, 20); 156 // mpc_decoder_read_bitstream_sv7(d, FALSE); 157 // mpc_decoder_requantisierung(d, d->Max_Band); 158 // } 159 // 160 // mpc_decoder_synthese_filter_float(d, buffer + 2304); 161 // 162 // i->samples = MPC_FRAME_LENGTH + FilterDecay; 163 // } 164 // else { // there are only FilterDecay samples needed for this frame 165 // i->samples = FilterDecay; 166 // } 167 // } 131 // cut off first MPC_DECODER_SYNTH_DELAY zero-samples 132 // reconstruct exact filelength 133 if (d->decoded_frames == d->frames && (d->stream_version & 15) == 7) { 134 d->last_frame_samples = mpc_bits_read(r, 11); 135 if (d->last_frame_samples == 0) { 136 // Encoder bugfix 137 d->last_frame_samples = MPC_FRAME_LENGTH; 138 } 139 } 140 141 mpc_int32_t samples_left = d->last_frame_samples + MPC_DECODER_SYNTH_DELAY 142 + (d->frames - d->decoded_frames) * MPC_FRAME_LENGTH; 143 144 i->samples = samples_left > MPC_FRAME_LENGTH ? MPC_FRAME_LENGTH : samples_left < 0 ? 0 : samples_left; 168 145 169 146 if (d->samples_to_skip) { … … 173 150 } else { 174 151 i->samples -= d->samples_to_skip; 175 memmove(i->buffer, i->buffer + d->samples_to_skip * i->channels,176 i->samples * i->channels * sizeof (MPC_SAMPLE_FORMAT));152 memmove(i->buffer, i->buffer + d->samples_to_skip * d->channels, 153 i->samples * d->channels * sizeof (MPC_SAMPLE_FORMAT)); 177 154 d->samples_to_skip = 0; 178 155 } … … 193 170 mpc_int32_t* L; 194 171 mpc_int32_t* R; 195 const mpc_int32_t Last_Band = d-> Max_Band;172 const mpc_int32_t Last_Band = d->max_band; 196 173 197 174 #ifdef MPC_FIXED_POINT … … 363 340 *ResL = mpc_bits_read(r, 4); 364 341 *ResR = mpc_bits_read(r, 4); 365 if (d->MS_used&& !(*ResL==0 && *ResR==0)) {342 if (d->ms && !(*ResL==0 && *ResR==0)) { 366 343 d->MS_Flag[0] = mpc_bits_read(r, 1); 367 344 } … … 369 346 // consecutive subbands 370 347 ++ResL; ++ResR; // increase pointers 371 for (n=1; n <= d->Max_Band; ++n, ++ResL, ++ResR)348 for (n=1; n <= d->max_band; ++n, ++ResL, ++ResR) 372 349 { 373 350 idx = mpc_bits_huff_dec(r, mpc_table_HuffHdr); … … 377 354 *ResR = (idx!=4) ? *(ResR-1) + idx : (int) mpc_bits_read(r, 4); 378 355 379 if (d->MS_used&& !(*ResL==0 && *ResR==0)) {356 if (d->ms && !(*ResL==0 && *ResR==0)) { 380 357 d->MS_Flag[n] = mpc_bits_read(r, 1); 381 358 }
Note: See TracChangeset
for help on using the changeset viewer.