Ticket #3426: patchcyyk.diff

File patchcyyk.diff, 1.6 KB (added by Carl Eugen Hoyos, 13 years ago)
  • libavcodec/mjpegdec.c

    diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
    index ac94345..0e5cdf2 100644
    a b int ff_mjpeg_decode_sof(MJpegDecodeContext *s)  
    380380        else {
    381381            if (s->adobe_transform == 0 && s->bits <= 8) {
    382382                s->avctx->pix_fmt = AV_PIX_FMT_GBRAP;
     383            } else if (s->adobe_transform == 2 && s->bits <= 8) {
     384                av_log(s->avctx, AV_LOG_WARNING,
     385                       "Adobe CYYK not completely supported, output colours will be wrong.\n");
     386                s->avctx->pix_fmt = AV_PIX_FMT_YUVA444P;
    383387            } else {
    384388                s->avctx->pix_fmt = s->bits <= 8 ? AV_PIX_FMT_YUVA444P : AV_PIX_FMT_YUVA444P16;
    385389                s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
    … … the_end:  
    20922096            }
    20932097        }
    20942098    }
     2099    if (s->adobe_transform == 2 && s->avctx->pix_fmt == AV_PIX_FMT_YUVA444P) {
     2100        int w = s->picture_ptr->width;
     2101        int h = s->picture_ptr->height;
     2102        for (i=0; i<h; i++) {
     2103            int j;
     2104            uint8_t *dst[4];
     2105            for (index=0; index<4; index++) {
     2106                dst[index] =   s->picture_ptr->data[index]
     2107                             + s->picture_ptr->linesize[index]*i;
     2108            }
     2109            for (j=0; j<w; j++) {
     2110                dst[0][j] = 255 - dst[0][j];
     2111                dst[1][j] = 255 - dst[1][j];
     2112                dst[2][j] = 255 - dst[2][j];
     2113                dst[3][j] = 255;
     2114            }
     2115        }
     2116    }
    20952117
    20962118    if (s->stereo3d) {
    20972119        AVStereo3D *stereo = av_stereo3d_create_side_data(data);