[FFmpeg-devel] [PATCH 4/9] avcodec/sanm: fix codec3
Manuel Lauss
manuel.lauss at gmail.com
Tue Mar 11 17:03:36 EET 2025
codec3 is codec1 which writes zero values instead of skipping them.
This fixes a lot of RA1 videos.
Signed-off-by: Manuel Lauss <manuel.lauss at gmail.com>
---
libavcodec/sanm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index b2923515b1..a512810987 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -556,7 +556,7 @@ static int rle_decode(SANMVideoContext *ctx, uint8_t *dst, const int out_size)
}
static int old_codec1(SANMVideoContext *ctx, int top,
- int left, int width, int height)
+ int left, int width, int height, int opaque)
{
uint8_t *dst = ((uint8_t *)ctx->frm0) + left + top * ctx->pitch;
int i, j, len, flag, code, val, pos, end;
@@ -581,7 +581,7 @@ static int old_codec1(SANMVideoContext *ctx, int top,
return AVERROR_INVALIDDATA;
if (flag) {
val = bytestream2_get_byteu(&ctx->gb);
- if (val)
+ if (val || opaque)
memset(dst + pos, val, code);
pos += code;
} else {
@@ -589,7 +589,7 @@ static int old_codec1(SANMVideoContext *ctx, int top,
return AVERROR_INVALIDDATA;
for (j = 0; j < code; j++) {
val = bytestream2_get_byteu(&ctx->gb);
- if (val)
+ if (val || opaque)
dst[pos] = val;
pos++;
}
@@ -1300,7 +1300,7 @@ static int process_frame_obj(SANMVideoContext *ctx)
switch (codec) {
case 1:
case 3:
- return old_codec1(ctx, top, left, w, h);
+ return old_codec1(ctx, top, left, w, h, codec != 1);
case 37:
return old_codec37(ctx, w, h);
case 47:
--
2.48.1
More information about the ffmpeg-devel
mailing list