home *** CD-ROM | disk | FTP | other *** search
- //
- // lococodec v0.1 based on:
- //
- // Huffyuv v2.1.1, by Ben Rudiak-Gould.
- // http://www.math.berkeley.edu/~benrg/huffyuv.html
- //
- // This file is copyright 2000 Ben Rudiak-Gould, and distributed under
- // the terms of the GNU General Public License, v2 or later. See
- // http://www.gnu.org/copyleft/gpl.html.
- //
- //
-
-
- #include <windows.h>
- #include <vfw.h>
- #pragma hdrstop
-
-
- static const DWORD FOURCC_LOCO = mmioFOURCC('L','O','C','O'); // our compressed format
- static const DWORD FOURCC_YUY2 = mmioFOURCC('Y','U','Y','2'); // uncompressed YUY2
- static const DWORD FOURCC_UYVY = mmioFOURCC('U','Y','V','Y'); // uncompressed UYVY
- static const DWORD FOURCC_VYUY = mmioFOURCC('V','Y','U','Y'); // an alias for YUY2 used by ATI cards
- static const DWORD FOURCC_YV12 = mmioFOURCC('Y','V','1','2'); // YV12
-
- static const int FIELD_THRESHOLD = 288; // old field threshold used by huffyuv
- static const int FULL_SIZE_BUFFER= 1; // use worst case scenario buffer by default?
-
-
- extern HMODULE hmoduleLocoCodec;
-
- #define INI_FILE "lococodec.ini"
-
- #define BITMAP_TYPE_UNKNOWN 0
- #define BITMAP_TYPE_COMPRESSED_YUY2 -1
- #define BITMAP_TYPE_COMPRESSED_RGB -2
- #define BITMAP_TYPE_COMPRESSED_RGBA -3
- #define BITMAP_TYPE_COMPRESSED_YV12 -4
- #define BITMAP_TYPE_YUY2 1
- #define BITMAP_TYPE_UYVY 2
- #define BITMAP_TYPE_RGB 3
- #define BITMAP_TYPE_RGBA 4
- #define BITMAP_TYPE_YV12 5
-
-
- // huffyuv.cpp
-
- struct CodecInst {
- unsigned char* yuy2_buffer;
- unsigned char* median_buffer;
- unsigned char* rgb_buffer;
- unsigned char* decompress_yuy2_buffer;
- bool swapfields;
- bool decompressing;
- bool ignoretopdown; // ignore top-down output requests and change them into bottom-up ones
- bool source_interlaced;
- int max_loss;
-
- // methods
- CodecInst() : yuy2_buffer(0), median_buffer(0), rgb_buffer(0), decompress_yuy2_buffer(0), decompressing(false),
- ignoretopdown(false), source_interlaced(false) {}
-
- BOOL QueryAbout();
- DWORD About(HWND hwnd);
-
- BOOL QueryConfigure();
- DWORD Configure(HWND hwnd);
-
- DWORD GetState(LPVOID pv, DWORD dwSize);
- DWORD SetState(LPVOID pv, DWORD dwSize);
-
- DWORD GetInfo(ICINFO* icinfo, DWORD dwSize);
-
- DWORD CompressQuery(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
- DWORD CompressGetFormat(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
- DWORD CompressBegin(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
- DWORD CompressGetSize(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
- DWORD Compress(ICCOMPRESS* icinfo, DWORD dwSize);
- DWORD CompressEnd();
-
- void ConvertRGB24toYUY2(const unsigned char* src, unsigned char* dst, int width, int height);
-
- DWORD DecompressQuery(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
- DWORD DecompressGetFormat(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
- DWORD DecompressBegin(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
- DWORD Decompress(ICDECOMPRESS* icinfo, DWORD dwSize);
- DWORD DecompressGetPalette(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut);
- DWORD DecompressEnd();
-
- };
-
- CodecInst* Open(ICOPEN* icinfo);
- DWORD Close(CodecInst* pinst);
-
-
-