aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-03-25 02:44:11 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-03-28 03:08:01 +0100
commit33b1c7ebbfc47b5755366a3b657edf0a6b9b7baa (patch)
tree20afc5d627ef752b769ab496cc2b64abe3363ac8
parent8013574e9b4a52c28f896655bae235244d139801 (diff)
downloadffmpeg-33b1c7ebbfc47b5755366a3b657edf0a6b9b7baa.tar.gz
avcodec/magicyuvenc: Don't call functions twice due to macro
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/magicyuvenc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c
index 1c3ab56460..77e068496e 100644
--- a/libavcodec/magicyuvenc.c
+++ b/libavcodec/magicyuvenc.c
@@ -211,10 +211,13 @@ static av_cold int magy_encode_init(AVCodecContext *avctx)
return AVERROR(ENOMEM);
if (s->correlate) {
- s->decorrelate_buf[0] = av_calloc(2U * (s->nb_slices * s->slice_height), FFALIGN(avctx->width, av_cpu_max_align()));
+ size_t max_align = av_cpu_max_align();
+ size_t aligned_width = FFALIGN(avctx->width, max_align);
+ s->decorrelate_buf[0] = av_calloc(2U * (s->nb_slices * s->slice_height),
+ aligned_width);
if (!s->decorrelate_buf[0])
return AVERROR(ENOMEM);
- s->decorrelate_buf[1] = s->decorrelate_buf[0] + (s->nb_slices * s->slice_height) * FFALIGN(avctx->width, av_cpu_max_align());
+ s->decorrelate_buf[1] = s->decorrelate_buf[0] + (s->nb_slices * s->slice_height) * aligned_width;
}
s->bitslice_size = avctx->width * s->slice_height + 2;
@@ -493,7 +496,8 @@ static int encode_slice(AVCodecContext *avctx, void *tdata,
static int predict_slice(AVCodecContext *avctx, void *tdata,
int n, int threadnr)
{
- const int aligned_width = FFALIGN(avctx->width, av_cpu_max_align());
+ size_t max_align = av_cpu_max_align();
+ const int aligned_width = FFALIGN(avctx->width, max_align);
MagicYUVContext *s = avctx->priv_data;
const int slice_height = s->slice_height;
const int last_height = FFMIN(slice_height, avctx->height - n * slice_height);