[FFmpeg-cvslog] lavc/dds: Fix GRAY8A decoding.

Carl Eugen Hoyos git at videolan.org
Fri Apr 15 21:07:50 CEST 2016


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Fri Apr 15 21:06:34 2016 +0200| [139cbeb75e0f5e3176b2b09660d2570b1bcc2408] | committer: Carl Eugen Hoyos

lavc/dds: Fix GRAY8A decoding.

Fixes ticket #4667.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=139cbeb75e0f5e3176b2b09660d2570b1bcc2408
---

 libavcodec/dds.c      |    6 ++++--
 libavcodec/version.h  |    2 +-
 tests/ref/fate/dds-ya |    2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/dds.c b/libavcodec/dds.c
index 9577b67..feaaba5 100644
--- a/libavcodec/dds.c
+++ b/libavcodec/dds.c
@@ -356,6 +356,10 @@ static int parse_pixel_format(AVCodecContext *avctx)
         /* 16 bpp */
         else if (bpp == 16 && r == 0xff && g == 0 && b == 0 && a == 0xff00)
             avctx->pix_fmt = AV_PIX_FMT_YA8;
+        else if (bpp == 16 && r == 0xff00 && g == 0 && b == 0 && a == 0xff) {
+            avctx->pix_fmt = AV_PIX_FMT_YA8;
+            ctx->postproc = DDS_SWAP_ALPHA;
+        }
         else if (bpp == 16 && r == 0xffff && g == 0 && b == 0 && a == 0)
             avctx->pix_fmt = AV_PIX_FMT_GRAY16LE;
         else if (bpp == 16 && r == 0xf800 && g == 0x7e0 && b == 0x1f && a == 0)
@@ -387,8 +391,6 @@ static int parse_pixel_format(AVCodecContext *avctx)
         ctx->postproc = DDS_NORMAL_MAP;
     else if (ycocg_classic && !ctx->compressed)
         ctx->postproc = DDS_RAW_YCOCG;
-    else if (avctx->pix_fmt == AV_PIX_FMT_YA8)
-        ctx->postproc = DDS_SWAP_ALPHA;
 
     /* ATI/NVidia variants sometimes add swizzling in bpp. */
     switch (bpp) {
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 8f0522b..c24f0fc 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  57
 #define LIBAVCODEC_VERSION_MINOR  34
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
diff --git a/tests/ref/fate/dds-ya b/tests/ref/fate/dds-ya
index 1de0436..a0f12b5 100644
--- a/tests/ref/fate/dds-ya
+++ b/tests/ref/fate/dds-ya
@@ -3,4 +3,4 @@
 #codec_id 0: rawvideo
 #dimensions 0: 220x64
 #sar 0: 0/1
-0,          0,          0,        1,    28160, 0xd3981fcb
+0,          0,          0,        1,    28160, 0x5aa41fcb



More information about the ffmpeg-cvslog mailing list