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

Seg Fault

the_ether
Beginner
471 Views
I am compiling a DLL in MinGW using the gcc compiler. I then call this DLL from my Windows program. All runs fine.

I have then started to replace some of the existing functions with ones from the Intel IPP. The first I used is ippiSub8x8_8u16s_C1R(). All compiles and links okay with the IPPI DLLS, however when I run the program it crashes with a segmentation fault.

The crash occurs in a totally unrelated area of code to do with byte swapping a 32-bit word so I suspect it has something to do with memory alignment or linking. Any ideas?
0 Kudos
7 Replies
Vladimir_Dudnik
Employee
471 Views

Did you try the same code but compiled with Microsoft or Intel C/C++ compilers? Does it have the same issue?

Probably you can show here how you are call IPP function, may be something wrong is with setting of function's parameters?

Regards,
Vladimir

0 Kudos
the_ether
Beginner
471 Views
I'm afraid the source code is not suitable for the MS compiler which isn't standards compliant. I therefore have to use gcc under MinGW and I think the problem lies in connecting the code generated under MinGW with teh Windows-based Intel IPP.
I'm sure I'm using the IPP function correctly and at any rate the program crashes in a completely un-related part of code. This is almost certainly an issue to do with linking or memory alignment. I posted the question here just in case someone had come across omething similar.
g.
0 Kudos
majin_radox
Beginner
471 Views
Here I am!
I've the same problem, maybe together we can solve. Here some additional info:
- (MinGW) I've a code that processes many images, and after working fine on the first ten, it crashes giving me a segfault. If I start from the critical image it works fine on it and crashes after a few next. Also I've debugged to discover that the erroris produced in different parts of the code, not from the same function.
- I'veinstalled Linux:smileysad: andthe same code works with gcc. Linux is not a good choice for the work I'm doing anyway (and...ehm, maybe it's not good for anything :smileyvery-happy: ), and also gcc 4.0.0 I've on my distribution has some LITTLE bug that make it unusable (sometimes it doesn't recognize the function I write...but it's another story).
- Back on Windows, I've tried with Microsoft Visual C++ Toolkit 2003. I've spent the last hour correcting the code to make it compile with MS VC++: after all the work I run and...SAME BEHAVIOUR AS WITH MinGW!!!!! Same segfault at the same points.
The_ether: you're right, it's a problem with memory allignment, but I really can't understand where it could be...Since using VC++ and MinGW the problem is the same, maybe we're missing something...
I'm going crazy!
0 Kudos
Vladimir_Dudnik
Employee
471 Views

Hi,

that is great if you can reproduce the issue. Could you please attach some test case for us, to analize what the problem?

Regards,
Vladimir

0 Kudos
radox
Beginner
471 Views
Thanks for interesting in my problem
I have a database of ~700 images of eyes. The purpose is to recognizepeople byiris.The first pass of my program processes them all calling this function to find the centre of the iris (ignore italian comments):
Code:
void estraiIride(IppImage *image, IppiPoint *centro, int *raggiointerno, int *raggioEsterno)
{
    IppImage *temp=new IppImage(image);
	IppImage *temp2=new IppImage(image);
 	IppImage *temp1=new IppImage(image);

    int rInt,rEst,x,y;
    IppiPoint centroTemp={0,0};

    int *istogramma=new int[256];
    int soglia,max;

    temp->Istogramma_8u_C1(istogramma);
	maxOfAVector(istogramma,80,&max,&soglia);
    temp->threshold_LTValGTVal_8u_C1(soglia, soglia);

	temp->baricentro_8u_C1(&centroTemp); 

    temp1->threshold_LTValGTVal_8u_C1(soglia,soglia);
    temp1->SobelOrizzontale();

    rInt=temp1->AleCircularHoughTransform_8u_C1(centroTemp,10,60,0,180);  
	rInt+=10;
	x=centroTemp.x-rInt;
    y=centroTemp.y-rInt;
    IppiRect croppedROI={x,y,rInt*2,rInt*2};
    temp->crop_8u_C1IR(croppedROI);

	temp->baricentro_8u_C1(centro);			

    centro->y+=y;
    centro->x+=x;
    *raggiointerno=temp1->AleCircularHoughTransform_8u_C1(*centro,10,80,0,180); 
	//temp1->write_ppm("temp1.ppm");

    delete temp;  //fino a qui ho estratto centro e raggio interno.
    delete temp1;

	int r1,r2;
    temp2->gaussianFilter(55,20);					//sfuoco
    temp2->SobelVerticale();
    temp2->threshold_LTValGTVal_8u_C1(20,20);
    //temp->baricentro_8u_C1(centro);

	//temp2->write_ppm("soglia2.ppm");

    *raggioEsterno=temp2->AleCircularHoughTransform_8u_C1(*centro,*raggiointerno+32,*raggiointerno+100,135,225);		//e ottengo il cerchio:la ricerca avviene da 135 a 225 gradi xk ho meno sporco nell'immagine
	//r2=temp2->AleCircularHoughTransform_8u_C1(*centro,*raggiointerno+32,*raggiointerno+64,225,315);

    //*raggioEsterno=(int)(r1+r2)/2;
    /*
     IppImage *pInput2= new IppImage(image);

     //(r1<=r2)? *raggioEsterno=r2 : *raggioEsterno=r1;


    for (int theta=0; theta<360; theta++){
        pInput2->setPixel_8u_C1(centro->y+((*raggiointerno)*sin(theta)),centro->x+((*raggiointerno)*cos(theta)), 255);
        pInput2->setPixel_8u_C1(centro->y+((*raggioEsterno)*sin(theta)),centro->x+((*raggioEsterno)*cos(theta)), 255);
        pInput2->setPixel_8u_C1(centro->y+((r1)*sin(theta)),centro->x+((r1)*cos(theta)), 200);
        pInput2->setPixel_8u_C1(centro->y+((r2)*sin(theta)),centro->x+((r2)*cos(theta)), 100);
    }
    pInput2->write_ppm("cerchi.ppm");
    delete pInput2;*/
    delete temp2;
	}


the non Ipp functions like SobelOrizzontale() [it means Horizontal Sobel]simply call IPP relative function (in this case ippiFilterSobelHoriz_8u_C1R() ). If you need the complete source code I can give it, it's under GNU/GPL.
The program works fine with some images (the result is also correct) then it gives me the segfault. If I restart from the critical image it works fine on it, but crashes after some more. Eventually I can process all my images set, but the problem comes againwith the code used later to perform other operations. Thus I believe the problem is not related with this particular part of code, but it's something more "general".
It's not related with the compiler, since Min GW and Microsoft Visual C++ Toolkit 2003 give me the same error.
It's related with Windows, because the same code works fine with Linux.
I've tried with two PC:
Intel Centrino, 512Mb RAM (Notebook Toshiba Satellite M30)
AMD Athlon XP 3Ghz, 512 Mb RAM
Both have Windows XP Professional SP1
These are all info I got. If you need I can provide complete source code. Also if you need some other infos or tests you only have to ask!
Thanks
My regards

Message Edited by radox on 01-24-2006 03:34 PM

0 Kudos
Intel_C_Intel
Employee
471 Views
Function ippiSobelHoriz_* requires border pixel in memory. Have you providedextra border pixels in memory in your object?
0 Kudos
radox
Beginner
471 Views


akibkal1 wrote:
Function ippiSobelHoriz_* requires border pixel in memory. Have you providedextra border pixels in memory in your object?



You're right, the code I have doesn't take care of this aspect. Thank you very much, I'm in debt.
0 Kudos
Reply