summaryrefslogtreecommitdiff
path: root/libavcodec/mlpenc.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-09-07 18:03:16 +0200
committerPaul B Mahol <onemda@gmail.com>2021-09-07 18:16:13 +0200
commit1cbd4b00b1d0a542b8772b56c739709f6140e738 (patch)
tree9753600c12bfe76b4f3b093af1c8f063e856ea80 /libavcodec/mlpenc.c
parent7ebeef6affb5f683febdc86f2dc45a339ac97f6c (diff)
downloadffmpeg-1cbd4b00b1d0a542b8772b56c739709f6140e738.tar.gz
avcodec/mlpenc: simplify strange pointer initializations
Diffstat (limited to 'libavcodec/mlpenc.c')
-rw-r--r--libavcodec/mlpenc.c16
1 files changed, 4 insertions, 12 deletions
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;