ReactOS 0.4.17-dev-966-gf06eace
iccvid.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "commdlg.h"
#include "vfw.h"
#include "mmsystem.h"
#include "iccvid_private.h"
#include "wine/debug.h"
Include dependency graph for iccvid.c:

Go to the source code of this file.

Classes

struct  cvid_codebook
 
struct  cinepak_info
 
struct  _ICCVID_Info
 

Macros

#define ICCVID_MAGIC   mmioFOURCC('c', 'v', 'i', 'd')
 
#define compare_fourcc(fcc1, fcc2)   (((fcc1)^(fcc2))&~0x20202020)
 
#define MAX_STRIPS   32
 
#define get_byte()   *(in_buffer++)
 
#define skip_byte()   in_buffer++
 
#define get_word()
 
#define get_long()
 
#define MAKECOLOUR32(r, g, b)   (((r) << 16) | ((g) << 8) | (b))
 
#define MAKECOLOUR16(r, g, b)   (((r) >> 3) << 11)| (((g) >> 2) << 5)| (((b) >> 3) << 0)
 
#define MAKECOLOUR15(r, g, b)   (((r) >> 3) << 10)| (((g) >> 3) << 5)| (((b) >> 3) << 0)
 

Typedefs

typedef struct _ICCVID_Info ICCVID_Info
 
typedef void(* fn_cvid_v1) (unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
 
typedef 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)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (iccvid)
 
static void read_codebook (cvid_codebook *c, int mode)
 
static long get_addr (BOOL inverted, unsigned long x, unsigned long y, int frm_stride, int bpp, unsigned int out_height)
 
static void cvid_v1_32 (unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
 
static int get_stride (int width, int depth)
 
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 cvid_v1_24 (unsigned char *vptr, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
 
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)
 
static void cvid_v1_16 (unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
 
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 void cvid_v1_15 (unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
 
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 cinepak_info * decode_cinepak_init (void)
 
static void free_cvinfo (cinepak_info *cvinfo)
 
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 ICCVID_dump_BITMAPINFO (const BITMAPINFO *bmi)
 
static int ICCVID_CheckMask (RGBQUAD bmiColors[3], COLORREF redMask, COLORREF blueMask, COLORREF greenMask)
 
static LRESULT ICCVID_DecompressQuery (ICCVID_Info *info, LPBITMAPINFO in, LPBITMAPINFO out)
 
static LRESULT ICCVID_DecompressGetFormat (ICCVID_Info *info, LPBITMAPINFO in, LPBITMAPINFO out)
 
static LRESULT ICCVID_DecompressBegin (ICCVID_Info *info, LPBITMAPINFO in, LPBITMAPINFO out)
 
static LRESULT ICCVID_Decompress (ICCVID_Info *info, ICDECOMPRESS *icd, DWORD size)
 
static LRESULT ICCVID_DecompressEx (ICCVID_Info *info, ICDECOMPRESSEX *icd, DWORD size)
 
static LRESULT ICCVID_Close (ICCVID_Info *info)
 
static LRESULT ICCVID_GetInfo (ICCVID_Info *info, ICINFO *icinfo, DWORD dwSize)
 
static LRESULT ICCVID_DecompressEnd (ICCVID_Info *info)
 
LRESULT WINAPI ICCVID_DriverProc (DWORD_PTR dwDriverId, HDRVR hdrvr, UINT msg, LPARAM lParam1, LPARAM lParam2)
 
BOOL WINAPI DllMain (HINSTANCE hModule, DWORD dwReason, LPVOID lpReserved)
 

Variables

static HINSTANCE ICCVID_hModule
 
static unsigned char * in_buffer
 
static unsigned char uiclip [1024]
 
static unsigned char * uiclp = NULL
 

Macro Definition Documentation

◆ compare_fourcc

#define compare_fourcc (   fcc1,
  fcc2 
)    (((fcc1)^(fcc2))&~0x20202020)

Definition at line 60 of file iccvid.c.

◆ get_byte

#define get_byte ( )    *(in_buffer++)

Definition at line 88 of file iccvid.c.

◆ get_long

#define get_long ( )
Value:
((unsigned long)(in_buffer += 4, \
(in_buffer[-4] << 24 | in_buffer[-3] << 16 | in_buffer[-2] << 8 | in_buffer[-1])))
static unsigned char * in_buffer
Definition: iccvid.c:86
#define long
Definition: qsort.c:33

Definition at line 92 of file iccvid.c.

◆ get_word

#define get_word ( )
Value:
((unsigned short)(in_buffer += 2, \
(in_buffer[-2] << 8 | in_buffer[-1])))
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94

Definition at line 90 of file iccvid.c.

◆ ICCVID_MAGIC

#define ICCVID_MAGIC   mmioFOURCC('c', 'v', 'i', 'd')

Definition at line 59 of file iccvid.c.

◆ MAKECOLOUR15

#define MAKECOLOUR15 (   r,
  g,
  b 
)    (((r) >> 3) << 10)| (((g) >> 3) << 5)| (((b) >> 3) << 0)

Definition at line 147 of file iccvid.c.

◆ MAKECOLOUR16

#define MAKECOLOUR16 (   r,
  g,
  b 
)    (((r) >> 3) << 11)| (((g) >> 2) << 5)| (((b) >> 3) << 0)

Definition at line 146 of file iccvid.c.

◆ MAKECOLOUR32

#define MAKECOLOUR32 (   r,
  g,
  b 
)    (((r) << 16) | ((g) << 8) | (b))

Definition at line 144 of file iccvid.c.

◆ MAX_STRIPS

#define MAX_STRIPS   32

Definition at line 61 of file iccvid.c.

◆ skip_byte

#define skip_byte ( )    in_buffer++

Definition at line 89 of file iccvid.c.

Typedef Documentation

◆ fn_cvid_v1

typedef void(* fn_cvid_v1) (unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)

Definition at line 382 of file iccvid.c.

◆ fn_cvid_v4

typedef 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)

Definition at line 384 of file iccvid.c.

◆ ICCVID_Info

Function Documentation

◆ cvid_v1_15()

static void cvid_v1_15 ( unsigned char *  frm,
unsigned char *  limit,
int  stride,
BOOL  inverted,
cvid_codebook *  cb 
)
static

Definition at line 300 of file iccvid.c.

