[嵌入式Linux]

ARM算法源码,帮我测试一下

[复制链接]
627|0
手机看帖
扫描二维码
随时随地手机跟帖
feihufuture|  楼主 | 2017-7-17 14:22 | 显示全部楼层 |阅读模式
各位,现在有个小算法,我想大家用自己的ARM平台,帮我测试下各自平台下的性能!
如果谁测试出来,请附上ARM主频和型号,及对应消耗的总时间!谢谢!
        #define COUNTS_PER_SECOND          (XPAR_CPU_CORTEXA9_CORE_CLOCK_FREQ_HZ / 64)
        #define BOUND(x, mn, mx)        ((x) < (mn) ? (mn) : ((x) > (mx) ? (mx) : (x)))

        u8 image[1024][2048] = {0};

        void FastKirschDT(u8 * lpDIBBits, u32  lWidth, u32  lHeight);

        int main()
        {
        XTime tEnd, tCur;
        u32 tUsed;
        printf("time elapsed caculating");
        XTime_GetTime(&tCur);

    usleep(1000);
        //FastKirschDT(image, 2048, 1024);


        XTime_GetTime(&tEnd);
        tUsed = ((tEnd-tCur)*1000000)/(COUNTS_PER_SECOND);
        printf("time elapsed is %d us\r\n",tUsed);while(1);//等待
        return 0;



        }

        //快速kirsch两方向运算
        void FastKirschDT(u8 * lpDIBBits, u32 lWidth,  u32 lHeight)
        {
                int GMax,GrayValue1,GrayValue2;
                u8 g[9];
                int lOffset;
                u8 imagenew[1024][2048];

                int offseti;
                u32 k,i,j;
                for ( k = 0; k < 10;  k++ )
                {
                        offseti= lWidth;
                        for( i = 1; i < lHeight - 1; i++)
                        {
                                for(j = 1; j < lWidth - 1; j++)
                                {
                                        GMax = 0;

                                        lOffset = (offseti-lWidth + j - 1);

                                        g[0] = *(lpDIBBits + lOffset++);
                                        g[1] = *(lpDIBBits + lOffset++);
                                        g[2] = *(lpDIBBits + lOffset);

                                        lOffset =  (offseti + j - 1);

                                        g[3] = *(lpDIBBits + lOffset++);

                                        lOffset++;
                                        //g[4]=0;
                                        g[5] = *(lpDIBBits + lOffset);

                                        lOffset = (offseti + lWidth + j - 1);

                                        g[6] = *(lpDIBBits + lOffset++);
                                        g[7] = *(lpDIBBits + lOffset++);
                                        g[8] = *(lpDIBBits + lOffset);

                                        GrayValue1 = 5*(g[0]+g[3]+g[6])-3*(g[1]+g[2]+g[5]+g[7]+g[8]);
                                        GrayValue2 = GrayValue1+8*(g[1]+g[2]-g[3]-g[6]);
                                        if(GrayValue1 < 0)
                                                GrayValue1 = -GrayValue1;
                                        if(GrayValue2 < 0)
                                                GrayValue2 = -GrayValue2;

                                        GMax = GrayValue1 > GrayValue2?GrayValue1:GrayValue2;

                                        lOffset = (offseti + j );

                                        imagenew[i][j] = BOUND(GMax, 0, 255);

                                }
                                offseti+=lWidth;
                        }
                }

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

171

主题

1027

帖子

97

粉丝