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.

About the usage of the C64X imglib

Hi,all

              I am using the evmDM642 to do the image processing with the PAL camera captuing the vidio display on a 800*640 VGA monitor. I enconter some questions when  I invoke the functions in imglib.I list it in the below.

            1. yc2rgb16(coeffs, capFrameBuf->frame.iFrm.y1 + i * (capLinePitch),capFrameBuf->frame.iFrm.cb1 + (capLinePitch >> 1) * i, capFrameBuf->frame.iFrm.cr1 + (capLinePitch >> 1) * i, disFrameBuf->frame.rpFrm.buf + (disLinePitch << 1) * i, numPixels);             

           This function provied by TI is to transfer the YCbcr format of vidio to RGB565 format of vidio to  display on the VGA monitor,  it   works normal,but  when I use the IMG_ycbcr422p_rgb565(coeffs, capFrameBuf->frame.iFrm.y1 + i * (capLinePitch),capFrameBuf->frame.iFrm.cb1 + (capLinePitch >> 1) * i, capFrameBuf->frame.iFrm.cr1 + (capLinePitch >> 1) * i, (short *)disFrameBuf->frame.rpFrm.buf + (disLinePitch << 1) * i, numPixels);  it is the function of imglib ,it display only one picture on the monitor,  And it can't display vidio,just one picture. the rest of the code is:    FVID_exchange(capChan, &capFrameBuf);    FVID_exchange(disChan, &disFrameBuf;    Why it can't display the vidio?

           2.I try to do the filter of the vidio,use the function of imglib ,the code list below:

   for(i = 0; i < numLines; i++) {
            m_nID=DAT_copy(capFrameBuf->frame.iFrm.y1+i*capLinePitch,nMemTemp,numPixels);
   DAT_wait(m_nID);
   IMG_median_3x3(nMemTemp,720,nMemTemp_out);
   DAT_copy(nMemTemp_out,capFrameBuf->frame.iFrm.y1+i*capLinePitch,numPixels);
            yc2rgb16(coeffs, capFrameBuf->frame.iFrm.y1 + i * (capLinePitch),

   yc2rgb16(coeffs, capFrameBuf->frame.iFrm.y1 + i * (capLinePitch),
                capFrameBuf->frame.iFrm.cb1 + (capLinePitch >> 1) * i,
                capFrameBuf->frame.iFrm.cr1 + (capLinePitch >> 1) * i,
                disFrameBuf->frame.rpFrm.buf + (disLinePitch << 1) * i,
                numPixels);

    The vidio is display on the monitor ,but there have so much white column bar display on the monitor,there have some wrong using of the imglib,or there

    have some wrong with the code?

   Thank you  very much!

   

                                                                    

            

    1.       Kernels provided in Image Library are designed to process an image, or an segment of the image. The video implementation of these kernels can be achieved by introducing a loop that applies these kernels to each individual frame in the video.

    2.     This may be caused due to incorrect usage of the IMG_median_3x3 kernel.  Median 3x3 kernel expects 3 rows of image data to be passed from the application code. The code mentioned in the above post seems to currently pass just one rowe of image data to the kernel. The correct usage would be

                       /* Median filter the image (Assuming no padding )*/

                            for(i = 0; i < numLines-2; i++) {

                       /* Process only image data */
                      IMG_median_3x3_8(capFrameBuf->frame.iFrm.y1+i*capLinePitch,

                                                              720,  // Number of columns in the image data

                                                              temp_buffer+i*capLinePitch); //temp_buffer is used to store  intermediate output (Size of y frame)

      }

      /* YCtoRGB processing */

                         for(i = 0; i < numLines; i++) {

                       /* Convert YUV data to RGB using IMG_ycbcr422p_rgb565*/

                         yc2rgb16(coeffs, temp_buffer + i * (capLinePitch),
                                          capFrameBuf->frame.iFrm.cb1 + (capLinePitch >> 1) * i,
                                         capFrameBuf->frame.iFrm.cr1 + (capLinePitch >> 1) * i,
                                        disFrameBuf->frame.rpFrm.buf + (disLinePitch << 1) * i,
                                        numPixels);

      }

       

       

  • Int i;
           for(i = 0; i < numLines; i++)
           {m_nID=DAT_copy(capFrameBuf->frame.iFrm.y1+i*capLinePitch,temp_buffer ,numPixels);

            DAT_wait(m_nID);
            ICETEKDM642PCIImageProcessReverse();
            //DAT_copy(temp_buffer,capFrameBuf->frame.iFrm.y1+i*capLinePitch,numPixels)
            }


           /* Median filter the image (Assuming no padding )*/
                          
                                                    
          for(i = 0; i < numLines; i++) {
                yc2rgb16(coeffs,temp_buffer+i*capLinePitch,
                    capFrameBuf->frame.iFrm.cb1 + (capLinePitch >> 1) * i,
                    capFrameBuf->frame.iFrm.cr1 + (capLinePitch >> 1) * i,
                    disFrameBuf->frame.rpFrm.buf + (disLinePitch << 1) * i,
                    numPixels);
            }
       
           //myImageProcess();
           
            //DAT_wait(DAT_XFRID_WAITALL);
            //采集一帧视频
            FVID_exchange(capChan, &capFrameBuf);
              /* raw frame buffer         */
            //FillFrmBufRGB(&disFrameBuf->frame.rpFrm,      
        
           // EVMDM642_vDisParamsChan.imgHSizeFld1,         
            //EVMDM642_vDisParamsChan.imgVSizeFld1,            
            //frames %(EVMDM642_vDisParamsChan.imgHSizeFld1 >> 3)
            //);
            // 180.    
            //上面这段代码,是VGA显示时,显示七色滚动条的。如果想显示采集的图像,不需这个。
           
            CACHE_clean(CACHE_L2ALL, 0, 0);
            //显示一帧视频
            FVID_exchange(disChan, &disFrameBuf);       
            frames ++;             
       }


    void ICETEKDM642PCIImageProcessReverse()
    {
        int i;
        unsigned int *y;
     
        //for ( i=0,y=(unsigned int *)temp_buffer;i<582;i++,y++ )
        // (*y)=~(*y);
         for ( i=0,y=(unsigned int *)temp_buffer;i<582;i++,y++ )
        { if((*y)<158)
            (*y)=0;
          else 
              (*y)=255;
        }
    }

    I USE your example,  but it only display ane picture.so where do you defined you temp_buffer sdram isram or cache_l2

    i want to know if I use is it right ?

     for(i = 0; i < numLines; i++)
           {m_nID=DAT_copy(capFrameBuf->frame.iFrm.y1+i*capLinePitch,temp_buffer ,numPixels);

            DAT_wait(m_nID);
            ICETEKDM642PCIImageProcessReverse();
           DAT_copy(temp_buffer,capFrameBuf->frame.iFrm.y1+i*capLinePitch,numPixels)

     

     for(i = 0; i < numLines; i++) {
                yc2rgb16(coeffs, capFrameBuf->frame.iFrm.r+i*capLinePitch,
                    capFrameBuf->frame.iFrm.cb1 + (capLinePitch >> 1) * i,
                    capFrameBuf->frame.iFrm.cr1 + (capLinePitch >> 1) * i,
                    disFrameBuf->frame.rpFrm.buf + (disLinePitch << 1) * i,
                    numPixels);
            }