302{
303unsigned short *vptr = (unsigned short *)frm;
304int row_inc;
305int x, y;
306
307 if (!inverted)
308 row_inc = -stride/2;
309 else
310 row_inc = stride/2;
311
312 /* fill 4x4 block of pixels with colour values from codebook */
313 for (y = 0; y < 4; y++)
314 {
315 if (&vptr[y*row_inc] < (unsigned short *)limit) return;
316 for (x = 0; x < 4; x++)
317 vptr[y*row_inc + x] = MAKECOLOUR15(cb->r[x/2+(y/2)*2], cb->g[x/2+(y/2)*2], cb->b[x/2+(y/2)*2]);
318 }
319}
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLsizei stride
Definition: glext.h:5848
GLint limit
Definition: glext.h:10326
#define MAKECOLOUR15(r, g, b)
Definition: iccvid.c:147

Referenced by decode_cinepak().

◆ cvid_v1_16()

static void cvid_v1_16 ( unsigned char *  frm,
unsigned char *  limit,
int  stride,
BOOL  inverted,
cvid_codebook *  cb 
)
static

Definition at line 254 of file iccvid.c.

256{
257unsigned short *vptr = (unsigned short *)frm;
258int row_inc;
259int x, y;
260
261 if (!inverted)
262 row_inc = -stride/2;
263 else
264 row_inc = stride/2;
265
266 /* fill 4x4 block of pixels with colour values from codebook */
267 for (y = 0; y < 4; y++)
268 {
269 if (&vptr[y*row_inc] < (unsigned short *)limit) return;
270 for (x = 0; x < 4; x++)
271 vptr[y*row_inc + x] = MAKECOLOUR16(cb->r[x/2+(y/2)*2], cb->g[x/2+(y/2)*2], cb->b[x/2+(y/2)*2]);
272 }
273}
#define MAKECOLOUR16(r, g, b)
Definition: iccvid.c:146

Referenced by decode_cinepak().

◆ cvid_v1_24()

static void cvid_v1_24 ( unsigned char *  vptr,
unsigned char *  limit,
int  stride,
BOOL  inverted,
cvid_codebook *  cb 
)
static

Definition at line 201 of file iccvid.c.

203{
204int row_inc;
205int x, y;
206
207 if (!inverted)
208 row_inc = -stride;
209 else
210 row_inc = stride;
211
212 /* fill 4x4 block of pixels with colour values from codebook */
213 for (y = 0; y < 4; y++)
214 {
215 if (&vptr[y*row_inc] < limit) return;
216 for (x = 0; x < 4; x++)
217 {
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];
221 }
222 }
223}

Referenced by decode_cinepak().

◆ cvid_v1_32()

static void cvid_v1_32 ( unsigned char *  frm,
unsigned char *  limit,
int  stride,
BOOL  inverted,
cvid_codebook *  cb 
)
static

Definition at line 150 of file iccvid.c.

152{
153unsigned long *vptr = (unsigned long *)frm;
154int row_inc;
155int x, y;
156
157 if (!inverted)
158 row_inc = -stride/4;
159 else
160 row_inc = stride/4;
161
162 /* fill 4x4 block of pixels with colour values from codebook */
163 for (y = 0; y < 4; y++)
164 {
165 if (&vptr[y*row_inc] < (unsigned long *)limit) return;
166 for (x = 0; x < 4; x++)
167 vptr[y*row_inc + x] = MAKECOLOUR32(cb->r[x/2+(y/2)*2], cb->g[x/2+(y/2)*2], cb->b[x/2+(y/2)*2]);
168 }
169}
#define MAKECOLOUR32(r, g, b)
Definition: iccvid.c:144

Referenced by decode_cinepak().

◆ cvid_v4_15()

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

Definition at line 323 of file iccvid.c.

325{
326unsigned short *vptr = (unsigned short *)frm;
327int row_inc;
328cvid_codebook * cb[] = {cb0,cb1,cb2,cb3};
329int x, y;
330
331 if (!inverted)
332 row_inc = -stride/2;
333 else
334 row_inc = stride/2;
335
336 /* fill 4x4 block of pixels with colour values from codebooks */
337 for (y = 0; y < 4; y++)
338 {
339 if (&vptr[y*row_inc] < (unsigned short *)limit) return;
340 for (x = 0; x < 4; x++)
341 vptr[y*row_inc + x] = MAKECOLOUR15(cb[x/2+(y/2)*2]->r[x%2+(y%2)*2], cb[x/2+(y/2)*2]->g[x%2+(y%2)*2], cb[x/2+(y/2)*2]->b[x%2+(y%2)*2]);
342 }
343}

Referenced by decode_cinepak().

◆ cvid_v4_16()

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

Definition at line 277 of file iccvid.c.

279{
280unsigned short *vptr = (unsigned short *)frm;
281int row_inc;
282cvid_codebook * cb[] = {cb0,cb1,cb2,cb3};
283int x, y;
284
285 if (!inverted)
286 row_inc = -stride/2;
287 else
288 row_inc = stride/2;
289
290 /* fill 4x4 block of pixels with colour values from codebooks */
291 for (y = 0; y < 4; y++)
292 {
293 if (&vptr[y*row_inc] < (unsigned short *)limit) return;
294 for (x = 0; x < 4; x++)
295 vptr[y*row_inc + x] = MAKECOLOUR16(cb[x/2+(y/2)*2]->r[x%2+(y%2)*2], cb[x/2+(y/2)*2]->g[x%2+(y%2)*2], cb[x/2+(y/2)*2]->b[x%2+(y%2)*2]);
296 }
297}

Referenced by decode_cinepak().

◆ cvid_v4_24()

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 
)
static

Definition at line 227 of file iccvid.c.

229{
230int row_inc;
231cvid_codebook * cb[] = {cb0,cb1,cb2,cb3};
232int x, y;
233
234 if (!inverted)
235 row_inc = -stride;
236 else
237 row_inc = stride;
238
239 /* fill 4x4 block of pixels with colour values from codebooks */
240 for (y = 0; y < 4; y++)
241 {
242 if (&vptr[y*row_inc] < limit) return;
243 for (x = 0; x < 4; x++)
244 {
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];
248 }
249 }
250}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204

Referenced by decode_cinepak().

◆ cvid_v4_32()

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

