Ticket #865: grayras2.diff

File grayras2.diff, 917 bytes (added by ami_stuff, 15 years ago)
  • libavcodec/sunrast.c

    diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c
    index 3e1cea6..9a0a738 100644
    a b static int sunrast_decode_frame(AVCodecContext *avctx, void *data,  
    9393            avctx->pix_fmt = PIX_FMT_MONOWHITE;
    9494            break;
    9595        case 8:
    96             avctx->pix_fmt = PIX_FMT_PAL8;
     96            avctx->pix_fmt = maplength ? PIX_FMT_PAL8 : PIX_FMT_GRAY8;
    9797            break;
    9898        case 24:
    9999            avctx->pix_fmt = (type == RT_FORMAT_RGB) ? PIX_FMT_RGB24 : PIX_FMT_BGR24;
    … … static int sunrast_decode_frame(AVCodecContext *avctx, void *data,  
    121121    if (depth != 8 && maplength) {
    122122        av_log(avctx, AV_LOG_WARNING, "useless colormap found or file is corrupted, trying to recover\n");
    123123
    124     } else if (depth == 8) {
     124    } else if (maplength) {
    125125        unsigned int len = maplength / 3;
    126126
    127127        if (!maplength) {