Question about ippiCopyManaged_8u_C1R function

Question about ippiCopyManaged_8u_C1R function

I am trying to copy my own 2D matrix data to ipp8u by usingippiCopyManaged_8u_C1R.But it couldn't copy correctly:Only the first row of matrix can be copiedproperly. The others are wrong.The following is my code:a[size.width*1] is not equal to ipp_template[step*1], which means copying is wrong.Any wrong in my code?





#include "ipp.h"	//use ipp 7.0 library
int main (void){
	  IppiSize size;

	  size.width = 512;		//if it's less than 256, the copying is ok

	  size.height = 10;

	  __declspec(align(32)) unsigned char* a = (unsigned char*)malloc(size.width*size.height);		//2d Matrix data

	  for(int i = 0; i < size.width*size.height; i++)


		  a[i] = i %255;

	  int step;

	  Ipp8u *ipp_template = ippiMalloc_8u_C1( size.width, size.height, &step);

	  IppStatus err = ippiCopyManaged_8u_C1R((Ipp8u*)a, (Ipp8u)size.width, ipp_template, step, size, IPP_TEMPORAL_COPY);

	  bool bEqual = (a[size.width*1] == ipp_template[step*1]);	//No equal, why?
	  return 0;


3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi wesky1984,

The problem is in (Ipp8u)size.width

asthe function definition: IppStatus ippiCopyManaged_8u_C1R(const Ipp8u* pSrc, int srcStep, Ipp8u* pDst, int dstStep, IppiSize roiSize, int flags);

The srsStepBytes is type int .It is the distance in bytes of imagerow.To use (Ipp 8u)will crop the real value of size.width. please delete it. you will get expected result.

Best Regards,

I didn't notice the type before.Thank you very much!

Leave a Comment

Please sign in to add a comment. Not a member? Join today