diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c index 88329e4091..f153dcc58d 100644 --- a/libavcodec/mlpenc.c +++ b/libavcodec/mlpenc.c @@ -1970,12 +1970,8 @@ static void set_major_params(MLPEncodeContext *ctx) RestartHeader *rh = ctx->cur_restart_header; uint8_t max_huff_lsbs = 0; uint8_t max_output_bits = 0; - DecodingParams *seq_dp = (DecodingParams *) ctx->decoding_params+ - (ctx->restart_intervals - 1)*(ctx->sequence_size)*(ctx->avctx->channels) + - (ctx->seq_offset[ctx->restart_intervals - 1])*(ctx->avctx->channels); - ChannelParams *seq_cp = (ChannelParams *) ctx->channel_params + - (ctx->restart_intervals - 1)*(ctx->sequence_size)*(ctx->avctx->channels) + - (ctx->seq_offset[ctx->restart_intervals - 1])*(ctx->avctx->channels); + DecodingParams *seq_dp = ctx->decoding_params + ctx->seq_offset[0] * ctx->avctx->channels; + ChannelParams *seq_cp = ctx->channel_params + ctx->seq_offset[0] * ctx->avctx->channels; for (unsigned int index = 0; index < ctx->seq_size[ctx->restart_intervals-1]; index++) { memcpy(&ctx->major_decoding_params[index], seq_dp + index, sizeof(DecodingParams)); @@ -2160,13 +2156,9 @@ input_and_return: ctx->number_of_frames = ctx->next_major_number_of_frames; ctx->number_of_subblocks = ctx->next_major_number_of_frames + 1; - ctx->seq_channel_params = (ChannelParams *) ctx->channel_params + - (ctx->frame_index / ctx->min_restart_interval)*(ctx->sequence_size)*(ctx->avctx->channels) + - (ctx->seq_offset[seq_index])*(ctx->avctx->channels); + ctx->seq_channel_params = ctx->channel_params + ctx->seq_offset[seq_index] * ctx->avctx->channels; - ctx->seq_decoding_params = (DecodingParams *) ctx->decoding_params + - (ctx->frame_index / ctx->min_restart_interval)*(ctx->sequence_size) + - (ctx->seq_offset[seq_index]); + ctx->seq_decoding_params = ctx->decoding_params + ctx->seq_offset[seq_index]; number_of_samples = avctx->frame_size * ctx->number_of_frames; ctx->number_of_samples = number_of_samples;