From 139cbeb75e0f5e3176b2b09660d2570b1bcc2408 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 15 Apr 2016 21:06:34 +0200 Subject: lavc/dds: Fix GRAY8A decoding. Fixes ticket #4667. --- libavcodec/dds.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libavcodec/dds.c') diff --git a/libavcodec/dds.c b/libavcodec/dds.c index 9577b67f0f..feaaba5a24 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) { -- cgit v1.2.3