From 99f0f6e4012ef89c4e9079da6aba8824769ebe0f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 9 Mar 2025 23:33:48 +0100 Subject: [PATCH] avcodec/ffv1enc: Fix slice coding mode 1 with rgb frames Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavcodec/ffv1enc.c | 6 +++--- libavcodec/ffv1enc_template.c | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index 6acc4d7ece..cc366621ca 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -419,7 +419,7 @@ av_cold int ff_ffv1_write_extradata(AVCodecContext *avctx) if (f->version == 3) { f->micro_version = 4; } else if (f->version == 4) - f->micro_version = 4; + f->micro_version = 5; f->combined_version += f->micro_version; put_symbol(&c, state, f->micro_version, 0); } @@ -1158,9 +1158,9 @@ retry: ret = encode_plane(f, sc, p->data[0] + ps*x + y*p->linesize[0], width, height, p->linesize[0], 0, 2, ac); ret |= encode_plane(f, sc, p->data[0] + 1 + ps*x + y*p->linesize[0], width, height, p->linesize[0], 1, 2, ac); } else if (f->use32bit) { - ret = encode_rgb_frame32(f, sc, planes, width, height, p->linesize); + ret = encode_rgb_frame32(f, sc, planes, width, height, p->linesize, ac); } else { - ret = encode_rgb_frame(f, sc, planes, width, height, p->linesize); + ret = encode_rgb_frame(f, sc, planes, width, height, p->linesize, ac); } if (ac != AC_GOLOMB_RICE) { diff --git a/libavcodec/ffv1enc_template.c b/libavcodec/ffv1enc_template.c index af3354497a..1430a27ee7 100644 --- a/libavcodec/ffv1enc_template.c +++ b/libavcodec/ffv1enc_template.c @@ -129,12 +129,11 @@ RENAME(encode_line)(FFV1Context *f, FFV1SliceContext *sc, static int RENAME(encode_rgb_frame)(FFV1Context *f, FFV1SliceContext *sc, const uint8_t *src[4], - int w, int h, const int stride[4]) + int w, int h, const int stride[4], int ac) { int x, y, p, i; const int ring_size = f->context_model ? 3 : 2; TYPE *sample[4][3]; - const int ac = f->ac; const int pass1 = !!(f->avctx->flags & AV_CODEC_FLAG_PASS1); int lbd = f->bits_per_raw_sample <= 8; int packed = !src[1];