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.

using the video_prieview as RGB 565

hi,

i have some questions about the video_preview project, as i see the format that is being used in the project is ycbcr 4:2:2.

as i understand (correct me if i'm wrong) the pixele it that format are stay in this order (y1 cb2 y2 cr2 y3 cb4 y4 cr4) and soo on, i still cant understand how can i modify the the image to work on each pixel for example, i want in my project to make a miror present a miror image - how shuld i work on these pixeles? or can it be some ting as i wrote here down.

void process_image_test( void* currentFrame,  int yRows, int xPixels)
{
  
    int xx = 0;
    int yy = 0;

            for( yy = 0; yy < (xPixels*yRows)*2; yy+=4 )
              {

                 *( ( (unsigned char*)currentFrame ) + yy ) = *( ( (unsigned char*)currentFrame ) - yy + (xx*yRows) - 2);
                if (yy == (xx*yRows))
                xx++;
               }
            for( yy = 1; yy < (xPixels*yRows)*2; yy+=2 )
              {

                 *( ( (unsigned char*)currentFrame ) + yy ) = *( ( (unsigned char*)currentFrame ) - yy + (xx*yRows));
                if (yy == (xx*yRows))
                xx++;
               }
            for( yy = 2; yy < (xPixels*yRows)*2; yy+=4 )
              {

                 *( ( (unsigned char*)currentFrame ) + yy ) = *( ( (unsigned char*)currentFrame ) - yy + (xx*yRows) + 2);
                if (yy == (xx*yRows))
                xx++;
               }

}

 

another question i have is how can i change the format from Ycbcr to RGB 565 and supose i can work on the Y cb and cr how the function :

   FVID_exchange(hGioVpbeVid0, &frameBuffPtr);

will know to work with this format.

 

thank you for your help,

vadim beginer user of dsp

  • can someone help me please.

    thnks alot!

  • First, the easy one.  When you call fvid exchange and pass it the address of frameBuffPtr, the vpbe driver expects that pointer to address a frame in whatever format that you initialized it in.  So if you initialize FVID_YCbCr422_INTERLEAVED in your vpbe parameters, you have to pass it data in that format.  So, the easiest way to accomplish this is to have your video source come in as the same format.  Since this example brings vpfe in as yuv 4:2:2, you will have to reformat the pixels in software if you want to tinker with displaying it in a different format.  Some of the dsps have a dedicated hardware image processing pipeline that will do this reformat for you, but that is beyond my experience.  Is there a reason you want to change from yuv to rgb space, or are you just experimenting?

    As far as mirroring your image, I will again confess to a poor memory as to the y cb cr component order in the array.  You would think that it was y cb cr, but I'm pretty sure that is wrong.  I believe the order is chroma luma chroma luma ... and I always forget which one is blue and which one is red.  I would confirm the order by setting every fourth pixel to 0x80 (I believe this is the midpoint, correct me if not) starting at pixel 0 and look at the output image, then try 1,2, 3 until you find the actual order.  Then mirror each row by components.  You might try to make a grayscale image (set all chroma to midpoint) and just mirror the luma first, then add the chroma into the mirror after you get that working.  Don't forget to do a cache writeback invalidate after your processing and before you call fvid_exchange to the vpbe.

    Best of luck, it was a pretty painful process for me to understand what seems like it should be a simple example.  DSP is a drink from the firehose.