[FFmpeg-cvslog] avcodec/mlpenc: simplify strange pointer initializations
Paul B Mahol
git at videolan.org
Tue Sep 7 19:17:41 EEST 2021
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Sep 7 18:03:16 2021 +0200| [1cbd4b00b1d0a542b8772b56c739709f6140e738] | committer: Paul B Mahol
avcodec/mlpenc: simplify strange pointer initializations
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1cbd4b00b1d0a542b8772b56c739709f6140e738
---
libavcodec/mlpenc.c | 16 ++++------------
1 file 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;
More information about the ffmpeg-cvslog
mailing list