Browse code

lavc/dds: Fix GRAY8A decoding.

Fixes ticket #4667.

Carl Eugen Hoyos authored on 2016/04/16 04:06:34
Showing 3 changed files
... ...
@@ -356,6 +356,10 @@ static int parse_pixel_format(AVCodecContext *avctx)
356 356
         /* 16 bpp */
357 357
         else if (bpp == 16 && r == 0xff && g == 0 && b == 0 && a == 0xff00)
358 358
             avctx->pix_fmt = AV_PIX_FMT_YA8;
359
+        else if (bpp == 16 && r == 0xff00 && g == 0 && b == 0 && a == 0xff) {
360
+            avctx->pix_fmt = AV_PIX_FMT_YA8;
361
+            ctx->postproc = DDS_SWAP_ALPHA;
362
+        }
359 363
         else if (bpp == 16 && r == 0xffff && g == 0 && b == 0 && a == 0)
360 364
             avctx->pix_fmt = AV_PIX_FMT_GRAY16LE;
361 365
         else if (bpp == 16 && r == 0xf800 && g == 0x7e0 && b == 0x1f && a == 0)
... ...
@@ -387,8 +391,6 @@ static int parse_pixel_format(AVCodecContext *avctx)
387 387
         ctx->postproc = DDS_NORMAL_MAP;
388 388
     else if (ycocg_classic && !ctx->compressed)
389 389
         ctx->postproc = DDS_RAW_YCOCG;
390
-    else if (avctx->pix_fmt == AV_PIX_FMT_YA8)
391
-        ctx->postproc = DDS_SWAP_ALPHA;
392 390
 
393 391
     /* ATI/NVidia variants sometimes add swizzling in bpp. */
394 392
     switch (bpp) {
... ...
@@ -29,7 +29,7 @@
29 29
 
30 30
 #define LIBAVCODEC_VERSION_MAJOR  57
31 31
 #define LIBAVCODEC_VERSION_MINOR  34
32
-#define LIBAVCODEC_VERSION_MICRO 101
32
+#define LIBAVCODEC_VERSION_MICRO 102
33 33
 
34 34
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
35 35
                                                LIBAVCODEC_VERSION_MINOR, \
... ...
@@ -3,4 +3,4 @@
3 3
 #codec_id 0: rawvideo
4 4
 #dimensions 0: 220x64
5 5
 #sar 0: 0/1
6
-0,          0,          0,        1,    28160, 0xd3981fcb
6
+0,          0,          0,        1,    28160, 0x5aa41fcb