Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Copy a 8u_C2 image

costelha1
Beginner
467 Views
Hi,

This might seem a little stupid, but I don't really see how to do it.

I have an YUV422 image which I got from somewhere. In my program I used ippiMalloc_8u_C2 to create space to get a copy of the received image. I thought I would use ippiCopy_8u_C2 to save a copy of the received image to my self, but there is no such function.

How can I solve this?
0 Kudos
4 Replies
Vladimir_Dudnik
Employee
467 Views

Hi,

there is no any magic in ippiCopy function, so if you know size of data you can use every copy function (memcpy, ippsCopy, ippiCopy_8u_C1). You just need to set up arguments of these functions accordingly.

Regards,
Vladimir

0 Kudos
costelha1
Beginner
467 Views
So, I use the following to allocate space for an YUV422 image (which is Y U Y V Y U ...):



dst = ippiMalloc_8u_C2( width, height, &this->imgStep_ );



and my idea, was to use the following to copy the data (this->imgStep_ contains width and height):



ippiCopy_8u_C2R( src, srcStep, dst,

this->imgStep_, this->imgSize_ );



If I want to use ippiCopy_8u_C3, can I simply do



ippiCopy_8u_C2R( src, srcStep, dst,

this->imgStep_, this->imgSize_ );

?



Consider src and dst to have the same step, the same format.

Message Edited by costelha on 12-09-2005 07:21 AM

0 Kudos
Vladimir_Dudnik
Employee
467 Views

Hi,

there is no real necessety for all this special functions, like ippiMalloc_8u_C2, ippiCopy_8u_C2, if you are able to do all of this with just C malloc andmemcpy you also will be able to do this with ippMalloc and ippiCopy_8u_C1 (or even ippsCopy_8u). These functionsexists only to allow youto simplify somehow your source code, but actually they do not contains any magic inside.

Code:

IppiSize roi;

roi.width  = width * 2; // we can consider 422 images as 1 channels image with doubled width
roi.height = height;

ippiCopy_8u_C1(pSrc, srcStep, pDst, dstStep, roi);

Regards,
Vladimir

0 Kudos
costelha1
Beginner
467 Views
I understood that there is nothing speccial about ippiMalloc functions. My purpose in using these functions in the code is to keep it clear, since I need to make sure that if someone needs to work with my code, it will understand it easily.

Using functions that are not the right ones, even if they make the job right, is not good practice for code that needs to change hands from time to time.

So, even if you had just added

#define ippiCopy_8u_C2(pSrc, srcStep, pDst, dstStep, roi) ippiCopy_8u_C1(pSrc, srcStep, pDst, dstStep, roi)

with something more to adjust the steps and widths, it would be fine by me, and it would be useful, even if just to keep the code more readable.

Nevertheless, thanks for the answer and for the help.
0 Kudos
Reply