Definition at line 177 of file iccvid.c.

179{
180unsigned long *vptr = (unsigned long *)frm;
181int row_inc;
182int x, y;
183cvid_codebook * cb[] = {cb0,cb1,cb2,cb3};
184
185 if (!inverted)
186 row_inc = -stride/4;
187 else
188 row_inc = stride/4;
189
190 /* fill 4x4 block of pixels with colour values from codebooks */
191 for (y = 0; y < 4; y++)
192 {
193 if (&vptr[y*row_inc] < (unsigned long *)limit) return;
194 for (x = 0; x < 4; x++)
195 vptr[y*row_inc + x] = MAKECOLOUR32(cb[x/2+(y/2)*2]->r[x%2+(y%2)*2], cb[x/2+(y/2)*2]->g[x%2+(y%2)*2], cb[x/2+(y/2)*2]->b[x%2+(y%2)*2]);
196 }
197}

Referenced by decode_cinepak().

◆ decode_cinepak()

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

Definition at line 402 of file iccvid.c.

404{
405 cvid_codebook *v4_codebook, *v1_codebook, *codebook = NULL;
406 unsigned long x, y, y_bottom, cnum, strip_id, chunk_id,
407 x0, y0, x1, y1, ci, flag, mask;
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;
412 fn_cvid_v1 cvid_v1 = cvid_v1_24;
413 fn_cvid_v4 cvid_v4 = cvid_v4_24;
414 struct frame_header
415 {
416 unsigned char flags;
417 unsigned long length;
418 unsigned short width;
419 unsigned short height;
420 unsigned short strips;
421 } frame;
422
423 y = 0;
424 y_bottom = 0;
425 in_buffer = buf;
426
427 frame.flags = get_byte();
428 frame.length = get_byte() << 16;
429 frame.length |= get_byte() << 8;
430 frame.length |= get_byte();
431
432 switch(bit_per_pixel)
433 {
434 case 15:
435 bpp = 2;
436 cvid_v1 = cvid_v1_15;
437 cvid_v4 = cvid_v4_15;
438 break;
439 case 16:
440 bpp = 2;
441 cvid_v1 = cvid_v1_16;
442 cvid_v4 = cvid_v4_16;
443 break;
444 case 24:
445 bpp = 3;
446 cvid_v1 = cvid_v1_24;
447 cvid_v4 = cvid_v4_24;
448 break;
449 case 32:
450 bpp = 4;
451 cvid_v1 = cvid_v1_32;
452 cvid_v4 = cvid_v4_32;
453 break;
454 }
455
456 frm_stride = get_stride(out_width, bpp * 8);
457 frm_ptr = output;
458
459 if(frame.length != size)
460 {
461 if(frame.length & 0x01) frame.length++; /* AVIs tend to have a size mismatch */
462 if(frame.length != size)
463 {
464 ERR("CVID: corruption %d (QT/AVI) != %ld (CV)\n", size, frame.length);
465 /* return; */
466 }
467 }
468
469 frame.width = get_word();
470 frame.height = get_word();
471 frame.strips = get_word();
472
473 if(frame.strips > cvinfo->strip_num)
474 {
475 if(frame.strips >= MAX_STRIPS)
476 {
477 ERR("CVID: strip overflow (more than %d)\n", MAX_STRIPS);
478 return;
479 }
480
481 for(i = cvinfo->strip_num; i < frame.strips; i++)
482 {
483 if((cvinfo->v4_codebook[i] = malloc(sizeof(cvid_codebook) * 260)) == NULL)
484 {
485 ERR("CVID: codebook v4 alloc err\n");
486 return;
487 }
488
489 if((cvinfo->v1_codebook[i] = malloc(sizeof(cvid_codebook) * 260)) == NULL)
490 {
491 ERR("CVID: codebook v1 alloc err\n");
492 return;
493 }
494 }
495 }
496 cvinfo->strip_num = frame.strips;
497
498 TRACE("CVID: %ux%u, strips %u, length %lu\n",
499 frame.width, frame.height, frame.strips, frame.length);
500
501 for(cur_strip = 0; cur_strip < frame.strips; cur_strip++)
502 {
503 v4_codebook = cvinfo->v4_codebook[cur_strip];
504 v1_codebook = cvinfo->v1_codebook[cur_strip];
505
506 if((cur_strip > 0) && (!(frame.flags & 0x01)))
507 {
508 memcpy(cvinfo->v4_codebook[cur_strip], cvinfo->v4_codebook[cur_strip-1], 260 * sizeof(cvid_codebook));
509 memcpy(cvinfo->v1_codebook[cur_strip], cvinfo->v1_codebook[cur_strip-1], 260 * sizeof(cvid_codebook));
510 }
511
512 strip_id = get_word(); /* 1000 = key strip, 1100 = iter strip */
513 top_size = get_word();
514 y0 = get_word(); /* FIXME: most of these are ignored at the moment */
515 x0 = get_word();
516 y1 = get_word();
517 x1 = get_word();
518
519 y_bottom += y1;
520 top_size -= 12;
521 x = 0;
522 if(x1 != out_width)
523 WARN("CVID: Warning x1 (%ld) != width (%d)\n", x1, out_width);
524
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);
527
528 while(top_size > 0)
529 {
530 chunk_id = get_word();
531 chunk_size = get_word();
532
533 TRACE(" %04lx %04ld\n", chunk_id, chunk_size);
534 top_size -= chunk_size;
535 chunk_size -= 4;
536
537 switch(chunk_id)
538 {
539 /* -------------------- Codebook Entries -------------------- */
540 case 0x2000:
541 case 0x2200:
542 codebook = (chunk_id == 0x2200 ? v1_codebook : v4_codebook);
543 cnum = chunk_size/6;
544 for(i = 0; i < cnum; i++) read_codebook(codebook+i, 0);
545 break;
546
547 case 0x2400:
548 case 0x2600: /* 8 bit per pixel */
549 codebook = (chunk_id == 0x2600 ? v1_codebook : v4_codebook);
550 cnum = chunk_size/4;
551 for(i = 0; i < cnum; i++) read_codebook(codebook+i, 1);
552 break;
553
554 case 0x2100:
555 case 0x2300:
556 codebook = (chunk_id == 0x2300 ? v1_codebook : v4_codebook);
557
558 ci = 0;
559 while(chunk_size > 0)
560 {
561 flag = get_long();
562 chunk_size -= 4;
563
564 for(i = 0; i < 32; i++)
565 {
566 if(flag & 0x80000000)
567 {
568 chunk_size -= 6;
569 read_codebook(codebook+ci, 0);
570 }
571
572 ci++;
573 flag <<= 1;
574 }
575 }
576 while(chunk_size > 0) { skip_byte(); chunk_size--; }
577 break;
578
579 case 0x2500:
580 case 0x2700: /* 8 bit per pixel */
581 codebook = (chunk_id == 0x2700 ? v1_codebook : v4_codebook);
582
583 ci = 0;
584 while(chunk_size > 0)
585 {
586 flag = get_long();
587 chunk_size -= 4;
588
589 for(i = 0; i < 32; i++)
590 {
591 if(flag & 0x80000000)
592 {
593 chunk_size -= 4;
594 read_codebook(codebook+ci, 1);
595 }
596
597 ci++;
598 flag <<= 1;
599 }
600 }
601 while(chunk_size > 0) { skip_byte(); chunk_size--; }
602 break;
603
604 /* -------------------- Frame -------------------- */
605 case 0x3000:
606 while((chunk_size > 0) && (y < y_bottom))
607 {
608 flag = get_long();
609 chunk_size -= 4;
610
611 for(i = 0; i < 32; i++)
612 {
613 if(y >= y_bottom) break;
614 if(flag & 0x80000000) /* 4 bytes per block */
615 {
616 d0 = get_byte();
617 d1 = get_byte();
618 d2 = get_byte();
619 d3 = get_byte();
620 chunk_size -= 4;
621
622 addr = get_addr(inverted, x, y, frm_stride, bpp, out_height);
623 cvid_v4(frm_ptr + addr, output, frm_stride, inverted, v4_codebook+d0, v4_codebook+d1, v4_codebook+d2, v4_codebook+d3);
624 }
625 else /* 1 byte per block */
626 {
627 addr = get_addr(inverted, x, y, frm_stride, bpp, out_height);
628 cvid_v1(frm_ptr + addr, output, frm_stride, inverted, v1_codebook + get_byte());
629
630 chunk_size--;
631 }
632
633 x += 4;
634 if(x >= out_width)
635 {
636 x = 0;
637 y += 4;
638 }
639 flag <<= 1;
640 }
641 }
642 while(chunk_size > 0) { skip_byte(); chunk_size--; }
643 break;
644
645 case 0x3100:
646 while((chunk_size > 0) && (y < y_bottom))
647 {
648 /* ---- flag bits: 0 = SKIP, 10 = V1, 11 = V4 ---- */
649 flag = get_long();
650 chunk_size -= 4;
651 mask = 0x80000000;
652
653 while((mask) && (y < y_bottom))
654 {
655 if(flag & mask)
656 {
657 if(mask == 1)
658 {
659 if(chunk_size < 0) break;
660 flag = get_long();
661 chunk_size -= 4;
662 mask = 0x80000000;
663 }
664 else mask >>= 1;
665
666 if(flag & mask) /* V4 */
667 {
668 d0 = get_byte();
669 d1 = get_byte();
670 d2 = get_byte();
671 d3 = get_byte();
672 chunk_size -= 4;
673
674 addr = get_addr(inverted, x, y, frm_stride, bpp, out_height);
675 cvid_v4(frm_ptr + addr, output, frm_stride, inverted, v4_codebook+d0, v4_codebook+d1, v4_codebook+d2, v4_codebook+d3);
676 }
677 else /* V1 */
678 {
679 chunk_size--;
680
681 addr = get_addr(inverted, x, y, frm_stride, bpp, out_height);
682 cvid_v1(frm_ptr + addr, output, frm_stride, inverted, v1_codebook + get_byte());
683 }
684 } /* else SKIP */
685
686 mask >>= 1;
687 x += 4;
688 if(x >= out_width)
689 {
690 x = 0;
691 y += 4;
692 }
693 }
694 }
695
696 while(chunk_size > 0) { skip_byte(); chunk_size--; }
697 break;
698
699 case 0x3200: /* each byte is a V1 codebook */
700 while((chunk_size > 0) && (y < y_bottom))
701 {
702 addr = get_addr(inverted, x, y, frm_stride, bpp, out_height);
703 cvid_v1(frm_ptr + addr, output, frm_stride, inverted, v1_codebook + get_byte());
704
705 chunk_size--;
706 x += 4;
707 if(x >= out_width)
708 {
709 x = 0;
710 y += 4;
711 }
712 }
713 while(chunk_size > 0) { skip_byte(); chunk_size--; }
714 break;
715
716 default:
717 ERR("CVID: unknown chunk_id %08lx\n", chunk_id);
718 while(chunk_size > 0) { skip_byte(); chunk_size--; }
719 break;
720 }
721 }
722 }
723
724 if(frame.length != size)
725 {
726 if(frame.length & 0x01) frame.length++; /* AVIs tend to have a size mismatch */
727 if(frame.length != size)
728 {
729 long xlen;
730 skip_byte();
731 xlen = get_byte() << 16;
732 xlen |= get_byte() << 8;
733 xlen |= get_byte(); /* Read Len */
734 WARN("CVID: END INFO chunk size %d cvid size1 %ld cvid size2 %ld\n",
735 size, frame.length, xlen);
736 }
737 }
738}
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLuint mask
Definition: glext.h:6028
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLenum const GLvoid * addr
Definition: glext.h:9621
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
Definition: glfuncs.h:52
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
Definition: glfuncs.h:248
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)
Definition: iccvid.c:177
static void read_codebook(cvid_codebook *c, int mode)
Definition: iccvid.c:97
void(* fn_cvid_v1)(unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
Definition: iccvid.c:382
static int get_stride(int width, int depth)
Definition: iccvid.c:171
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)
Definition: iccvid.c:384
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)
Definition: iccvid.c:277
static void cvid_v1_16(unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
Definition: iccvid.c:254
static void cvid_v1_15(unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
Definition: iccvid.c:300
#define get_byte()
Definition: iccvid.c:88
#define get_word()
Definition: iccvid.c:90
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)
Definition: iccvid.c:227
#define get_long()
Definition: iccvid.c:92
static void cvid_v1_32(unsigned char *frm, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
Definition: iccvid.c:150
static long get_addr(BOOL inverted, unsigned long x, unsigned long y, int frm_stride, int bpp, unsigned int out_height)
Definition: iccvid.c:134
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)
Definition: iccvid.c:323
static void cvid_v1_24(unsigned char *vptr, unsigned char *limit, int stride, BOOL inverted, cvid_codebook *cb)
Definition: iccvid.c:201
#define MAX_STRIPS
Definition: iccvid.c:61
#define skip_byte()
Definition: iccvid.c:89
GLint x0
Definition: linetemp.h:95
GLint y0
Definition: linetemp.h:96
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TRACE(s)
Definition: solgame.cpp:4
cvid_codebook * v4_codebook[MAX_STRIPS]
Definition: iccvid.c:72
unsigned int strip_num
Definition: iccvid.c:74
cvid_codebook * v1_codebook[MAX_STRIPS]
Definition: iccvid.c:73
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
ULONG bpp[]
Definition: xlate.c:19

Referenced by ICCVID_Decompress(), and ICCVID_DecompressEx().

◆ decode_cinepak_init()

static cinepak_info * decode_cinepak_init ( void  )
static

Definition at line 350 of file iccvid.c.

351{
352 cinepak_info *cvinfo;
353 int i;
354
355 cvinfo = malloc(sizeof(cinepak_info));
356 if( !cvinfo )
357 return NULL;
358 cvinfo->strip_num = 0;
359
360 if(uiclp == NULL)
361 {
362 uiclp = uiclip+512;
363 for(i = -512; i < 512; i++)
364 uiclp[i] = (i < 0 ? 0 : (i > 255 ? 255 : i));
365 }
366
367 return cvinfo;
368}
static unsigned char uiclip[1024]
Definition: iccvid.c:86
static unsigned char * uiclp
Definition: iccvid.c:86

Referenced by ICCVID_DecompressBegin().

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hModule,
DWORD  dwReason,
LPVOID  lpReserved 
)

