History

avcodec/sanm: codec2 decoder

this codec consists of 4 byte packets: 2bytes delta-x, 1 byte delta-y and 1 byte color to put at that spot. Used in Rebel Assault 1 only.

Manuel Lauss committed 1 year ago

Commit 968ffbe1 parent aa2f2be1 file · +20 −0Browse files

Unified · Split

libavcodec/sanm.c+20−0
@@ -607,6 +607,24 @@ static int old_codec1(SANMVideoContext *ctx, int top, · 606 unmodified lines
607607 return 0;
608608 }
609609
610+static int old_codec2(SANMVideoContext *ctx, int top,
611+ int left, int width, int height)
612+{
613+ uint8_t *dst = (uint8_t *)ctx->frm0, col;
614+ int16_t xpos = left, ypos = top;
615+
616+ while (bytestream2_get_bytes_left(&ctx->gb) > 3) {
617+ xpos += bytestream2_get_le16u(&ctx->gb);
618+ ypos += bytestream2_get_byteu(&ctx->gb);
619+ col = bytestream2_get_byteu(&ctx->gb);
620+ if (xpos >= 0 && ypos >= 0 &&
621+ xpos < ctx->width && ypos < ctx->height) {
622+ *(dst + xpos + ypos * ctx->pitch) = col;
623+ }
624+ }
625+ return 0;
626+}
627+
610628 static inline void codec37_mv(uint8_t *dst, const uint8_t *src,
611629 int height, int stride, int x, int y)
612630 {
@@ -1313,6 +1331,8 @@ static int process_frame_obj(SANMVideoContext *ctx) · 700 unmodified lines
13131331 case 1:
13141332 case 3:
13151333 return old_codec1(ctx, top, left, w, h, codec == 3);
1334+ case 2:
1335+ return old_codec2(ctx, top, left, w, h);
13161336 case 37:
13171337 return old_codec37(ctx, w, h);
13181338 case 47:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t