summaryrefslogtreecommitdiff
path: root/libavcodec/sunrast.c
diff options
context:
space:
mode:
authorAneesh Dogra <lionaneesh@gmail.com>2012-02-11 10:42:45 +0530
committerRonald S. Bultje <rsbultje@gmail.com>2012-02-11 11:05:43 -0800
commit4fbccfab2371eb400efc51e550bf89adb87f1070 (patch)
tree3833a38cf39a16440a9ea4fc1b8d5d8021c0b106 /libavcodec/sunrast.c
parentdae2ce361a2b5fd9be1d43e5e8c00bdbc5f03e3d (diff)
sunrast: Add support for gray8 decoding.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec/sunrast.c')
-rw-r--r--libavcodec/sunrast.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c
index 601ba6efc9..f03f24c158 100644
--- a/libavcodec/sunrast.c
+++ b/libavcodec/sunrast.c
@@ -112,7 +112,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
avctx->pix_fmt = PIX_FMT_MONOWHITE;
break;
case 8:
- avctx->pix_fmt = PIX_FMT_PAL8;
+ avctx->pix_fmt = maplength ? PIX_FMT_PAL8 : PIX_FMT_GRAY8;
break;
case 24:
avctx->pix_fmt = (type == RT_FORMAT_RGB) ? PIX_FMT_RGB24 : PIX_FMT_BGR24;
@@ -140,13 +140,9 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
if (depth != 8 && maplength) {
av_log(avctx, AV_LOG_WARNING, "useless colormap found or file is corrupted, trying to recover\n");
- } else if (depth == 8) {
+ } else if (maplength) {
unsigned int len = maplength / 3;
- if (!maplength) {
- av_log(avctx, AV_LOG_ERROR, "colormap expected\n");
- return -1;
- }
if (maplength % 3 || maplength > 768) {
av_log(avctx, AV_LOG_WARNING, "invalid colormap length\n");
return -1;