Definition at line 1045 of file iccvid.c.

1046{
1047 TRACE("(%p,%ld,%p)\n", hModule, dwReason, lpReserved);
1048
1049 switch (dwReason)
1050 {
1051 case DLL_PROCESS_ATTACH:
1054 break;
1055 }
1056 return TRUE;
1057}
DWORD dwReason
Definition: misc.cpp:135
#define TRUE
Definition: types.h:120
HMODULE hModule
Definition: animate.c:44
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
static HINSTANCE ICCVID_hModule
Definition: iccvid.c:57
_In_ DWORD _In_ int _In_ int _In_opt_ LPNLSVERSIONINFO _In_opt_ LPVOID lpReserved
Definition: winnls.h:1279

◆ free_cvinfo()

static void free_cvinfo ( cinepak_info *  cvinfo)
static

Definition at line 370 of file iccvid.c.

371{
372 unsigned int i;
373
374 for( i=0; i<cvinfo->strip_num; i++ )
375 {
376 free(cvinfo->v4_codebook[i]);
377 free(cvinfo->v1_codebook[i]);
378 }
379 free( cvinfo );
380}
#define free
Definition: debug_ros.c:5

Referenced by ICCVID_Close(), ICCVID_DecompressBegin(), and ICCVID_DecompressEnd().

