avcodec/mlpenc: simplify some complicated expressions more

This commit is contained in:
Paul B Mahol 2021-09-07 18:11:45 +02:00
parent 1cbd4b00b1
commit 9e33572b3d
1 changed files with 2 additions and 9 deletions

View File

@ -187,7 +187,6 @@ typedef struct MLPEncodeContext {
AudioFrameQueue afq;
/* Analysis stage. */
unsigned int starting_frame_index;
unsigned int number_of_frames;
unsigned int number_of_samples;
unsigned int number_of_subblocks;
@ -1226,7 +1225,7 @@ static void input_to_sample_buffer(MLPEncodeContext *ctx)
int32_t *sample_buffer = ctx->sample_buffer;
for (unsigned int index = 0; index < ctx->number_of_frames; index++) {
unsigned int cur_index = (ctx->starting_frame_index + index) % ctx->max_restart_interval;
unsigned int cur_index = (ctx->frame_index + index + 1) % ctx->max_restart_interval;
int32_t *input_buffer = ctx->inout_buffer + cur_index * ctx->one_sample_buffer_size;
for (unsigned int i = 0; i < ctx->avctx->frame_size; i++) {
@ -2059,7 +2058,6 @@ static void process_major_frame(MLPEncodeContext *ctx)
{
ctx->sample_buffer = ctx->major_inout_buffer;
ctx->starting_frame_index = 0;
ctx->number_of_frames = ctx->major_number_of_frames;
ctx->number_of_samples = ctx->major_frame_size;
@ -2142,17 +2140,12 @@ input_and_return:
restart_frame = (ctx->frame_index + 1) % ctx->min_restart_interval;
if (!restart_frame) {
for (unsigned int seq_index = 0;
seq_index < ctx->restart_intervals && (seq_index * ctx->min_restart_interval) <= ctx->avctx->frame_number;
seq_index++) {
for (unsigned int seq_index = 0; seq_index < ctx->restart_intervals; seq_index++) {
unsigned int number_of_samples;
ctx->sample_buffer = ctx->major_scratch_buffer;
ctx->inout_buffer = ctx->major_inout_buffer;
ctx->seq_index = seq_index;
ctx->starting_frame_index = (ctx->avctx->frame_number - (ctx->avctx->frame_number % ctx->min_restart_interval)
- (seq_index * ctx->min_restart_interval)) % ctx->max_restart_interval;
ctx->number_of_frames = ctx->next_major_number_of_frames;
ctx->number_of_subblocks = ctx->next_major_number_of_frames + 1;