annotate libmpcodecs/vd_qt8bps.c @ 10809:304c94c89359

simple logo remover
author henry
date Wed, 03 Sep 2003 22:44:28 +0000
parents 6193f96a04d5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10712
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
1 /*
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
2 *
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
3 * QuickTime 8BPS decoder for Mplayer
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
4 * (c) 2003 Roberto Togni
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
5 *
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
6 * Fourcc: 8BPS
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
7 *
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
8 * Supports 8bpp (paletted), 24bpp and 32bpp (4th plane ignored)
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
9 *
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
10 */
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
11
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
12 #include <stdio.h>
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
13 #include <stdlib.h>
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
14
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
15 #include "config.h"
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
16 #include "bswap.h"
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
17
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
18 #include "mp_msg.h"
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
19
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
20 #include "vd_internal.h"
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
21
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
22
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
23 static vd_info_t info = {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
24 "8BPS Video decoder",
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
25 "qt8bps",
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
26 "Roberto Togni",
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
27 "Roberto Togni",
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
28 "native codec"
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
29 };
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
30
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
31 LIBVD_EXTERN(qt8bps)
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
32
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
33
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
34 /*
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
35 * Decoder context
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
36 */
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
37 typedef struct {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
38 unsigned char planes;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
39 unsigned char planemap[4];
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
40 unsigned char *palette;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
41 } qt8bps_context_t;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
42
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
43
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
44 /*
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
45 * Internal function prototypes
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
46 */
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
47
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
48
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
49 // to set/get/query special features/parameters
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
50 static int control(sh_video_t *sh,int cmd,void* arg,...)
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
51 {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
52 qt8bps_context_t *hc = (qt8bps_context_t *) sh->context; // Decoder context
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
53
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
54 if (cmd == VDCTRL_QUERY_FORMAT)
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
55 switch (hc->planes) {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
56 case 1:
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
57 if (*((int*)arg) == IMGFMT_BGR8)
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
58 return CONTROL_TRUE;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
59 else
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
60 return CONTROL_FALSE;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
61 break;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
62 case 3:
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
63 case 4:
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
64 if ((*((int*)arg) == IMGFMT_BGR24) || (*((int*)arg) == IMGFMT_BGR32))
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
65 return CONTROL_TRUE;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
66 else
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
67 return CONTROL_FALSE;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
68 break;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
69 default:
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
70 return CONTROL_FALSE;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
71 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
72
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
73 return CONTROL_UNKNOWN;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
74 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
75
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
76
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
77 /*
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
78 *
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
79 * Init 8BPS decoder
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
80 *
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
81 */
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
82 static int init(sh_video_t *sh)
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
83 {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
84 int vo_ret; // Video output init ret value
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
85 qt8bps_context_t *hc; // Decoder context
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
86 BITMAPINFOHEADER *bih = sh->bih;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
87
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
88 if ((hc = malloc(sizeof(qt8bps_context_t))) == NULL) {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
89 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Can't allocate memory for 8BPS decoder context.\n");
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
90 return 0;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
91 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
92
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
93 sh->context = (void *)hc;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
94 hc->palette = NULL;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
95
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
96 switch (bih->biBitCount) {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
97 case 8:
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
98 hc->planes = 1;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
99 hc->planemap[0] = 0; // 1st plane is palette indexes
10713
6193f96a04d5 100l fix for paletted 8bpp files, I committed an old version
rtognimp
parents: 10712
diff changeset
100 if (bih->biSize > sizeof(BITMAPINFOHEADER)) {
6193f96a04d5 100l fix for paletted 8bpp files, I committed an old version
rtognimp
parents: 10712
diff changeset
101 hc->palette = (unsigned char *)malloc(256*4);
6193f96a04d5 100l fix for paletted 8bpp files, I committed an old version
rtognimp
parents: 10712
diff changeset
102 memcpy(hc->palette, (unsigned char*)bih + sizeof(BITMAPINFOHEADER), 256*4);
6193f96a04d5 100l fix for paletted 8bpp files, I committed an old version
rtognimp
parents: 10712
diff changeset
103 }
10712
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
104 break;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
105 case 24:
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
106 hc->planes = 3;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
107 hc->planemap[0] = 2; // 1st plane is red
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
108 hc->planemap[1] = 1; // 2nd plane is green
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
109 hc->planemap[2] = 0; // 3rd plane is blue
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
110 break;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
111 case 32:
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
112 hc->planes = 4;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
113 hc->planemap[0] = 2; // 1st plane is red
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
114 hc->planemap[1] = 1; // 2nd plane is green
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
115 hc->planemap[2] = 0; // 3rd plane is blue
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
116 hc->planemap[3] = 3; // 4th plane is alpha???
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
117 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "[8BPS] Ignoring 4th (alpha?) plane.\n");
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
118 break;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
119 default:
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
120 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[8BPS] Unsupported color depth: %u.\n", bih->biBitCount);
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
121 return 0;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
122 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
123
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
124 /*
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
125 * Initialize video output device
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
126 */
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
127 vo_ret = mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24);
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
128
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
129 return vo_ret;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
130 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
131
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
132
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
133
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
134
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
135 /*
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
136 *
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
137 * Uninit 8BPS decoder
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
138 *
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
139 */
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
140 static void uninit(sh_video_t *sh)
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
141 {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
142 qt8bps_context_t *hc = (qt8bps_context_t *) sh->context; // Decoder context
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
143
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
144 if (sh->context) {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
145 if (hc->palette)
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
146 free (hc->palette);
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
147 free(sh->context);
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
148 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
149 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
150
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
151
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
152
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
153 /*
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
154 *
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
155 * Decode a frame
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
156 *
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
157 */
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
158 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags)
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
159 {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
160 mp_image_t* mpi;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
161 unsigned char *encoded = (unsigned char *)data;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
162 qt8bps_context_t *hc = (qt8bps_context_t *) sh->context; // Decoder context
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
163 unsigned char *outptr, *pixptr;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
164 unsigned int height = sh->disp_h; // Real image height
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
165 unsigned int dlen, p, row;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
166 unsigned char *lp, *dp;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
167 unsigned char count;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
168 unsigned int px_inc;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
169 unsigned int planes = hc->planes;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
170 unsigned char *planemap = hc->planemap;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
171
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
172
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
173 // Skipped frame
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
174 if(len <= 0)
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
175 return NULL;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
176
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
177 /* Get output image buffer */
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
178 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE, sh->disp_w, sh->disp_h);
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
179 if (!mpi) {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
180 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Can't allocate mpi image for 8BPS codec.\n");
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
181 return NULL;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
182 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
183
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
184 outptr = mpi->planes[0]; // Output image pointer
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
185 px_inc = mpi->bpp/8;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
186
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
187 /* Set data pointer after line lengths */
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
188 dp = encoded + hc->planes*(height << 1);
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
189
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
190 /* Ignore alpha plane, don't know what to do with it */
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
191 if (planes == 4)
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
192 planes--;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
193
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
194 for (p = 0; p < planes; p++) {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
195 /* Lines length pointer for this plane */
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
196 lp = encoded + p*(height << 1);
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
197
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
198 /* Decode a plane */
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
199 for(row = 0; row < height; row++) {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
200 pixptr = outptr + row * mpi->stride[0] + planemap[p];
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
201 dlen = be2me_16(*(unsigned short *)(lp+row*2));
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
202 /* Decode a row of this plane */
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
203 while(dlen > 0) {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
204 if ((count = *dp++) <= 127) {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
205 count++;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
206 dlen -= count + 1;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
207 while(count--) {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
208 *pixptr = *dp++;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
209 pixptr += px_inc;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
210 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
211 } else {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
212 count = 257 - count;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
213 while(count--) {
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
214 *pixptr = *dp;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
215 pixptr += px_inc;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
216 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
217 dp++;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
218 dlen -= 2;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
219 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
220 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
221 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
222 }
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
223
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
224 if (hc->palette)
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
225 mpi->planes[1] = hc->palette;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
226
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
227 return mpi;
03b410c39759 Quicktime 8BPS decoder
rtognimp
parents:
diff changeset
228 }