ICETEK-DM642-C.c
上传用户:dahaojd
上传日期:2008-01-29
资源大小:14357k
文件大小:1k
- #include "math.h"
- #include <csl_cache.h>
- #include "ICETEK-DM642-C.h"
- //工作变量
- unsigned char m_dbFrameY[SIMGWIDTH*SIMGHEIGHT];
- unsigned char m_dbFrameU[SIMGWIDTH1*SIMGHEIGHT1];
- unsigned char m_dbFrameV[SIMGWIDTH1*SIMGHEIGHT1];
- unsigned char m_dbTargetImageR[SIMGWIDTH*SIMGHEIGHT];
- unsigned char m_dbTargetImageG[SIMGWIDTH*SIMGHEIGHT];
- unsigned char m_dbTargetImageB[SIMGWIDTH*SIMGHEIGHT];
- unsigned int m_uVideoStatus,m_bFreeze;
- void ICETEKDM642CInit()
- {
- m_uVideoStatus=m_bFreeze=0;
- }
- void ICETEKDM642CYUVRGB()
- {
- int i,j;
- int r,g,b,y,u,v;
- unsigned char *py,*pu,*pv,*pr,*pg,*pb;
-
- py=m_dbFrameY; pu=m_dbFrameU; pv=m_dbFrameV;
- pr=m_dbTargetImageR; pg=m_dbTargetImageG; pb=m_dbTargetImageB;
- for ( i=0;i<SIMGHEIGHT;i++ )
- {
- for ( j=0;j<SIMGWIDTH;j+=2 ) //列720点,360个32bit,
- {
- u=(*pu); v=(*pv); y=(*py);
- u-=128; v-=128;
- r=y+1.402*u;
- g=y-0.34414*u-0.71414*v;
- b=y+1.772*v;
- if ( r>255 ) r=255;
- else if ( r<0 ) r=0;
- if ( g>255 ) g=255;
- else if ( g<0 ) g=0;
- if ( b>255 ) b=255;
- else if ( b<0 ) b=0;
- (*pr)=r; pr++;
- (*pg)=g; pg++;
- (*pb)=b; pb++;
- py++; y=(*py);
- r=y+1.402*u;
- g=y-0.34414*u-0.71414*v;
- b=y+1.772*v;
- if ( r>255 ) r=255;
- else if ( r<0 ) r=0;
- if ( g>255 ) g=255;
- else if ( g<0 ) g=0;
- if ( b>255 ) b=255;
- else if ( b<0 ) b=0;
- (*pr)=r; pr++;
- (*pg)=g; pg++;
- (*pb)=b; pb++;
- py++; pu++; pv++;
- }
- }
- CACHE_clean(CACHE_L2ALL, 0, 0);
- }