1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

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>
This commit is contained in:
Manuel Lauss
2025-03-17 17:39:44 +01:00
parent fd6bfaab55
commit 950ad969fb

View File

@ -947,6 +947,24 @@ static int old_codec2(SANMVideoContext *ctx, GetByteContext *gb, int top,
return 0; 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, static inline void codec37_mv(uint8_t *dst, const uint8_t *src,
int height, int stride, int x, int y) int height, int stride, int x, int y)
{ {
@ -1667,6 +1685,8 @@ static int process_frame_obj(SANMVideoContext *ctx, GetByteContext *gb)
case 33: case 33:
case 34: case 34:
return old_codec4(ctx, gb, top, left, w, h, param, parm2, codec); return old_codec4(ctx, gb, top, left, w, h, param, parm2, codec);
case 20:
return old_codec20(ctx, w, h);
case 21: case 21:
return old_codec21(ctx, gb, top, left, w, h); return old_codec21(ctx, gb, top, left, w, h);
case 23: case 23: