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

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
558558 }
559559
560560 static int old_codec1(SANMVideoContext *ctx, int top,
561− int left, int width, int height)
561+ int left, int width, int height, int opaque)
562562 {
563563 int i, j, len, flag, code, val, end, pxoff;
564564 const int maxpxo = ctx->height * ctx->pitch;
@@ -581,7 +581,7 @@ static int old_codec1(SANMVideoContext *ctx, int top, · 16 unmodified lines
581581 code = (code >> 1) + 1;
582582 if (flag) {
583583 val = bytestream2_get_byteu(&ctx->gb);
584− if (val) {
584+ if (val || opaque) {
585585 for (j = 0; j < code; j++) {
586586 if (pxoff >= 0 && pxoff < maxpxo)
587587 *(dst + pxoff) = val;
@@ -595,7 +595,7 @@ static int old_codec1(SANMVideoContext *ctx, int top, · 7 unmodified lines
595595 return AVERROR_INVALIDDATA;
596596 for (j = 0; j < code; j++) {
597597 val = bytestream2_get_byteu(&ctx->gb);
598− if ((pxoff >= 0) && (pxoff < maxpxo) && val)
598+ if ((pxoff >= 0) && (pxoff < maxpxo) && (val || opaque))
599599 *(dst + pxoff) = val;
600600 pxoff++;
601601 }
@@ -1312,7 +1312,7 @@ static int process_frame_obj(SANMVideoContext *ctx) · 710 unmodified lines
13121312 switch (codec) {
13131313 case 1:
13141314 case 3:
1315− return old_codec1(ctx, top, left, w, h);
1315+ return old_codec1(ctx, top, left, w, h, codec == 3);
13161316 case 37:
13171317 return old_codec37(ctx, w, h);
13181318 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