[Theora-dev] question from beginner (YCbCr to RGB)
LS PLOTINKA
linesoft at plotinka.ru
Mon Mar 14 21:06:42 PST 2005
Hello, i'm sorry for my English is not good.
I need help with convert yuv_buffer data (YCbCr) to RGB without SDL.
I write:
BYTE *frame=new BYTE[YUV_BUFFER.y_height*YUV_BUFFER.y_width*4];
for(int cc=0; cc<YUV_BUFFER.y_height*YUV_BUFFER.y_width; cc++)
{
frame[cc*4+0]=YUV_BUFFER.y[cc]+1.371*(YUV_BUFFER.v[cc]-128);
frame[cc*4+1]=YUV_BUFFER.y[cc]-0.698*(YUV_BUFFER.v[cc]-128)-0.336*(YUV_BUFFER.u[cc]-128);
frame[cc*4+2]=YUV_BUFFER.y[cc]+1.732*(YUV_BUFFER.u[cc]-128);
frame[cc*4+3]=255;
//R = Y + 1.371(CR - 128)
//G = Y - 0.698(CR - 128) - 0.336(CB - 128)
//B = Y + 1.732(CB - 128)
//A = 255
}
But it seems to me that this code is incorrect, because don't use y_stride,
uv_height, uv_width, uv_stride fields.
File libtheora-1.0alpha4.pdf doesn't contain enough useful information
concerning these fields: y_stride, uv_height, uv_width, uv_stride.
Please, write an example-code for needeed YCbCr to RGB convertion or
give me link where wrote about that.
Thanks!
ls, russian enthusiast.
More information about the Theora-dev
mailing list