openexr-devel
[Top][All Lists]
Advanced

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

Re: [Openexr-devel] On YUV support


From: Florian Kainz
Subject: Re: [Openexr-devel] On YUV support
Date: Tue, 10 Feb 2004 19:43:07 -0800

I should mention a couple of points regarding my previous post:

* RY and BY are undefined if Y is zero.  If RY and BY are downsampled,
  negative Y values must also be disallowed in order to avoid artifacts 
  during upsampling and conversion back to RGB.  The body of the loop
  that converts RGB to luminance and chroma should really look like this:

            Rgba &p = pixels[y][x];

            if (p.r < 0)
                p.r = 0;

            if (p.g < 0)
                p.g = 0;

            if (p.b < 0)
                p.b = 0;

            p.g = p.r * m[0][1] + p.g * m[1][1] + p.b * m[2][1];

            if (p.r < HALF_MAX * p.g)
                p.r = p.r / p.g - 1;
            else
                p.r = 0;

            if (p.b < HALF_MAX * p.g)
                p.b = p.b / p.g - 1;
            else
                p.b = 0;

* In my sample code, the low-pass filter used during chroma downsampling
  doesn't have a sharp frequency cutoff, and upsampling is done by linear 
  interpolation.  This way, repeated conversion from RGB to Y/RY/BY and 
  back degrades the image rather quickly by blurring the RY and BY channels.
  In order to avoid this degradation, the filter used during downsampling
  should have a much sharper frequency cutoff, and upsampling should be 
  done with a filter that looks more like a sinc function.
  If anyone has experience with with designing good separable filters for 
  this task, I'd like to hear about it.  (I intend to add Y/RY/BY support
  to the RgbaOutputFile and RgbaInputFile classes.)

* Regarding terminology and nitpicking:  The "Technical Details" page
  on the OpenEXR web does not refer to luminance as "luma".  The term
  "YUV" has been eliminated, too.

Florian





reply via email to

[Prev in Thread] Current Thread [Next in Thread]