Ticket #865: grayras.diff

File grayras.diff, 1.4 KB (added by ami_stuff, 15 years ago)
  • libavcodec/sunrast.c

    diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c
    index 3e1cea6..64793db 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            /*
     97            if(!grayscale)
     98                avctx->pix_fmt = PIX_FMT_PAL8;
     99            else
     100            */
     101                avctx->pix_fmt = PIX_FMT_GRAY8;
    97102            break;
    98103        case 24:
    99104            avctx->pix_fmt = (type == RT_FORMAT_RGB) ? PIX_FMT_RGB24 : PIX_FMT_BGR24;
    … … static int sunrast_decode_frame(AVCodecContext *avctx, void *data,  
    121126    if (depth != 8 && maplength) {
    122127        av_log(avctx, AV_LOG_WARNING, "useless colormap found or file is corrupted, trying to recover\n");
    123128
    124     } else if (depth == 8) {
    125         unsigned int len = maplength / 3;
     129    } else if (depth == 8 /*&& !grayscale */) {
     130/*        unsigned int len = maplength / 3;
    126131
    127132        if (!maplength) {
    128133            av_log(avctx, AV_LOG_ERROR, "colormap expected\n");
    … … static int sunrast_decode_frame(AVCodecContext *avctx, void *data,  
    136141        ptr = p->data[1];
    137142        for (x=0; x<len; x++, ptr+=4)
    138143            *(uint32_t *)ptr = (0xFF<<24) + (buf[x]<<16) + (buf[len+x]<<8) + buf[len+len+x];
     144*/
    139145    }
    140146
    141147    buf += maplength;