Gifflen致命的信号11 [英] Gifflen Fatal Signal 11

查看:183
本文介绍了Gifflen致命的信号11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用一些本土code创建GIF文件。 我画用油漆的图像,创建几笔,然后单击保存和绘制的图像被保存为JPG格式。当我点击制作GIF它需要所有的图像,并开始创造一个GIF。这是当我得到一个致命的信号11和应用程序重新启动。

I'm trying to use some Native Code to create Gifs. I draw the images using paint, creating a few strokes, click save and the image drawn gets saved to a JPG format. when I click create Gif it takes all the images and starts creating a gif. This is when I get a Fatal Signal 11 and the app restarts.

我使用本机code,所以我有崩溃的回溯:

I use native code so I have a backtrace of the crash:

I/DEBUG(95): backtrace:
I/DEBUG(95):     #00  pc 00002a04  /lib/libgifflen.so (NeuQuant::learn()+239)
I/DEBUG(95):     #01  pc 00002b9d  /lib/libgifflen.so (NeuQuant::quantise(DIB*, DIB*, int, int, int)+84)
I/DEBUG(95):     #02  pc 00002d41  lib/libgifflen.so (Java_com_stay_gif_GifEncoder_addFrame+208)
I/DEBUG(95):     #03  pc 0001deb0  /system/lib/libdvm.so (dvmPlatformInvoke+112)
I/DEBUG(95):     #04  pc 0004d103  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+394)
I/DEBUG(95):     #05  pc 0004f21f  /system/lib/libdvm.so (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+174)
I/DEBUG(95):     #06  pc 000272e0  /system/lib/libdvm.so
I/DEBUG(95):     #07  pc 0002bbe8  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
I/DEBUG(95):     #08  pc 0005fb37  /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+374)
I/DEBUG(95):     #09  pc 000670e5  /system/lib/libdvm.so
I/DEBUG(95):     #10  pc 000272e0  /system/lib/libdvm.so
I/DEBUG(95):     #11  pc 0002bbe8  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
I/DEBUG(95):     #12  pc 0005f871  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
I/DEBUG(95):     #13  pc 000496f3  /system/lib/libdvm.so
I/DEBUG(95):     #14  pc 00048581  /system/lib/libandroid_runtime.so
I/DEBUG(95):     #15  pc 00049637  /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+390)
I/DEBUG(95):     #16  pc 00000dcf  /system/bin/app_process

在code其中它崩溃了:

The code where it crashes:

void NeuQuant::learn()
{

    int i,j,b,g,r;
    int radius,rad,alpha,step,delta,samplepixels;
    //unsigned char *p;
    int *p;
    unsigned char *lim;

    alphadec = 30 + ((samplefac-1)/3);
    p = (int*)thepicture;
    lim = thepicture + lengthcount;
    samplepixels = lengthcount/samplefac;
    delta = samplepixels/ncycles;
    alpha = initalpha;
    radius = initradius;

    rad = radius >> radiusbiasshift;
    if (rad <= 1) rad = 0;
    for (i=0; i<rad; i++)
            radpower[i] = alpha*(((rad*rad - i*i)*radbias)/(rad*rad));

    //fprintf(stderr,"beginning 1D learning: initial radius=%d\n", rad);
    sprintf(s, "samplepixels = %d, rad = %d, a=%d, ad=%d, d=%d", samplepixels, rad, alpha, alphadec, delta);
    __android_log_write(ANDROID_LOG_VERBOSE, "gifflen",s);

    if ((lengthcount%prime1) != 0) step = prime1;
    else {
            if ((lengthcount%prime2) !=0) step = prime2;
            else {
                    if ((lengthcount%prime3) !=0) step = prime3;
                    else step = prime4;
            }
    }

    i = 0;
    while (i < samplepixels)
        {
    /*      b = p[0] << netbiasshift;
            g = p[1] << netbiasshift;
            r = p[2] << netbiasshift;*/
            b = (((*p)) & 0xff) << netbiasshift;
            g = (((*p) >> 8) & 0xff) << netbiasshift;
            r = (((*p) >> 16) & 0xff) << netbiasshift;
            j = contest(b, g, r);
            altersingle(alpha,j,b,g,r); //these crashes
            if (rad) alterneigh(rad,j,b,g,r);   // alter neighbours

            p += step;
            if (p >= (int *)lim) p -= lengthcount;

            i++;
            if (i%delta == 0)
            {
                alpha -= alpha / alphadec;
                radius -= radius / radiusdec;
                rad = radius >> radiusbiasshift;
                if (rad <= 1) rad = 0;
                for (j=0; j<rad; j++)
                    radpower[j] = alpha*(((rad*rad - j*j)*radbias)/(rad*rad));
            }
        }

        //sprintf(s, "final alpha = %f", ((float)alpha)/initalpha);
    //  __android_log_write(ANDROID_LOG_VERBOSE, "gifflen",s);
}

THX的日志我发现了错误NeuQuant发生::学会(),做了一些调试与崩溃这个确切的行B =(((* P))及0xFF的)LT;&LT; netbiasshift;

Thx to the Log I found out that the error happens in NeuQuant::learn(), did some debugs and it crashes on this exact line b = (((*p)) & 0xff) << netbiasshift;.

的崩溃总不发生,有时我得到一个GIF和一切正常,但有时它崩溃在B =(((* P))及0xFF的)LT;&LT; netbiasshift;

The Crash doesnt happen always, sometimes I get a gif and everything works, but sometimes it crashes at b = (((*p)) & 0xff) << netbiasshift;.

我做了一些更多的debuging,我发现,当它崩溃上的b =(((* P))及0xFF的)LT;&LT; netbiasshift;它不崩溃,当它进入第一次,它崩溃像30检查B液后=(((* P))及0xFF的)LT;&LT; netbiasshift;

I did some more debuging and I found out that when it crashes on b = (((*p)) & 0xff) << netbiasshift; it doesnt crash when it enters the first time, it crashes like after the 30 check of b = (((*p)) & 0xff) << netbiasshift;.

任何人都知道可能是什么问题?

Anyone know what might be the problem?

推荐答案

我改了:

if (p >= (int *)lim)
    p -= lengthcount;

if (p >= (unsigned int *)lim)
    p = (unsigned int*)thepicture;

和它似乎现在的工作。

这篇关于Gifflen致命的信号11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