Ticket #297: patchplanarjpeg.diff

File patchplanarjpeg.diff, 967 bytes (added by cehoyos, 8 years ago)
  • libavcodec/mjpegdec.c

    diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
    index 9beb464..68d8c38 100644
    a b int ff_mjpeg_decode_sof(MJpegDecodeContext *s) 
    328328        }else{
    329329            s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV444P : PIX_FMT_YUVJ444P;
    330330            s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
     331s->avctx->pix_fmt =PIX_FMT_GBR24P;
    331332        }
    332333        assert(s->nb_components==3);
    333334        break;
    eoi_parser: 
    15591560    av_log(avctx, AV_LOG_FATAL, "No JPEG data found in image\n");
    15601561    return -1;
    15611562the_end:
     1563    if (s->avctx->pix_fmt == PIX_FMT_GBR24P) {
     1564        FFSWAP(uint8_t *, picture->data[0], picture->data[1]);
     1565        FFSWAP(uint8_t *, picture->data[1], picture->data[2]);
     1566    }
    15621567    av_log(avctx, AV_LOG_DEBUG, "mjpeg decode frame unused %td bytes\n", buf_end - buf_ptr);
    15631568//    return buf_end - buf_ptr;
    15641569    return buf_ptr - buf;