Mercurial > mplayer.hg
annotate libmpcodecs/vd_msrle.c @ 5358:29b5e5facb53
fixed green lines caused by missing rounding to 2
author | iive |
---|---|
date | Tue, 26 Mar 2002 16:45:21 +0000 |
parents | b40644bb0e61 |
children | 4ea69b1790d9 |
rev | line source |
---|---|
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
1 #include <stdio.h> |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
2 #include <stdlib.h> |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
3 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
4 #include "config.h" |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
5 #include "mp_msg.h" |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
6 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
7 #include "vd_internal.h" |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
8 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
9 static vd_info_t info = { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
10 "Microsoft RLE decoder", |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
11 "msrle", |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
12 VFM_MSRLE, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
13 "A'rpi", |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
14 "Mike Melanson", |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
15 "native codec" |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
16 }; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
17 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
18 LIBVD_EXTERN(msrle) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
19 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
20 // to set/get/query special features/parameters |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
21 static int control(sh_video_t *sh,int cmd,void* arg,...){ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
22 return CONTROL_UNKNOWN; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
23 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
24 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
25 // init driver |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
26 static int init(sh_video_t *sh){ |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
27 unsigned char *palette = (unsigned char *)sh->bih+40; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
28 int i; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
29 unsigned short color; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
30 |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
31 // if BGR15 & BGR16, modify palette in place |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
32 for (i = 0; i < sh->bih->biClrUsed; i++) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
33 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
34 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
35 |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
36 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24); |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
37 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
38 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
39 // uninit driver |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
40 static void uninit(sh_video_t *sh){ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
41 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
42 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
43 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
44 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
45 #define FETCH_NEXT_STREAM_BYTE() \ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
46 if (stream_ptr >= encoded_size) \ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
47 { \ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
48 mp_msg(MSGT_DECVIDEO, MSGL_WARN, \ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
49 "MS RLE: stream ptr just went out of bounds (1)\n"); \ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
50 return; \ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
51 } \ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
52 stream_byte = encoded[stream_ptr++]; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
53 |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
54 void decode_msrle4( |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
55 unsigned char *encoded, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
56 int encoded_size, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
57 unsigned char *decoded, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
58 int width, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
59 int height, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
60 unsigned char *palette_map, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
61 int bits_per_pixel) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
62 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
63 int bytes_per_pixel = (bits_per_pixel + 1) / 8; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
64 unsigned char r1, g1, b1; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
65 unsigned char r2, g2, b2; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
66 int stream_ptr = 0; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
67 unsigned char rle_code; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
68 unsigned char extra_byte; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
69 unsigned char stream_byte; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
70 int frame_size = width * height * bytes_per_pixel; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
71 int pixel_ptr = 0; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
72 int row_dec = width * bytes_per_pixel; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
73 int row_ptr = (height - 1) * row_dec; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
74 int i; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
75 |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
76 while (row_ptr >= 0) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
77 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
78 FETCH_NEXT_STREAM_BYTE(); |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
79 rle_code = stream_byte; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
80 if (rle_code == 0) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
81 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
82 // fetch the next byte to see how to handle escape code |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
83 FETCH_NEXT_STREAM_BYTE(); |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
84 if (stream_byte == 0) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
85 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
86 // line is done, goto the next one |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
87 row_ptr -= row_dec; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
88 pixel_ptr = 0; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
89 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
90 else if (stream_byte == 1) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
91 // decode is done |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
92 return; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
93 else if (stream_byte == 2) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
94 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
95 // reposition frame decode coordinates |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
96 FETCH_NEXT_STREAM_BYTE(); |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
97 pixel_ptr += stream_byte * bytes_per_pixel; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
98 FETCH_NEXT_STREAM_BYTE(); |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
99 row_ptr -= stream_byte * row_dec; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
100 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
101 else |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
102 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
103 // copy pixels from encoded stream |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
104 rle_code = stream_byte; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
105 rle_code /= 2; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
106 extra_byte = rle_code & 0x01; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
107 if ((row_ptr + pixel_ptr + rle_code * bytes_per_pixel > frame_size) || |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
108 (row_ptr < 0)) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
109 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
110 mp_msg(MSGT_DECVIDEO, MSGL_WARN, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
111 "MS RLE: frame ptr just went out of bounds (1)\n"); |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
112 return; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
113 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
114 |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
115 for (i = 0; i < rle_code; i++) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
116 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
117 if (pixel_ptr >= row_dec) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
118 break; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
119 r1 = palette_map[(encoded[stream_ptr + i] >> 4) * 4 + 2]; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
120 g1 = palette_map[(encoded[stream_ptr + i] >> 4) * 4 + 1]; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
121 b1 = palette_map[(encoded[stream_ptr + i] >> 4) * 4 + 0]; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
122 decoded[row_ptr + pixel_ptr + 0] = b1; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
123 decoded[row_ptr + pixel_ptr + 1] = g1; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
124 decoded[row_ptr + pixel_ptr + 2] = r1; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
125 pixel_ptr += bytes_per_pixel; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
126 |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
127 if (pixel_ptr >= row_dec) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
128 break; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
129 r1 = palette_map[(encoded[stream_ptr + i] & 0x0F) * 4 + 2]; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
130 g1 = palette_map[(encoded[stream_ptr + i] & 0x0F) * 4 + 1]; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
131 b1 = palette_map[(encoded[stream_ptr + i] & 0x0F) * 4 + 0]; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
132 decoded[row_ptr + pixel_ptr + 0] = b1; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
133 decoded[row_ptr + pixel_ptr + 1] = g1; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
134 decoded[row_ptr + pixel_ptr + 2] = r1; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
135 pixel_ptr += bytes_per_pixel; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
136 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
137 stream_ptr += rle_code; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
138 |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
139 // if the RLE code is odd, skip a byte in the stream |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
140 if (extra_byte) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
141 stream_ptr++; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
142 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
143 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
144 else |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
145 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
146 // decode a run of data |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
147 FETCH_NEXT_STREAM_BYTE(); |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
148 r1 = palette_map[(stream_byte >> 4) * 4 + 2]; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
149 g1 = palette_map[(stream_byte >> 4) * 4 + 1]; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
150 b1 = palette_map[(stream_byte >> 4) * 4 + 0]; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
151 r2 = palette_map[(stream_byte & 0x0F) * 4 + 2]; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
152 g2 = palette_map[(stream_byte & 0x0F) * 4 + 1]; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
153 b2 = palette_map[(stream_byte & 0x0F) * 4 + 0]; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
154 for (i = 0; i < rle_code; i++) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
155 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
156 if (pixel_ptr >= row_dec) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
157 break; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
158 |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
159 if ((i & 1) == 0) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
160 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
161 decoded[row_ptr + pixel_ptr + 0] = b1; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
162 decoded[row_ptr + pixel_ptr + 1] = g1; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
163 decoded[row_ptr + pixel_ptr + 2] = r1; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
164 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
165 else |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
166 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
167 decoded[row_ptr + pixel_ptr + 0] = b2; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
168 decoded[row_ptr + pixel_ptr + 1] = g2; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
169 decoded[row_ptr + pixel_ptr + 2] = r2; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
170 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
171 pixel_ptr += bytes_per_pixel; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
172 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
173 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
174 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
175 |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
176 // one last sanity check on the way out |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
177 if (stream_ptr < encoded_size) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
178 mp_msg(MSGT_DECVIDEO, MSGL_WARN, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
179 "MS RLE: ended frame decode with bytes left over (%d < %d)\n", |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
180 stream_ptr, encoded_size); |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
181 } |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
182 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
183 void decode_msrle8( |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
184 unsigned char *encoded, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
185 int encoded_size, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
186 unsigned char *decoded, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
187 int width, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
188 int height, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
189 unsigned char *palette_map, |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
190 int bits_per_pixel) |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
191 { |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
192 int bytes_per_pixel = (bits_per_pixel + 1) / 8; |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
193 unsigned char r, g, b; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
194 int stream_ptr = 0; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
195 unsigned char rle_code; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
196 unsigned char extra_byte; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
197 unsigned char stream_byte; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
198 int frame_size = width * height * bytes_per_pixel; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
199 int pixel_ptr = 0; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
200 int row_dec = width * bytes_per_pixel; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
201 int row_ptr = (height - 1) * row_dec; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
202 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
203 while (row_ptr >= 0) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
204 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
205 FETCH_NEXT_STREAM_BYTE(); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
206 rle_code = stream_byte; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
207 if (rle_code == 0) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
208 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
209 // fetch the next byte to see how to handle escape code |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
210 FETCH_NEXT_STREAM_BYTE(); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
211 if (stream_byte == 0) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
212 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
213 // line is done, goto the next one |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
214 row_ptr -= row_dec; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
215 pixel_ptr = 0; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
216 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
217 else if (stream_byte == 1) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
218 // decode is done |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
219 return; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
220 else if (stream_byte == 2) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
221 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
222 // reposition frame decode coordinates |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
223 FETCH_NEXT_STREAM_BYTE(); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
224 pixel_ptr += stream_byte * bytes_per_pixel; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
225 FETCH_NEXT_STREAM_BYTE(); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
226 row_ptr -= stream_byte * row_dec; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
227 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
228 else |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
229 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
230 // copy pixels from encoded stream |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
231 if ((row_ptr + pixel_ptr + stream_byte * bytes_per_pixel > frame_size) || |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
232 (row_ptr < 0)) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
233 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
234 mp_msg(MSGT_DECVIDEO, MSGL_WARN, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
235 "MS RLE: frame ptr just went out of bounds (1)\n"); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
236 return; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
237 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
238 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
239 rle_code = stream_byte; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
240 extra_byte = stream_byte & 0x01; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
241 if (stream_ptr + rle_code + extra_byte > encoded_size) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
242 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
243 mp_msg(MSGT_DECVIDEO, MSGL_WARN, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
244 "MS RLE: stream ptr just went out of bounds (2)\n"); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
245 return; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
246 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
247 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
248 while (rle_code--) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
249 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
250 r = palette_map[encoded[stream_ptr] * 4 + 2]; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
251 g = palette_map[encoded[stream_ptr] * 4 + 1]; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
252 b = palette_map[encoded[stream_ptr] * 4 + 0]; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
253 stream_ptr++; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
254 decoded[row_ptr + pixel_ptr + 0] = b; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
255 decoded[row_ptr + pixel_ptr + 1] = g; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
256 decoded[row_ptr + pixel_ptr + 2] = r; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
257 pixel_ptr += bytes_per_pixel; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
258 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
259 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
260 // if the RLE code is odd, skip a byte in the stream |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
261 if (extra_byte) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
262 stream_ptr++; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
263 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
264 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
265 else |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
266 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
267 // decode a run of data |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
268 if ((row_ptr + pixel_ptr + stream_byte * bytes_per_pixel > frame_size) || |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
269 (row_ptr < 0)) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
270 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
271 mp_msg(MSGT_DECVIDEO, MSGL_WARN, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
272 "MS RLE: frame ptr just went out of bounds (2)\n"); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
273 return; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
274 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
275 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
276 FETCH_NEXT_STREAM_BYTE(); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
277 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
278 r = palette_map[stream_byte * 4 + 2]; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
279 g = palette_map[stream_byte * 4 + 1]; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
280 b = palette_map[stream_byte * 4 + 0]; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
281 while(rle_code--) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
282 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
283 decoded[row_ptr + pixel_ptr + 0] = b; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
284 decoded[row_ptr + pixel_ptr + 1] = g; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
285 decoded[row_ptr + pixel_ptr + 2] = r; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
286 pixel_ptr += bytes_per_pixel; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
287 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
288 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
289 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
290 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
291 // one last sanity check on the way out |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
292 if (stream_ptr < encoded_size) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
293 mp_msg(MSGT_DECVIDEO, MSGL_WARN, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
294 "MS RLE: ended frame decode with bytes left over (%d < %d)\n", |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
295 stream_ptr, encoded_size); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
296 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
297 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
298 // decode a frame |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
299 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
300 mp_image_t* mpi; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
301 if(len<=0) return NULL; // skipped frame |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
302 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
303 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
304 sh->disp_w, sh->disp_h); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
305 if(!mpi) return NULL; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
306 |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
307 if (sh->format == 1) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
308 decode_msrle8( |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
309 data,len, mpi->planes[0], |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
310 sh->disp_w, sh->disp_h, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
311 (unsigned char *)sh->bih+40, |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
312 mpi->bpp); |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
313 else if (sh->format == 2) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
314 decode_msrle4( |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
315 data,len, mpi->planes[0], |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
316 sh->disp_w, sh->disp_h, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
317 (unsigned char *)sh->bih+40, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
318 mpi->bpp); |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
319 else |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
320 mp_msg(MSGT_DECVIDEO, MSGL_WARN, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
321 "MS RLE: Don't know how to decode format %08X", sh->format); |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
322 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
323 return mpi; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
324 } |