comparison rv10.c @ 1064:b32afefe7d33 libavcodec

* UINTX -> uintx_t INTX -> intx_t
author kabi
date Tue, 11 Feb 2003 16:35:48 +0000
parents 1f9afd8b9131
children 6da5ae9ee199
comparison
equal deleted inserted replaced
1063:fdeac9642346 1064:b32afefe7d33
22 22
23 //#define DEBUG 23 //#define DEBUG
24 24
25 #define DC_VLC_BITS 14 //FIXME find a better solution 25 #define DC_VLC_BITS 14 //FIXME find a better solution
26 26
27 static const UINT16 rv_lum_code[256] = 27 static const uint16_t rv_lum_code[256] =
28 { 28 {
29 0x3e7f, 0x0f00, 0x0f01, 0x0f02, 0x0f03, 0x0f04, 0x0f05, 0x0f06, 29 0x3e7f, 0x0f00, 0x0f01, 0x0f02, 0x0f03, 0x0f04, 0x0f05, 0x0f06,
30 0x0f07, 0x0f08, 0x0f09, 0x0f0a, 0x0f0b, 0x0f0c, 0x0f0d, 0x0f0e, 30 0x0f07, 0x0f08, 0x0f09, 0x0f0a, 0x0f0b, 0x0f0c, 0x0f0d, 0x0f0e,
31 0x0f0f, 0x0f10, 0x0f11, 0x0f12, 0x0f13, 0x0f14, 0x0f15, 0x0f16, 31 0x0f0f, 0x0f10, 0x0f11, 0x0f12, 0x0f13, 0x0f14, 0x0f15, 0x0f16,
32 0x0f17, 0x0f18, 0x0f19, 0x0f1a, 0x0f1b, 0x0f1c, 0x0f1d, 0x0f1e, 32 0x0f17, 0x0f18, 0x0f19, 0x0f1a, 0x0f1b, 0x0f1c, 0x0f1d, 0x0f1e,
58 0x0f68, 0x0f69, 0x0f6a, 0x0f6b, 0x0f6c, 0x0f6d, 0x0f6e, 0x0f6f, 58 0x0f68, 0x0f69, 0x0f6a, 0x0f6b, 0x0f6c, 0x0f6d, 0x0f6e, 0x0f6f,
59 0x0f70, 0x0f71, 0x0f72, 0x0f73, 0x0f74, 0x0f75, 0x0f76, 0x0f77, 59 0x0f70, 0x0f71, 0x0f72, 0x0f73, 0x0f74, 0x0f75, 0x0f76, 0x0f77,
60 0x0f78, 0x0f79, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f7e, 0x0f7f, 60 0x0f78, 0x0f79, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f7e, 0x0f7f,
61 }; 61 };
62 62
63 static const UINT8 rv_lum_bits[256] = 63 static const uint8_t rv_lum_bits[256] =
64 { 64 {
65 14, 12, 12, 12, 12, 12, 12, 12, 65 14, 12, 12, 12, 12, 12, 12, 12,
66 12, 12, 12, 12, 12, 12, 12, 12, 66 12, 12, 12, 12, 12, 12, 12, 12,
67 12, 12, 12, 12, 12, 12, 12, 12, 67 12, 12, 12, 12, 12, 12, 12, 12,
68 12, 12, 12, 12, 12, 12, 12, 12, 68 12, 12, 12, 12, 12, 12, 12, 12,
94 12, 12, 12, 12, 12, 12, 12, 12, 94 12, 12, 12, 12, 12, 12, 12, 12,
95 12, 12, 12, 12, 12, 12, 12, 12, 95 12, 12, 12, 12, 12, 12, 12, 12,
96 12, 12, 12, 12, 12, 12, 12, 12, 96 12, 12, 12, 12, 12, 12, 12, 12,
97 }; 97 };
98 98
99 static const UINT16 rv_chrom_code[256] = 99 static const uint16_t rv_chrom_code[256] =
100 { 100 {
101 0xfe7f, 0x3f00, 0x3f01, 0x3f02, 0x3f03, 0x3f04, 0x3f05, 0x3f06, 101 0xfe7f, 0x3f00, 0x3f01, 0x3f02, 0x3f03, 0x3f04, 0x3f05, 0x3f06,
102 0x3f07, 0x3f08, 0x3f09, 0x3f0a, 0x3f0b, 0x3f0c, 0x3f0d, 0x3f0e, 102 0x3f07, 0x3f08, 0x3f09, 0x3f0a, 0x3f0b, 0x3f0c, 0x3f0d, 0x3f0e,
103 0x3f0f, 0x3f10, 0x3f11, 0x3f12, 0x3f13, 0x3f14, 0x3f15, 0x3f16, 103 0x3f0f, 0x3f10, 0x3f11, 0x3f12, 0x3f13, 0x3f14, 0x3f15, 0x3f16,
104 0x3f17, 0x3f18, 0x3f19, 0x3f1a, 0x3f1b, 0x3f1c, 0x3f1d, 0x3f1e, 104 0x3f17, 0x3f18, 0x3f19, 0x3f1a, 0x3f1b, 0x3f1c, 0x3f1d, 0x3f1e,
130 0x3f68, 0x3f69, 0x3f6a, 0x3f6b, 0x3f6c, 0x3f6d, 0x3f6e, 0x3f6f, 130 0x3f68, 0x3f69, 0x3f6a, 0x3f6b, 0x3f6c, 0x3f6d, 0x3f6e, 0x3f6f,
131 0x3f70, 0x3f71, 0x3f72, 0x3f73, 0x3f74, 0x3f75, 0x3f76, 0x3f77, 131 0x3f70, 0x3f71, 0x3f72, 0x3f73, 0x3f74, 0x3f75, 0x3f76, 0x3f77,
132 0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, 0x3f7d, 0x3f7e, 0x3f7f, 132 0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, 0x3f7d, 0x3f7e, 0x3f7f,
133 }; 133 };
134 134
135 static const UINT8 rv_chrom_bits[256] = 135 static const uint8_t rv_chrom_bits[256] =
136 { 136 {
137 16, 14, 14, 14, 14, 14, 14, 14, 137 16, 14, 14, 14, 14, 14, 14, 14,
138 14, 14, 14, 14, 14, 14, 14, 14, 138 14, 14, 14, 14, 14, 14, 14, 14,
139 14, 14, 14, 14, 14, 14, 14, 14, 139 14, 14, 14, 14, 14, 14, 14, 14,
140 14, 14, 14, 14, 14, 14, 14, 14, 140 14, 14, 14, 14, 14, 14, 14, 14,
180 /* XXX: I don't understand why they use LONGER codes than 180 /* XXX: I don't understand why they use LONGER codes than
181 necessary. The following code would be completely useless 181 necessary. The following code would be completely useless
182 if they had thought about it !!! */ 182 if they had thought about it !!! */
183 code = get_bits(&s->gb, 7); 183 code = get_bits(&s->gb, 7);
184 if (code == 0x7c) { 184 if (code == 0x7c) {
185 code = (INT8)(get_bits(&s->gb, 7) + 1); 185 code = (int8_t)(get_bits(&s->gb, 7) + 1);
186 } else if (code == 0x7d) { 186 } else if (code == 0x7d) {
187 code = -128 + get_bits(&s->gb, 7); 187 code = -128 + get_bits(&s->gb, 7);
188 } else if (code == 0x7e) { 188 } else if (code == 0x7e) {
189 if (get_bits(&s->gb, 1) == 0) 189 if (get_bits(&s->gb, 1) == 0)
190 code = (INT8)(get_bits(&s->gb, 8) + 1); 190 code = (int8_t)(get_bits(&s->gb, 8) + 1);
191 else 191 else
192 code = (INT8)(get_bits(&s->gb, 8)); 192 code = (int8_t)(get_bits(&s->gb, 8));
193 } else if (code == 0x7f) { 193 } else if (code == 0x7f) {
194 get_bits(&s->gb, 11); 194 get_bits(&s->gb, 11);
195 code = 1; 195 code = 1;
196 } 196 }
197 } else { 197 } else {
201 code = get_vlc2(&s->gb, rv_dc_chrom.table, DC_VLC_BITS, 2); 201 code = get_vlc2(&s->gb, rv_dc_chrom.table, DC_VLC_BITS, 2);
202 /* same remark */ 202 /* same remark */
203 if (code < 0) { 203 if (code < 0) {
204 code = get_bits(&s->gb, 9); 204 code = get_bits(&s->gb, 9);
205 if (code == 0x1fc) { 205 if (code == 0x1fc) {
206 code = (INT8)(get_bits(&s->gb, 7) + 1); 206 code = (int8_t)(get_bits(&s->gb, 7) + 1);
207 } else if (code == 0x1fd) { 207 } else if (code == 0x1fd) {
208 code = -128 + get_bits(&s->gb, 7); 208 code = -128 + get_bits(&s->gb, 7);
209 } else if (code == 0x1fe) { 209 } else if (code == 0x1fe) {
210 get_bits(&s->gb, 9); 210 get_bits(&s->gb, 9);
211 code = 1; 211 code = 1;
388 MPV_common_end(s); 388 MPV_common_end(s);
389 return 0; 389 return 0;
390 } 390 }
391 391
392 static int rv10_decode_packet(AVCodecContext *avctx, 392 static int rv10_decode_packet(AVCodecContext *avctx,
393 UINT8 *buf, int buf_size) 393 uint8_t *buf, int buf_size)
394 { 394 {
395 MpegEncContext *s = avctx->priv_data; 395 MpegEncContext *s = avctx->priv_data;
396 int i, mb_count, mb_pos, left; 396 int i, mb_count, mb_pos, left;
397 397
398 init_get_bits(&s->gb, buf, buf_size*8); 398 init_get_bits(&s->gb, buf, buf_size*8);
466 return buf_size; 466 return buf_size;
467 } 467 }
468 468
469 static int rv10_decode_frame(AVCodecContext *avctx, 469 static int rv10_decode_frame(AVCodecContext *avctx,
470 void *data, int *data_size, 470 void *data, int *data_size,
471 UINT8 *buf, int buf_size) 471 uint8_t *buf, int buf_size)
472 { 472 {
473 MpegEncContext *s = avctx->priv_data; 473 MpegEncContext *s = avctx->priv_data;
474 int i; 474 int i;
475 AVFrame *pict = data; 475 AVFrame *pict = data;
476 476