Revision a80f74c5

View differences:

libavcodec/imgconvert.c
790 790
    int y_shift;
791 791
    int x_shift;
792 792

  
793
    if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB || !is_yuv_planar(&pix_fmt_info[pix_fmt]))
793
    if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)
794 794
        return -1;
795 795

  
796 796
    y_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h;
797 797
    x_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_w;
798 798

  
799
    if (is_yuv_planar(&pix_fmt_info[pix_fmt])) {
799 800
    dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;
800 801
    dst->data[1] = src->data[1] + ((top_band >> y_shift) * src->linesize[1]) + (left_band >> x_shift);
801 802
    dst->data[2] = src->data[2] + ((top_band >> y_shift) * src->linesize[2]) + (left_band >> x_shift);
803
    } else{
804
        if(top_band % (1<<y_shift) || left_band % (1<<x_shift))
805
            return -1;
806
        if(left_band) //FIXME add support for this too
807
            return -1;
808
        dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;
809
    }
802 810

  
803 811
    dst->linesize[0] = src->linesize[0];
804 812
    dst->linesize[1] = src->linesize[1];

Also available in: Unified diff