Mercurial > mplayer.hg
annotate libmpcodecs/vd_msrle.c @ 6547:1c282256162a
it's bug not vbug...
author | jonas |
---|---|
date | Mon, 24 Jun 2002 11:03:04 +0000 |
parents | 4ea69b1790d9 |
children | 28677d779205 |
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, |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
13 "Mike Melanson", |
5193
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){ |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
27 unsigned char *palette_map = NULL; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
28 unsigned char *orig_map = (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
|
29 int i; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
30 unsigned short color; |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
31 unsigned char r, g, b; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
32 int bits_per_pixel = sh->codec->outfmt[sh->outfmtidx] & 255; |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
33 |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
34 // convert the palette for the requested output format |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
35 switch (bits_per_pixel) |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
36 { |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
37 case 15: |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
38 case 16: |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
39 if ((palette_map = |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
40 (unsigned char *)malloc(sh->bih->biClrUsed * 2)) == NULL) |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
41 return 0; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
42 |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
43 for (i = 0; i < sh->bih->biClrUsed; i++) |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
44 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
45 r = orig_map[i * 4 + 2]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
46 g = orig_map[i * 4 + 1]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
47 b = orig_map[i * 4 + 0]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
48 if (bits_per_pixel == 15) |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
49 color = ((r>>3)<<10) | ((g>>3)<<5) | ((b>>3)); |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
50 else |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
51 color = ((r>>3)<<11) | ((g>>2)<<5) | ((b>>3)); |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
52 palette_map[i * 2 + 1] = color >> 8; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
53 palette_map[i * 2 + 0] = color & 0xFF; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
54 } |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
55 break; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
56 |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
57 case 24: |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
58 case 32: |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
59 if ((palette_map = |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
60 (unsigned char *)malloc(sh->bih->biClrUsed * 4)) == NULL) |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
61 return 0; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
62 memcpy(palette_map, orig_map, sh->bih->biClrUsed * 4); |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
63 break; |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
64 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
65 |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
66 sh->context = palette_map; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
67 |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
68 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
|
69 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
70 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
71 // uninit driver |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
72 static void uninit(sh_video_t *sh){ |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
73 unsigned char *palette_map = (unsigned char *)sh->context; |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
74 |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
75 free(palette_map); |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
76 } |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
77 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
78 #define FETCH_NEXT_STREAM_BYTE() \ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
79 if (stream_ptr >= encoded_size) \ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
80 { \ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
81 mp_msg(MSGT_DECVIDEO, MSGL_WARN, \ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
82 "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
|
83 return; \ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
84 } \ |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
85 stream_byte = encoded[stream_ptr++]; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
86 |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
87 void decode_msrle4( |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
88 unsigned char *encoded, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
89 int encoded_size, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
90 unsigned char *decoded, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
91 int width, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
92 int height, |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
93 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
|
94 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
|
95 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
96 int bytes_per_pixel = (bits_per_pixel + 1) / 8; |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
97 unsigned char r1, g1, b1; // for 24/32 bpp |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
98 unsigned char r2, g2, b2; |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
99 unsigned char color_hi1, color_lo1; // for 15/16 bpp |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
100 unsigned char color_hi2, color_lo2; |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
101 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
|
102 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
|
103 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
|
104 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
|
105 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
|
106 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
|
107 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
|
108 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
|
109 int i; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
110 |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
111 r1 = r2 = g1 = g2 = b1 = b2 = |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
112 color_hi1 = color_hi2 = color_lo1 = color_lo2 = 0; |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
113 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
|
114 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
115 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
|
116 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
|
117 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
|
118 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
119 // 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
|
120 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
|
121 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
|
122 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
123 // 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
|
124 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
|
125 pixel_ptr = 0; |
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 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
|
128 // decode is done |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
129 return; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
130 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
|
131 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
132 // 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
|
133 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
|
134 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
|
135 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
|
136 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
|
137 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
138 else |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
139 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
140 // 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
|
141 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
|
142 rle_code /= 2; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
143 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
|
144 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
|
145 (row_ptr < 0)) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
146 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
147 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
|
148 "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
|
149 return; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
150 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
151 |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
152 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
|
153 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
154 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
|
155 break; |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
156 if (bytes_per_pixel == 2) |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
157 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
158 color_hi1 = palette_map[(encoded[stream_ptr + i] >> 4) * 2 + 0]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
159 color_lo1 = palette_map[(encoded[stream_ptr + i] >> 4) * 2 + 1]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
160 decoded[row_ptr + pixel_ptr + 0] = color_hi1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
161 decoded[row_ptr + pixel_ptr + 1] = color_lo1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
162 } |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
163 else |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
164 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
165 r1 = palette_map[(encoded[stream_ptr + i] >> 4) * 4 + 2]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
166 g1 = palette_map[(encoded[stream_ptr + i] >> 4) * 4 + 1]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
167 b1 = palette_map[(encoded[stream_ptr + i] >> 4) * 4 + 0]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
168 decoded[row_ptr + pixel_ptr + 0] = b1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
169 decoded[row_ptr + pixel_ptr + 1] = g1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
170 decoded[row_ptr + pixel_ptr + 2] = r1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
171 } |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
172 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
|
173 |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
174 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
|
175 break; |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
176 if (bytes_per_pixel == 2) |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
177 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
178 color_hi1 = palette_map[(encoded[stream_ptr + i] & 0x0F) * 2 + 0]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
179 color_lo1 = palette_map[(encoded[stream_ptr + i] & 0x0F) * 2 + 1]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
180 decoded[row_ptr + pixel_ptr + 0] = color_hi1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
181 decoded[row_ptr + pixel_ptr + 1] = color_lo1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
182 } |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
183 else |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
184 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
185 r1 = palette_map[(encoded[stream_ptr + i] & 0x0F) * 4 + 2]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
186 g1 = palette_map[(encoded[stream_ptr + i] & 0x0F) * 4 + 1]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
187 b1 = palette_map[(encoded[stream_ptr + i] & 0x0F) * 4 + 0]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
188 decoded[row_ptr + pixel_ptr + 0] = b1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
189 decoded[row_ptr + pixel_ptr + 1] = g1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
190 decoded[row_ptr + pixel_ptr + 2] = r1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
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 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
|
193 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
194 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
|
195 |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
196 // 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
|
197 if (extra_byte) |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
198 stream_ptr++; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
199 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
200 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
201 else |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
202 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
203 // 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
|
204 FETCH_NEXT_STREAM_BYTE(); |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
205 if (bytes_per_pixel == 2) |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
206 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
207 color_hi1 = palette_map[(stream_byte >> 4) * 2 + 0]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
208 color_lo1 = palette_map[(stream_byte >> 4) * 2 + 1]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
209 color_hi2 = palette_map[(stream_byte & 0x0F) * 2 + 0]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
210 color_lo2 = palette_map[(stream_byte & 0x0F) * 2 + 1]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
211 } |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
212 else |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
213 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
214 r1 = palette_map[(stream_byte >> 4) * 4 + 2]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
215 g1 = palette_map[(stream_byte >> 4) * 4 + 1]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
216 b1 = palette_map[(stream_byte >> 4) * 4 + 0]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
217 r2 = palette_map[(stream_byte & 0x0F) * 4 + 2]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
218 g2 = palette_map[(stream_byte & 0x0F) * 4 + 1]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
219 b2 = palette_map[(stream_byte & 0x0F) * 4 + 0]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
220 } |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
221 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
|
222 { |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
223 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
|
224 break; |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
225 |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
226 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
|
227 { |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
228 if (bytes_per_pixel == 2) |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
229 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
230 decoded[row_ptr + pixel_ptr + 0] = color_hi1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
231 decoded[row_ptr + pixel_ptr + 1] = color_lo1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
232 } |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
233 else |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
234 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
235 decoded[row_ptr + pixel_ptr + 0] = b1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
236 decoded[row_ptr + pixel_ptr + 1] = g1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
237 decoded[row_ptr + pixel_ptr + 2] = r1; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
238 } |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
239 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
240 else |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
241 { |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
242 if (bytes_per_pixel == 2) |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
243 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
244 decoded[row_ptr + pixel_ptr + 0] = color_hi2; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
245 decoded[row_ptr + pixel_ptr + 1] = color_lo2; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
246 } |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
247 else |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
248 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
249 decoded[row_ptr + pixel_ptr + 0] = b2; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
250 decoded[row_ptr + pixel_ptr + 1] = g2; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
251 decoded[row_ptr + pixel_ptr + 2] = r2; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
252 } |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
253 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
254 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
|
255 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
256 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
257 } |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
258 |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
259 // 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
|
260 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
|
261 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
|
262 "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
|
263 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
|
264 } |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
265 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
266 void decode_msrle8( |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
267 unsigned char *encoded, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
268 int encoded_size, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
269 unsigned char *decoded, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
270 int width, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
271 int height, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
272 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
|
273 int bits_per_pixel) |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
274 { |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
275 int bytes_per_pixel = (bits_per_pixel + 1) / 8; |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
276 unsigned char r, g, b; // for 24/32 bpp |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
277 unsigned char color_hi, color_lo; // for 15/16 bpp |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
278 int stream_ptr = 0; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
279 unsigned char rle_code; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
280 unsigned char extra_byte; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
281 unsigned char stream_byte; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
282 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
|
283 int pixel_ptr = 0; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
284 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
|
285 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
|
286 |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
287 r = g = b = color_hi = color_lo = 0; |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
288 while (row_ptr >= 0) |
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 FETCH_NEXT_STREAM_BYTE(); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
291 rle_code = stream_byte; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
292 if (rle_code == 0) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
293 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
294 // 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
|
295 FETCH_NEXT_STREAM_BYTE(); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
296 if (stream_byte == 0) |
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 // 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
|
299 row_ptr -= row_dec; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
300 pixel_ptr = 0; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
301 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
302 else if (stream_byte == 1) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
303 // decode is done |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
304 return; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
305 else if (stream_byte == 2) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
306 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
307 // reposition frame decode coordinates |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
308 FETCH_NEXT_STREAM_BYTE(); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
309 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
|
310 FETCH_NEXT_STREAM_BYTE(); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
311 row_ptr -= stream_byte * row_dec; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
312 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
313 else |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
314 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
315 // copy pixels from encoded stream |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
316 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
|
317 (row_ptr < 0)) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
318 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
319 mp_msg(MSGT_DECVIDEO, MSGL_WARN, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
320 "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
|
321 return; |
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 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
324 rle_code = stream_byte; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
325 extra_byte = stream_byte & 0x01; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
326 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
|
327 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
328 mp_msg(MSGT_DECVIDEO, MSGL_WARN, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
329 "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
|
330 return; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
331 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
332 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
333 while (rle_code--) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
334 { |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
335 FETCH_NEXT_STREAM_BYTE(); |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
336 if (bytes_per_pixel == 2) |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
337 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
338 color_hi = palette_map[stream_byte * 2 + 0]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
339 color_lo = palette_map[stream_byte * 2 + 1]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
340 decoded[row_ptr + pixel_ptr + 0] = color_hi; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
341 decoded[row_ptr + pixel_ptr + 1] = color_lo; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
342 } |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
343 else |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
344 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
345 r = palette_map[stream_byte * 4 + 2]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
346 g = palette_map[stream_byte * 4 + 1]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
347 b = palette_map[stream_byte * 4 + 0]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
348 decoded[row_ptr + pixel_ptr + 0] = b; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
349 decoded[row_ptr + pixel_ptr + 1] = g; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
350 decoded[row_ptr + pixel_ptr + 2] = r; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
351 } |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
352 pixel_ptr += bytes_per_pixel; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
353 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
354 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
355 // 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
|
356 if (extra_byte) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
357 stream_ptr++; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
358 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
359 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
360 else |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
361 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
362 // decode a run of data |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
363 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
|
364 (row_ptr < 0)) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
365 { |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
366 mp_msg(MSGT_DECVIDEO, MSGL_WARN, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
367 "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
|
368 return; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
369 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
370 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
371 FETCH_NEXT_STREAM_BYTE(); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
372 |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
373 if (bytes_per_pixel == 2) |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
374 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
375 color_hi = palette_map[stream_byte * 2 + 0]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
376 color_lo = palette_map[stream_byte * 2 + 1]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
377 } |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
378 else |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
379 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
380 r = palette_map[stream_byte * 4 + 2]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
381 g = palette_map[stream_byte * 4 + 1]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
382 b = palette_map[stream_byte * 4 + 0]; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
383 } |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
384 while(rle_code--) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
385 { |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
386 if (bytes_per_pixel == 2) |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
387 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
388 decoded[row_ptr + pixel_ptr + 0] = color_hi; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
389 decoded[row_ptr + pixel_ptr + 1] = color_lo; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
390 } |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
391 else |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
392 { |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
393 decoded[row_ptr + pixel_ptr + 0] = b; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
394 decoded[row_ptr + pixel_ptr + 1] = g; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
395 decoded[row_ptr + pixel_ptr + 2] = r; |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
396 } |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
397 pixel_ptr += bytes_per_pixel; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
398 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
399 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
400 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
401 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
402 // 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
|
403 if (stream_ptr < encoded_size) |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
404 mp_msg(MSGT_DECVIDEO, MSGL_WARN, |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
405 "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
|
406 stream_ptr, encoded_size); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
407 } |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
408 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
409 // decode a frame |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
410 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
|
411 mp_image_t* mpi; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
412 if(len<=0) return NULL; // skipped frame |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
413 |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
414 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
|
415 sh->disp_w, sh->disp_h); |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
416 if(!mpi) return NULL; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
417 |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
418 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
|
419 decode_msrle8( |
5193
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
420 data,len, mpi->planes[0], |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
421 sh->disp_w, sh->disp_h, |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
422 (unsigned char *)sh->context, |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
423 mpi->imgfmt & 255); |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
424 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
|
425 decode_msrle4( |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
426 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
|
427 sh->disp_w, sh->disp_h, |
5420
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
428 (unsigned char *)sh->context, |
4ea69b1790d9
modified the new MS RLE decoder to support BGR15/16 output formats in
melanson
parents:
5213
diff
changeset
|
429 mpi->imgfmt & 255); |
5213
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
430 else |
b40644bb0e61
oh yeah, this is it...MPlayer now has 4-bit MS RLE support...I think
melanson
parents:
5193
diff
changeset
|
431 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
|
432 "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
|
433 |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
434 return mpi; |
abea2deab4d6
MPlayer now has a Microsoft RLE decoder to call its own...only supports
melanson
parents:
diff
changeset
|
435 } |