59#define ICCVID_MAGIC mmioFOURCC('c', 'v', 'i', 'd')
60#define compare_fourcc(fcc1, fcc2) (((fcc1)^(fcc2))&~0x20202020)
68 unsigned char r[4],
g[4],
b[4];
88#define get_byte() *(in_buffer++)
89#define skip_byte() in_buffer++
90#define get_word() ((unsigned short)(in_buffer += 2, \
91 (in_buffer[-2] << 8 | in_buffer[-1])))
92#define get_long() ((unsigned long)(in_buffer += 4, \
93 (in_buffer[-4] << 24 | in_buffer[-3] << 16 | in_buffer[-2] << 8 | in_buffer[-1])))
109 c->r[0] =
c->g[0] =
c->b[0] =
c->y0;
110 c->r[1] =
c->g[1] =
c->b[1] =
c->y1;
111 c->r[2] =
c->g[2] =
c->b[2] =
c->y2;
112 c->r[3] =
c->g[3] =
c->b[3] =
c->y3;
124 uvg = -((
c->u+1) >> 1) -
c->v;
135 int frm_stride,
int bpp,
unsigned int out_height)
139 return y * frm_stride +
x *
bpp;
141 return (out_height - 1 -
y) * frm_stride +
x *
bpp;
144#define MAKECOLOUR32(r,g,b) (((r) << 16) | ((g) << 8) | (b))
146#define MAKECOLOUR16(r,g,b) (((r) >> 3) << 11)| (((g) >> 2) << 5)| (((b) >> 3) << 0)
147#define MAKECOLOUR15(r,g,b) (((r) >> 3) << 10)| (((g) >> 3) << 5)| (((b) >> 3) << 0)
153unsigned long *vptr = (
unsigned long *)frm;
163 for (
y = 0;
y < 4;
y++)
165 if (&vptr[
y*row_inc] < (
unsigned long *)
limit)
return;
166 for (
x = 0;
x < 4;
x++)
180unsigned long *vptr = (
unsigned long *)frm;
191 for (
y = 0;
y < 4;
y++)
193 if (&vptr[
y*row_inc] < (
unsigned long *)
limit)
return;
194 for (
x = 0;
x < 4;
x++)
213 for (
y = 0;
y < 4;
y++)
215 if (&vptr[
y*row_inc] <
limit)
return;
216 for (
x = 0;
x < 4;
x++)
218 vptr[
y*row_inc +
x*3 + 0] =
cb->b[
x/2+(
y/2)*2];
219 vptr[
y*row_inc +
x*3 + 1] =
cb->g[
x/2+(
y/2)*2];
220 vptr[
y*row_inc +
x*3 + 2] =
cb->r[
x/2+(
y/2)*2];
240 for (
y = 0;
y < 4;
y++)
242 if (&vptr[
y*row_inc] <
limit)
return;
243 for (
x = 0;
x < 4;
x++)
245 vptr[
y*row_inc +
x*3 + 0] =
cb[
x/2+(
y/2)*2]->
b[
x%2+(
y%2)*2];
246 vptr[
y*row_inc +
x*3 + 1] =
cb[
x/2+(
y/2)*2]->
g[
x%2+(
y%2)*2];
247 vptr[
y*row_inc +
x*3 + 2] =
cb[
x/2+(
y/2)*2]->
r[
x%2+(
y%2)*2];
257unsigned short *vptr = (
unsigned short *)frm;
267 for (
y = 0;
y < 4;
y++)
269 if (&vptr[
y*row_inc] < (
unsigned short *)
limit)
return;
270 for (
x = 0;
x < 4;
x++)
280unsigned short *vptr = (
unsigned short *)frm;
291 for (
y = 0;
y < 4;
y++)
293 if (&vptr[
y*row_inc] < (
unsigned short *)
limit)
return;
294 for (
x = 0;
x < 4;
x++)
303unsigned short *vptr = (
unsigned short *)frm;
313 for (
y = 0;
y < 4;
y++)
315 if (&vptr[
y*row_inc] < (
unsigned short *)
limit)
return;
316 for (
x = 0;
x < 4;
x++)
326unsigned short *vptr = (
unsigned short *)frm;
337 for (
y = 0;
y < 4;
y++)
339 if (&vptr[
y*row_inc] < (
unsigned short *)
limit)
return;
340 for (
x = 0;
x < 4;
x++)
363 for(
i = -512;
i < 512;
i++)
364 uiclp[
i] = (
i < 0 ? 0 : (
i > 255 ? 255 :
i));
403 unsigned char *output,
unsigned int out_width,
unsigned int out_height,
int bit_per_pixel,
BOOL inverted)
406 unsigned long x,
y, y_bottom, cnum, strip_id, chunk_id,
408 long top_size, chunk_size;
409 unsigned char *frm_ptr;
410 unsigned int i, cur_strip,
addr;
411 int d0, d1, d2, d3, frm_stride,
bpp = 3;
418 unsigned short width;
420 unsigned short strips;
432 switch(bit_per_pixel)
459 if(frame.length !=
size)
461 if(frame.length & 0x01) frame.length++;
462 if(frame.length !=
size)
464 ERR(
"CVID: corruption %d (QT/AVI) != %ld (CV)\n",
size, frame.length);
485 ERR(
"CVID: codebook v4 alloc err\n");
491 ERR(
"CVID: codebook v1 alloc err\n");
498 TRACE(
"CVID: %ux%u, strips %u, length %lu\n",
499 frame.width, frame.height, frame.strips, frame.length);
501 for(cur_strip = 0; cur_strip < frame.strips; cur_strip++)
506 if((cur_strip > 0) && (!(frame.flags & 0x01)))
523 WARN(
"CVID: Warning x1 (%ld) != width (%d)\n",
x1, out_width);
525 TRACE(
" %d) %04lx %04ld <%ld,%ld> <%ld,%ld> yt %ld\n",
526 cur_strip, strip_id, top_size,
x0,
y0,
x1,
y1, y_bottom);
533 TRACE(
" %04lx %04ld\n", chunk_id, chunk_size);
534 top_size -= chunk_size;
542 codebook = (chunk_id == 0x2200 ? v1_codebook : v4_codebook);
549 codebook = (chunk_id == 0x2600 ? v1_codebook : v4_codebook);
556 codebook = (chunk_id == 0x2300 ? v1_codebook : v4_codebook);
559 while(chunk_size > 0)
564 for(
i = 0;
i < 32;
i++)
566 if(
flag & 0x80000000)
576 while(chunk_size > 0) {
skip_byte(); chunk_size--; }
581 codebook = (chunk_id == 0x2700 ? v1_codebook : v4_codebook);
584 while(chunk_size > 0)
589 for(
i = 0;
i < 32;
i++)
591 if(
flag & 0x80000000)
601 while(chunk_size > 0) {
skip_byte(); chunk_size--; }
606 while((chunk_size > 0) && (
y < y_bottom))
611 for(
i = 0;
i < 32;
i++)
613 if(
y >= y_bottom)
break;
614 if(
flag & 0x80000000)
623 cvid_v4(frm_ptr +
addr, output, frm_stride, inverted, v4_codebook+d0, v4_codebook+d1, v4_codebook+d2, v4_codebook+d3);
628 cvid_v1(frm_ptr +
addr, output, frm_stride, inverted, v1_codebook +
get_byte());
642 while(chunk_size > 0) {
skip_byte(); chunk_size--; }
646 while((chunk_size > 0) && (
y < y_bottom))
653 while((
mask) && (
y < y_bottom))
659 if(chunk_size < 0)
break;
675 cvid_v4(frm_ptr +
addr, output, frm_stride, inverted, v4_codebook+d0, v4_codebook+d1, v4_codebook+d2, v4_codebook+d3);
682 cvid_v1(frm_ptr +
addr, output, frm_stride, inverted, v1_codebook +
get_byte());
696 while(chunk_size > 0) {
skip_byte(); chunk_size--; }
700 while((chunk_size > 0) && (
y < y_bottom))
703 cvid_v1(frm_ptr +
addr, output, frm_stride, inverted, v1_codebook +
get_byte());
713 while(chunk_size > 0) {
skip_byte(); chunk_size--; }
717 ERR(
"CVID: unknown chunk_id %08lx\n", chunk_id);
718 while(chunk_size > 0) {
skip_byte(); chunk_size--; }
724 if(frame.length !=
size)
726 if(frame.length & 0x01) frame.length++;
727 if(frame.length !=
size)
734 WARN(
"CVID: END INFO chunk size %d cvid size1 %ld cvid size2 %ld\n",
735 size, frame.length, xlen);
757 COLORREF realRedMask =
MAKECOLOUR32(bmiColors[0].rgbRed, bmiColors[0].rgbGreen, bmiColors[0].rgbBlue);
758 COLORREF realBlueMask =
MAKECOLOUR32(bmiColors[1].rgbRed, bmiColors[1].rgbGreen, bmiColors[1].rgbBlue);
759 COLORREF realGreenMask =
MAKECOLOUR32(bmiColors[2].rgbRed, bmiColors[2].rgbGreen, bmiColors[2].rgbBlue);
761 TRACE(
"\nbmiColors[0] = 0x%08lx\nbmiColors[1] = 0x%08lx\nbmiColors[2] = 0x%08lx\n",
762 realRedMask, realBlueMask, realGreenMask);
764 if ((realRedMask == redMask) &&
765 (realBlueMask == blueMask) &&
766 (realGreenMask == greenMask))
789 if(
in->bmiHeader.biPlanes !=
out->bmiHeader.biPlanes )
791 if(
in->bmiHeader.biHeight !=
out->bmiHeader.biHeight )
793 if(
in->bmiHeader.biHeight != -
out->bmiHeader.biHeight )
795 TRACE(
"Detected inverted height for video output\n");
797 if(
in->bmiHeader.biWidth !=
out->bmiHeader.biWidth )
800 switch(
out->bmiHeader.biCompression )
803 if (
out->bmiHeader.biBitCount == 16 ||
out->bmiHeader.biBitCount == 24 ||
out->bmiHeader.biBitCount == 32 )
813 TRACE(
"unsupported output format\n");
829 size =
in->bmiHeader.biSize;
830 if (
in->bmiHeader.biBitCount <= 8)
836 out->bmiHeader.biBitCount = 24;
838 out->bmiHeader.biSizeImage =
get_stride(
in->bmiHeader.biWidth, 24) *
in->bmiHeader.biHeight;
851 info->bits_per_pixel =
out->bmiHeader.biBitCount;
853 if (
info->bits_per_pixel == 16)
858 info->bits_per_pixel = 15;
860 info->bits_per_pixel = 16;
863 TRACE(
"unsupported output bit field(s) for 16-bit colors\n");
868 info->bits_per_pixel = 15;
871 TRACE(
"bit_per_pixel = %d\n",
info->bits_per_pixel);
891 ERR(
"ICM_DECOMPRESS sent after ICM_DECOMPRESS_END\n");
916 ERR(
"ICM_DECOMPRESSEX sent after ICM_DECOMPRESS_END\n");
944 if (!icinfo)
return sizeof(
ICINFO);
976 TRACE(
"%Id %p %d %Id %Id\n", dwDriverId, hdrvr,
msg, lParam1, lParam2);
1033 FIXME(
"compression not implemented\n");
1040 FIXME(
"Unknown message: %04x %Id %Id\n",
msg, lParam1, lParam2);
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define DLL_PROCESS_ATTACH
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
GLint GLint GLsizei GLsizei GLsizei depth
GLint GLint GLint GLint GLint x
GLint GLint GLsizei GLsizei height
GLint GLint GLint GLint GLint GLint y
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 float int float int float int float y3
static __inline const char * debugstr_fourcc(unsigned int cc)
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
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
_In_ DWORD _In_ int _In_ int _In_opt_ LPNLSVERSIONINFO _In_opt_ LPVOID lpReserved