[Theora-dev] yuv2rgb

lluis lluis at artefacte.org
Thu Dec 9 09:37:03 PST 2004


thank's all for this value informations ... i'm reading a lot now ;=) 

however my problem is that i don't understand how to get the numeric values 
from the yuv_buffer ::

typedef struct {
    int   y_width;
    int   y_height;
    int   y_stride;

    int   uv_width;
    int   uv_height;
    int   uv_stride;
    char *y;
    char *u;
    char *v;

} yuv_buffer;

for example i supose that in the "y" char pointer we have 1 byte foreach 
pixel ... correct? 

so ...

  char value;
  int x,y;
  int lumi[320][240];
   for(y=0;y<240;y++) {
            for(x=0;x<320;x++) {
              value = *yuv.y++;
              p = value;
              lumi[x][y]=p;
            }
  }

this will take me an integer array for all the luminance values for each 
pixel ....

but don't works ... 
what's wrong in my aproach? 

thanks



On Thursday 09 December 2004 16:39, Alen Ladavac wrote:
> Phew.... sorry for just trying to help a poor guy who clearly states he's a
> newb. It won't happen again. I'll try to be a Puritan and preach the true
> religion.
>
> Lluis, it doesn't matter if you can't get the component planes correctly,
> just remember that "Thou shalt always order Cr and Cb components properly,
> and pray to the true color space..." ;)
>
> ----- Original Message -----
> From: "Timothy B. Terriberry" <tterribe at vt.edu>
> To: "Alen Ladavac" <alenl-ml at croteam.com>
> Cc: <theora-dev at xiph.org>
> Sent: Thursday, December 09, 2004 08:21
> Subject: Re: [Theora-dev] yuv2rgb
>
> > Alen Ladavac wrote:
> > > Here are some usefull references:
> > >
> > > a) checkout http://www.fourcc.org/yuv.php
> > > b) search for "Video Rendering with 8-Bit YUV Formats" on
> > > http://msdn.microsoft.com/library
> > >
> > > To help you filter the information you are interested in, the format
>
> that
>
> > > theora uses internally is officially called YV12.
> > >
> > > That's regarding the color format. I hope you understand the image
>
> layout
>
> > > tricks with negative strides etc.
> >
> > I would ignore FOURCC codes altogether. They both overspecify things
> > like memory layout that do not apply to the libtheora API and
> > underspecify things like chroma siting locations, RGB primaries, etc.
> >
> > Step 1 to understanding video colorspaces: there is no such space as YUV.
> >
> > Alen nicely proves the point of why you should never use the term by
> > suggesting Theora uses YV12. Theora uses Y'CbCr, however most (but not
> > all) interpretations of YV12 really mean Y'CrCb, with the chroma
> > components swapped. Unlike U and V, Cb and Cr have an unambiguous
> > interpretation. In the current libtheora API, U corresponds to Cb and V
> > corresponds to Cr (future API revisions will hopefully fix this to refer
> > to them as Cb and Cr directly).
> >
> > Step 2: There is more than one RGB space.
> > The red, green, and blue primaries in your television are not the same
> > as in your monitor. They're not even the same between NTSC and PAL
> > televisions. Know what your target is and use the right conversion.
> >
> > Having said that, Chapter 4 of the Theora spec
> > (http://www.theora.org/doc/Theora_I_spec.pdf) provides explicit detail
> > on the exact colorspaces Theora supports, and how to convert between
> > them.
>
> _______________________________________________
> Theora-dev mailing list
> Theora-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/theora-dev


More information about the Theora-dev mailing list