home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************
- uvtempbuffers.h
-
- 03/02/08 Xiaohong
- *************************************************************************/
- #ifndef _INCLUDE_UVTEMPBUFFERS_H___________________________________________
- #define _INCLUDE_UVTEMPBUFFERS_H___________________________________________
-
- #include "picturestruct.h"
- #include "sequencedata.h"
- /**********************************************************
- UVTEMPBUFFERS é╠ÉΘî╛
- **********************************************************/
- class UVTEMPBUFFERS
- {
- public:
- UVTEMPBUFFERS();
- ~UVTEMPBUFFERS();
-
- inline void conv444to422U(const PICTURESTRUCT* p,const SEQUENCEDATA* s)
- {
- conv444to422(pUBuffer,pUBuffer422,p,s);
- }
- inline void conv444to422V(const PICTURESTRUCT* p,const SEQUENCEDATA* s)
- {
- conv444to422(pVBuffer,pVBuffer422,p,s);
- }
- inline void conv422to420U(unsigned char* frame,const PICTURESTRUCT* p,const SEQUENCEDATA* s)
- {
- conv422to420(pUBuffer422,frame,p,s);
- }
- inline void conv422to420V(unsigned char* frame,const PICTURESTRUCT* p,const SEQUENCEDATA* s)
- {
- conv422to420(pVBuffer422,frame,p,s);
- }
- inline void SetUVBuffer(const int address,int u,int v)
- {
- if(address>=0&&address<m_nSize)
- {
- if(u<0)
- {
- u = 0;
- }
- else if(u>255)
- {
- u = 255;
- }
- if(v<0)
- {
- v = 0;
- }
- else if(v>255)
- {
- v = 255;
- }
- pUBuffer[address] = u;
- pVBuffer[address] = v;
- }
- }
- inline void SetUVBuffer(int start,int u,int v,int size)
- {
- int end = start + size;
- if(end<0)
- {
- return;
- }
- else if(end>m_nSize)
- {
- end = m_nSize;
- }
- if(start>=m_nSize)
- {
- return;
- }
- else if(start<0)
- {
- start = 0;
- }
- size = end - start;
- memset(pUBuffer+start,u,size);
- memset(pVBuffer+start,v,size);
- }
-
- bool Alloc(int,bool);
- void Clear(void);
- void SoftFilter(unsigned char*[],const int,const int);
-
-
- private:
- void conv444to422(const unsigned char*,unsigned char*,const PICTURESTRUCT*,const SEQUENCEDATA*);
- void conv422to420(unsigned char*,unsigned char*,const PICTURESTRUCT*,const SEQUENCEDATA*);
- void SoftFilter(unsigned char* dest, unsigned char* src,const int width,const int height);
-
- unsigned char* pUBuffer422;
- unsigned char* pVBuffer422;
- unsigned char* pTempFilterBuffer;
- unsigned char* pUBuffer;
- unsigned char* pVBuffer;
- int m_nSize;
- };
-
- #endif