comparison c93.c @ 4819:ec6c58426b82 libavcodec

remove c93_ prefix from static functions in c93.c
author michael
date Sun, 08 Apr 2007 09:31:54 +0000
parents 12279b61177b
children 7470749c2384
comparison
equal deleted inserted replaced
4818:2137206961c9 4819:ec6c58426b82
44 #define HEIGHT 192 44 #define HEIGHT 192
45 45
46 #define C93_HAS_PALETTE 0x01 46 #define C93_HAS_PALETTE 0x01
47 #define C93_FIRST_FRAME 0x02 47 #define C93_FIRST_FRAME 0x02
48 48
49 static int c93_decode_init(AVCodecContext *avctx) 49 static int decode_init(AVCodecContext *avctx)
50 { 50 {
51 avctx->pix_fmt = PIX_FMT_PAL8; 51 avctx->pix_fmt = PIX_FMT_PAL8;
52 return 0; 52 return 0;
53 } 53 }
54 54
55 static int c93_decode_end(AVCodecContext *avctx) 55 static int decode_end(AVCodecContext *avctx)
56 { 56 {
57 C93DecoderContext * const c93 = avctx->priv_data; 57 C93DecoderContext * const c93 = avctx->priv_data;
58 58
59 if (c93->pictures[0].data[0]) 59 if (c93->pictures[0].data[0])
60 avctx->release_buffer(avctx, &c93->pictures[0]); 60 avctx->release_buffer(avctx, &c93->pictures[0]);
61 if (c93->pictures[1].data[0]) 61 if (c93->pictures[1].data[0])
62 avctx->release_buffer(avctx, &c93->pictures[1]); 62 avctx->release_buffer(avctx, &c93->pictures[1]);
63 return 0; 63 return 0;
64 } 64 }
65 65
66 static inline int c93_copy_block(AVCodecContext *avctx, uint8_t *to, 66 static inline int copy_block(AVCodecContext *avctx, uint8_t *to,
67 uint8_t *from, int offset, int height, int stride) 67 uint8_t *from, int offset, int height, int stride)
68 { 68 {
69 int i; 69 int i;
70 int width = height; 70 int width = height;
71 int from_x = offset % WIDTH; 71 int from_x = offset % WIDTH;
95 } 95 }
96 96
97 return 0; 97 return 0;
98 } 98 }
99 99
100 static inline void c93_draw_n_color(uint8_t *out, int stride, int width, 100 static inline void draw_n_color(uint8_t *out, int stride, int width,
101 int height, int bpp, uint8_t cols[4], uint8_t grps[4], uint32_t col) 101 int height, int bpp, uint8_t cols[4], uint8_t grps[4], uint32_t col)
102 { 102 {
103 int x, y; 103 int x, y;
104 for (y = 0; y < height; y++) { 104 for (y = 0; y < height; y++) {
105 if (grps) 105 if (grps)
111 col >>= bpp; 111 col >>= bpp;
112 } 112 }
113 } 113 }
114 } 114 }
115 115
116 static int c93_decode_frame(AVCodecContext *avctx, void *data, 116 static int decode_frame(AVCodecContext *avctx, void *data,
117 int *data_size, uint8_t * buf, int buf_size) 117 int *data_size, uint8_t * buf, int buf_size)
118 { 118 {
119 C93DecoderContext * const c93 = avctx->priv_data; 119 C93DecoderContext * const c93 = avctx->priv_data;
120 AVFrame * const newpic = &c93->pictures[c93->currentpic]; 120 AVFrame * const newpic = &c93->pictures[c93->currentpic];
121 AVFrame * const oldpic = &c93->pictures[c93->currentpic^1]; 121 AVFrame * const oldpic = &c93->pictures[c93->currentpic^1];
166 bt = *buf++; 166 bt = *buf++;
167 167
168 switch (bt & 0x0F) { 168 switch (bt & 0x0F) {
169 case C93_8X8_FROM_PREV: 169 case C93_8X8_FROM_PREV:
170 offset = bytestream_get_le16(&buf); 170 offset = bytestream_get_le16(&buf);
171 if (c93_copy_block(avctx, out, copy_from, offset, 8, stride)) 171 if (copy_block(avctx, out, copy_from, offset, 8, stride))
172 return -1; 172 return -1;
173 break; 173 break;
174 174
175 case C93_4X4_FROM_CURR: 175 case C93_4X4_FROM_CURR:
176 copy_from = newpic->data[0]; 176 copy_from = newpic->data[0];
177 case C93_4X4_FROM_PREV: 177 case C93_4X4_FROM_PREV:
178 for (j = 0; j < 8; j += 4) { 178 for (j = 0; j < 8; j += 4) {
179 for (i = 0; i < 8; i += 4) { 179 for (i = 0; i < 8; i += 4) {
180 offset = bytestream_get_le16(&buf); 180 offset = bytestream_get_le16(&buf);
181 if (c93_copy_block(avctx, &out[j*stride+i], 181 if (copy_block(avctx, &out[j*stride+i],
182 copy_from, offset, 4, stride)) 182 copy_from, offset, 4, stride))
183 return -1; 183 return -1;
184 } 184 }
185 } 185 }
186 break; 186 break;
187 187
188 case C93_8X8_2COLOR: 188 case C93_8X8_2COLOR:
189 bytestream_get_buffer(&buf, cols, 2); 189 bytestream_get_buffer(&buf, cols, 2);
190 for (i = 0; i < 8; i++) { 190 for (i = 0; i < 8; i++) {
191 c93_draw_n_color(out + i*stride, stride, 8, 1, 1, cols, 191 draw_n_color(out + i*stride, stride, 8, 1, 1, cols,
192 NULL, *buf++); 192 NULL, *buf++);
193 } 193 }
194 194
195 break; 195 break;
196 196
199 case C93_4X4_4COLOR_GRP: 199 case C93_4X4_4COLOR_GRP:
200 for (j = 0; j < 8; j += 4) { 200 for (j = 0; j < 8; j += 4) {
201 for (i = 0; i < 8; i += 4) { 201 for (i = 0; i < 8; i += 4) {
202 if ((bt & 0x0F) == C93_4X4_2COLOR) { 202 if ((bt & 0x0F) == C93_4X4_2COLOR) {
203 bytestream_get_buffer(&buf, cols, 2); 203 bytestream_get_buffer(&buf, cols, 2);
204 c93_draw_n_color(out + i + j*stride, stride, 4, 4, 204 draw_n_color(out + i + j*stride, stride, 4, 4,
205 1, cols, NULL, bytestream_get_le16(&buf)); 205 1, cols, NULL, bytestream_get_le16(&buf));
206 } else if ((bt & 0x0F) == C93_4X4_4COLOR) { 206 } else if ((bt & 0x0F) == C93_4X4_4COLOR) {
207 bytestream_get_buffer(&buf, cols, 4); 207 bytestream_get_buffer(&buf, cols, 4);
208 c93_draw_n_color(out + i + j*stride, stride, 4, 4, 208 draw_n_color(out + i + j*stride, stride, 4, 4,
209 2, cols, NULL, bytestream_get_le32(&buf)); 209 2, cols, NULL, bytestream_get_le32(&buf));
210 } else { 210 } else {
211 bytestream_get_buffer(&buf, grps, 4); 211 bytestream_get_buffer(&buf, grps, 4);
212 c93_draw_n_color(out + i + j*stride, stride, 4, 4, 212 draw_n_color(out + i + j*stride, stride, 4, 4,
213 1, cols, grps, bytestream_get_le16(&buf)); 213 1, cols, grps, bytestream_get_le16(&buf));
214 } 214 }
215 } 215 }
216 } 216 }
217 break; 217 break;
243 AVCodec c93_decoder = { 243 AVCodec c93_decoder = {
244 "c93", 244 "c93",
245 CODEC_TYPE_VIDEO, 245 CODEC_TYPE_VIDEO,
246 CODEC_ID_C93, 246 CODEC_ID_C93,
247 sizeof(C93DecoderContext), 247 sizeof(C93DecoderContext),
248 c93_decode_init, 248 decode_init,
249 NULL, 249 NULL,
250 c93_decode_end, 250 decode_end,
251 c93_decode_frame, 251 decode_frame,
252 CODEC_CAP_DR1, 252 CODEC_CAP_DR1,
253 }; 253 };