[FFmpeg-cvslog] avcodec/sanm: codec20 decoder
Manuel Lauss
git at videolan.org
Wed Mar 19 22:06:30 EET 2025
ffmpeg | branch: master | Manuel Lauss <manuel.lauss at gmail.com> | Mon Mar 17 17:39:44 2025 +0100| [950ad969fb3891ccbc872c05262009f152e678ab] | committer: Manuel Lauss
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 at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=950ad969fb3891ccbc872c05262009f152e678ab
---
libavcodec/sanm.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
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:
More information about the ffmpeg-cvslog
mailing list