function that do that is: int tcv_convert(TCVHandle handle, uint8_t *src, uint8_t *dest, int width, int height, ImageFormat srcfmt, ImageFormat destfmt); (libtcvideo/tcvideo.h) (or look at my few filters i sent on this mailing list less then month ago for example use) (also, you need to convert back to YUV422)
Also, try this: Y' = 16 + 1/256 * ( 65.738 * R'd + 129.057 * G'd + 25.064 * B'd) Cb = 128 + 1/256 * ( - 37.945 * R'd - 74.494 * G'd + 112.439 * B'd) Cr = 128 + 1/256 * ( 112.439 * R'd - 94.154 * G'd - 18.285 * B'd) from http://en.wikipedia.org/wiki/YCbCr I also don't know nothing about colorspaces, but it seems that this formula did the job (at least for some of my videos). If you plan to use formula and not tcv_convert function, I would wait for someone to answer your question about different colorspaces<->different codecs or you need (at least) to have a large number of testing videos:/ I hope this helps a bit greetings, kokan 2007/8/13, James G. Flewelling, Cobras2 <[EMAIL PROTECTED]>: > Hello there, > I've never done any coding for transcode, or any other video software > for that matter, so I'm a bit new to the whole idea... but what I want > to know is, how do I take a given RGB colour value, and convert it into > the YUV values as used in the transcode vframe_list structure's > video_buf_Y, video_buf_U, and video_buf_V? (Note that I only need to > convert one or a small number of colours, and then use them over and > over; I am not extracting a whole bunch of colours from the frame itself > and then converting them, or anything like that.) > > This might be a stupid question. I don't even know if the Y,U,V values > have the same interpretation for every different codec (do they?), but I > won't find out if I don't ask. > > It would be highly convenient if there is already some kind of RGB to > YUV conversion function in the transcode source I could use (I would > have thought there would be one, but I can't find it if it exists), but > it would be just as useful if someone could give me (or tell me where to > find) some info on how to make my own. > > For example, although it's not the way I was planning on doing it, it > would solve my problem if I could simply define some pixels in the > video_buf_RGB member array of the vframe_list structure, and then run a > conversion to place the same info in the video_buf_Y, _U, and _V arrays > (in YUV format). > > I have already looked at the wikipedia article about YUV (at > http://en.wikipedia.org/wiki/YUV ), which gives a conversion (when > simplified) as: > > Y = 0.299*R + 0.587*G + 0.114*B; > U = (B-Y)*0.565; > V = (R-Y)*0.713; > > but that isn't working quite right. (Either that or I am still not > applying it correctly; see the next paragraph.) > > It would also be very useful to know how the values themselves in the > video_buf_Y, _U, and _V arrays are stored (in fact, this may actually be > my only problem, but I'm not sure). They are specified as char values, > but what is the particular interpretation of the bits inside the char? > For example, what would the maximum Y value look like? (11111111 which > is 0xFF, or something different?) And what would the minimum look like > (00000000 which is 0x00, or something different ?) > > Any information (or links to information) that anyone has on the subject > would be much appreciated; I am pretty sure that I almost have my > problem solved - I've been able to display what I want on the screen (in > the right place) - but I just don't have control of what colour it ends > up being (since I can't quite figure out the format of the Y, U, and V > values). >