◆ get_addr()

static long get_addr ( BOOL  inverted,
unsigned long  x,
unsigned long  y,
int  frm_stride,
int  bpp,
unsigned int  out_height 
)
inlinestatic

Definition at line 134 of file iccvid.c.

136{
137 /* Returns the starting position of a line from top-down or bottom-up */
138 if (inverted)
139 return y * frm_stride + x * bpp;
140 else
141 return (out_height - 1 - y) * frm_stride + x * bpp;
142}

Referenced by decode_cinepak().

◆ get_stride()

static int get_stride ( int  width,
int  depth 
)
inlinestatic

Definition at line 171 of file iccvid.c.

172{
173 return ((depth * width + 31) >> 3) & ~3;
174}
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546

Referenced by decode_cinepak(), and ICCVID_DecompressGetFormat().

◆ ICCVID_CheckMask()

static int ICCVID_CheckMask ( RGBQUAD  bmiColors[3],
COLORREF  redMask,
COLORREF  blueMask,
COLORREF  greenMask 
)
inlinestatic

Definition at line 755 of file iccvid.c.

756{
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);
760
761 TRACE("\nbmiColors[0] = 0x%08lx\nbmiColors[1] = 0x%08lx\nbmiColors[2] = 0x%08lx\n",
762 realRedMask, realBlueMask, realGreenMask);
763
764 if ((realRedMask == redMask) &&
765 (realBlueMask == blueMask) &&
766 (realGreenMask == greenMask))
767 return TRUE;
768 return FALSE;
769}
#define FALSE
Definition: types.h:117
DWORD COLORREF
Definition: windef.h:100

Referenced by ICCVID_DecompressBegin(), and ICCVID_DecompressQuery().

◆ ICCVID_Close()

static LRESULT ICCVID_Close ( ICCVID_Info *  info)
static

Definition at line 932 of file iccvid.c.

933{
934 if( (info==NULL) || (info->dwMagic!=ICCVID_MAGIC) )
935 return 0;
936 if( info->cvinfo )
937 free_cvinfo( info->cvinfo );
938 free( info );
939 return 1;
940}
#define ICCVID_MAGIC
Definition: iccvid.c:59
static void free_cvinfo(cinepak_info *cvinfo)
Definition: iccvid.c:370

Referenced by ICCVID_DriverProc().

◆ ICCVID_Decompress()

static LRESULT ICCVID_Decompress ( ICCVID_Info *  info,
ICDECOMPRESS *  icd,
DWORD  size 
)
static

Definition at line 880 of file iccvid.c.

