Failure in color conversion functions in MAC OSX

Failure in color conversion functions in MAC OSX

Hi folks,

I am developing a application for video processing in MAC, my computer is:

MAC OS X 10.5.2, processor 2.16 Ghz Intel Core 2 Duo. I use the IPPs ( for ia32 OS) in "Static linkage with dispatching" as told in the doumentation.

The issue is that calling some functions fails, and result in a EXC_BAD_ACCESS in GDB. I have seen this in functions:

ippiYCbCr420ToBGR_8u_P3C3R and ippiRGBToYCbCr420_8u_C3P3R, other similar functions work fine, for instace ippiBGRToYCrCb420_8u_C3P3R.

The call stack shows that the 'real' functions called in run-time are v8_innerippiYCbCr420ToBGR_8u_P3C3R or v8_innerippiBGRToYCrCb420_8u_C3P3R, that seems fine as my prosessor is a core 2 duo.

I have checked the parameters and I can not explain why ippiBGRToYCrCb420_8u_C3P3R works and ippiRGBToYCbCr420_8u_C3P3R crashes with the same parameters.

This is a sample code:

Ipp8u* rgbBuffCo = (Ipp8u*)calloc(640*480*24/8,1);

int imageSize = 0;

FILE* f = fopen("rawimg","rb");

if ( NULL != f )


imageSize = fread( rgbBuffCo, 1, 640*480*24/8, f );



Ipp8u *pDstAuxCo = (Ipp8u*)calloc( 1920*960+2*960*960,1 );//Parameters taken from a successfull execution

int step_dstCo[3]={1920,960,960};

Ipp8u *pDstCo[3]={ pDstAuxCo, pDstAuxCo + 1920*960, pDstAuxCo + 1920*960+ 960*960 };

IppiSize szCo = {640,480};

//IppStatus st = ippiBGRToYCrCb420_8u_C3P3R((const Ipp8u*)rgbBuffCo, 1920, pDstCo, step_dstCo, szCo);//This goes right

//IppStatus st = ippiRGBToYCbCr420_8u_C3P3R( (const Ipp8u*)rgbBuffCo, 1920, pDstCo,step_dstCo,szCo);//This fails

Can somebody guess what is going on?



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


I did not analyse your code much, but I think parameters you pass to IPP function cause memory access of out allocated space.

By the way, for RGB to YCbCr420 conversion you need 640x480source buffer and you need output buffers like 640x480 for Y component and two 320x240 for Cb and Cr components.


Hi Vladimir, thanks for your response.

I am pretty sure that the parameters are all right, because in other tests I allocated big amounts of memory to be sure, and the behaviour was the same, in addition the memory allocation does not explain why RGBTo YCrCb420 fails and BGR to YCbCr works.

Anyway and just for clarification, I think the allocation in the sample is right, for the RGB image of size 640*480 with 24pps I alloc 640*480*24/8 Bytes, and for the destination YCbCr I alloc 1920*960+2*960*960 = 3.686.400 Bytes that is bigger than (640*480 +2*320*240)*16/8 (16 bits per pixel) = 921.600 Bytes.

I am really stuck with this issue, after lots of debugging and testing I am begining to think in a bug in some functionns, any idea?


I am having a similar problem on Mac OSX that is perhaps related.
Function ippiDCTQuantFwd8x8LS_JPEG_8u16s_C1R crashes.
But if I comment out the call to ippStaticInit then the call doesn't crash.
I use the same code on Windows and Linux without problems.

Try commenting out ippStaticInit or linking dynamically.

Alan Page


Yes, If I don't use ippStaticInit() these functions don't crash but unfortunately then other function does (I don't remember wich ones now), in addition if ippStaticInit is not used optimization per processor is lost and PX_ippXXX functions are always used.

Thanks anyway.


This is useful information.

I changed to dynamic linking and the crashes disappeared. This tells me that there is nothing wrong with the code but static linking is broken, at least on certain systems (mine is dual Xeon quad core). Unfortunately I want to use static linking.



I did the same and my porogram is working now, so I agree something is wrong with statick linking. How can this be reported to IPP's support if I didn't buy the product yet?


Hi Goyo,

We are still investigating that issue. It seems that particular version of Intel C/C++ compiler which was used to build IPP 5.3 had (or cause) some throubles with Mac OS Leopard linker. Note, there is no such issue under Mac OS Tiger.

If that will be confirmed we will provide bug fix update for IPP 5.3 libraries.


Hi Vladimir,

I tried to build my application in a Tiger and it worked successfully in Tiger and Leopard.



Leave a Comment

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