[Theora-dev] yuv2rgb

lluis lluis at artefacte.org
Thu Dec 9 11:21:20 PST 2004


exactly ;)

this is just what i'm finding.

now it's time for yuv2rgb ... but i think i'm right with the info posted here
thanks very much all...

when i finish my program i send it to the list ... maybe it could be a good
example in the libtheora tree ...

On Thursday 09 December 2004 19:35, you wrote:
> While individual rows are always themselves contiguous in memory, each
> consecutive row is not. The distance between the first pixel of one row
> and the first pixel of the next row is stored in the y_stride field (and
> the uv_stride field for the u and v planes). This distance can be
> negative! And in fact, the way the library is currently written, it
> usually is.
>
> (The reasons for this are that internally libtheora needs to add padding
> around the image during the decode process, and for simplicity also
> currently stores it from bottom to top instead of top to bottom; by
> specifying the stride, libtheora lets you access the reversed, padded
> image directly without copying it into a more compact form)
>
> So, better code would be:
>
>     unsigned char *y_row;
>     unsigned char *y_col;
>     int x,y;
>     int lumi[320][240];
>     y_row = yuv.y;
>     for(y=0;y<240;y++) {
>        y_col = y_row;
>        for(x=0;x<320;x++) {
>           lumi[x][y]=*y_col++;
>        }
>        y_row += yuv.y_stride;
>     }

-------------------------------------------------------


More information about the Theora-dev mailing list