881{
883 BOOL inverted;
884
885 TRACE("ICM_DECOMPRESS %p %p %ld\n", info, icd, size);
886
887 if( (info==NULL) || (info->dwMagic!=ICCVID_MAGIC) )
888 return ICERR_BADPARAM;
889 if (info->cvinfo==NULL)
890 {
891 ERR("ICM_DECOMPRESS sent after ICM_DECOMPRESS_END\n");
892 return ICERR_BADPARAM;
893 }
894
895 width = icd->lpbiInput->biWidth;
896 height = icd->lpbiInput->biHeight;
897 inverted = -icd->lpbiOutput->biHeight == height;
898
899 decode_cinepak(info->cvinfo, icd->lpInput, icd->lpbiInput->biSizeImage,
900 icd->lpOutput, width, height, info->bits_per_pixel, inverted);
901
902 return ICERR_OK;
903}
unsigned int BOOL
Definition: ntddk_ex.h:94
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)
Definition: iccvid.c:402
long LONG
Definition: pedump.c:60
DWORD biSizeImage
Definition: amvideo.idl:36
LPBITMAPINFOHEADER lpbiInput
Definition: vfw.h:335
LPBITMAPINFOHEADER lpbiOutput
Definition: vfw.h:337
#define ICERR_BADPARAM
Definition: vfw.h:61
#define ICERR_OK
Definition: vfw.h:50

Referenced by ICCVID_DriverProc().

◆ ICCVID_DecompressBegin()

static LRESULT ICCVID_DecompressBegin ( ICCVID_Info *  info,
LPBITMAPINFO  in,
LPBITMAPINFO  out 
)
static

Definition at line 844 of file iccvid.c.

845{
846 TRACE("ICM_DECOMPRESS_BEGIN %p %p %p\n", info, in, out);
847
848 if( (info==NULL) || (info->dwMagic!=ICCVID_MAGIC) )
849 return ICERR_BADPARAM;
850
851 info->bits_per_pixel = out->bmiHeader.biBitCount;
852
853 if (info->bits_per_pixel == 16)
854 {
855 if ( out->bmiHeader.biCompression == BI_BITFIELDS )
856 {
857 if ( ICCVID_CheckMask(out->bmiColors, 0x7C00, 0x03E0, 0x001F) )
858 info->bits_per_pixel = 15;
859 else if ( ICCVID_CheckMask(out->bmiColors, 0xF800, 0x07E0, 0x001F) )
860 info->bits_per_pixel = 16;
861 else
862 {
863 TRACE("unsupported output bit field(s) for 16-bit colors\n");
864 return ICERR_UNSUPPORTED;
865 }
866 }
867 else
868 info->bits_per_pixel = 15;
869 }
870
871 TRACE("bit_per_pixel = %d\n", info->bits_per_pixel);
872
873 if( info->cvinfo )
874 free_cvinfo( info->cvinfo );
875 info->cvinfo = decode_cinepak_init();
876
877 return ICERR_OK;
878}
GLuint in
Definition: glext.h:9616
static int ICCVID_CheckMask(RGBQUAD bmiColors[3], COLORREF redMask, COLORREF blueMask, COLORREF greenMask)
Definition: iccvid.c:755
static cinepak_info * decode_cinepak_init(void)
Definition: iccvid.c:350
#define BI_BITFIELDS
Definition: mmreg.h:507
#define ICERR_UNSUPPORTED
Definition: vfw.h:56
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

Referenced by ICCVID_DriverProc().

◆ ICCVID_DecompressEnd()

static LRESULT ICCVID_DecompressEnd ( ICCVID_Info *  info)
static

Definition at line 961 of file iccvid.c.

962{
963 if( info->cvinfo )
964 {
965 free_cvinfo( info->cvinfo );
966 info->cvinfo = NULL;
967 }
968 return ICERR_OK;
969}

Referenced by ICCVID_DriverProc().

◆ ICCVID_DecompressEx()

static LRESULT ICCVID_DecompressEx ( ICCVID_Info *  info,
ICDECOMPRESSEX *  icd,
DWORD  size 
)
static

Definition at line 905 of file iccvid.c.

906{
908 BOOL inverted;
909
910 TRACE("ICM_DECOMPRESSEX %p %p %ld\n", info, icd, size);
911
912 if( (info==NULL) || (info->dwMagic!=ICCVID_MAGIC) )
913 return ICERR_BADPARAM;
914 if (info->cvinfo==NULL)
915 {
916 ERR("ICM_DECOMPRESSEX sent after ICM_DECOMPRESS_END\n");
917 return ICERR_BADPARAM;
918 }
919
920 /* FIXME: flags are ignored */
921
922 width = icd->lpbiSrc->biWidth;
923 height = icd->lpbiSrc->biHeight;
924 inverted = -icd->lpbiDst->biHeight == height;
925
926 decode_cinepak(info->cvinfo, icd->lpSrc, icd->lpbiSrc->biSizeImage,
927 icd->lpDst, width, height, info->bits_per_pixel, inverted);
928
929 return ICERR_OK;
930}
LPBITMAPINFOHEADER lpbiSrc
Definition: vfw.h:344
LPVOID lpDst
Definition: vfw.h:347
LPVOID lpSrc
Definition: vfw.h:345
LPBITMAPINFOHEADER lpbiDst
Definition: vfw.h:346

Referenced by ICCVID_DriverProc().

◆ ICCVID_DecompressGetFormat()

static LRESULT ICCVID_DecompressGetFormat ( ICCVID_Info *  info,
LPBITMAPINFO  in,
LPBITMAPINFO  out 
)
static

Definition at line 820 of file iccvid.c.

821{
822 DWORD size;
823
824 TRACE("ICM_DECOMPRESS_GETFORMAT %p %p %p\n", info, in, out);
825
826 if( (info==NULL) || (info->dwMagic!=ICCVID_MAGIC) )
827 return ICERR_BADPARAM;
828
829 size = in->bmiHeader.biSize;
830 if (in->bmiHeader.biBitCount <= 8)
831 size += in->bmiHeader.biClrUsed * sizeof(RGBQUAD);
832
833 if( out )
834 {
835 memcpy( out, in, size );
836 out->bmiHeader.biBitCount = 24;
837 out->bmiHeader.biCompression = BI_RGB;
838 out->bmiHeader.biSizeImage = get_stride(in->bmiHeader.biWidth, 24) * in->bmiHeader.biHeight;
839 return ICERR_OK;
840 }
841 return size;
842}
ULONG RGBQUAD
Definition: precomp.h:47
unsigned long DWORD
Definition: ntddk_ex.h:95
#define BI_RGB
Definition: uefivid.c:46

Referenced by ICCVID_DriverProc().

◆ ICCVID_DecompressQuery()

