ICETEK-DM642-C.c
上传用户:dahaojd
上传日期:2008-01-29
资源大小:14357k
文件大小:1k
- #include "ICETEK-DM642-C.h"
- #include <csl_cache.h>
- //工作变量
- #pragma DATA_SECTION(nMemTemp, ".INTPROCBUFF");
- #pragma DATA_ALIGN(nMemTemp,128);
- #pragma DATA_SECTION(nUV, ".INTPROCBUFF");
- unsigned char nMemTemp[720],nUV[720];
- #pragma DATA_SECTION(nHisto, ".INTPROCBUFF");
- #pragma DATA_ALIGN(nHisto,128);
- unsigned int nHisto[256];
- unsigned char imgHisto[HISTOHIGH*HISTOWIDTH];
- int mi,mj,m_nWork1;
- unsigned int m_nWork,*pWork,js;
- unsigned char *pImg,*pImg1;
- void ICETEKDM642CInit()
- {
- js=0;
- for ( mi=0;mi<720;mi++ )
- nUV[mi]=0x80;
- for ( mi=0;mi<HISTOHIGH*HISTOWIDTH;mi++ )
- imgHisto[mi]=1;
- for ( mi=0;mi<256;mi++ )
- nHisto[mi]=0;
- }
- #pragma CODE_SECTION(ICETEKDM642CStatistic,".text1")
- void ICETEKDM642CStatistic()
- {
- int i;
- for ( i=0;i<720;i++ )
- nHisto[nMemTemp[i]]++;
- CACHE_clean(CACHE_L2ALL, 0, 0);
- }
- #pragma CODE_SECTION(ICETEKDM642CHistogram,".text1")
- void ICETEKDM642CHistogram()
- {
- m_nWork=0;
- for ( mi=0;mi<256;mi++ )
- if ( m_nWork<nHisto[mi] )
- m_nWork=nHisto[mi];
- m_nWork/=(HISTOHIGH-1);
- for ( mi=0;mi<256;mi++ )
- {
- nHisto[mi]/=m_nWork;
- }
- for ( mi=0;mi<HISTOHIGH*HISTOWIDTH;mi++ )
- imgHisto[mi]=1;
- pImg=imgHisto; pImg+=((HISTOHIGH-1)*HISTOWIDTH); pImg++;
- for ( mi=1;mi<255;mi++,pImg++ )
- {
- for ( mj=0,pImg1=pImg;mj<nHisto[mi];mj++,pImg1-=HISTOWIDTH )
- (*pImg1)=HISTOCOLOR;
- }
- js++; js%=2;
- for ( mi=0;mi<256;mi++ )
- nHisto[mi]=0;
- CACHE_clean(CACHE_L2ALL, 0, 0);
- }