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