[FFmpeg-cvslog] avcodec/magicyuvenc: stop hardcoding max possible align
Paul B Mahol
git at videolan.org
Sun Sep 10 14:49:00 EEST 2023
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Sep 10 12:44:58 2023 +0200| [a71662429367556dac50f3db6112e7502db86592] | committer: Paul B Mahol
avcodec/magicyuvenc: stop hardcoding max possible align
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a71662429367556dac50f3db6112e7502db86592
---
libavcodec/magicyuvenc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c
index a8a85f1b5f..97a7779c08 100644
--- a/libavcodec/magicyuvenc.c
+++ b/libavcodec/magicyuvenc.c
@@ -194,10 +194,10 @@ static av_cold int magy_encode_init(AVCodecContext *avctx)
break;
}
if (s->correlate) {
- s->decorrelate_buf[0] = av_calloc(2U * avctx->height, FFALIGN(avctx->width, 16));
+ s->decorrelate_buf[0] = av_calloc(2U * avctx->height, FFALIGN(avctx->width, av_cpu_max_align()));
if (!s->decorrelate_buf[0])
return AVERROR(ENOMEM);
- s->decorrelate_buf[1] = s->decorrelate_buf[0] + avctx->height * FFALIGN(avctx->width, 16);
+ s->decorrelate_buf[1] = s->decorrelate_buf[0] + avctx->height * FFALIGN(avctx->width, av_cpu_max_align());
}
ff_llvidencdsp_init(&s->llvidencdsp);
@@ -471,7 +471,7 @@ 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, 16);
+ const int aligned_width = FFALIGN(avctx->width, av_cpu_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);
@@ -484,7 +484,7 @@ static int predict_slice(AVCodecContext *avctx, void *tdata,
s->decorrelate_buf[1] + n * slice_height * aligned_width };
const int decorrelate_linesize = aligned_width;
const uint8_t *const data[4] = { decorrelated[0], frame->data[0] + n * slice_height * frame->linesize[0],
- decorrelated[1], frame->data[3] + n * slice_height * frame->linesize[3] };
+ decorrelated[1], s->planes == 4 ? frame->data[3] + n * slice_height * frame->linesize[3] : NULL };
const uint8_t *r, *g, *b;
const int linesize[4] = { decorrelate_linesize, frame->linesize[0],
decorrelate_linesize, frame->linesize[3] };
More information about the ffmpeg-cvslog
mailing list