diff options
author | Manuel Lauss <manuel.lauss@gmail.com> | 2025-03-17 17:39:44 +0100 |
---|---|---|
committer | Manuel Lauss <manuel.lauss@gmail.com> | 2025-03-19 21:02:56 +0100 |
commit | 950ad969fb3891ccbc872c05262009f152e678ab (patch) | |
tree | 8b80004ef40fffac354c3a90dcfa642fa44e2be0 | |
parent | fd6bfaab55148a7e016fb77f31cf177d31e5568f (diff) | |
download | ffmpeg-950ad969fb3891ccbc872c05262009f152e678ab.tar.gz |
avcodec/sanm: codec20 decoder
codec20 is raw uncompressed image data.
It exists in Rebel Assault 1 as a special format for STOR/FTCH
and is used again in the Full Throttle Remaster from 2017.
Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
-rw-r--r-- | libavcodec/sanm.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index 91be83029f..6b1da2e30c 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -947,6 +947,24 @@ static int old_codec2(SANMVideoContext *ctx, GetByteContext *gb, int top, return 0; } +static int old_codec20(SANMVideoContext *ctx, int w, int h) +{ + uint8_t *dst = (uint8_t *)ctx->frm0; + + if (bytestream2_get_bytes_left(&ctx->gb) < w * h) + return AVERROR_INVALIDDATA; + + if (w == ctx->pitch) { + bytestream2_get_bufferu(&ctx->gb, dst, w * h); + } else { + for (int i = 0; i < h; i++) { + bytestream2_get_bufferu(&ctx->gb, dst, w); + dst += ctx->pitch; + } + } + return 0; +} + static inline void codec37_mv(uint8_t *dst, const uint8_t *src, int height, int stride, int x, int y) { @@ -1667,6 +1685,8 @@ static int process_frame_obj(SANMVideoContext *ctx, GetByteContext *gb) case 33: case 34: return old_codec4(ctx, gb, top, left, w, h, param, parm2, codec); + case 20: + return old_codec20(ctx, w, h); case 21: return old_codec21(ctx, gb, top, left, w, h); case 23: |