History

avcodec/sanm: fix codec3

codec3 is codec1 which writes zero values instead of skipping them. This fixes a lot of RA1 videos.

Manuel Lauss committed 1 year ago

Commit aa2f2be1 parent fd9b92b1 file · +4 −4Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/sanm.c+4−4
@@ -558,7 +558,7 @@ static int rle_decode(SANMVideoContext *ctx, uint8_t *dst, const int out_size) · 557 unmodified lines
558}558}
559 559
560static int old_codec1(SANMVideoContext *ctx, int top,560static int old_codec1(SANMVideoContext *ctx, int top,
561 int left, int width, int height)561 int left, int width, int height, int opaque)
562{562{
563 int i, j, len, flag, code, val, end, pxoff;563 int i, j, len, flag, code, val, end, pxoff;
564 const int maxpxo = ctx->height * ctx->pitch;564 const int maxpxo = ctx->height * ctx->pitch;
@@ -581,7 +581,7 @@ static int old_codec1(SANMVideoContext *ctx, int top, · 16 unmodified lines
581 code = (code >> 1) + 1;581 code = (code >> 1) + 1;
582 if (flag) {582 if (flag) {
583 val = bytestream2_get_byteu(&ctx->gb);583 val = bytestream2_get_byteu(&ctx->gb);
584 if (val) {584 if (val || opaque) {
585 for (j = 0; j < code; j++) {585 for (j = 0; j < code; j++) {
586 if (pxoff >= 0 && pxoff < maxpxo)586 if (pxoff >= 0 && pxoff < maxpxo)
587 *(dst + pxoff) = val;587 *(dst + pxoff) = val;
@@ -595,7 +595,7 @@ static int old_codec1(SANMVideoContext *ctx, int top, · 7 unmodified lines
595 return AVERROR_INVALIDDATA;595 return AVERROR_INVALIDDATA;
596 for (j = 0; j < code; j++) {596 for (j = 0; j < code; j++) {
597 val = bytestream2_get_byteu(&ctx->gb);597 val = bytestream2_get_byteu(&ctx->gb);
598 if ((pxoff >= 0) && (pxoff < maxpxo) && val)598 if ((pxoff >= 0) && (pxoff < maxpxo) && (val || opaque))
599 *(dst + pxoff) = val;599 *(dst + pxoff) = val;
600 pxoff++;600 pxoff++;
601 }601 }
@@ -1312,7 +1312,7 @@ static int process_frame_obj(SANMVideoContext *ctx) · 710 unmodified lines
1312 switch (codec) {1312 switch (codec) {
1313 case 1:1313 case 1:
1314 case 3:1314 case 3:
1315 return old_codec1(ctx, top, left, w, h);1315 return old_codec1(ctx, top, left, w, h, codec == 3);
1316 case 37:1316 case 37:
1317 return old_codec37(ctx, w, h);1317 return old_codec37(ctx, w, h);
1318 case 47:1318 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