V4L/JPEG Y'CbCr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



> Trent Piepho wrote:
>
> >
> > The Rec.601 Y'CbCr colorspace used by bt848 is different than that used by the
> > JFIF standard.  It would be better to call the colorspace used by jpeg Y'PbPr.
> > If you take the "YUV" data from a bt848 and try to jpeg encode it without
> > modifiying the data, your JPEG will look wrong.  Been there, done that, wrote
> > a Y'CbCr -> Y'PbPr converter so my JPEGs would look correct.

I just checked the color space FAQ:

http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html

..and this seems to confirm that JPEG is also Rec. 601-1 Y'CbCr (same as the Bt848). It says
Y'PbPr is an HDTV standard.

****

>From section 5.6:

    To avoid such problems, you'll preferr the YCbCr. This color space is
    similar to YUV and YIQ without the disadvantages. Y remains the component
    of luminancy but Cb and Cr become the respective components of blue and
    red. Futhermore, with YCbCr color space you can choose your luminancy from
    your favorite recommendation. The most popular are given below:
    +----------------+---------------+-----------------+----------------+
    | Recommendation | Coef. for red | Coef. for Green | Coef. for Blue |
    +----------------+---------------+-----------------+----------------+
    | Rec 601-1      | 0.299         | 0.587           | 0.114          |
    | Rec 709        | 0.2125        | 0.7154          | 0.0721         |
    | ITU            | 0.2125        | 0.7154          | 0.0721         |
    +----------------+---------------+-----------------+----------------+
    RGB -> YCbCr
    Y  = Coef. for red*Red+Coef. for green*Green+Coef. for blue*Blue
    Cb = (Blue-Y)/(2-2*Coef. for blue)
    Cr = (Red-Y)/(2-2*Coef. for red)
    YCbCr -> RGB
    Red   = Cr*(2-2*Coef. for red)+Y
    Green = (Y-Coef. for blue*Blue-Coef. for red*Red)/Coef. for green
    Blue  = Cb*(2-2*Coef. for blue)+Y
    (Note that the Green component must be computed *after* the two other
    components because Green component use the values of the two others.)
    Usually, you'll need the following conversions based on Rec 601-1
    for TIFF and JPEG works:
    RGB -> YCbCr (with Rec 601-1 specs)         | YCbCr (with Rec 601-1 specs) -> RGB
    Y=  0.2989*Red+0.5866*Green+0.1145*Blue     | Red=  Y+0.0000*Cb+1.4022*Cr
    Cb=-0.1687*Red-0.3312*Green+0.5000*Blue     | Green=Y-0.3456*Cb-0.7145*Cr
    Cr= 0.5000*Red-0.4183*Green-0.0816*Blue     | Blue= Y+1.7710*Cb+0.0000*Cr


****

I can't imagine that JFIF (which is a file format) overrides the colorspace specification of
the JPEG standard.

Ben






[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux