Show RGB888 content

Posted by Abhi on Stack Overflow See other posts from Stack Overflow or by Abhi
Published on 2010-03-12T10:35:13Z Indexed on 2010/03/12 10:37 UTC
Read the original article Hit count: 408

Filed under:
|
|
|
|

Hi all!

I have to show RGB888 content using the ShowRGBContent function.

The below function is a ShowRGBContent function for yv12->rgb565 & UYVY->RGB565

static void ShowRGBContent(UINT8 * pImageBuf, INT32 width, INT32 height)

{ LogEntry(L"%d : In %s Function \r\n",++abhineet,WFUNCTION); UINT16 * temp; BYTE rValue, gValue, bValue;

// this is to refresh the background desktop
ShowWindow(GetDesktopWindow(),SW_HIDE);
ShowWindow(GetDesktopWindow(),SW_SHOW);

for(int i=0; i<height; i++)
{
 for (int j=0; j< width; j++)        
 {
  temp = (UINT16 *) (pImageBuf+ i*width*PP_TEST_FRAME_BPP+j*PP_TEST_FRAME_BPP);
  bValue = (BYTE) ((*temp & RGB_COMPONET0_MASK) >> RGB_COMPONET0_OFFSET) << (8 -RGB_COMPONET0_WIDTH);
  gValue = (BYTE) ((*temp & RGB_COMPONET1_MASK) >> RGB_COMPONET1_OFFSET) << (8 -RGB_COMPONET1_WIDTH);
  rValue = (BYTE) ((*temp & RGB_COMPONET2_MASK) >> RGB_COMPONET2_OFFSET) << (8 -RGB_COMPONET2_WIDTH);            
  SetPixel(g_hDisplay, SCREEN_OFFSET_X + j, SCREEN_OFFSET_Y+i, RGB(rValue, gValue, bValue));
 }
}

Sleep(2000); //sleep here to review the result

LogEntry(L"%d :Out %s Function \r\n",++abhineet,__WFUNCTION__);

}

I have to modify this for RGB888

Here in the above function:

************************
RGB_COMPONET0_WIDTH = 5
RGB_COMPONET1_WIDTH = 6
RGB_COMPONET2_WIDTH = 5
************************

************************
RGB_COMPONET0_MASK = 0x001F //31 in decimal
RGB_COMPONET1_MASK = 0x07E0 //2016 in decimal
RGB_COMPONET2_MASK = 0xF800 //63488 in decimal
************************

************************
RGB_COMPONET0_OFFSET = 0
RGB_COMPONET1_OFFSET = 5
RGB_COMPONET2_OFFSET = 11
************************

Also PP_TEST_FRAME_BPP = 2 for yv12 -> RGB565 & UYVY -> RGB565

Now my task is for RGB888. Please guide me what shall i do in this.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about c

    Related posts about c++