home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / dctm.lzh / DCTM / source.lzh / source / uvtempbuffers.h < prev   
Encoding:
C/C++ Source or Header  |  2003-02-08  |  2.4 KB  |  102 lines

  1. /*************************************************************************
  2.     uvtempbuffers.h
  3.  
  4.     03/02/08    Xiaohong
  5. *************************************************************************/
  6. #ifndef _INCLUDE_UVTEMPBUFFERS_H___________________________________________
  7. #define _INCLUDE_UVTEMPBUFFERS_H___________________________________________
  8.  
  9. #include "picturestruct.h"
  10. #include "sequencedata.h"
  11. /**********************************************************
  12.     UVTEMPBUFFERS é╠ÉΘî╛
  13. **********************************************************/
  14. class UVTEMPBUFFERS
  15. {
  16. public:
  17.     UVTEMPBUFFERS();
  18.     ~UVTEMPBUFFERS();
  19.  
  20.     inline void conv444to422U(const PICTURESTRUCT* p,const SEQUENCEDATA* s)
  21.     {
  22.         conv444to422(pUBuffer,pUBuffer422,p,s);
  23.     }
  24.     inline void conv444to422V(const PICTURESTRUCT* p,const SEQUENCEDATA* s)
  25.     {
  26.         conv444to422(pVBuffer,pVBuffer422,p,s);
  27.     }
  28.     inline void conv422to420U(unsigned char* frame,const PICTURESTRUCT* p,const SEQUENCEDATA* s)
  29.     {
  30.         conv422to420(pUBuffer422,frame,p,s);
  31.     }
  32.     inline void conv422to420V(unsigned char* frame,const PICTURESTRUCT* p,const SEQUENCEDATA* s)
  33.     {
  34.         conv422to420(pVBuffer422,frame,p,s);
  35.     }
  36.     inline void SetUVBuffer(const int address,int u,int v)
  37.     {
  38.         if(address>=0&&address<m_nSize)
  39.         {
  40.             if(u<0)
  41.             {
  42.                 u = 0;
  43.             }
  44.             else if(u>255)
  45.             {
  46.                 u = 255;
  47.             }
  48.             if(v<0)
  49.             {
  50.                 v = 0;
  51.             }
  52.             else if(v>255)
  53.             {
  54.                 v = 255;
  55.             }
  56.             pUBuffer[address] = u;
  57.             pVBuffer[address] = v;
  58.         }
  59.     }
  60.     inline void SetUVBuffer(int start,int u,int v,int size)
  61.     {
  62.         int end = start + size;
  63.         if(end<0)
  64.         {
  65.             return;
  66.         }
  67.         else if(end>m_nSize)
  68.         {
  69.             end = m_nSize;
  70.         }
  71.         if(start>=m_nSize)
  72.         {
  73.             return;
  74.         }
  75.         else if(start<0)
  76.         {
  77.             start = 0;
  78.         }
  79.         size = end - start;
  80.         memset(pUBuffer+start,u,size);
  81.         memset(pVBuffer+start,v,size);
  82.     }
  83.  
  84.     bool Alloc(int,bool);
  85.     void Clear(void);
  86.     void SoftFilter(unsigned char*[],const int,const int);
  87.  
  88.  
  89. private:
  90.     void conv444to422(const unsigned char*,unsigned char*,const PICTURESTRUCT*,const SEQUENCEDATA*);
  91.     void conv422to420(unsigned char*,unsigned char*,const PICTURESTRUCT*,const SEQUENCEDATA*);
  92.     void SoftFilter(unsigned char* dest, unsigned char* src,const int width,const int height);
  93.  
  94.     unsigned char* pUBuffer422;
  95.     unsigned char* pVBuffer422;
  96.     unsigned char* pTempFilterBuffer;
  97.     unsigned char* pUBuffer;
  98.     unsigned char* pVBuffer;
  99.     int m_nSize;
  100. };
  101.  
  102. #endif