ICETEK-DM642-C.c
上传用户:dahaojd
上传日期:2008-01-29
资源大小:14357k
文件大小:2k
- #include <csl_cache.h>
- #include "ICETEK-DM642-C.h"
- //工作变量
- #pragma DATA_SECTION(nMemTemp, ".INTPROCBUFF");
- #pragma DATA_ALIGN(nMemTemp,128);
- unsigned char nMemTemp[720];
- #pragma DATA_SECTION(nUV, ".INTPROCBUFF");
- unsigned char nUV[720];
- #pragma DATA_SECTION(cLines, ".INTPROCBUFF");
- #pragma DATA_ALIGN(cLines,128);
- unsigned char cLines[MWIDTH*3];
- int mi,mj,m_nWork1,m_nWork2;
- unsigned int m_nWork,*pWork,m_nOffset1,m_nOffset2,m_nOffset3;
- unsigned char *pImg1,*pImg2,*pImg3;
- unsigned char x1,x2,x3,x4,x5,x6,x7,x8,x9;
- #pragma DATA_SECTION(cBuffer, ".INTPROCBUFF");
- #pragma DATA_ALIGN(cBuffer,128);
- unsigned char cBuffer[9],cWork;
- void ICETEKDM642CInit()
- {
- m_nOffset1=0;
- m_nOffset2=MWIDTH;
- m_nOffset3=MWIDTH*2;
- for ( mi=0;mi<720;mi++ )
- nUV[mi]=0x80;
- for ( mi=0;mi<MWIDTH*2;mi++ )
- cLines[mi]=0;
- }
- #pragma CODE_SECTION(ICETEKDM642CSobel,".text1")
- void ICETEKDM642CSobel()
- {
- unsigned int m_nID;
-
- m_nID=DAT_copy(nMemTemp+180,cLines+m_nOffset3,MWIDTH);
- pImg1=cLines; pImg1+=m_nOffset1;
- pImg2=cLines; pImg2+=m_nOffset2;
- pImg3=cLines; pImg3+=m_nOffset3;
- x1=(*pImg1); pImg1++; x2=(*pImg1); pImg1++;
- x4=(*pImg2); pImg2++; x5=(*pImg2); pImg2++;
- x7=(*pImg3); pImg3++; x8=(*pImg3); pImg3++;
- for ( mi=0;mi<MWIDTH;mi++,pImg1++,pImg2++,pImg3++ )
- {
- x3=(*pImg1); x6=(*pImg2); x9=(*pImg3);
- m_nWork1=x7+x8+x8-x2-x2-x3;
- m_nWork2=x3+x6+x6-x4-x4-x7;
- if ( m_nWork1<m_nWork2 )
- m_nWork1=m_nWork2;
- m_nWork2=m_nWork1+x9-x1;
- if ( m_nWork2>255 ) m_nWork2=255;
- else if ( m_nWork2<0 ) m_nWork2=0;
- nMemTemp[mi+180]=m_nWork2;
- x1=x2; x2=x3;
- x4=x5; x5=x6;
- x7=x8; x8=x9;
- }
- nMemTemp[mi]=0;
- m_nWork=m_nOffset1; m_nOffset1=m_nOffset2;
- m_nOffset2=m_nOffset3; m_nOffset3=m_nWork;
- CACHE_clean(CACHE_L2ALL, 0, 0);
- }