Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
26 Views

Form Composite 32s ARGB vector from 4 8u vectors

Hello,

I have 4 channels of 8u vector data.  How can I composite them into a single 32s ARGB vector?

Thank you.

0 Kudos
3 Replies
Highlighted
Employee
26 Views

hi Brian,

please use IPPAPI ( IppStatus, ippiCopy_8u_P4C4R, (const  Ipp8u* const pSrc[4], int srcStep, Ipp8u* pDst, int dstStep, IppiSize roiSize )) function.

regards, Igor.
 

0 Kudos
Highlighted
26 Views

Hello Igor Astakhov,

Thanks for your quick response.

I saw this method but didn't know if it would work because the destination buffer is still Ipp8u.  How do I composite the resulting 8u bits into 32s bit values?

Thank you.

0 Kudos
Highlighted
26 Views

I implemented the following code which seems to be working for the most part, except the channels are shifted by one whole frame in the display, where the alpha data is shown in the red channel, red data shown in the green channel and green data shown in the blue channel.

this->m_p8uAlphaChannelData = ippiMalloc_8u_C1(width, height, &m_nStepBytes8u);
this->m_p8uRedChannelData = ippiMalloc_8u_C1(width, height, &m_nStepBytes8u);
this->m_p8uGreenChannelData = ippiMalloc_8u_C1(width, height, &m_nStepBytes8u);
this->m_p8uBlueChannelData = ippiMalloc_8u_C1(width, height, &m_nStepBytes8u);
this->m_p8uAlphaChannelData = ippiMalloc_8u_C1(width, height, &m_nStepBytes8u);
 
this->m_pCompositeBuffer = ippiMalloc_8u_C4(width, height, &m_nStepBytes8u);
 
status = ippsZero_8u(this->m_p8uAlphaChannelData, width*height);
 
status = ippsCopy_8u((Ipp8u*)m_p8uAlphaChannelData, this->m_pRGBInterleavedArray[0], width*height);
status = ippsCopy_8u((Ipp8u*)p8bitRedChannelDisplayData, this->m_pRGBInterleavedArray[1], width*height);
status = ippsCopy_8u((Ipp8u*)p8bitGreenChannelDisplayData, this->m_pRGBInterleavedArray[2], width*height);
status = ippsCopy_8u((Ipp8u*)p8bitBlueChannelDisplayData, this->m_pRGBInterleavedArray[3], width*height);
 
status = ippiCopy_8u_P4C4R(this->m_pRGBInterleavedArray, width, this->m_pCompositeBuffer, width*4, roiSize);
 
I suspect the shifting is caused by the destination buffer stepBytes value.  Can you tell me what that value should be to ensure the channel data is copied to the right location in the multi-channel image?
 
Thank you
0 Kudos