Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 1/8] tests/fate/screen: Add test for skipping cursor with FIC
Date: Mon, 23 Jun 2025 05:07:33 +0200
Message-ID: <GV1P250MB0737ED8071F42A891EF80B198F79A@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw)

[-- Attachment #1: Type: text/plain, Size: 29 bytes --]

Patches attached.

- Andreas

[-- Attachment #2: 0001-tests-fate-screen-Add-test-for-skipping-cursor-with-.patch --]
[-- Type: text/x-patch, Size: 8833 bytes --]

From b3b26d0b46a44adc0d4ccdfcffb7b808fbf056df Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 23 Jun 2025 03:37:08 +0200
Subject: [PATCH 1/8] tests/fate/screen: Add test for skipping cursor with FIC

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 tests/fate/screen.mak              |   3 +-
 tests/ref/fate/fic-avi-skip_cursor | 126 +++++++++++++++++++++++++++++
 2 files changed, 128 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/fic-avi-skip_cursor

diff --git a/tests/fate/screen.mak b/tests/fate/screen.mak
index 1c92935d23..1320d64688 100644
--- a/tests/fate/screen.mak
+++ b/tests/fate/screen.mak
@@ -5,8 +5,9 @@ fate-cscd: CMD = framecrc -i $(TARGET_SAMPLES)/CSCD/sample_video.avi -an -pix_fm
 FATE_SCREEN-$(call FRAMECRC, AVI, DXTORY) += fate-dxtory
 fate-dxtory: CMD = framecrc -i $(TARGET_SAMPLES)/dxtory/dxtory_mic.avi -an
 
-FATE_SCREEN-$(call FRAMECRC, AVI, FIC) += fate-fic-avi
+FATE_SCREEN-$(call FRAMECRC, AVI, FIC) += fate-fic-avi fate-fic-avi-skip_cursor
 fate-fic-avi: CMD = framecrc -i $(TARGET_SAMPLES)/fic/fic-partial-2MB.avi -an
+fate-fic-avi-skip_cursor: CMD = framecrc -skip_cursor 1 -i $(TARGET_SAMPLES)/fic/fic-partial-2MB.avi -an
 
 FATE_FMVC += fate-fmvc-type1
 fate-fmvc-type1: CMD = framecrc -i $(TARGET_SAMPLES)/fmvc/6-methyl-5-hepten-2-one-CC-db_small.avi
diff --git a/tests/ref/fate/fic-avi-skip_cursor b/tests/ref/fate/fic-avi-skip_cursor
new file mode 100644
index 0000000000..2fef549659
--- /dev/null
+++ b/tests/ref/fate/fic-avi-skip_cursor
@@ -0,0 +1,126 @@
+#tb 0: 1/60
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 1360x768
+#sar 0: 0/1
+0,          0,          0,        1,  1566720, 0x6a23168e
+0,          1,          1,        1,  1566720, 0x6a23168e
+0,          2,          2,        1,  1566720, 0x598f8176
+0,          3,          3,        1,  1566720, 0x598f8176
+0,          4,          4,        1,  1566720, 0x598f8176
+0,          5,          5,        1,  1566720, 0x598f8176
+0,          6,          6,        1,  1566720, 0x598f8176
+0,          7,          7,        1,  1566720, 0x598f8176
+0,          8,          8,        1,  1566720, 0x7c747ecd
+0,          9,          9,        1,  1566720, 0x7c747ecd
+0,         10,         10,        1,  1566720, 0x7c747ecd
+0,         11,         11,        1,  1566720, 0x7c747ecd
+0,         12,         12,        1,  1566720, 0x7c747ecd
+0,         13,         13,        1,  1566720, 0x7c747ecd
+0,         14,         14,        1,  1566720, 0x80e5b2bf
+0,         15,         15,        1,  1566720, 0x80e5b2bf
+0,         16,         16,        1,  1566720, 0x80e5b2bf
+0,         17,         17,        1,  1566720, 0x80e5b2bf
+0,         18,         18,        1,  1566720, 0x80e5b2bf
+0,         19,         19,        1,  1566720, 0x80e5b2bf
+0,         20,         20,        1,  1566720, 0x80e5b2bf
+0,         21,         21,        1,  1566720, 0x80e5b2bf
+0,         22,         22,        1,  1566720, 0x80e5b2bf
+0,         23,         23,        1,  1566720, 0x80e5b2bf
+0,         24,         24,        1,  1566720, 0x80e5b2bf
+0,         25,         25,        1,  1566720, 0x80e5b2bf
+0,         26,         26,        1,  1566720, 0x80e5b2bf
+0,         27,         27,        1,  1566720, 0x80e5b2bf
+0,         28,         28,        1,  1566720, 0x80e5b2bf
+0,         29,         29,        1,  1566720, 0x4b9d027f
+0,         30,         30,        1,  1566720, 0x4b9d027f
+0,         31,         31,        1,  1566720, 0xe707ff5b
+0,         32,         32,        1,  1566720, 0x80d3fdd9
+0,         33,         33,        1,  1566720, 0x80d3fdd9
+0,         34,         34,        1,  1566720, 0x80d3fdd9
+0,         35,         35,        1,  1566720, 0x80d3fdd9
+0,         36,         36,        1,  1566720, 0x80d3fdd9
+0,         37,         37,        1,  1566720, 0x80d3fdd9
+0,         38,         38,        1,  1566720, 0x80d3fdd9
+0,         39,         39,        1,  1566720, 0x80d3fdd9
+0,         40,         40,        1,  1566720, 0x80d3fdd9
+0,         41,         41,        1,  1566720, 0x80d3fdd9
+0,         42,         42,        1,  1566720, 0x80d3fdd9
+0,         43,         43,        1,  1566720, 0x80d3fdd9
+0,         44,         44,        1,  1566720, 0x80d3fdd9
+0,         45,         45,        1,  1566720, 0x80d3fdd9
+0,         46,         46,        1,  1566720, 0x80d3fdd9
+0,         47,         47,        1,  1566720, 0x80d3fdd9
+0,         48,         48,        1,  1566720, 0x80d3fdd9
+0,         49,         49,        1,  1566720, 0x80d3fdd9
+0,         50,         50,        1,  1566720, 0x80d3fdd9
+0,         51,         51,        1,  1566720, 0x80d3fdd9
+0,         52,         52,        1,  1566720, 0x80d3fdd9
+0,         53,         53,        1,  1566720, 0x80d3fdd9
+0,         54,         54,        1,  1566720, 0x80d3fdd9
+0,         55,         55,        1,  1566720, 0x80d3fdd9
+0,         56,         56,        1,  1566720, 0x80d3fdd9
+0,         57,         57,        1,  1566720, 0x80d3fdd9
+0,         58,         58,        1,  1566720, 0x80d3fdd9
+0,         59,         59,        1,  1566720, 0x80d3fdd9
+0,         60,         60,        1,  1566720, 0x09caf9ca
+0,         61,         61,        1,  1566720, 0x09caf9ca
+0,         62,         62,        1,  1566720, 0x09caf9ca
+0,         63,         63,        1,  1566720, 0x09caf9ca
+0,         64,         64,        1,  1566720, 0x09caf9ca
+0,         65,         65,        1,  1566720, 0x09caf9ca
+0,         66,         66,        1,  1566720, 0x09caf9ca
+0,         67,         67,        1,  1566720, 0x09caf9ca
+0,         68,         68,        1,  1566720, 0x09caf9ca
+0,         69,         69,        1,  1566720, 0x09caf9ca
+0,         70,         70,        1,  1566720, 0x09caf9ca
+0,         71,         71,        1,  1566720, 0x09caf9ca
+0,         72,         72,        1,  1566720, 0x09caf9ca
+0,         73,         73,        1,  1566720, 0x6f2bf874
+0,         74,         74,        1,  1566720, 0x6f2bf874
+0,         75,         75,        1,  1566720, 0x6f2bf874
+0,         76,         76,        1,  1566720, 0x6f2bf874
+0,         77,         77,        1,  1566720, 0x6f2bf874
+0,         78,         78,        1,  1566720, 0x6f2bf874
+0,         79,         79,        1,  1566720, 0x6f2bf874
+0,         80,         80,        1,  1566720, 0x6f2bf874
+0,         81,         81,        1,  1566720, 0x6f2bf874
+0,         82,         82,        1,  1566720, 0x6f2bf874
+0,         83,         83,        1,  1566720, 0x6f2bf874
+0,         84,         84,        1,  1566720, 0x6f2bf874
+0,         85,         85,        1,  1566720, 0x6f2bf874
+0,         86,         86,        1,  1566720, 0x6f2bf874
+0,         87,         87,        1,  1566720, 0x6f2bf874
+0,         88,         88,        1,  1566720, 0x6f2bf874
+0,         89,         89,        1,  1566720, 0x6f2bf874
+0,         90,         90,        1,  1566720, 0x6f2bf874
+0,         91,         91,        1,  1566720, 0x6f2bf874
+0,         92,         92,        1,  1566720, 0x6f2bf874
+0,         93,         93,        1,  1566720, 0x6f2bf874
+0,         94,         94,        1,  1566720, 0x6f2bf874
+0,         95,         95,        1,  1566720, 0x6f2bf874
+0,         96,         96,        1,  1566720, 0x6f2bf874
+0,         97,         97,        1,  1566720, 0x6f2bf874
+0,         98,         98,        1,  1566720, 0x6f2bf874
+0,         99,         99,        1,  1566720, 0x6f2bf874
+0,        100,        100,        1,  1566720, 0xfcc5f839
+0,        101,        101,        1,  1566720, 0x78f1be70
+0,        102,        102,        1,  1566720, 0xfcc5f839
+0,        103,        103,        1,  1566720, 0xfcc5f839
+0,        104,        104,        1,  1566720, 0xfcc5f839
+0,        105,        105,        1,  1566720, 0xfcc5f839
+0,        106,        106,        1,  1566720, 0xfcc5f839
+0,        107,        107,        1,  1566720, 0x2326f885
+0,        108,        108,        1,  1566720, 0x2326f885
+0,        109,        109,        1,  1566720, 0x2326f885
+0,        110,        110,        1,  1566720, 0x2326f885
+0,        111,        111,        1,  1566720, 0x2326f885
+0,        112,        112,        1,  1566720, 0x2326f885
+0,        113,        113,        1,  1566720, 0x2326f885
+0,        114,        114,        1,  1566720, 0x2326f885
+0,        115,        115,        1,  1566720, 0x2326f885
+0,        116,        116,        1,  1566720, 0x2326f885
+0,        117,        117,        1,  1566720, 0x2326f885
+0,        118,        118,        1,  1566720, 0x3c4ffbd4
+0,        119,        119,        1,  1566720, 0x3c4ffbd4
+0,        120,        120,        1,  1566720, 0x3c4ffbd4
-- 
2.45.2


[-- Attachment #3: 0002-avcodec-fic-Avoid-copying-cursor-unnecessarily.patch --]
[-- Type: text/x-patch, Size: 2337 bytes --]

From 6366258409ed926739a7dbd51301b49fdee5a4b3 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 23 Jun 2025 03:40:15 +0200
Subject: [PATCH 2/8] avcodec/fic: Avoid copying cursor unnecessarily

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/fic.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index ec26e3154d..a40fe1f27b 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -56,7 +56,6 @@ typedef struct FICContext {
     int aligned_width, aligned_height;
     int num_slices, slice_h;
 
-    uint8_t cursor_buf[4096];
     int skip_cursor;
 } FICContext;
 
@@ -86,6 +85,7 @@ static const uint8_t fic_header[7] = { 0, 0, 1, 'F', 'I', 'C', 'V' };
 
 #define FIC_HEADER_SIZE 27
 #define CURSOR_OFFSET 59
+#define CURSOR_SIZE   4096
 
 static av_always_inline void fic_idct(int16_t *blk, int step, int shift, int rnd)
 {
@@ -214,10 +214,11 @@ static av_always_inline void fic_alpha_blend(uint8_t *dst, uint8_t *src,
         dst[i] += ((src[i] - dst[i]) * alpha[i]) >> 8;
 }
 
-static void fic_draw_cursor(AVCodecContext *avctx, int cur_x, int cur_y)
+static void fic_draw_cursor(AVCodecContext *avctx, const uint8_t cursor_buf[CURSOR_SIZE],
+                            int cur_x, int cur_y)
 {
     FICContext *ctx = avctx->priv_data;
-    uint8_t *ptr    = ctx->cursor_buf;
+    const uint8_t *ptr = cursor_buf;
     uint8_t *dstptr[3];
     uint8_t planes[4][1024];
     uint8_t chroma[3][256];
@@ -346,9 +347,8 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
         skip_cursor = 1;
     }
 
-    if (!skip_cursor && avpkt->size < CURSOR_OFFSET + sizeof(ctx->cursor_buf)) {
+    if (!skip_cursor && avpkt->size < CURSOR_OFFSET + CURSOR_SIZE)
         skip_cursor = 1;
-    }
 
     /* Slice height for all but the last slice. */
     ctx->slice_h = 16 * (ctx->aligned_height >> 4) / nslices;
@@ -431,8 +431,7 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
 
     /* Draw cursor. */
     if (!skip_cursor) {
-        memcpy(ctx->cursor_buf, src + CURSOR_OFFSET, sizeof(ctx->cursor_buf));
-        fic_draw_cursor(avctx, cur_x, cur_y);
+        fic_draw_cursor(avctx, src + CURSOR_OFFSET, cur_x, cur_y);
     }
 
 skip:
-- 
2.45.2


[-- Attachment #4: 0003-avcodec-fic-Avoid-implicit-av_frame_free-av_frame_al.patch --]
[-- Type: text/x-patch, Size: 2224 bytes --]

From 1302163264dcda7990cedbe5cd75318c0ef45130 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 23 Jun 2025 03:52:45 +0200
Subject: [PATCH 3/8] avcodec/fic: Avoid implicit
 av_frame_free()+av_frame_alloc()

Use av_frame_replace() instead. Also remove the error message:
It was highly misleading (as if av_frame_clone() duplicated
the AVFrame data buffers instead of just creating a new reference).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/fic.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index a40fe1f27b..bf7b2ead2b 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -297,7 +297,7 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
 
     /* Is it a skip frame? */
     if (src[17]) {
-        if (!ctx->final_frame) {
+        if (!ctx->final_frame->data[0]) {
             av_log(avctx, AV_LOG_WARNING, "Initial frame is skipped\n");
             return AVERROR_INVALIDDATA;
         }
@@ -416,12 +416,9 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
             break;
         }
     }
-    av_frame_free(&ctx->final_frame);
-    ctx->final_frame = av_frame_clone(ctx->frame);
-    if (!ctx->final_frame) {
-        av_log(avctx, AV_LOG_ERROR, "Could not clone frame buffer.\n");
-        return AVERROR(ENOMEM);
-    }
+    ret = av_frame_replace(ctx->final_frame, ctx->frame);
+    if (ret < 0)
+        return ret;
 
     /* Make sure we use a user-supplied buffer. */
     if ((ret = ff_reget_buffer(avctx, ctx->final_frame, 0)) < 0) {
@@ -468,6 +465,9 @@ static av_cold int fic_decode_init(AVCodecContext *avctx)
     ctx->frame = av_frame_alloc();
     if (!ctx->frame)
         return AVERROR(ENOMEM);
+    ctx->final_frame = av_frame_alloc();
+    if (!ctx->final_frame)
+        return AVERROR(ENOMEM);
 
     return 0;
 }
@@ -495,4 +495,5 @@ const FFCodec ff_fic_decoder = {
     .close          = fic_decode_close,
     .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SLICE_THREADS,
     .p.priv_class   = &fic_decoder_class,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };
-- 
2.45.2


[-- Attachment #5: 0004-avcodec-fic-Don-t-copy-frame-unnecessarily.patch --]
[-- Type: text/x-patch, Size: 1064 bytes --]

From 9c2c8f921bc11ca786f7a4432a573c0c6efc107c Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 23 Jun 2025 03:59:37 +0200
Subject: [PATCH 4/8] avcodec/fic: Don't copy frame unnecessarily

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/fic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index bf7b2ead2b..2d1a2951ed 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -420,14 +420,14 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
     if (ret < 0)
         return ret;
 
+    /* Draw cursor if needed. */
+    if (!skip_cursor) {
     /* Make sure we use a user-supplied buffer. */
     if ((ret = ff_reget_buffer(avctx, ctx->final_frame, 0)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "Could not make frame writable.\n");
         return ret;
     }
 
-    /* Draw cursor. */
-    if (!skip_cursor) {
         fic_draw_cursor(avctx, src + CURSOR_OFFSET, cur_x, cur_y);
     }
 
-- 
2.45.2


[-- Attachment #6: 0005-avcodec-fic-Remove-redundant-logmessage.patch --]
[-- Type: text/x-patch, Size: 1173 bytes --]

From a3e7692ea8b7cf8d2df4204693187f22c730cc82 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 23 Jun 2025 04:01:15 +0200
Subject: [PATCH 5/8] avcodec/fic: Remove redundant logmessage

ff_reget_buffer() emits its own logmessage on error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/fic.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index 2d1a2951ed..7f5257f01c 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -422,11 +422,10 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
 
     /* Draw cursor if needed. */
     if (!skip_cursor) {
-    /* Make sure we use a user-supplied buffer. */
-    if ((ret = ff_reget_buffer(avctx, ctx->final_frame, 0)) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "Could not make frame writable.\n");
-        return ret;
-    }
+        /* Make frame writable. */
+        ret = ff_reget_buffer(avctx, ctx->final_frame, 0);
+        if (ret < 0)
+            return ret;
 
         fic_draw_cursor(avctx, src + CURSOR_OFFSET, cur_x, cur_y);
     }
-- 
2.45.2


[-- Attachment #7: 0006-avcodec-fic-Don-t-prematurely-claim-to-have-decoded-.patch --]
[-- Type: text/x-patch, Size: 796 bytes --]

From 7b7ca5cce9214c3439c3f2fba764f7b443fe33d3 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 23 Jun 2025 04:07:09 +0200
Subject: [PATCH 6/8] avcodec/fic: Don't prematurely claim to have decoded a
 frame

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/fic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index 7f5257f01c..2345e7c9ad 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -431,9 +431,9 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
     }
 
 skip:
-    *got_frame = 1;
     if ((ret = av_frame_ref(rframe, ctx->final_frame)) < 0)
         return ret;
+    *got_frame = 1;
 
     return avpkt->size;
 }
-- 
2.45.2


[-- Attachment #8: 0007-avcodec-fic-Ensure-skip-frames-have-up-to-date-props.patch --]
[-- Type: text/x-patch, Size: 928 bytes --]

From c81de44cba99c28d4f0a04b99712cebb44f4dadd Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 23 Jun 2025 04:48:40 +0200
Subject: [PATCH 7/8] avcodec/fic: Ensure skip frames have up-to-date props

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/fic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index 2345e7c9ad..47cfb6ae7e 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -301,6 +301,10 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
             av_log(avctx, AV_LOG_WARNING, "Initial frame is skipped\n");
             return AVERROR_INVALIDDATA;
         }
+        ret = ff_reget_buffer(avctx, ctx->final_frame,
+                              FF_REGET_BUFFER_FLAG_READONLY);
+        if (ret < 0)
+            return ret;
         goto skip;
     }
 
-- 
2.45.2


[-- Attachment #9: 0008-avcodec-fic-Postpone-duplicating-AVFrame-buffer.patch --]
[-- Type: text/x-patch, Size: 1416 bytes --]

From bf6927c962d600251367eb0cb537e8632f2a1707 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon, 23 Jun 2025 04:51:08 +0200
Subject: [PATCH 8/8] avcodec/fic: Postpone duplicating AVFrame buffer

This avoids duplicating the AVFrames in case of skip frames
or in case of errors.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/fic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index 47cfb6ae7e..b3468d751b 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -282,9 +282,6 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
     int skip_cursor = ctx->skip_cursor;
     const uint8_t *sdata;
 
-    if ((ret = ff_reget_buffer(avctx, ctx->frame, 0)) < 0)
-        return ret;
-
     /* Header + at least one slice (4) */
     if (avpkt->size < FIC_HEADER_SIZE + 4) {
         av_log(avctx, AV_LOG_ERROR, "Frame data is too small.\n");
@@ -407,6 +404,9 @@ static int fic_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
         ctx->slice_data[slice].y_off    = y_off;
     }
 
+    if ((ret = ff_reget_buffer(avctx, ctx->frame, 0)) < 0)
+        return ret;
+
     if ((ret = avctx->execute(avctx, fic_decode_slice, ctx->slice_data,
                               NULL, nslices, sizeof(ctx->slice_data[0]))) < 0)
         return ret;
-- 
2.45.2


[-- Attachment #10: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

                 reply	other threads:[~2025-06-23  3:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=GV1P250MB0737ED8071F42A891EF80B198F79A@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git