[FFmpeg-cvslog] avcodec/mlpenc: simplify some complicated expressions more
Paul B Mahol
git at videolan.org
Tue Sep 7 19:17:43 EEST 2021
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Sep 7 18:11:45 2021 +0200| [9e33572b3d7b8873e8bc0498b0aac06a4ba269c9] | committer: Paul B Mahol
avcodec/mlpenc: simplify some complicated expressions more
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9e33572b3d7b8873e8bc0498b0aac06a4ba269c9
---
libavcodec/mlpenc.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c
index f153dcc58d..6d4a12ce3b 100644
--- a/libavcodec/mlpenc.c
+++ b/libavcodec/mlpenc.c
@@ -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;
More information about the ffmpeg-cvslog
mailing list