Hi
I need to produce BMP image as output from previewer. It is all fine except
converting YUV to RGB.
I have made function which take 3 bytes YUV data and stores 3bytes RGB. I
need to do it in fixed point arithmetic.
Below is my code of this function. I have no idea what is wrong.
int convertYUVtoRGB (struct RGBhodnoty *RGBvals,struct YUVhodnoty *YUVvals)
{
short Yshort,Ushort,Vshort;
Yshort = (short)YUVvals->val_Y;
if (YUVvals->val_U > 127) Ushort = (short)YUVvals->val_U - 256;
else Ushort = (short)YUVvals->val_U;
if (YUVvals->val_V > 127) Vshort = (short)YUVvals->val_V - 256;
else Vshort = (short)YUVvals->val_V;
RGBvals->val_R = (char) (((298*(Yshort-16) + 409*(Vshort) + 128)>>8) &
0xFF);
RGBvals->val_G = (char) (((298*(Yshort-16) - 100*(Ushort) - 208*(Vshort) +
128) >>8) & 0xFF);
RGBvals->val_B = (char) (((298*(Yshort-16) + 516*(Ushort) + 128)>>8) &
0xFF);
return 0;
}Please help!
Ondrej Pindroch
SoftHard Technology ltd.
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source