static LRESULT ICCVID_DecompressQuery ( ICCVID_Info *  info,
LPBITMAPINFO  in,
LPBITMAPINFO  out 
)
static

Definition at line 771 of file iccvid.c.

772{
773 TRACE("ICM_DECOMPRESS_QUERY %p %p %p\n", info, in, out);
774
775 if( (info==NULL) || (info->dwMagic!=ICCVID_MAGIC) )
776 return ICERR_BADPARAM;
777
778 TRACE("in: ");
780
781 if( in->bmiHeader.biCompression != ICCVID_MAGIC )
782 return ICERR_BADFORMAT;
783
784 if( out )
785 {
786 TRACE("out: ");
788
789 if( in->bmiHeader.biPlanes != out->bmiHeader.biPlanes )
790 return ICERR_BADFORMAT;
791 if( in->bmiHeader.biHeight != out->bmiHeader.biHeight )
792 {
793 if( in->bmiHeader.biHeight != -out->bmiHeader.biHeight )
794 return ICERR_BADFORMAT;
795 TRACE("Detected inverted height for video output\n");
796 }
797 if( in->bmiHeader.biWidth != out->bmiHeader.biWidth )
798 return ICERR_BADFORMAT;
799
800 switch( out->bmiHeader.biCompression )
801 {
802 case BI_RGB:
803 if ( out->bmiHeader.biBitCount == 16 || out->bmiHeader.biBitCount == 24 || out->bmiHeader.biBitCount == 32 )
804 return ICERR_OK;
805 break;
806 case BI_BITFIELDS:
807 if ( out->bmiHeader.biBitCount == 16 && ICCVID_CheckMask(out->bmiColors, 0x7C00, 0x03E0, 0x001F) )
808 return ICERR_OK;
809 if ( out->bmiHeader.biBitCount == 16 && ICCVID_CheckMask(out->bmiColors, 0xF800, 0x07E0, 0x001F) )
810 return ICERR_OK;
811 break;
812 }
813 TRACE("unsupported output format\n");
814 return ICERR_BADFORMAT;
815 }
816
817 return ICERR_OK;
818}
static void ICCVID_dump_BITMAPINFO(const BITMAPINFO *bmi)
Definition: iccvid.c:740
#define ICERR_BADFORMAT
Definition: vfw.h:57

Referenced by ICCVID_DriverProc().

◆ ICCVID_DriverProc()

LRESULT WINAPI ICCVID_DriverProc ( DWORD_PTR  dwDriverId,
HDRVR  hdrvr,
UINT  msg,
LPARAM  lParam1,
LPARAM  lParam2 
)

Definition at line 971 of file iccvid.c.

973{
974 ICCVID_Info *info = (ICCVID_Info *) dwDriverId;
975
976 TRACE("%Id %p %d %Id %Id\n", dwDriverId, hdrvr, msg, lParam1, lParam2);
977
978 switch( msg )
979 {
980 case DRV_LOAD:
981 TRACE("Loaded\n");
982 return 1;
983 case DRV_ENABLE:
984 return 0;
985 case DRV_DISABLE:
986 return 0;
987 case DRV_FREE:
988 return 0;
989
990 case DRV_OPEN:
991 {
992 ICINFO *icinfo = (ICINFO *)lParam2;
993
994 TRACE("Opened\n");
995
996 if (icinfo && compare_fourcc(icinfo->fccType, ICTYPE_VIDEO)) return 0;
997
998 info = malloc(sizeof(ICCVID_Info));
999 if( info )
1000 {
1001 info->dwMagic = ICCVID_MAGIC;
1002 info->cvinfo = NULL;
1003 }
1004 return (LRESULT) info;
1005 }
1006
1007 case DRV_CLOSE:
1008 return ICCVID_Close( info );
1009
1010 case ICM_GETINFO:
1011 return ICCVID_GetInfo( info, (ICINFO *)lParam1, (DWORD)lParam2 );
1012
1014 return ICCVID_DecompressQuery( info, (LPBITMAPINFO) lParam1,
1015 (LPBITMAPINFO) lParam2 );
1017 return ICCVID_DecompressGetFormat( info, (LPBITMAPINFO) lParam1,
1018 (LPBITMAPINFO) lParam2 );
1020 return ICCVID_DecompressBegin( info, (LPBITMAPINFO) lParam1,
1021 (LPBITMAPINFO) lParam2 );
1022 case ICM_DECOMPRESS:
1023 return ICCVID_Decompress( info, (ICDECOMPRESS*) lParam1,
1024 (DWORD) lParam2 );
1025 case ICM_DECOMPRESSEX:
1026 return ICCVID_DecompressEx( info, (ICDECOMPRESSEX*) lParam1,
1027 (DWORD) lParam2 );
1028
1029 case ICM_DECOMPRESS_END:
1030 return ICCVID_DecompressEnd( info );
1031
1032 case ICM_COMPRESS_QUERY:
1033 FIXME("compression not implemented\n");
1034 return ICERR_BADFORMAT;
1035
1036 case ICM_CONFIGURE:
1037 return ICERR_UNSUPPORTED;
1038
1039 default:
1040 FIXME("Unknown message: %04x %Id %Id\n", msg, lParam1, lParam2);
1041 }
1042 return ICERR_UNSUPPORTED;
1043}
#define msg(x)
Definition: auth_time.c:54
#define FIXME(fmt,...)
Definition: precomp.h:53
static LRESULT ICCVID_Decompress(ICCVID_Info *info, ICDECOMPRESS *icd, DWORD size)
Definition: iccvid.c:880
static LRESULT ICCVID_DecompressGetFormat(ICCVID_Info *info, LPBITMAPINFO in, LPBITMAPINFO out)
Definition: iccvid.c:820
static LRESULT ICCVID_DecompressBegin(ICCVID_Info *info, LPBITMAPINFO in, LPBITMAPINFO out)
Definition: iccvid.c:844
static LRESULT ICCVID_DecompressEx(ICCVID_Info *info, ICDECOMPRESSEX *icd, DWORD size)
Definition: iccvid.c:905
#define compare_fourcc(fcc1, fcc2)
Definition: iccvid.c:60
static LRESULT ICCVID_DecompressEnd(ICCVID_Info *info)
Definition: iccvid.c:961
static LRESULT ICCVID_Close(ICCVID_Info *info)
Definition: iccvid.c:932
static LRESULT ICCVID_DecompressQuery(ICCVID_Info *info, LPBITMAPINFO in, LPBITMAPINFO out)
Definition: iccvid.c:771
static LRESULT ICCVID_GetInfo(ICCVID_Info *info, ICINFO *icinfo, DWORD dwSize)
Definition: iccvid.c:942
#define DRV_LOAD(x)
LONG_PTR LRESULT
Definition: minwindef.h:176
#define ICTYPE_VIDEO
Definition: mmreg.h:531
#define DRV_CLOSE
Definition: mmsystem.h:122
#define DRV_ENABLE
Definition: mmsystem.h:120
#define DRV_OPEN
Definition: mmsystem.h:121
#define DRV_FREE
Definition: mmsystem.h:124
#define DRV_DISABLE
Definition: mmsystem.h:123
Definition: vfw.h:280
DWORD fccType
Definition: vfw.h:282
#define ICM_COMPRESS_QUERY
Definition: vfw.h:101
#define ICM_DECOMPRESS_QUERY
Definition: vfw.h:107
#define ICM_GETINFO
Definition: vfw.h:82
#define ICM_DECOMPRESSEX
Definition: vfw.h:140
#define ICM_DECOMPRESS_GET_FORMAT
Definition: vfw.h:106
#define ICM_CONFIGURE
Definition: vfw.h:84
#define ICM_DECOMPRESS_END
Definition: vfw.h:110
#define ICM_DECOMPRESS_BEGIN
Definition: vfw.h:108
#define ICM_DECOMPRESS
Definition: vfw.h:109

