You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avcodec/alsdec: Improve code locality
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -2094,12 +2094,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
ctx->reverted_channels = NULL;
|
ctx->reverted_channels = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
channel_size = sconf->frame_length + sconf->max_order;
|
|
||||||
|
|
||||||
ctx->prev_raw_samples = av_malloc_array(sconf->max_order, sizeof(*ctx->prev_raw_samples));
|
|
||||||
ctx->raw_buffer = av_calloc(avctx->channels * channel_size, sizeof(*ctx->raw_buffer));
|
|
||||||
ctx->raw_samples = av_malloc_array(avctx->channels, sizeof(*ctx->raw_samples));
|
|
||||||
|
|
||||||
if (sconf->floating) {
|
if (sconf->floating) {
|
||||||
ctx->acf = av_malloc_array(avctx->channels, sizeof(*ctx->acf));
|
ctx->acf = av_malloc_array(avctx->channels, sizeof(*ctx->acf));
|
||||||
ctx->shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->shift_value));
|
ctx->shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->shift_value));
|
||||||
@@ -2125,7 +2119,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
channel_size = sconf->frame_length + sconf->max_order;
|
||||||
|
|
||||||
// allocate previous raw sample buffer
|
// allocate previous raw sample buffer
|
||||||
|
ctx->prev_raw_samples = av_malloc_array(sconf->max_order, sizeof(*ctx->prev_raw_samples));
|
||||||
|
ctx->raw_buffer = av_calloc(avctx->channels * channel_size, sizeof(*ctx->raw_buffer));
|
||||||
|
ctx->raw_samples = av_malloc_array(avctx->channels, sizeof(*ctx->raw_samples));
|
||||||
if (!ctx->prev_raw_samples || !ctx->raw_buffer|| !ctx->raw_samples) {
|
if (!ctx->prev_raw_samples || !ctx->raw_buffer|| !ctx->raw_samples) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
|
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
Reference in New Issue
Block a user