Supoort decoding of gray16 images with libopenjpeg.
authorMichael Bradshaw <mbradshaw@sorensonmedia.com>
Mon, 30 Jan 2012 22:53:25 +0000 (23:53 +0100)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Mon, 30 Jan 2012 22:53:25 +0000 (23:53 +0100)
libavcodec/libopenjpegdec.c

index 07cca25..3139b85 100644 (file)
@@ -258,7 +258,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
     avcodec_set_dimensions(avctx, width, height);
 
     switch (image->numcomps) {
-    case 1:  avctx->pix_fmt = PIX_FMT_GRAY8;
+    case 1:  avctx->pix_fmt = (image->comps[0].bpp == 8) ? PIX_FMT_GRAY8 : PIX_FMT_GRAY16;
              break;
     case 3:  avctx->pix_fmt = check_image_attributes(avctx, image);
              break;