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.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -607,6 +607,24 @@ static int old_codec1(SANMVideoContext *ctx, int top, · 606 unmodified lines | |||
| 607 | return 0; | 607 | return 0; |
| 608 | } | 608 | } |
| 609 | 609 | ||
| 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 | |||
| 610 | static inline void codec37_mv(uint8_t *dst, const uint8_t *src, | 628 | static inline void codec37_mv(uint8_t *dst, const uint8_t *src, |
| 611 | int height, int stride, int x, int y) | 629 | int height, int stride, int x, int y) |
| 612 | { | 630 | { |
| @@ -1313,6 +1331,8 @@ static int process_frame_obj(SANMVideoContext *ctx) · 700 unmodified lines | |||
| 1313 | case 1: | 1331 | case 1: |
| 1314 | case 3: | 1332 | case 3: |
| 1315 | return old_codec1(ctx, top, left, w, h, codec == 3); | 1333 | return old_codec1(ctx, top, left, w, h, codec == 3); |
| 1334 | case 2: | ||
| 1335 | return old_codec2(ctx, top, left, w, h); | ||
| 1316 | case 37: | 1336 | case 37: |
| 1317 | return old_codec37(ctx, w, h); | 1337 | return old_codec37(ctx, w, h); |
| 1318 | case 47: | 1338 | case 47: |