ICETEK-DM642-C.c
上传用户:dahaojd
上传日期:2008-01-29
资源大小:14357k
文件大小:1k
- #include "math.h"
- #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(fHisto, ".INTPROCBUFF");
- #pragma DATA_ALIGN(fHisto,128);
- float fHisto[256];
- #pragma DATA_SECTION(lut, ".INTPROCBUFF");
- #pragma DATA_ALIGN(lut,128);
- unsigned char lut[256];
- int mi,mj,m_nWork1;
- unsigned int m_nWork,*pWork,js;
- unsigned char *pImg,*pImg1;
- float m_fWork;
- void ICETEKDM642CInit()
- {
- js=0;
- for ( mi=0;mi<720;mi++ )
- nUV[mi]=0x80;
- for ( mi=0;mi<256;mi++ )
- {
- fHisto[mi]=0.0f;
- lut[mi]=0;
- }
- }
- #pragma CODE_SECTION(ICETEKDM642CStatistic,".text1")
- void ICETEKDM642CStatistic()
- {
- int i;
- for ( i=0;i<720;i++ )
- {
- fHisto[nMemTemp[i]]++;
- nMemTemp[i]=lut[nMemTemp[i]];
- }
- CACHE_clean(CACHE_L2ALL, 0, 0);
- }
- #pragma CODE_SECTION(ICETEKDM642CHistogramEnhance,".text1")
- void ICETEKDM642CHistogramEnhance()
- {
- m_fWork=720*576; fHisto[0]/=m_fWork;
- for ( mi=1;mi<256;mi++ )
- {
- fHisto[mi]/=m_fWork;
- fHisto[mi]+=fHisto[mi-1];
- }
- for ( mi=0;mi<256;mi++ )
- {
- m_fWork=fHisto[mi];
- m_fWork*=255;
- lut[mi]=(unsigned char)m_fWork;
- }
- for ( mi=0;mi<256;mi++ )
- fHisto[mi]=0.0f;
- CACHE_clean(CACHE_L2ALL, 0, 0);
- }