TV will accept raw YUV format and hence you do not need colour space conversion. Also colour space conversion may be available as a ready made function as part of IMGLIB. Regds JS -----Original Message----- From: piyush kaul [mailto:] Sent: Monday, May 24, 2004 5:39 AM To: Jeff Brower Cc: Subject: Re: [c6x] YUV format for Video Driver in DM642 Hi Jeff, Thanks for the help. However I intend to use the EVM as a standalone system(unconnected to PC) and hence using any software like DirectDSP is out of question. Also the objective is to display real-time video through the video port on a Television or VGA Monitor and not through PC. Hence the code might not be relevent to my need as of now. I already have a reasonable implementation of real-time video display for VGA. However, as I communicated, I am not able to do without color-space conversion (YUV to RGB). As you might know, color-space conversion is highly intensive especially for large resolutions, hence my question whether it could be avoided. Sankaran suggests that it can not be avoided for VGA, hence I need to go with it atleast for VGA. Now need to look for TV. Regards Piyush --- Jeff Brower <> wrote: > Piyush- > > > I have been trying to display decoded video using > the > > DDK libraries on DM642. The output of the decoder > is > > YUV 4:2:0 format. However for displaying it > correctly > > on the VGA Monitor, I need to convert it to RGB > for > > proper color. The documentation seems to suggest > that > > feeding the YUV directly should also work but the > > color is not correct when I directly feed yuv > data. > > > > Even the example program which uses YUV for XGA > > displays incorrect colors. > > > > My guess is that the yuv works only for SDTV and > for > > monitors Color space conversion in software is > > required. > > Any experiences/hints would be very valueble. > > Below is some example source code that uses > DirectDSP software and reads MPEG4 > algorithm output from the DSK C6711 + IDK board > combination. The MPEG4 algorithm is > from Mecoso; this example shows D1 resolution about > 12 frame/sec on the DSK board > (relatively slow at 150 MHz). > > The GetMem() calls are DirectDSP API calls (actually > a C++ class on top of the > standard DSGetMem API call). Note the memcpy()'s to > grab separate Y, Cb, Cr format > data from DSP mem. Then there is a bunch more code > (SetFrame call) to convert YCbCr > data to RGB format suitable for display in a Win > bitmap -- but I did not post that > code. > > I hope this is helpful. > > -Jeff > > while (!g_DSP.GetFrameReady()); > > //Capture data and set current frame data > > //All sizes divided by four because we're reading > 4-byte chunks > //NOTE: Max read is 32768 bytes > > //Read Y data > for (i=0; i<FrameSize-32768; i+2768) { > g_DSP.GetMem(DS_GM_LINEAR_DATA, 0x80500008 + > i, DS_GM_SIZE32, Data, 8192); > memcpy(m_YUVData.Y + i, Data, 32768); > } > //Not an even number of 32768 byte chunks... > if (i - FrameSize != 0) { > //i -= 32768; > g_DSP.GetMem(DS_GM_LINEAR_DATA, 0x80500008 + > i, DS_GM_SIZE32, Data, (FrameSize > - i) / 4); > memcpy(m_YUVData.Y + i, Data, (FrameSize - > i)); > } > > //Read Cb data > for (i=0; i<=FrameSize / 4-32768; i+2768) { > g_DSP.GetMem(DS_GM_LINEAR_DATA, 0x80500008 + > FrameSize + i, DS_GM_SIZE32, Data, > 8192); > memcpy(m_YUVData.Cb + i, Data, 32768); > } > //Not an even number of 32768 byte chunks... > if (i - FrameSize / 4 != 0) { > //i -= 32768; > g_DSP.GetMem(DS_GM_LINEAR_DATA, 0x80500008 + > FrameSize + i, DS_GM_SIZE32, Data, > (FrameSize / 4 - i) / 4); > memcpy(m_YUVData.Cb + i, Data, (FrameSize / 4 > - i)); > } > > //Read Cr Data > for (i=0; i<=FrameSize / 4-32768; i+2768) { > g_DSP.GetMem(DS_GM_LINEAR_DATA, 0x80500008 + > FrameSize * 5 / 4 + i, > DS_GM_SIZE32, Data, 8192); > memcpy(m_YUVData.Cr + i, Data, 32768); > } > //Not an even number of 32768 byte chunks... > if (i - FrameSize / 4 != 0) { > //i -= 32768; > g_DSP.GetMem(DS_GM_LINEAR_DATA, 0x80500008 + > FrameSize * 5 / 4 + i, > DS_GM_SIZE32, Data, (FrameSize / 4 - i) / 4); > memcpy(m_YUVData.Cr + i, Data, (FrameSize / 4 > - i)); > } > > //Save to file if we have a file pointer > if (pFile) > { > fwrite(m_YUVData.Y, FrameSize, 1, pFile); > fwrite(m_YUVData.Cb, FrameSize / 4, 1, pFile); > fwrite(m_YUVData.Cr, FrameSize / 4, 1, pFile); > } > > //Set current frame data > m_YUV.SetFrame(m_YUVData); > > //Force view to refresh > ((CFrameWnd *)::AfxGetM > _____________________________________ > Note: If you do a simple "reply" with your email > client, only the author of this message will receive > your answer. You need to do a "reply all" if you > want your answer to be distributed to the entire > group. > > _____________________________________ > About this discussion group: > > To Join: Send an email to > To Post: Send an email to > > To Leave: Send an email to > Archives: http://www.yahoogroups.com/group/c6x > > Other Groups: http://www.dsprelated.com > > Yahoo! Groups Links > ===== ************************************** And---"A blind Understanding!" Heav'n replied. Piyush Kaul http://www.geocities.com/piyushkaul __________________________________ _____________________________________ Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer. You need to do a "reply all" if you want your answer to be distributed to the entire group. _____________________________________ About this discussion group: To Join: Send an email to To Post: Send an email to To Leave: Send an email to Archives: http://www.yahoogroups.com/group/c6x Other Groups: http://www.dsprelated.com Yahoo! Groups Links |