60#define ICCVID_MAGIC mmioFOURCC('c', 'v', 'i', 'd')
61#define compare_fourcc(fcc1, fcc2) (((fcc1)^(fcc2))&~0x20202020)
69 unsigned char r[4],
g[4],
b[4];
89#define get_byte() *(in_buffer++)
90#define skip_byte() in_buffer++
91#define get_word() ((unsigned short)(in_buffer += 2, \
92 (in_buffer[-2] << 8 | in_buffer[-1])))
93#define get_long() ((unsigned long)(in_buffer += 4, \
94 (in_buffer[-4] << 24 | in_buffer[-3] << 16 | in_buffer[-2] << 8 | in_buffer[-1])))
110 c->r[0] =
c->g[0] =
c->b[0] =
c->y0;
111 c->r[1] =
c->g[1] =
c->b[1] =
c->y1;
112 c->r[2] =
c->g[2] =
c->b[2] =
c->y2;
113 c->r[3] =
c->g[3] =
c->b[3] =
c->y3;
125 uvg = -((
c->u+1) >> 1) -
c->v;
136 int frm_stride,
int bpp,
unsigned int out_height)
140 return y * frm_stride +
x *
bpp;
142 return (out_height - 1 -
y) * frm_stride +
x *
bpp;
145#define MAKECOLOUR32(r,g,b) (((r) << 16) | ((g) << 8) | (b))
147#define MAKECOLOUR16(r,g,b) (((r) >> 3) << 11)| (((g) >> 2) << 5)| (((b) >> 3) << 0)
148#define MAKECOLOUR15(r,g,b) (((r) >> 3) << 10)| (((g) >> 3) << 5)| (((b) >> 3) << 0)
154unsigned long *vptr = (
unsigned long *)frm;
164 for (
y = 0;
y < 4;
y++)
166 if (&vptr[
y*row_inc] < (
unsigned long *)
limit)
return;
167 for (
x = 0;
x < 4;
x++)
181unsigned long *vptr = (
unsigned long *)frm;
192 for (
y = 0;
y < 4;
y++)
194 if (&vptr[
y*row_inc] < (
unsigned long *)
limit)
return;
195 for (
x = 0;
x < 4;
x++)
214 for (
y = 0;
y < 4;
y++)
216 if (&vptr[
y*row_inc] <
limit)
return;
217 for (
x = 0;
x < 4;
x++)
219 vptr[
y*row_inc +
x*3 + 0] =
cb->b[
x/2+(
y/2)*2];
220 vptr[
y*row_inc +
x*3 + 1] =
cb->g[
x/2+(
y/2)*2];
221 vptr[
y*row_inc +
x*3 + 2] =
cb->r[
x/2+(
y/2)*2];
241 for (
y = 0;
y < 4;
y++)
243 if (&vptr[
y*row_inc] <
limit)
return;
244 for (
x = 0;
x < 4;
x++)
246 vptr[
y*row_inc +
x*3 + 0] =
cb[
x/2+(
y/2)*2]->
b[
x%2+(
y%2)*2];
247 vptr[
y*row_inc +
x*3 + 1] =
cb[
x/2+(
y/2)*2]->
g[
x%2+(
y%2)*2];
248 vptr[
y*row_inc +
x*3 + 2] =
cb[
x/2+(
y/2)*2]->
r[
x%2+(
y%2)*2];
258unsigned short *vptr = (
unsigned short *)frm;
268 for (
y = 0;
y < 4;
y++)
270 if (&vptr[
y*row_inc] < (
unsigned short *)
limit)
return;
271 for (
x = 0;
x < 4;
x++)
281unsigned short *vptr = (
unsigned short *)frm;
292 for (
y = 0;
y < 4;
y++)
294 if (&vptr[
y*row_inc] < (
unsigned short *)
limit)
return;
295 for (
x = 0;
x < 4;
x++)
304unsigned short *vptr = (
unsigned short *)frm;
314 for (
y = 0;
y < 4;
y++)
316 if (&vptr[
y*row_inc] < (
unsigned short *)
limit)
return;
317 for (
x = 0;
x < 4;
x++)
327unsigned short *vptr = (
unsigned short *)frm;
338 for (
y = 0;
y < 4;
y++)
340 if (&vptr[
y*row_inc] < (
unsigned short *)
limit)
return;
341 for (
x = 0;
x < 4;
x++)
364 for(
i = -512;
i < 512;
i++)
365 uiclp[
i] = (
i < 0 ? 0 : (
i > 255 ? 255 :
i));
404 unsigned char *output,
unsigned int out_width,
unsigned int out_height,
int bit_per_pixel,
BOOL inverted)
407 unsigned long x,
y, y_bottom, cnum, strip_id, chunk_id,
409 long top_size, chunk_size;
410 unsigned char *frm_ptr;
411 unsigned int i, cur_strip,
addr;
412 int d0, d1, d2, d3, frm_stride,
bpp = 3;
419 unsigned short width;
421 unsigned short strips;
433 switch(bit_per_pixel)
460 if(frame.length !=
size)
462 if(frame.length & 0x01) frame.length++;
463 if(frame.length !=
size)
465 ERR(
"CVID: corruption %d (QT/AVI) != %ld (CV)\n",
size, frame.length);
486 ERR(
"CVID: codebook v4 alloc err\n");
492 ERR(
"CVID: codebook v1 alloc err\n");
499 TRACE(
"CVID: %ux%u, strips %u, length %lu\n",
500 frame.width, frame.height, frame.strips, frame.length);
502 for(cur_strip = 0; cur_strip < frame.strips; cur_strip++)
507 if((cur_strip > 0) && (!(frame.flags & 0x01)))
524 WARN(
"CVID: Warning x1 (%ld) != width (%d)\n",
x1, out_width);
526 TRACE(
" %d) %04lx %04ld <%ld,%ld> <%ld,%ld> yt %ld\n",
527 cur_strip, strip_id, top_size,
x0,
y0,
x1,
y1, y_bottom);
534 TRACE(
" %04lx %04ld\n", chunk_id, chunk_size);
535 top_size -= chunk_size;
543 codebook = (chunk_id == 0x2200 ? v1_codebook : v4_codebook);
550 codebook = (chunk_id == 0x2600 ? v1_codebook : v4_codebook);
557 codebook = (chunk_id == 0x2300 ? v1_codebook : v4_codebook);
560 while(chunk_size > 0)
565 for(
i = 0;
i < 32;
i++)
567 if(
flag & 0x80000000)
577 while(chunk_size > 0) {
skip_byte(); chunk_size--; }
582 codebook = (chunk_id == 0x2700 ? v1_codebook : v4_codebook);
585 while(chunk_size > 0)
590 for(
i = 0;
i < 32;
i++)
592 if(
flag & 0x80000000)
602 while(chunk_size > 0) {
skip_byte(); chunk_size--; }
607 while((chunk_size > 0) && (
y < y_bottom))
612 for(
i = 0;
i < 32;
i++)
614 if(
y >= y_bottom)
break;
615 if(
flag & 0x80000000)
624 cvid_v4(frm_ptr +
addr, output, frm_stride, inverted, v4_codebook+d0, v4_codebook+d1, v4_codebook+d2, v4_codebook+d3);
629 cvid_v1(frm_ptr +
addr, output, frm_stride, inverted, v1_codebook +
get_byte());
643 while(chunk_size > 0) {
skip_byte(); chunk_size--; }
647 while((chunk_size > 0) && (
y < y_bottom))
654 while((
mask) && (
y < y_bottom))
660 if(chunk_size < 0)
break;
676 cvid_v4(frm_ptr +
addr, output, frm_stride, inverted, v4_codebook+d0, v4_codebook+d1, v4_codebook+d2, v4_codebook+d3);
683 cvid_v1(frm_ptr +
addr, output, frm_stride, inverted, v1_codebook +
get_byte());
697 while(chunk_size > 0) {
skip_byte(); chunk_size--; }
701 while((chunk_size > 0) && (
y < y_bottom))
704 cvid_v1(frm_ptr +
addr, output, frm_stride, inverted, v1_codebook +
get_byte());
714 while(chunk_size > 0) {
skip_byte(); chunk_size--; }
718 ERR(
"CVID: unknown chunk_id %08lx\n", chunk_id);
719 while(chunk_size > 0) {
skip_byte(); chunk_size--; }
725 if(frame.length !=
size)
727 if(frame.length & 0x01) frame.length++;
728 if(frame.length !=
size)
735 WARN(
"CVID: END INFO chunk size %d cvid size1 %ld cvid size2 %ld\n",
736 size, frame.length, xlen);
758 COLORREF realRedMask =
MAKECOLOUR32(bmiColors[0].rgbRed, bmiColors[0].rgbGreen, bmiColors[0].rgbBlue);
759 COLORREF realBlueMask =
MAKECOLOUR32(bmiColors[1].rgbRed, bmiColors[1].rgbGreen, bmiColors[1].rgbBlue);
760 COLORREF realGreenMask =
MAKECOLOUR32(bmiColors[2].rgbRed, bmiColors[2].rgbGreen, bmiColors[2].rgbBlue);
762 TRACE(
"\nbmiColors[0] = 0x%08x\nbmiColors[1] = 0x%08x\nbmiColors[2] = 0x%08x\n",
763 realRedMask, realBlueMask, realGreenMask);
765 if ((realRedMask == redMask) &&
766 (realBlueMask == blueMask) &&
767 (realGreenMask == greenMask))
790 if(
in->bmiHeader.biPlanes !=
out->bmiHeader.biPlanes )
792 if(
in->bmiHeader.biHeight !=
out->bmiHeader.biHeight )
794 if(
in->bmiHeader.biHeight != -
out->bmiHeader.biHeight )
796 TRACE(
"Detected inverted height for video output\n");
798 if(
in->bmiHeader.biWidth !=
out->bmiHeader.biWidth )
801 switch(
out->bmiHeader.biBitCount )
809 TRACE(
"unsupported output bit field(s) for 16-bit colors\n");
818 TRACE(
"unsupported output bitcount = %d\n",
out->bmiHeader.biBitCount );
835 size =
in->bmiHeader.biSize;
836 if (
in->bmiHeader.biBitCount <= 8)
842 out->bmiHeader.biBitCount = 24;
844 out->bmiHeader.biSizeImage =
get_stride(
in->bmiHeader.biWidth, 24) *
in->bmiHeader.biHeight;
857 info->bits_per_pixel =
out->bmiHeader.biBitCount;
859 if (
info->bits_per_pixel == 16)
864 info->bits_per_pixel = 15;
866 info->bits_per_pixel = 16;
869 TRACE(
"unsupported output bit field(s) for 16-bit colors\n");
874 info->bits_per_pixel = 15;
877 TRACE(
"bit_per_pixel = %d\n",
info->bits_per_pixel);
897 ERR(
"ICM_DECOMPRESS sent after ICM_DECOMPRESS_END\n");
922 ERR(
"ICM_DECOMPRESSEX sent after ICM_DECOMPRESS_END\n");
950 if (!icinfo)
return sizeof(
ICINFO);
982 TRACE(
"%ld %p %d %ld %ld\n", dwDriverId, hdrvr,
msg, lParam1, lParam2);
1039 FIXME(
"compression not implemented\n");
1046 FIXME(
"Unknown message: %04x %ld %ld\n",
msg, lParam1, lParam2);
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define DLL_PROCESS_ATTACH
static __inline const char * debugstr_an(const char *s, int n)
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
GLint GLint GLsizei GLsizei GLsizei depth
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble r
GLint GLint GLsizei width
GLboolean GLboolean GLboolean b
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei GLsizei * length
GLenum const GLvoid * addr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static HINSTANCE ICCVID_hModule
static LRESULT ICCVID_Decompress(ICCVID_Info *info, ICDECOMPRESS *icd, DWORD size)
static void cvid_v4_32(unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb0, cvid_codebook *cb1, cvid_codebook *cb2, cvid_codebook *cb3)
static void read_codebook(cvid_codebook *c, int mode)
void(* fn_cvid_v1)(unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
static int get_stride(int width, int depth)
#define MAKECOLOUR32(r, g, b)
static void free_cvinfo(cinepak_info *cvinfo)
void(* fn_cvid_v4)(unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb0, cvid_codebook *cb1, cvid_codebook *cb2, cvid_codebook *cb3)
static void cvid_v4_16(unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb0, cvid_codebook *cb1, cvid_codebook *cb2, cvid_codebook *cb3)
static LRESULT ICCVID_DecompressGetFormat(ICCVID_Info *info, LPBITMAPINFO in, LPBITMAPINFO out)
static void cvid_v1_16(unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
static int ICCVID_CheckMask(RGBQUAD bmiColors[3], COLORREF redMask, COLORREF blueMask, COLORREF greenMask)
static LRESULT ICCVID_DecompressBegin(ICCVID_Info *info, LPBITMAPINFO in, LPBITMAPINFO out)
static void cvid_v1_15(unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
#define MAKECOLOUR15(r, g, b)
BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpReserved)
static cinepak_info * decode_cinepak_init(void)
static LRESULT ICCVID_DecompressEx(ICCVID_Info *info, ICDECOMPRESSEX *icd, DWORD size)
static unsigned char * in_buffer
static void decode_cinepak(cinepak_info *cvinfo, unsigned char *buf, int size, unsigned char *output, unsigned int out_width, unsigned int out_height, int bit_per_pixel, BOOL inverted)
static void cvid_v4_24(unsigned char *vptr, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb0, cvid_codebook *cb1, cvid_codebook *cb2, cvid_codebook *cb3)
#define compare_fourcc(fcc1, fcc2)
static LRESULT ICCVID_DecompressEnd(ICCVID_Info *info)
#define MAKECOLOUR16(r, g, b)
static void cvid_v1_32(unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
static LRESULT ICCVID_Close(ICCVID_Info *info)
static long get_addr(BOOL inverted, unsigned long x, unsigned long y, int frm_stride, int bpp, unsigned int out_height)
static unsigned char uiclip[1024]
LRESULT WINAPI ICCVID_DriverProc(DWORD_PTR dwDriverId, HDRVR hdrvr, UINT msg, LPARAM lParam1, LPARAM lParam2)
static unsigned char * uiclp
static LRESULT ICCVID_DecompressQuery(ICCVID_Info *info, LPBITMAPINFO in, LPBITMAPINFO out)
struct _ICCVID_Info ICCVID_Info
static void cvid_v4_15(unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb0, cvid_codebook *cb1, cvid_codebook *cb2, cvid_codebook *cb3)
static void cvid_v1_24(unsigned char *vptr, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
static LRESULT ICCVID_GetInfo(ICCVID_Info *info, ICINFO *icinfo, DWORD dwSize)
static void ICCVID_dump_BITMAPINFO(const BITMAPINFO *bmi)
#define memcpy(s1, s2, n)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
static HMODULE MODULEINFO DWORD cb
LPBITMAPINFOHEADER lpbiSrc
LPBITMAPINFOHEADER lpbiDst
LPBITMAPINFOHEADER lpbiInput
LPBITMAPINFOHEADER lpbiOutput
cvid_codebook * v4_codebook[MAX_STRIPS]
cvid_codebook * v1_codebook[MAX_STRIPS]
BITMAPINFOHEADER bmiHeader
#define ICM_COMPRESS_QUERY
#define ICM_DECOMPRESS_QUERY
#define ICERR_UNSUPPORTED
#define ICM_DECOMPRESS_GET_FORMAT
#define ICM_DECOMPRESS_END
#define ICM_DECOMPRESS_BEGIN
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)