You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/psymodel: Use av_memdup() where appropriate
Also "fixes" the inverted order of arguments in the av_malloc_array() calls and therefore part of ticket #11620. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -37,8 +37,8 @@ av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens,
|
||||
ctx->avctx = avctx;
|
||||
ctx->ch = av_calloc(avctx->ch_layout.nb_channels, 2 * sizeof(ctx->ch[0]));
|
||||
ctx->group = av_calloc(num_groups, sizeof(ctx->group[0]));
|
||||
ctx->bands = av_malloc_array (sizeof(ctx->bands[0]), num_lens);
|
||||
ctx->num_bands = av_malloc_array (sizeof(ctx->num_bands[0]), num_lens);
|
||||
ctx->bands = av_memdup(bands, num_lens * sizeof(ctx->bands[0]));
|
||||
ctx->num_bands = av_memdup(num_bands, num_lens * sizeof(ctx->num_bands[0]));
|
||||
ctx->cutoff = avctx->cutoff;
|
||||
|
||||
if (!ctx->ch || !ctx->group || !ctx->bands || !ctx->num_bands) {
|
||||
@ -46,9 +46,6 @@ av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens,
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
memcpy(ctx->bands, bands, sizeof(ctx->bands[0]) * num_lens);
|
||||
memcpy(ctx->num_bands, num_bands, sizeof(ctx->num_bands[0]) * num_lens);
|
||||
|
||||
/* assign channels to groups (with virtual channels for coupling) */
|
||||
for (i = 0; i < num_groups; i++) {
|
||||
/* NOTE: Add 1 to handle the AAC chan_config without modification.
|
||||
|
Reference in New Issue
Block a user