diff options
author | Manuel Lauss <manuel.lauss@gmail.com> | 2025-03-11 13:02:14 +0100 |
---|---|---|
committer | Manuel Lauss <manuel.lauss@gmail.com> | 2025-03-19 20:58:46 +0100 |
commit | aa2f2befaa786b4b0970c08b2837c07ff77ebabc (patch) | |
tree | c7587051b9b7987e6ad4a773e38f9ddd906fe530 | |
parent | fd9b92b216308f5d5c2722d497fb4d7661dd63cd (diff) | |
download | ffmpeg-aa2f2befaa786b4b0970c08b2837c07ff77ebabc.tar.gz |
avcodec/sanm: fix codec3
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@gmail.com>
-rw-r--r-- | libavcodec/sanm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index 395548ee2d..e1471211d6 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -558,7 +558,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) { int i, j, len, flag, code, val, end, pxoff; const int maxpxo = ctx->height * ctx->pitch; @@ -581,7 +581,7 @@ static int old_codec1(SANMVideoContext *ctx, int top, code = (code >> 1) + 1; if (flag) { val = bytestream2_get_byteu(&ctx->gb); - if (val) { + if (val || opaque) { for (j = 0; j < code; j++) { if (pxoff >= 0 && pxoff < maxpxo) *(dst + pxoff) = val; @@ -595,7 +595,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 ((pxoff >= 0) && (pxoff < maxpxo) && val) + if ((pxoff >= 0) && (pxoff < maxpxo) && (val || opaque)) *(dst + pxoff) = val; pxoff++; } @@ -1312,7 +1312,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 == 3); case 37: return old_codec37(ctx, w, h); case 47: |