In YUV color space, Y represents the gray scale; in RGB color space, R=G=B represents gray scale. You can simply set R=G=B=Y, to convert YUV to RGB. If the original color depth is 24 bit, then the result is 24 bit too.
You can create gray scale color table like this:
array size = 256;
[0] = 0x000000;
[1] = 0x010101;
[2] = 0x020202;
...
[255] = 0xFFFFFF;
To convert 24 bit gray scale to 8 bit, check every pixel in 24 bit image to find the array index according to the color table, and replace the pixel with array index.
George Zou
http://gtoolbox.yeah.net
George Zou