Mercurial > mplayer.hg
annotate libmpcodecs/native/cinepak.c @ 5607:1972c3475d93
mp_image.h and img_format.h moved to libmpcodecs
author | arpi |
---|---|
date | Sat, 13 Apr 2002 19:14:34 +0000 |
parents | 628c85c15c7b |
children | 33f2f851d264 |
rev | line source |
---|---|
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
1 /* ------------------------------------------------------------------------ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
2 * Radius Cinepak Video Decoder |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
3 * |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
4 * Dr. Tim Ferguson, 2001. |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
5 * For more details on the algorithm: |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
6 * http://www.csse.monash.edu.au/~timf/videocodec.html |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
7 * |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
8 * This is basically a vector quantiser with adaptive vector density. The |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
9 * frame is segmented into 4x4 pixel blocks, and each block is coded using |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
10 * either 1 or 4 vectors. |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
11 * |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
12 * There are still some issues with this code yet to be resolved. In |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
13 * particular with decoding in the strip boundaries. |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
14 * ------------------------------------------------------------------------ */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
15 #include <stdio.h> |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
16 #include <stdlib.h> |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
17 #include <string.h> |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
18 #include <sys/types.h> |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
19 #include <unistd.h> |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
20 #include <math.h> |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
21 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
22 #include "config.h" |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
23 #include "mp_msg.h" |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
24 #include "bswap.h" |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
25 |
5607 | 26 #include "img_format.h" |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
27 #include "mp_image.h" |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
28 |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
29 #define DBUG 0 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
30 #define MAX_STRIPS 32 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
31 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
32 /* ------------------------------------------------------------------------ */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
33 typedef struct |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
34 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
35 unsigned char y0, y1, y2, y3; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
36 char u, v; |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
37 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
38 // These variables are for YV12 output: The v1 vars are for |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
39 // when the vector is doublesized and used by itself to paint a |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
40 // 4x4 block. |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
41 // This quad (y0 y0 y1 y1) is used on the 2 upper rows. |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
42 unsigned long yv12_v1_u; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
43 // This quad (y2 y2 y3 y3) is used on the 2 lower rows. |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
44 unsigned long yv12_v1_l; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
45 // The v4 vars are for when the vector is used as 1 of 4 vectors |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
46 // to paint a 4x4 block. |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
47 // Upper pair (y0 y1): |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
48 unsigned short yv12_v4_u; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
49 // Lower pair (y2 y3): |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
50 unsigned short yv12_v4_l; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
51 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
52 // These longs are for YUY2 output: The v1 vars are for when the |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
53 // vector is doublesized and used by itself to paint a 4x4 block. |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
54 // The names stand for the upper-left, upper-right, |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
55 // lower-left, and lower-right YUY2 pixel pairs. |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
56 unsigned long yuy2_v1_ul, yuy2_v1_ur; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
57 unsigned long yuy2_v1_ll, yuy2_v1_lr; |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
58 // The v4 vars are for when the vector is used as 1 of 4 vectors |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
59 // to paint a 4x4 block. The names stand for upper and lower |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
60 // YUY2 pixel pairs. |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
61 unsigned long yuy2_v4_u, yuy2_v4_l; |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
62 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
63 // These longs are for BGR32 output |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
64 unsigned long rgb0, rgb1, rgb2, rgb3; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
65 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
66 // These char arrays are for BGR24 output |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
67 unsigned char r[4], g[4], b[4]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
68 } cvid_codebook; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
69 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
70 typedef struct { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
71 cvid_codebook *v4_codebook[MAX_STRIPS]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
72 cvid_codebook *v1_codebook[MAX_STRIPS]; |
4628
1504901deed8
Fixed FILM demuxer so that it now plays (my) FILM files
melanson
parents:
4076
diff
changeset
|
73 unsigned long strip_num; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
74 } cinepak_info; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
75 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
76 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
77 /* ------------------------------------------------------------------------ */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
78 static unsigned char *in_buffer, uiclip[1024], *uiclp = NULL; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
79 |
4076
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
80 #define SCALEBITS 16 |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
81 #define ONE_HALF ((long) 1 << (SCALEBITS-1)) |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
82 #define FIX(x) ((long) ((x) * (1L<<SCALEBITS) + 0.5)) |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
83 static long CU_Y_tab[256], CV_Y_tab[256], CU_Cb_tab[256], CV_Cb_tab[256], |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
84 CU_Cr_tab[256], CV_Cr_tab[256]; |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
85 |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
86 #define get_byte() *(in_buffer++) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
87 #define skip_byte() in_buffer++ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
88 #define get_word() ((unsigned short)(in_buffer += 2, \ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
89 (in_buffer[-2] << 8 | in_buffer[-1]))) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
90 #define get_long() ((unsigned long)(in_buffer += 4, \ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
91 (in_buffer[-4] << 24 | in_buffer[-3] << 16 | in_buffer[-2] << 8 | in_buffer[-1]))) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
92 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
93 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
94 /* ---------------------------------------------------------------------- */ |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
95 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
96 // This PACKing macro packs the luminance bytes as y1-y1-y0-y0, which is |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
97 // stored on a little endian machine as y0-y0-y1-y1. Therefore, treat it as |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
98 // a little endian number and rearrange the bytes on big endian machines |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
99 // using the built-in byte order macros. |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
100 #define PACK_YV12_V1_Y(cb,y0,y1) le2me_32((((unsigned char)cb->y1)<<24)|(cb->y1<<16)|(((unsigned char)cb->y0)<<8)|(cb->y0)) |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
101 #define PACK_YV12_V4_Y(cb,y0,y1) le2me_16((((unsigned char)cb->y1)<<8)|(cb->y0)) |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
102 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
103 static inline void read_codebook_yv12(cvid_codebook *c, int mode) |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
104 { |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
105 unsigned char y0, y1, y2, y3, u, v; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
106 int y_uv; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
107 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
108 if(mode) /* black and white */ |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
109 { |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
110 c->y0 = get_byte(); |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
111 c->y1 = get_byte(); |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
112 c->y2 = get_byte(); |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
113 c->y3 = get_byte(); |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
114 c->u = c->v = 128; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
115 } |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
116 else /* colour */ |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
117 { |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
118 y0 = get_byte(); /* luma */ |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
119 y1 = get_byte(); |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
120 y2 = get_byte(); |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
121 y3 = get_byte(); |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
122 u = 128+get_byte(); /* chroma */ |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
123 v = 128+get_byte(); |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
124 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
125 /* YUV * inv(CinYUV) |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
126 * | Y | | 1 -0.0655 0.0110 | | CY | |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
127 * | Cb | = | 0 1.1656 -0.0062 | | CU | |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
128 * | Cr | | 0 0.0467 1.4187 | | CV | |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
129 */ |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
130 y_uv = (int)((CU_Y_tab[u] + CV_Y_tab[v]) >> SCALEBITS); |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
131 c->y0 = uiclp[y0 + y_uv]; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
132 c->y1 = uiclp[y1 + y_uv]; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
133 c->y2 = uiclp[y2 + y_uv]; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
134 c->y3 = uiclp[y3 + y_uv]; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
135 c->u = uiclp[(int)((CU_Cb_tab[u] + CV_Cb_tab[v]) >> SCALEBITS)]; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
136 c->v = uiclp[(int)((CU_Cr_tab[u] + CV_Cr_tab[v]) >> SCALEBITS)]; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
137 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
138 c->yv12_v1_u = PACK_YV12_V1_Y(c, y0, y1); |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
139 c->yv12_v1_l = PACK_YV12_V1_Y(c, y2, y3); |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
140 c->yv12_v4_u = PACK_YV12_V4_Y(c, y0, y1); |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
141 c->yv12_v4_l = PACK_YV12_V4_Y(c, y2, y3); |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
142 } |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
143 } |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
144 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
145 /* ---------------------------------------------------------------------- */ |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
146 |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
147 inline void cvid_v1_yv12(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb) |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
148 { |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
149 unsigned char *p; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
150 int stride; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
151 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
152 if(y+3>=(unsigned int)mpi->height) return; // avoid sig11 |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
153 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
154 // take care of the luminance |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
155 stride = mpi->stride[0]; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
156 p = mpi->planes[0]+y*stride+x; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
157 *((unsigned int*)p)=cb->yv12_v1_u; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
158 *((unsigned int*)(p+stride))=cb->yv12_v1_u; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
159 *((unsigned int*)(p+stride*2))=cb->yv12_v1_l; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
160 *((unsigned int*)(p+stride*3))=cb->yv12_v1_l; |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
161 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
162 // now for the chrominance |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
163 x/=2; y/=2; |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
164 |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
165 stride = mpi->stride[1]; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
166 p = mpi->planes[1]+y*stride+x; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
167 p[0]=p[1]=p[stride]=p[stride+1]=cb->u; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
168 |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
169 stride = mpi->stride[2]; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
170 p = mpi->planes[2]+y*stride+x; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
171 p[0]=p[1]=p[stride]=p[stride+1]=cb->v; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
172 |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
173 } |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
174 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
175 /* ---------------------------------------------------------------------- */ |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
176 inline void cvid_v4_yv12(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb0, |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
177 cvid_codebook *cb1, cvid_codebook *cb2, cvid_codebook *cb3) |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
178 { |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
179 unsigned char *p; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
180 int stride; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
181 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
182 if(y+3>=(unsigned int)mpi->height) return; // avoid sig11 |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
183 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
184 // take care of the luminance |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
185 stride = mpi->stride[0]; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
186 p = mpi->planes[0]+y*stride+x; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
187 ((unsigned short*)p)[0]=cb0->yv12_v4_u; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
188 ((unsigned short*)p)[1]=cb1->yv12_v4_u; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
189 ((unsigned short*)(p+stride))[0]=cb0->yv12_v4_l; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
190 ((unsigned short*)(p+stride))[1]=cb1->yv12_v4_l; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
191 ((unsigned short*)(p+stride*2))[0]=cb2->yv12_v4_u; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
192 ((unsigned short*)(p+stride*2))[1]=cb3->yv12_v4_u; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
193 ((unsigned short*)(p+stride*3))[0]=cb2->yv12_v4_l; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
194 ((unsigned short*)(p+stride*3))[1]=cb3->yv12_v4_l; |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
195 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
196 // now for the chrominance |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
197 x/=2; y/=2; |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
198 |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
199 stride = mpi->stride[1]; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
200 p = mpi->planes[1]+y*stride+x; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
201 p[0]=cb0->u; p[1]=cb1->u; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
202 p[stride]=cb2->u; p[stride+1]=cb3->u; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
203 |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
204 stride = mpi->stride[2]; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
205 p = mpi->planes[2]+y*stride+x; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
206 p[0]=cb0->v; p[1]=cb1->v; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
207 p[stride]=cb2->v; p[stride+1]=cb3->v; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
208 |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
209 } |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
210 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
211 /* ---------------------------------------------------------------------- */ |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
212 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
213 #define PACK_YUY2(cb,y0,y1,u,v) le2me_32(((((unsigned char)cb->v)<<24)|(cb->y1<<16)|(((unsigned char)cb->u)<<8)|(cb->y0))) |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
214 |
3646 | 215 static inline void read_codebook_yuy2(cvid_codebook *c, int mode) |
216 { | |
4076
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
217 unsigned char y0, y1, y2, y3, u, v; |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
218 int y_uv; |
3646 | 219 |
220 if(mode) /* black and white */ | |
221 { | |
222 c->y0 = get_byte(); | |
223 c->y1 = get_byte(); | |
224 c->y2 = get_byte(); | |
225 c->y3 = get_byte(); | |
226 c->u = c->v = 128; | |
227 } | |
228 else /* colour */ | |
229 { | |
4076
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
230 y0 = get_byte(); /* luma */ |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
231 y1 = get_byte(); |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
232 y2 = get_byte(); |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
233 y3 = get_byte(); |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
234 u = 128+get_byte(); /* chroma */ |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
235 v = 128+get_byte(); |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
236 |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
237 /* YUV * inv(CinYUV) |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
238 * | Y | | 1 -0.0655 0.0110 | | CY | |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
239 * | Cb | = | 0 1.1656 -0.0062 | | CU | |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
240 * | Cr | | 0 0.0467 1.4187 | | CV | |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
241 */ |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
242 y_uv = (int)((CU_Y_tab[u] + CV_Y_tab[v]) >> SCALEBITS); |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
243 c->y0 = uiclp[y0 + y_uv]; |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
244 c->y1 = uiclp[y1 + y_uv]; |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
245 c->y2 = uiclp[y2 + y_uv]; |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
246 c->y3 = uiclp[y3 + y_uv]; |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
247 c->u = uiclp[(int)((CU_Cb_tab[u] + CV_Cb_tab[v]) >> SCALEBITS)]; |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
248 c->v = uiclp[(int)((CU_Cr_tab[u] + CV_Cr_tab[v]) >> SCALEBITS)]; |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
249 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
250 c->yuy2_v4_u = PACK_YUY2(c, y0, y1, u, v); |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
251 c->yuy2_v4_l = PACK_YUY2(c, y2, y3, u, v); |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
252 c->yuy2_v1_ul = PACK_YUY2(c, y0, y0, u, v); |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
253 c->yuy2_v1_ur = PACK_YUY2(c, y1, y1, u, v); |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
254 c->yuy2_v1_ll = PACK_YUY2(c, y2, y2, u, v); |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
255 c->yuy2_v1_lr = PACK_YUY2(c, y3, y3, u, v); |
3646 | 256 } |
257 } | |
258 | |
259 /* ------------------------------------------------------------------------ */ | |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
260 inline void cvid_v1_yuy2(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb) |
3646 | 261 { |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
262 int stride = mpi->stride[0] / 2; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
263 unsigned long *vptr = (unsigned long *)mpi->planes[0]; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
264 |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
265 if(y+3>=(unsigned int)mpi->height) return; // avoid sig11 |
3646 | 266 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
267 vptr += (y * mpi->stride[0] + x) / 2; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
268 |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
269 vptr[0] = cb->yuy2_v1_ul; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
270 vptr[1] = cb->yuy2_v1_ur; |
3646 | 271 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
272 vptr += stride; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
273 vptr[0] = cb->yuy2_v1_ul; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
274 vptr[1] = cb->yuy2_v1_ur; |
3646 | 275 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
276 vptr += stride; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
277 vptr[0] = cb->yuy2_v1_ll; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
278 vptr[1] = cb->yuy2_v1_lr; |
3646 | 279 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
280 vptr += stride; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
281 vptr[0] = cb->yuy2_v1_ll; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
282 vptr[1] = cb->yuy2_v1_lr; |
3646 | 283 } |
284 | |
285 | |
286 /* ------------------------------------------------------------------------ */ | |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
287 inline void cvid_v4_yuy2(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb0, |
3646 | 288 cvid_codebook *cb1, cvid_codebook *cb2, cvid_codebook *cb3) |
289 { | |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
290 int stride = mpi->stride[0] / 2; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
291 unsigned long *vptr = (unsigned long *)mpi->planes[0]; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
292 |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
293 if(y+3>=(unsigned int)mpi->height) return; // avoid sig11 |
3646 | 294 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
295 vptr += (y * mpi->stride[0] + x) / 2; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
296 |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
297 vptr[0] = cb0->yuy2_v4_u; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
298 vptr[1] = cb1->yuy2_v4_u; |
3646 | 299 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
300 vptr += stride; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
301 vptr[0] = cb0->yuy2_v4_l; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
302 vptr[1] = cb1->yuy2_v4_l; |
3646 | 303 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
304 vptr += stride; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
305 vptr[0] = cb2->yuy2_v4_u; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
306 vptr[1] = cb3->yuy2_v4_u; |
3646 | 307 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
308 vptr += stride; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
309 vptr[0] = cb2->yuy2_v4_l; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
310 vptr[1] = cb3->yuy2_v4_l; |
3646 | 311 } |
312 | |
313 /* ---------------------------------------------------------------------- */ | |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
314 static inline void read_codebook_32(cvid_codebook *c, int mode) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
315 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
316 int uvr, uvg, uvb; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
317 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
318 if(mode) /* black and white */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
319 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
320 c->y0 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
321 c->y1 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
322 c->y2 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
323 c->y3 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
324 c->u = c->v = 0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
325 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
326 c->rgb0 = (c->y0 << 16) | (c->y0 << 8) | c->y0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
327 c->rgb1 = (c->y1 << 16) | (c->y1 << 8) | c->y1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
328 c->rgb2 = (c->y2 << 16) | (c->y2 << 8) | c->y2; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
329 c->rgb3 = (c->y3 << 16) | (c->y3 << 8) | c->y3; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
330 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
331 else /* colour */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
332 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
333 c->y0 = get_byte(); /* luma */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
334 c->y1 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
335 c->y2 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
336 c->y3 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
337 c->u = get_byte(); /* chroma */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
338 c->v = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
339 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
340 uvr = c->v << 1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
341 uvg = -((c->u+1) >> 1) - c->v; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
342 uvb = c->u << 1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
343 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
344 c->rgb0 = le2me_32((uiclp[c->y0 + uvr] << 16) | (uiclp[c->y0 + uvg] << 8) | uiclp[c->y0 + uvb]); |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
345 c->rgb1 = le2me_32((uiclp[c->y1 + uvr] << 16) | (uiclp[c->y1 + uvg] << 8) | uiclp[c->y1 + uvb]); |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
346 c->rgb2 = le2me_32((uiclp[c->y2 + uvr] << 16) | (uiclp[c->y2 + uvg] << 8) | uiclp[c->y2 + uvb]); |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
347 c->rgb3 = le2me_32((uiclp[c->y3 + uvr] << 16) | (uiclp[c->y3 + uvg] << 8) | uiclp[c->y3 + uvb]); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
348 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
349 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
350 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
351 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
352 /* ------------------------------------------------------------------------ */ |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
353 inline void cvid_v1_32(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb) |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
354 { |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
355 int stride = mpi->stride[0]; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
356 unsigned long *vptr = (unsigned long *)mpi->planes[0]; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
357 unsigned long rgb; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
358 |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
359 if(y+3>=(unsigned int)mpi->height) return; // avoid sig11 |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
360 |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
361 vptr += (y * stride + x); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
362 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
363 vptr[0] = rgb = cb->rgb0; vptr[1] = rgb; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
364 vptr[2] = rgb = cb->rgb1; vptr[3] = rgb; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
365 vptr += stride; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
366 vptr[0] = rgb = cb->rgb0; vptr[1] = rgb; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
367 vptr[2] = rgb = cb->rgb1; vptr[3] = rgb; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
368 vptr += stride; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
369 vptr[0] = rgb = cb->rgb2; vptr[1] = rgb; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
370 vptr[2] = rgb = cb->rgb3; vptr[3] = rgb; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
371 vptr += stride; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
372 vptr[0] = rgb = cb->rgb2; vptr[1] = rgb; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
373 vptr[2] = rgb = cb->rgb3; vptr[3] = rgb; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
374 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
375 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
376 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
377 /* ------------------------------------------------------------------------ */ |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
378 inline void cvid_v4_32(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb0, |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
379 cvid_codebook *cb1, cvid_codebook *cb2, cvid_codebook *cb3) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
380 { |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
381 int stride = mpi->stride[0]; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
382 unsigned long *vptr = (unsigned long *)mpi->planes[0]; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
383 |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
384 if(y+3>=(unsigned int)mpi->height) return; // avoid sig11 |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
385 |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
386 vptr += (y * stride + x); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
387 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
388 vptr[0] = cb0->rgb0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
389 vptr[1] = cb0->rgb1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
390 vptr[2] = cb1->rgb0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
391 vptr[3] = cb1->rgb1; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
392 vptr += stride; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
393 vptr[0] = cb0->rgb2; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
394 vptr[1] = cb0->rgb3; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
395 vptr[2] = cb1->rgb2; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
396 vptr[3] = cb1->rgb3; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
397 vptr += stride; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
398 vptr[0] = cb2->rgb0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
399 vptr[1] = cb2->rgb1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
400 vptr[2] = cb3->rgb0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
401 vptr[3] = cb3->rgb1; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
402 vptr += stride; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
403 vptr[0] = cb2->rgb2; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
404 vptr[1] = cb2->rgb3; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
405 vptr[2] = cb3->rgb2; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
406 vptr[3] = cb3->rgb3; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
407 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
408 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
409 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
410 /* ---------------------------------------------------------------------- */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
411 static inline void read_codebook_24(cvid_codebook *c, int mode) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
412 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
413 int uvr, uvg, uvb; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
414 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
415 if(mode) /* black and white */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
416 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
417 c->y0 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
418 c->y1 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
419 c->y2 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
420 c->y3 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
421 c->u = c->v = 0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
422 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
423 c->r[0] = c->g[0] = c->b[0] = c->y0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
424 c->r[1] = c->g[1] = c->b[1] = c->y1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
425 c->r[2] = c->g[2] = c->b[2] = c->y2; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
426 c->r[3] = c->g[3] = c->b[3] = c->y3; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
427 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
428 else /* colour */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
429 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
430 c->y0 = get_byte(); /* luma */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
431 c->y1 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
432 c->y2 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
433 c->y3 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
434 c->u = get_byte(); /* chroma */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
435 c->v = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
436 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
437 uvr = c->v << 1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
438 uvg = -((c->u+1) >> 1) - c->v; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
439 uvb = c->u << 1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
440 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
441 c->r[0] = uiclp[c->y0 + uvr]; c->g[0] = uiclp[c->y0 + uvg]; c->b[0] = uiclp[c->y0 + uvb]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
442 c->r[1] = uiclp[c->y1 + uvr]; c->g[1] = uiclp[c->y1 + uvg]; c->b[1] = uiclp[c->y1 + uvb]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
443 c->r[2] = uiclp[c->y2 + uvr]; c->g[2] = uiclp[c->y2 + uvg]; c->b[2] = uiclp[c->y2 + uvb]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
444 c->r[3] = uiclp[c->y3 + uvr]; c->g[3] = uiclp[c->y3 + uvg]; c->b[3] = uiclp[c->y3 + uvb]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
445 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
446 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
447 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
448 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
449 /* ------------------------------------------------------------------------ */ |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
450 inline void cvid_v1_24(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb) |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
451 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
452 unsigned char r, g, b; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
453 int stride = (mpi->stride[0]-4)*3; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
454 unsigned char *vptr = mpi->planes[0] + (y * mpi->stride[0] + x) * 3; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
455 |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
456 if(y+3>=(unsigned int)mpi->height) return; // avoid sig11 |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
457 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
458 *vptr++ = b = cb->b[0]; *vptr++ = g = cb->g[0]; *vptr++ = r = cb->r[0]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
459 *vptr++ = b; *vptr++ = g; *vptr++ = r; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
460 *vptr++ = b = cb->b[1]; *vptr++ = g = cb->g[1]; *vptr++ = r = cb->r[1]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
461 *vptr++ = b; *vptr++ = g; *vptr++ = r; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
462 vptr += stride; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
463 *vptr++ = b = cb->b[0]; *vptr++ = g = cb->g[0]; *vptr++ = r = cb->r[0]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
464 *vptr++ = b; *vptr++ = g; *vptr++ = r; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
465 *vptr++ = b = cb->b[1]; *vptr++ = g = cb->g[1]; *vptr++ = r = cb->r[1]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
466 *vptr++ = b; *vptr++ = g; *vptr++ = r; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
467 vptr += stride; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
468 *vptr++ = b = cb->b[2]; *vptr++ = g = cb->g[2]; *vptr++ = r = cb->r[2]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
469 *vptr++ = b; *vptr++ = g; *vptr++ = r; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
470 *vptr++ = b = cb->b[3]; *vptr++ = g = cb->g[3]; *vptr++ = r = cb->r[3]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
471 *vptr++ = b; *vptr++ = g; *vptr++ = r; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
472 vptr += stride; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
473 *vptr++ = b = cb->b[2]; *vptr++ = g = cb->g[2]; *vptr++ = r = cb->r[2]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
474 *vptr++ = b; *vptr++ = g; *vptr++ = r; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
475 *vptr++ = b = cb->b[3]; *vptr++ = g = cb->g[3]; *vptr++ = r = cb->r[3]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
476 *vptr++ = b; *vptr++ = g; *vptr++ = r; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
477 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
478 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
479 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
480 /* ------------------------------------------------------------------------ */ |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
481 inline void cvid_v4_24(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb0, |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
482 cvid_codebook *cb1, cvid_codebook *cb2, cvid_codebook *cb3) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
483 { |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
484 int stride = (mpi->stride[0]-4)*3; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
485 unsigned char *vptr = mpi->planes[0] + (y * mpi->stride[0] + x) * 3; |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
486 |
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
487 if(y+3>=(unsigned int)mpi->height) return; // avoid sig11 |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
488 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
489 *vptr++ = cb0->b[0]; *vptr++ = cb0->g[0]; *vptr++ = cb0->r[0]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
490 *vptr++ = cb0->b[1]; *vptr++ = cb0->g[1]; *vptr++ = cb0->r[1]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
491 *vptr++ = cb1->b[0]; *vptr++ = cb1->g[0]; *vptr++ = cb1->r[0]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
492 *vptr++ = cb1->b[1]; *vptr++ = cb1->g[1]; *vptr++ = cb1->r[1]; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
493 vptr += stride; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
494 *vptr++ = cb0->b[2]; *vptr++ = cb0->g[2]; *vptr++ = cb0->r[2]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
495 *vptr++ = cb0->b[3]; *vptr++ = cb0->g[3]; *vptr++ = cb0->r[3]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
496 *vptr++ = cb1->b[2]; *vptr++ = cb1->g[2]; *vptr++ = cb1->r[2]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
497 *vptr++ = cb1->b[3]; *vptr++ = cb1->g[3]; *vptr++ = cb1->r[3]; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
498 vptr += stride; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
499 *vptr++ = cb2->b[0]; *vptr++ = cb2->g[0]; *vptr++ = cb2->r[0]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
500 *vptr++ = cb2->b[1]; *vptr++ = cb2->g[1]; *vptr++ = cb2->r[1]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
501 *vptr++ = cb3->b[0]; *vptr++ = cb3->g[0]; *vptr++ = cb3->r[0]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
502 *vptr++ = cb3->b[1]; *vptr++ = cb3->g[1]; *vptr++ = cb3->r[1]; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
503 vptr += stride; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
504 *vptr++ = cb2->b[2]; *vptr++ = cb2->g[2]; *vptr++ = cb2->r[2]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
505 *vptr++ = cb2->b[3]; *vptr++ = cb2->g[3]; *vptr++ = cb2->r[3]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
506 *vptr++ = cb3->b[2]; *vptr++ = cb3->g[2]; *vptr++ = cb3->r[2]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
507 *vptr++ = cb3->b[3]; *vptr++ = cb3->g[3]; *vptr++ = cb3->r[3]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
508 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
509 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
510 /* ------------------------------------------------------------------------ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
511 * Call this function once at the start of the sequence and save the |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
512 * returned context for calls to decode_cinepak(). |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
513 */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
514 void *decode_cinepak_init(void) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
515 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
516 cinepak_info *cvinfo; |
4076
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
517 int i, x; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
518 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
519 if((cvinfo = calloc(sizeof(cinepak_info), 1)) == NULL) return NULL; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
520 cvinfo->strip_num = 0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
521 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
522 if(uiclp == NULL) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
523 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
524 uiclp = uiclip+512; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
525 for(i = -512; i < 512; i++) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
526 uiclp[i] = (i < 0 ? 0 : (i > 255 ? 255 : i)); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
527 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
528 |
4076
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
529 for(i = 0, x = -128; i < 256; i++, x++) |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
530 { |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
531 CU_Y_tab[i] = (-FIX(0.0655)) * x; |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
532 CV_Y_tab[i] = (FIX(0.0110)) * x + ONE_HALF; |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
533 CU_Cb_tab[i] = (FIX(1.1656)) * x; |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
534 CV_Cb_tab[i] = (-FIX(0.0062)) * x + ONE_HALF + FIX(128); |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
535 CU_Cr_tab[i] = (FIX(0.0467)) * x; |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
536 CV_Cr_tab[i] = (FIX(1.4187)) * x + ONE_HALF + FIX(128); |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
537 } |
47b9d8d3f3c5
committed Tim Ferguson's patch for proper YUV color space conversion
melanson
parents:
3646
diff
changeset
|
538 |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
539 return (void *)cvinfo; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
540 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
541 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
542 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
543 /* ------------------------------------------------------------------------ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
544 * This function decodes a buffer containing a Cinepak encoded frame. |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
545 * |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
546 * context - the context created by decode_cinepak_init(). |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
547 * buf - the input buffer to be decoded |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
548 * size - the size of the input buffer |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
549 * frame - the output frame buffer |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
550 * width - the width of the output frame |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
551 * height - the height of the output frame |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
552 * bit_per_pixel - the number of bits per pixel allocated to the output |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
553 * frame; depths support: |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
554 * 32: BGR32 |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
555 * 24: BGR24 |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
556 * 16: YUY2 |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
557 * 12: YV12 |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
558 */ |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
559 void decode_cinepak(void *context, unsigned char *buf, int size, mp_image_t *mpi) |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
560 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
561 cinepak_info *cvinfo = (cinepak_info *)context; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
562 cvid_codebook *v4_codebook, *v1_codebook, *codebook = NULL; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
563 unsigned long x, y, y_bottom, frame_flags, strips, cv_width, cv_height, cnum, |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
564 strip_id, chunk_id, x0, y0, x1, y1, ci, flag, mask; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
565 long len, top_size, chunk_size; |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
566 unsigned int i, cur_strip, d0, d1, d2, d3; |
4628
1504901deed8
Fixed FILM demuxer so that it now plays (my) FILM files
melanson
parents:
4076
diff
changeset
|
567 int modulo; |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
568 void (*read_codebook)(cvid_codebook *c, int mode) = NULL; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
569 void (*cvid_v1)(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb) = NULL; |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
570 void (*cvid_v4)(mp_image_t *mpi, unsigned int x, unsigned int y, cvid_codebook *cb0, |
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
571 cvid_codebook *cb1, cvid_codebook *cb2, cvid_codebook *cb3) = NULL; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
572 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
573 x = y = 0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
574 y_bottom = 0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
575 in_buffer = buf; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
576 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
577 frame_flags = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
578 len = get_byte() << 16; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
579 len |= get_byte() << 8; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
580 len |= get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
581 |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
582 switch(mpi->imgfmt) |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
583 { |
5321 | 584 case IMGFMT_I420: |
585 case IMGFMT_IYUV: | |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
586 case IMGFMT_YV12: // YV12 |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
587 read_codebook = read_codebook_yv12; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
588 cvid_v1 = cvid_v1_yv12; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
589 cvid_v4 = cvid_v4_yv12; |
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
590 break; |
4917
6002d8a3b080
reinstated YUY2, BGR32 and BGR24 decoders, all reworked to operate with
melanson
parents:
4916
diff
changeset
|
591 case IMGFMT_YUY2: // YUY2 |
3646 | 592 read_codebook = read_codebook_yuy2; |
593 cvid_v1 = cvid_v1_yuy2; | |
594 cvid_v4 = cvid_v4_yuy2; | |
595 break; | |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
596 case IMGFMT_BGR24: // BGR24 |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
597 read_codebook = read_codebook_24; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
598 cvid_v1 = cvid_v1_24; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
599 cvid_v4 = cvid_v4_24; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
600 break; |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
601 case IMGFMT_BGR32: // BGR32 |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
602 read_codebook = read_codebook_32; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
603 cvid_v1 = cvid_v1_32; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
604 cvid_v4 = cvid_v4_32; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
605 break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
606 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
607 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
608 if(len != size) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
609 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
610 if(len & 0x01) len++; /* AVIs tend to have a size mismatch */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
611 if(len != size) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
612 { |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
613 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "CVID: corruption %d (QT/AVI) != %ld (CV)\n", size, len); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
614 // return; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
615 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
616 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
617 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
618 cv_width = get_word(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
619 cv_height = get_word(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
620 strips = get_word(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
621 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
622 if(strips > cvinfo->strip_num) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
623 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
624 if(strips >= MAX_STRIPS) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
625 { |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
626 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "CVID: strip overflow (more than %d)\n", MAX_STRIPS); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
627 return; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
628 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
629 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
630 for(i = cvinfo->strip_num; i < strips; i++) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
631 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
632 if((cvinfo->v4_codebook[i] = (cvid_codebook *)calloc(sizeof(cvid_codebook), 260)) == NULL) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
633 { |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
634 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "CVID: codebook v4 alloc err\n"); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
635 return; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
636 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
637 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
638 if((cvinfo->v1_codebook[i] = (cvid_codebook *)calloc(sizeof(cvid_codebook), 260)) == NULL) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
639 { |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
640 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "CVID: codebook v1 alloc err\n"); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
641 return; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
642 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
643 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
644 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
645 cvinfo->strip_num = strips; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
646 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
647 #if DBUG |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
648 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "CVID: <%ld,%ld> strips %ld\n", cv_width, cv_height, strips); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
649 #endif |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
650 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
651 for(cur_strip = 0; cur_strip < strips; cur_strip++) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
652 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
653 v4_codebook = cvinfo->v4_codebook[cur_strip]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
654 v1_codebook = cvinfo->v1_codebook[cur_strip]; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
655 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
656 if((cur_strip > 0) && (!(frame_flags & 0x01))) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
657 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
658 memcpy(cvinfo->v4_codebook[cur_strip], cvinfo->v4_codebook[cur_strip-1], 260 * sizeof(cvid_codebook)); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
659 memcpy(cvinfo->v1_codebook[cur_strip], cvinfo->v1_codebook[cur_strip-1], 260 * sizeof(cvid_codebook)); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
660 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
661 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
662 strip_id = get_word(); /* 1000 = key strip, 1100 = iter strip */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
663 top_size = get_word(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
664 y0 = get_word(); /* FIXME: most of these are ignored at the moment */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
665 x0 = get_word(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
666 y1 = get_word(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
667 x1 = get_word(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
668 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
669 y_bottom += y1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
670 top_size -= 12; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
671 x = 0; |
5008 | 672 // if(x1 != (unsigned int)mpi->width) |
673 // mp_msg(MSGT_DECVIDEO, MSGL_WARN, "CVID: Warning x1 (%ld) != width (%d)\n", x1, mpi->width); | |
674 | |
675 //x1 = mpi->width; | |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
676 #if DBUG |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
677 mp_msg(MSGT_DECVIDEO, MSGL_WARN, " %d) %04lx %04ld <%ld,%ld> <%ld,%ld> yt %ld %d\n", |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
678 cur_strip, strip_id, top_size, x0, y0, x1, y1, y_bottom); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
679 #endif |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
680 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
681 while(top_size > 0) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
682 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
683 chunk_id = get_word(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
684 chunk_size = get_word(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
685 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
686 #if DBUG |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
687 mp_msg(MSGT_DECVIDEO, MSGL_WARN, " %04lx %04ld\n", chunk_id, chunk_size); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
688 #endif |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
689 top_size -= chunk_size; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
690 chunk_size -= 4; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
691 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
692 switch(chunk_id) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
693 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
694 /* -------------------- Codebook Entries -------------------- */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
695 case 0x2000: |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
696 case 0x2200: |
4628
1504901deed8
Fixed FILM demuxer so that it now plays (my) FILM files
melanson
parents:
4076
diff
changeset
|
697 modulo = chunk_size % 6; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
698 codebook = (chunk_id == 0x2200 ? v1_codebook : v4_codebook); |
4628
1504901deed8
Fixed FILM demuxer so that it now plays (my) FILM files
melanson
parents:
4076
diff
changeset
|
699 cnum = (chunk_size - modulo) / 6; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
700 for(i = 0; i < cnum; i++) read_codebook(codebook+i, 0); |
4628
1504901deed8
Fixed FILM demuxer so that it now plays (my) FILM files
melanson
parents:
4076
diff
changeset
|
701 while (modulo--) |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
702 in_buffer++; |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
703 break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
704 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
705 case 0x2400: |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
706 case 0x2600: /* 8 bit per pixel */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
707 codebook = (chunk_id == 0x2600 ? v1_codebook : v4_codebook); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
708 cnum = chunk_size/4; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
709 for(i = 0; i < cnum; i++) read_codebook(codebook+i, 1); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
710 break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
711 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
712 case 0x2100: |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
713 case 0x2300: |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
714 codebook = (chunk_id == 0x2300 ? v1_codebook : v4_codebook); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
715 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
716 ci = 0; |
4628
1504901deed8
Fixed FILM demuxer so that it now plays (my) FILM files
melanson
parents:
4076
diff
changeset
|
717 while(chunk_size > 3) |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
718 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
719 flag = get_long(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
720 chunk_size -= 4; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
721 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
722 for(i = 0; i < 32; i++) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
723 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
724 if(flag & 0x80000000) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
725 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
726 chunk_size -= 6; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
727 read_codebook(codebook+ci, 0); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
728 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
729 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
730 ci++; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
731 flag <<= 1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
732 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
733 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
734 while(chunk_size > 0) { skip_byte(); chunk_size--; } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
735 break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
736 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
737 case 0x2500: |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
738 case 0x2700: /* 8 bit per pixel */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
739 codebook = (chunk_id == 0x2700 ? v1_codebook : v4_codebook); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
740 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
741 ci = 0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
742 while(chunk_size > 0) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
743 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
744 flag = get_long(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
745 chunk_size -= 4; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
746 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
747 for(i = 0; i < 32; i++) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
748 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
749 if(flag & 0x80000000) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
750 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
751 chunk_size -= 4; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
752 read_codebook(codebook+ci, 1); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
753 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
754 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
755 ci++; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
756 flag <<= 1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
757 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
758 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
759 while(chunk_size > 0) { skip_byte(); chunk_size--; } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
760 break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
761 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
762 /* -------------------- Frame -------------------- */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
763 case 0x3000: |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
764 while((chunk_size > 0) && (y < y_bottom)) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
765 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
766 flag = get_long(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
767 chunk_size -= 4; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
768 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
769 for(i = 0; i < 32; i++) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
770 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
771 if(y >= y_bottom) break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
772 if(flag & 0x80000000) /* 4 bytes per block */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
773 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
774 d0 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
775 d1 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
776 d2 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
777 d3 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
778 chunk_size -= 4; |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
779 cvid_v4(mpi, x, y, v4_codebook+d0, v4_codebook+d1, v4_codebook+d2, v4_codebook+d3); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
780 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
781 else /* 1 byte per block */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
782 { |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
783 cvid_v1(mpi, x, y, v1_codebook + get_byte()); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
784 chunk_size--; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
785 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
786 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
787 x += 4; |
5008 | 788 if(x >= (unsigned int)x1) |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
789 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
790 x = 0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
791 y += 4; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
792 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
793 flag <<= 1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
794 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
795 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
796 while(chunk_size > 0) { skip_byte(); chunk_size--; } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
797 break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
798 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
799 case 0x3100: |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
800 while((chunk_size > 0) && (y < y_bottom)) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
801 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
802 /* ---- flag bits: 0 = SKIP, 10 = V1, 11 = V4 ---- */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
803 flag = (unsigned long)get_long(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
804 chunk_size -= 4; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
805 mask = 0x80000000; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
806 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
807 while((mask) && (y < y_bottom)) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
808 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
809 if(flag & mask) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
810 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
811 if(mask == 1) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
812 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
813 if(chunk_size < 0) break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
814 flag = (unsigned long)get_long(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
815 chunk_size -= 4; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
816 mask = 0x80000000; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
817 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
818 else mask >>= 1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
819 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
820 if(flag & mask) /* V4 */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
821 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
822 d0 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
823 d1 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
824 d2 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
825 d3 = get_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
826 chunk_size -= 4; |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
827 cvid_v4(mpi, x, y, v4_codebook+d0, v4_codebook+d1, v4_codebook+d2, v4_codebook+d3); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
828 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
829 else /* V1 */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
830 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
831 chunk_size--; |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
832 cvid_v1(mpi, x, y, v1_codebook + get_byte()); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
833 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
834 } /* else SKIP */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
835 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
836 mask >>= 1; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
837 x += 4; |
5008 | 838 if(x >= (unsigned int)x1) |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
839 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
840 x = 0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
841 y += 4; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
842 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
843 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
844 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
845 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
846 while(chunk_size > 0) { skip_byte(); chunk_size--; } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
847 break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
848 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
849 case 0x3200: /* each byte is a V1 codebook */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
850 while((chunk_size > 0) && (y < y_bottom)) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
851 { |
4916
a41e0440edfb
Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents:
4911
diff
changeset
|
852 cvid_v1(mpi, x, y, v1_codebook + get_byte()); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
853 chunk_size--; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
854 x += 4; |
5008 | 855 if(x >= (unsigned int)x1) |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
856 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
857 x = 0; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
858 y += 4; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
859 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
860 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
861 while(chunk_size > 0) { skip_byte(); chunk_size--; } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
862 break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
863 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
864 default: |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
865 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "CVID: unknown chunk_id %08lx\n", chunk_id); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
866 while(chunk_size > 0) { skip_byte(); chunk_size--; } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
867 break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
868 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
869 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
870 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
871 |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
872 if(len != size) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
873 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
874 if(len & 0x01) len++; /* AVIs tend to have a size mismatch */ |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
875 if(len != size) |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
876 { |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
877 long xlen; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
878 skip_byte(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
879 xlen = get_byte() << 16; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
880 xlen |= get_byte() << 8; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
881 xlen |= get_byte(); /* Read Len */ |
4911
6078b7894e20
Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents:
4881
diff
changeset
|
882 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "CVID: END INFO chunk size %d cvid size1 %ld cvid size2 %ld\n", size, len, xlen); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
883 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
884 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
885 } |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
diff
changeset
|
886 |