Changeset 126 for libmpcdec/branches/zorg/src/mpc_decoder.c
- Timestamp:
- 11/13/06 20:13:18 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpcdec/branches/zorg/src/mpc_decoder.c
r108 r126 70 70 static void mpc_decoder_requantisierung(mpc_decoder *d); 71 71 72 static void mpc_decoder_reset_y(mpc_decoder *d)73 {74 memset(d->Y_L, 0, sizeof d->Y_L);75 memset(d->Y_R, 0, sizeof d->Y_R);76 }72 // static void mpc_decoder_reset_y(mpc_decoder *d) 73 // { 74 // memset(d->Y_L, 0, sizeof d->Y_L); 75 // memset(d->Y_R, 0, sizeof d->Y_R); 76 // } 77 77 78 78 void mpc_decoder_setup(mpc_decoder *d) … … 92 92 d->ms = si->ms; 93 93 d->max_band = si->max_band; 94 d->frames = si->frames;95 d->is_true_gapless = si->is_true_gapless;96 94 d->channels = si->channels; 97 d->last_frame_samples = si->last_frame_samples; 95 96 if (si->stream_version == 7 && si->is_true_gapless) 97 d->samples = ((si->samples + MPC_FRAME_LENGTH - 1) / MPC_FRAME_LENGTH) * MPC_FRAME_LENGTH; 98 else 99 d->samples = si->samples; 98 100 } 99 101 … … 119 121 mpc_frame_info * i) 120 122 { 123 mpc_bits_reader r_sav = *r; 121 124 mpc_int64_t samples_left; 122 if (d->decoded_frames >= d->frames && !d->is_true_gapless) { 123 mpc_decoder_reset_y(d); 124 } else { 125 mpc_decoder_read_bitstream_sv7(d, r); 126 mpc_decoder_requantisierung(d); 125 126 if (d->decoded_samples >= d->samples && d->samples != 0) { 127 i->samples = 0; 128 return; 127 129 } 130 131 mpc_decoder_read_bitstream_sv7(d, r); 132 mpc_decoder_requantisierung(d); 128 133 mpc_decoder_synthese_filter_float(d, i->buffer); 129 134 130 d->decoded_frames++; 131 132 // cut off first MPC_DECODER_SYNTH_DELAY zero-samples 135 d->decoded_samples += MPC_FRAME_LENGTH; 136 133 137 // reconstruct exact filelength 134 if (d->decoded_frames == d->frames && (d->stream_version & 15) == 7 && 135 (d->last_frame_samples = mpc_bits_read(r, 11)) == 0) 136 // Encoder bugfix 137 d->last_frame_samples = MPC_FRAME_LENGTH; 138 139 samples_left = d->last_frame_samples + MPC_DECODER_SYNTH_DELAY 140 + ((mpc_int64_t)d->frames - d->decoded_frames) * MPC_FRAME_LENGTH; 141 138 if (d->decoded_samples == d->samples && d->stream_version == 7) { 139 int last_frame_samples = mpc_bits_read(r, 11); 140 if (last_frame_samples == 0) last_frame_samples = MPC_FRAME_LENGTH; 141 d->samples += last_frame_samples - MPC_FRAME_LENGTH; 142 } 143 144 samples_left = d->samples - d->decoded_samples + MPC_DECODER_SYNTH_DELAY; 142 145 i->samples = samples_left > MPC_FRAME_LENGTH ? MPC_FRAME_LENGTH : samples_left < 0 ? 0 : samples_left; 143 144 if (samples_left <= MPC_FRAME_LENGTH) d->is_true_gapless = 0; 146 i->bits = ((r->buff - r_sav.buff) << 3) + r_sav.count - r->count; 145 147 146 148 if (d->samples_to_skip) {
Note: See TracChangeset
for help on using the changeset viewer.