home *** CD-ROM | disk | FTP | other *** search
/ Spidla DivX / DivX.bin / LocoCodec / lococodec.h < prev    next >
Encoding:
C/C++ Source or Header  |  2003-04-27  |  3.2 KB  |  95 lines

  1. //
  2. // lococodec v0.1 based on:
  3. //
  4. // Huffyuv v2.1.1, by Ben Rudiak-Gould.
  5. // http://www.math.berkeley.edu/~benrg/huffyuv.html
  6. //
  7. // This file is copyright 2000 Ben Rudiak-Gould, and distributed under
  8. // the terms of the GNU General Public License, v2 or later.  See
  9. // http://www.gnu.org/copyleft/gpl.html.
  10. //
  11. //
  12.  
  13.  
  14. #include <windows.h>
  15. #include <vfw.h>
  16. #pragma hdrstop
  17.  
  18.  
  19. static const DWORD FOURCC_LOCO = mmioFOURCC('L','O','C','O');   // our compressed format
  20. static const DWORD FOURCC_YUY2 = mmioFOURCC('Y','U','Y','2');   // uncompressed YUY2
  21. static const DWORD FOURCC_UYVY = mmioFOURCC('U','Y','V','Y');   // uncompressed UYVY
  22. static const DWORD FOURCC_VYUY = mmioFOURCC('V','Y','U','Y');   // an alias for YUY2 used by ATI cards
  23. static const DWORD FOURCC_YV12 = mmioFOURCC('Y','V','1','2');   // YV12
  24.  
  25. static const int    FIELD_THRESHOLD = 288;                        // old field threshold used by huffyuv
  26. static const int    FULL_SIZE_BUFFER= 1;                        // use worst case scenario buffer by default?
  27.  
  28.  
  29. extern HMODULE hmoduleLocoCodec;
  30.  
  31. #define INI_FILE "lococodec.ini"
  32.  
  33. #define BITMAP_TYPE_UNKNOWN                0
  34. #define BITMAP_TYPE_COMPRESSED_YUY2        -1
  35. #define BITMAP_TYPE_COMPRESSED_RGB        -2
  36. #define BITMAP_TYPE_COMPRESSED_RGBA        -3
  37. #define BITMAP_TYPE_COMPRESSED_YV12        -4
  38. #define BITMAP_TYPE_YUY2                1
  39. #define BITMAP_TYPE_UYVY                2
  40. #define BITMAP_TYPE_RGB                    3
  41. #define BITMAP_TYPE_RGBA                4
  42. #define BITMAP_TYPE_YV12                5
  43.  
  44.  
  45. // huffyuv.cpp
  46.  
  47. struct CodecInst {
  48.   unsigned char* yuy2_buffer;
  49.   unsigned char* median_buffer;
  50.   unsigned char* rgb_buffer;
  51.   unsigned char* decompress_yuy2_buffer;
  52.   bool swapfields;
  53.   bool decompressing;
  54.   bool    ignoretopdown;        // ignore top-down output requests and change them into bottom-up ones
  55.   bool    source_interlaced;    
  56.   int max_loss;
  57.  
  58.   // methods
  59.   CodecInst() : yuy2_buffer(0), median_buffer(0), rgb_buffer(0), decompress_yuy2_buffer(0), decompressing(false),
  60.                 ignoretopdown(false), source_interlaced(false) {}
  61.  
  62.   BOOL QueryAbout();
  63.   DWORD About(HWND hwnd);
  64.  
  65.   BOOL QueryConfigure();
  66.   DWORD Configure(HWND hwnd);
  67.  
  68.   DWORD GetState(LPVOID pv, DWORD dwSize);
  69.   DWORD SetState(LPVOID pv, DWORD dwSize);
  70.  
  71.   DWORD GetInfo(ICINFO* icinfo, DWORD dwSize);
  72.  
  73.   DWORD CompressQuery(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
  74.   DWORD CompressGetFormat(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
  75.   DWORD CompressBegin(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
  76.   DWORD CompressGetSize(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
  77.   DWORD Compress(ICCOMPRESS* icinfo, DWORD dwSize);
  78.   DWORD CompressEnd();
  79.  
  80.   void ConvertRGB24toYUY2(const unsigned char* src, unsigned char* dst, int width, int height);
  81.  
  82.   DWORD DecompressQuery(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
  83.   DWORD DecompressGetFormat(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
  84.   DWORD DecompressBegin(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
  85.   DWORD Decompress(ICDECOMPRESS* icinfo, DWORD dwSize);
  86.   DWORD DecompressGetPalette(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
  87.   DWORD DecompressEnd();
  88.  
  89. };
  90.  
  91. CodecInst* Open(ICOPEN* icinfo);
  92. DWORD Close(CodecInst* pinst);
  93.  
  94.  
  95.