This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Modifying pixels' values in FVID_Frame



 I am using DM6437 to implement video object segmentation algorithm. I am using YCBCR 422 as my input format. When I try to modify the y1 pixel using the following code, it successfully changes.

 

frameBuffPtr->frame.iFrm.y1[i] = 10;

 

When I try to change any of the other pixel information, y2, cb1, cb2, cr1 or cr2. The value doesn't change although I can print their values correctly using printf.

I am using the following code to change their values which is exactly same as for y1.

 

frameBuffPtr->frame.iFrm.y2[i] = 10;

frameBuffPtr->frame.iFrm.cb1[i] = 10;

frameBuffPtr->frame.iFrm.cb2i] = 10;

frameBuffPtr->frame.iFrm.cr1[i] = 10;

frameBuffPtr->frame.iFrm.cr2[i] = 10;

 

Why I can't modify the value of these pixels?  I need to do this to set the pixels which are detected as background pixels to be displayed in black.

  • Hi,

    Only frameBufferPtr of the following frame union in fvid.h is valid in DM6437. The other members like iFrm, pFrm etc are used in DM648 platform and hence are not initialized in DM6437 VPFE/VPBE driver.

    The reason for this is that DM6437 supports only interleaved format unlike DM648 VPORT which supports planar format. And iFrm, pFrm members etc are used only in the case of planar format.

    union {
            FVID_IFrame     iFrm;
            /**< y/c frame buffer for interlaced mode         */
            FVID_PFrame     pFrm;
            /**< y/c frame buffer for progressive mode        */
            FVID_RawIFrame  riFrm;
            /**< raw frame buffer for interlaced mode         */
            FVID_RawPFrame  rpFrm;
            /**< raw frame buffer for progressive mode        */
            Ptr             frameBufferPtr;
        } frame;    /**< \brief union for frame type as used by driver */

     

    Regards,

    Sivaraj R

    PSP

    Texas Instruments India

  •  Thanks for your help. Problem solved :)

  • Hi,

    We are working on the DM6437 and we're trying to do something similar to the guy above...

    Can you please explain how we should use the frameBufferPtr  in order to modify the frame pixels? It seems that the CCS does'nt recognize the struct of this member (Ptr?) and also we cannot find in  your documentation any good explanation of how to use it.

    Furthermore, we have noticed that the pointer frameBuffPtr->frame.iFrm.y1[i] or frameBuffPtr->frame.pFrm.y[i] are pointing to the captured frame in the format of YUV422, and by changing its values we have actually succeeded to modify the values of the pixels in the frame (the luma & chroma, using only the 'y' pointer). You have said before that these pointers are hence, can you clarify?

     

    Thanks a lot.

     

  • Hi,

    the frameBuffPtr->frame.iFrm.y1 and frameBuffPtr->frame.pFrm.y and frameBufferPtr are actually pointing to the same location. You can use any to modify the pixels value. The pixels are stored in interleaved format.  i.e: y,cb,y,cr,y,cb,y,cr,y,cb,y,cr,y,cb,y,cr.... and so on. So each second element is a y value. Every two pixels share the cb and cr values. So if you read the first four elements using any of the mentioned pointers you actually access the first two pixels.

     Hope this would be helpful and goodluck with your work.

  •  I would like to point out one mistake. The interleaved format in 6437 is stored in the following format, not as was mentioned in previous post.

     

    cb, y, cr, y, cb, y, cr, y, cb, y, cr, y, cb, y, cr,...

     

    it starts with cb rather than with y.

  • Hi qais,

    Thanks for your help. Until this moment, we have reached to the same conclusions as you did.

    I'm disappointed that TI didn't publish any example which shows the right use in the frame struct, e.g. a codec which takes the grabbed frame and performs some kind of processing to it.

     

  • Based on this thread I created a wiki page at http://wiki.davincidsp.com/index.php?title=Accessing_pixels_in_a_frame_on_DM643x which discusses this, including providing a code example that does some pixel modifications for the DM6437 EVM.

  • Finally, clear and organized information on this subject!

    Thanks a lot!! :)

  •  Thanks for putting up the page although I already finished my work now and had to learn in the hard way!

    It would have been much easier if documentations provided this simple and basic information. Not all of us have the experience to deal easily with the situation!

     

    Anyway. Thanks alot for your help :)