◆ ICCVID_dump_BITMAPINFO()

static void ICCVID_dump_BITMAPINFO ( const BITMAPINFO *  bmi)
static

Definition at line 740 of file iccvid.c.

741{
742 TRACE(
743 "planes = %d\n"
744 "bpp = %d\n"
745 "height = %ld\n"
746 "width = %ld\n"
747 "compr = %s\n",
748 bmi->bmiHeader.biPlanes,
750 bmi->bmiHeader.biHeight,
751 bmi->bmiHeader.biWidth,
753}
static __inline const char * debugstr_fourcc(unsigned int cc)
Definition: debug.h:397
USHORT biBitCount
Definition: precomp.h:34
ULONG biCompression
Definition: precomp.h:35
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1922

Referenced by ICCVID_DecompressQuery().

◆ ICCVID_GetInfo()

static LRESULT ICCVID_GetInfo ( ICCVID_Info *  info,
ICINFO *  icinfo,
DWORD  dwSize 
)
static

Definition at line 942 of file iccvid.c.

943{
944 if (!icinfo) return sizeof(ICINFO);
945 if (dwSize < sizeof(ICINFO)) return 0;
946
947 icinfo->dwSize = sizeof(ICINFO);
948 icinfo->fccType = ICTYPE_VIDEO;
949 icinfo->fccHandler = info ? info->dwMagic : ICCVID_MAGIC;
950 icinfo->dwFlags = 0;
951 icinfo->dwVersion = ICVERSION;
952 icinfo->dwVersionICM = ICVERSION;
953
956 /* msvfw32 will fill icinfo->szDriver for us */
957
958 return sizeof(ICINFO);
959}
#define IDS_DESCRIPTION
Definition: resource.h:4
#define ARRAY_SIZE(A)
Definition: main.h:20
#define IDS_NAME
Definition: resource.h:90
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define LoadStringW
Definition: utils.h:64
DWORD dwSize
Definition: vfw.h:281
DWORD dwVersionICM
Definition: vfw.h:286
DWORD dwFlags
Definition: vfw.h:284
DWORD dwVersion
Definition: vfw.h:285
DWORD fccHandler
Definition: vfw.h:283
WCHAR szDescription[128]
Definition: vfw.h:291
WCHAR szName[16]
Definition: vfw.h:290
#define ICVERSION
Definition: vfw.h:45

Referenced by ICCVID_DriverProc().

◆ read_codebook()

static void read_codebook ( cvid_codebook *  c,
int  mode 
)
inlinestatic

Definition at line 97 of file iccvid.c.

98{
99int uvr, uvg, uvb;
100
101 if(mode) /* black and white */
102 {
103 c->y0 = get_byte();
104 c->y1 = get_byte();
105 c->y2 = get_byte();
106 c->y3 = get_byte();
107 c->u = c->v = 0;
108
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;
113 }
114 else /* colour */
115 {
116 c->y0 = get_byte(); /* luma */
117 c->y1 = get_byte();
118 c->y2 = get_byte();
119 c->y3 = get_byte();
120 c->u = get_byte(); /* chroma */
121 c->v = get_byte();
122
123 uvr = c->v << 1;
124 uvg = -((c->u+1) >> 1) - c->v;
125 uvb = c->u << 1;
126
127 c->r[0] = uiclp[c->y0 + uvr]; c->g[0] = uiclp[c->y0 + uvg]; c->b[0] = uiclp[c->y0 + uvb];
128 c->r[1] = uiclp[c->y1 + uvr]; c->g[1] = uiclp[c->y1 + uvg]; c->b[1] = uiclp[c->y1 + uvb];
129 c->r[2] = uiclp[c->y2 + uvr]; c->g[2] = uiclp[c->y2 + uvg]; c->b[2] = uiclp[c->y2 + uvb];
130 c->r[3] = uiclp[c->y3 + uvr]; c->g[3] = uiclp[c->y3 + uvg]; c->b[3] = uiclp[c->y3 + uvb];
131 }
132}
const GLubyte * c
Definition: glext.h:8905
GLenum mode
Definition: glext.h:6217

Referenced by decode_cinepak().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( iccvid  )

Variable Documentation

◆ ICCVID_hModule

HINSTANCE ICCVID_hModule
static

Definition at line 57 of file iccvid.c.

Referenced by DllMain(), and ICCVID_GetInfo().

◆ in_buffer

◆ uiclip

unsigned char uiclip[1024]
static

Definition at line 86 of file iccvid.c.

Referenced by decode_cinepak_init().

◆ uiclp

unsigned char * uiclp = NULL
static

Definition at line 86 of file iccvid.c.

Referenced by decode_cinepak_init(), and read_codebook().