Mercurial > mplayer.hg
annotate libvo/vo_svga.c @ 6540:5b3cace64e9d
100l (non mmx versions didnt compile)
some cleanup
author | michael |
---|---|
date | Mon, 24 Jun 2002 00:18:29 +0000 |
parents | f0b64210ce97 |
children | 6850df500b8c |
rev | line source |
---|---|
285 | 1 /* |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
2 Video driver for SVGAlib |
285 | 3 by Zoltan Mark Vician <se7en@sch.bme.hu> |
381 | 4 Code started: Mon Apr 1 23:25:47 2001 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
5 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
6 Some changes by Matan Ziv-Av <matan@svgalib.org> |
285 | 7 */ |
8 | |
9 #include <stdio.h> | |
10 #include <stdlib.h> | |
11 | |
12 #include <vga.h> | |
13 | |
485 | 14 #include <limits.h> |
15 | |
285 | 16 #include "config.h" |
17 #include "video_out.h" | |
18 #include "video_out_internal.h" | |
19 | |
616 | 20 #include "sub.h" |
2556 | 21 #include "../postproc/rgb2rgb.h" |
616 | 22 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
23 #include "../mp_msg.h" |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
24 //#include "../mp_image.h" |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
25 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
26 extern int vo_directrendering; |
485 | 27 extern int vo_dbpp; |
504 | 28 extern int verbose; |
407 | 29 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
30 static uint32_t query_format(uint32_t format); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
31 static int checksupportedmodes(); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
32 static void putbox(int x, int y, int w, int h, uint8_t *buf,int prog); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
33 static void fillbox(int x, int y, int w, int h, uint32_t c); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
34 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
35 unsigned char *srca, int stride); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
36 static uint32_t get_image(mp_image_t *mpi); |
285 | 37 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
38 static uint8_t *yuvbuf = NULL, *bppbuf = NULL; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
39 static uint8_t *GRAPH_MEM; |
285 | 40 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
41 static int BYTESPERPIXEL, WIDTH, HEIGHT, LINEWIDTH; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
42 static int frame, maxframes, oldmethod=0; |
285 | 43 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
44 static uint32_t pformat; |
285 | 45 static uint32_t orig_w, orig_h, maxw, maxh; // Width, height |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
46 static uint8_t buf0[8192]; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
47 static uint8_t *buffer; |
285 | 48 |
483 | 49 typedef struct vga_modelist_s { |
50 uint16_t modenum; | |
51 vga_modeinfo modeinfo; | |
52 struct vga_modelist_s *next; | |
53 } vga_modelist_t; | |
447 | 54 |
483 | 55 vga_modelist_t *modelist = NULL; |
56 | |
327 | 57 static uint8_t bpp; |
483 | 58 static uint8_t bpp_conv = 0; |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
447
diff
changeset
|
59 static uint32_t pformat; |
447 | 60 |
483 | 61 #define BPP_15 1 |
62 #define BPP_16 2 | |
63 #define BPP_24 4 | |
64 #define BPP_32 8 | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
65 #define BPP_8 16 |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
66 #define BPP_4 32 |
6453 | 67 #define BPP_1 64 |
483 | 68 static uint8_t bpp_avail = 0; |
69 | |
285 | 70 static uint8_t checked = 0; |
483 | 71 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
72 static uint32_t x_pos, y_pos; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
73 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
74 LIBVO_EXTERN(svga) |
285 | 75 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
76 static vo_info_t vo_info = { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
77 "SVGAlib", |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
78 "svga", |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
79 "Zoltan Mark Vician <se7en@sch.bme.hu>", |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
80 "" |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
81 }; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
82 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
83 static uint32_t preinit(const char *arg) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
84 { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
85 int i; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
86 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
87 for(i=0;i<8192;i++) buf0[i]=0; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
88 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
89 if(vo_directrendering) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
90 maxframes=0; |
483 | 91 } else { |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
92 maxframes=1; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
93 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
94 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
95 printf("vo_svga: preinit - maxframes=%i\n",maxframes); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
96 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
97 return 0; |
483 | 98 } |
99 | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
100 static uint32_t control(uint32_t request, void *data, ...) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
101 { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
102 switch (request) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
103 case VOCTRL_QUERY_FORMAT: |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
104 return query_format(*((uint32_t*)data)); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
105 case VOCTRL_GET_IMAGE: |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
106 return get_image(data); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
107 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
108 return VO_NOTIMPL; |
285 | 109 } |
110 | |
4433 | 111 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, |
285 | 112 uint32_t d_height, uint32_t fullscreen, char *title, |
4433 | 113 uint32_t format,const vo_tune_info_t *info) { |
483 | 114 uint32_t req_w = (d_width > 0 ? d_width : width); |
115 uint32_t req_h = (d_height > 0 ? d_height : height); | |
116 uint16_t vid_mode = 0; | |
976 | 117 uint8_t res_widescr, vid_widescr = (((req_w*1.0)/req_h) > (4.0/3)) ? 1 : 0; |
485 | 118 uint16_t buf_w = USHRT_MAX, buf_h = USHRT_MAX; |
483 | 119 vga_modelist_t *list = modelist; |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
120 |
285 | 121 if (!checked) { |
485 | 122 if (checksupportedmodes()) // Looking for available video modes |
483 | 123 return(1); |
285 | 124 } |
407 | 125 |
483 | 126 bpp_avail = 0; |
127 while (list != NULL) { | |
128 if ((list->modeinfo.width >= req_w) && (list->modeinfo.height >= req_h)) { | |
129 switch (list->modeinfo.colors) { | |
130 case 32768: bpp_avail |= BPP_15; break; | |
131 case 65536: bpp_avail |= BPP_16; break; | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
132 case 256 : bpp_avail |= BPP_8; break; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
133 case 16 : bpp_avail |= BPP_4; break; |
6453 | 134 case 2 : bpp_avail |= BPP_1; break; |
483 | 135 } |
136 switch (list->modeinfo.bytesperpixel) { | |
137 case 3: bpp_avail |= BPP_24; break; | |
138 case 4: bpp_avail |= BPP_32; break; | |
139 } | |
140 } | |
141 list = list->next; | |
142 } | |
143 | |
285 | 144 pformat = format; |
411 | 145 |
483 | 146 // bpp check |
147 bpp_conv = 0; | |
411 | 148 if (!vo_dbpp) { |
149 if (format == IMGFMT_YV12) bpp = 32; | |
150 else bpp = format & 255; | |
504 | 151 if (verbose) |
152 printf("vo_svga: vo_dbpp == 0, bpp: %d\n",bpp); | |
483 | 153 switch (bpp) { |
154 case 32: if (!(bpp_avail & BPP_32)) { | |
155 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
485 | 156 printf("vo_svga: Maybe you should try -bpp\n"); |
483 | 157 return(1); |
158 } | |
159 break; | |
619 | 160 case 24: if (!(bpp_avail & BPP_24)) { |
483 | 161 if (!(bpp_avail & BPP_32)) { |
162 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
485 | 163 printf("vo_svga: Maybe you should try -bpp\n"); |
483 | 164 return(1); |
165 } else { | |
166 bpp = 32; | |
167 bpp_conv = 1; | |
617 | 168 printf("vo_svga: BPP conversion 24->32\n"); |
619 | 169 } |
170 } | |
483 | 171 break; |
172 case 16: if (!(bpp_avail & BPP_16)) { | |
173 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
174 printf("vo_svga: Maybe you should try -bpp\n"); | |
175 return(1); | |
176 } | |
177 break; | |
619 | 178 case 15: if (!(bpp_avail & BPP_15)) { |
483 | 179 if (!(bpp_avail & BPP_16)) { |
180 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
181 printf("vo_svga: Maybe you should try -bpp\n"); | |
182 return(1); | |
183 } else { | |
184 bpp = 16; | |
185 bpp_conv = 1; | |
617 | 186 printf("vo_svga: BPP conversion 15->16\n"); |
483 | 187 } |
619 | 188 } |
483 | 189 break; |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
190 case 8: if (!(bpp_avail & BPP_8)) { |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
191 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
192 printf("vo_svga: Maybe you should try -bpp\n"); |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
193 return(1); |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
194 } |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
195 break; |
6453 | 196 case 4: if (!(bpp_avail & BPP_4)) { |
197 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
198 printf("vo_svga: Maybe you should try -bpp\n"); | |
199 return(1); | |
200 } | |
201 break; | |
202 case 1: if (!(bpp_avail & BPP_1)) { | |
203 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
204 printf("vo_svga: Maybe you should try -bpp\n"); | |
205 return(1); | |
206 } | |
207 break; | |
483 | 208 } |
411 | 209 } else { |
210 bpp = vo_dbpp; | |
504 | 211 if (verbose) |
212 printf("vo_svga: vo_dbpp == %d\n",bpp); | |
411 | 213 switch (bpp) { |
483 | 214 case 32: if (!(bpp_avail & BPP_32)) { |
485 | 215 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 216 return(1); |
217 } | |
485 | 218 break; |
483 | 219 case 24: if (!(bpp_avail & BPP_24)) { |
485 | 220 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 221 return(1); |
222 } | |
485 | 223 break; |
483 | 224 case 16: if (!(bpp_avail & BPP_16)) { |
485 | 225 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 226 return(1); |
227 } | |
485 | 228 break; |
483 | 229 case 15: if (!(bpp_avail & BPP_15)) { |
485 | 230 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 231 return(1); |
232 } | |
485 | 233 break; |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
234 case 8: if (!(bpp_avail & BPP_8)) { |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
235 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
236 return(1); |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
237 } |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
238 break; |
6453 | 239 case 4: if (!(bpp_avail & BPP_4)) { |
240 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); | |
241 return(1); | |
242 } | |
243 break; | |
244 case 1: if (!(bpp_avail & BPP_1)) { | |
245 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); | |
246 return(1); | |
247 } | |
248 break; | |
411 | 249 } |
250 } | |
483 | 251 |
252 list = modelist; | |
504 | 253 if (verbose) { |
254 printf("vo_svga: Looking for the best resolution...\n"); | |
255 printf("vo_svga: req_w: %d, req_h: %d, bpp: %d\n",req_w,req_h,bpp); | |
256 } | |
485 | 257 while (list != NULL) { |
483 | 258 if ((list->modeinfo.width >= req_w) && (list->modeinfo.height >= req_h)) { |
504 | 259 if (verbose) { |
260 switch (list->modeinfo.colors) { | |
6453 | 261 case 2 : printf("vo_svga: vid_mode: %d, %dx%d 1bpp\n", |
262 list->modenum,list->modeinfo.width,list->modeinfo.height); | |
263 break; | |
264 case 16 : printf("vo_svga: vid_mode: %d, %dx%d 4bpp\n", | |
265 list->modenum,list->modeinfo.width,list->modeinfo.height); | |
266 break; | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
267 case 256 : printf("vo_svga: vid_mode: %d, %dx%d 8bpp\n", |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
268 list->modenum,list->modeinfo.width,list->modeinfo.height); |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
269 break; |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
270 case 32768: printf("vo_svga: vid_mode: %d, %dx%d 15bpp\n", |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
271 list->modenum,list->modeinfo.width,list->modeinfo.height); |
504 | 272 break; |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
273 case 65536: printf("vo_svga: vid_mode: %d, %dx%d 16bpp\n", |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
274 list->modenum,list->modeinfo.width,list->modeinfo.height); |
504 | 275 break; |
276 } | |
277 switch (list->modeinfo.bytesperpixel) { | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
278 case 3: printf("vo_svga: vid_mode: %d, %dx%d 24bpp\n", |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
279 list->modenum,list->modeinfo.width,list->modeinfo.height); |
504 | 280 break; |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
281 case 4: printf("vo_svga: vid_mode: %d, %dx%d 32bpp\n", |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
282 list->modenum,list->modeinfo.width,list->modeinfo.height); |
504 | 283 break; |
284 } | |
285 } | |
285 | 286 switch (bpp) { |
483 | 287 case 32: if (list->modeinfo.bytesperpixel == 4) |
485 | 288 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
289 vid_mode = list->modenum; | |
290 buf_w = list->modeinfo.width; | |
291 buf_h = list->modeinfo.height; | |
976 | 292 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
485 | 293 } |
294 break; | |
483 | 295 case 24: if (list->modeinfo.bytesperpixel == 3) |
485 | 296 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
297 vid_mode = list->modenum; | |
298 buf_w = list->modeinfo.width; | |
299 buf_h = list->modeinfo.height; | |
976 | 300 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
485 | 301 } |
302 break; | |
483 | 303 case 16: if (list->modeinfo.colors == 65536) |
485 | 304 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
305 vid_mode = list->modenum; | |
306 buf_w = list->modeinfo.width; | |
307 buf_h = list->modeinfo.height; | |
976 | 308 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
485 | 309 } |
310 break; | |
483 | 311 case 15: if (list->modeinfo.colors == 32768) |
485 | 312 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
313 vid_mode = list->modenum; | |
314 buf_w = list->modeinfo.width; | |
315 buf_h = list->modeinfo.height; | |
976 | 316 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
485 | 317 } |
318 break; | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
319 case 8: if (list->modeinfo.colors == 256) |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
320 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
321 vid_mode = list->modenum; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
322 buf_w = list->modeinfo.width; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
323 buf_h = list->modeinfo.height; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
324 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
325 } |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
326 break; |
6453 | 327 case 4: if (list->modeinfo.colors ==16) |
328 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { | |
329 vid_mode = list->modenum; | |
330 buf_w = list->modeinfo.width; | |
331 buf_h = list->modeinfo.height; | |
332 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; | |
333 } | |
334 break; | |
335 case 1: if (list->modeinfo.colors == 2) | |
336 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { | |
337 vid_mode = list->modenum; | |
338 buf_w = list->modeinfo.width; | |
339 buf_h = list->modeinfo.height; | |
340 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; | |
341 } | |
342 break; | |
285 | 343 } |
483 | 344 } |
345 list = list->next; | |
407 | 346 } |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
347 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
348 if((vo_subdevice) && (strlen(vo_subdevice)>2)) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
349 if(!strncmp(vo_subdevice,"old",3)) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
350 oldmethod=1; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
351 vo_subdevice+=3; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
352 if( *vo_subdevice == ',' ) vo_subdevice++; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
353 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
354 } |
485 | 355 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
356 if((vo_subdevice) && *vo_subdevice) { |
2982
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
357 int vm; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
358 vm=vga_getmodenumber(vo_subdevice); |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
359 list=modelist; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
360 while(list) { |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
361 if(list->modenum == vm) { |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
362 buf_w = list->modeinfo.width; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
363 buf_h = list->modeinfo.height; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
364 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
365 switch(list->modeinfo.colors) { |
6453 | 366 case 2: |
367 bpp=1; | |
368 bpp_conv=0; | |
369 break; | |
370 case 16: | |
371 bpp=4; | |
372 bpp_conv=0; | |
373 break; | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
374 case 256: |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
375 bpp=8; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
376 bpp_conv=0; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
377 break; |
2982
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
378 case 32768: |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
379 bpp=16; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
380 bpp_conv=1; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
381 break; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
382 case 65536: |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
383 bpp=16; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
384 bpp_conv=0; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
385 break; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
386 case (1<<24): |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
387 if(list->modeinfo.bytesperpixel == 3) { |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
388 bpp=32; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
389 bpp_conv=1; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
390 } else { |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
391 bpp=32; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
392 bpp_conv=0; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
393 } |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
394 break; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
395 } |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
396 vid_mode=vm; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
397 list=NULL; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
398 } else list=list->next; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
399 } |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
400 } |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
401 |
504 | 402 if (verbose) |
403 printf("vo_svga: vid_mode: %d\n",vid_mode); | |
485 | 404 if (vga_setmode(vid_mode) == -1) { |
286 | 405 printf("vo_svga: vga_setmode(%d) failed.\n",vid_mode); |
483 | 406 uninit(); |
285 | 407 return(1); // error |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
408 } |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
409 |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
410 /* set 332 palette for 8 bpp */ |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
411 if(bpp==8){ |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
412 int i; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
413 for(i=0; i<256; i++) |
6453 | 414 vga_setpalette(i, ((i>>5)&7)*9, ((i>>2)&7)*9, (i&3)*21); |
415 } | |
416 /* set 121 palette for 4 bpp */ | |
417 else if(bpp==4){ | |
418 int i; | |
419 for(i=0; i<16; i++) | |
420 vga_setpalette(i, ((i>>3)&1)*63, ((i>>1)&3)*21, (i&1)*63); | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
421 } |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
422 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
423 WIDTH=vga_getxdim(); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
424 HEIGHT=vga_getydim(); |
6453 | 425 BYTESPERPIXEL=(bpp+4)>>3; |
6456 | 426 if(bpp==1) |
427 LINEWIDTH=(WIDTH+7)/8; | |
428 else | |
429 LINEWIDTH=WIDTH*BYTESPERPIXEL; | |
430 | |
2982
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
431 vga_setlinearaddressing(); |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
432 if(oldmethod) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
433 buffer=malloc(HEIGHT*LINEWIDTH); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
434 maxframes=0; |
286 | 435 } |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
436 vga_claimvideomemory((maxframes+1)*HEIGHT*LINEWIDTH); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
437 GRAPH_MEM=vga_getgraphmem(); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
438 frame=0; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
439 fillbox(0,0,WIDTH,HEIGHT*(maxframes+1),0); |
285 | 440 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
441 orig_w = width; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
442 orig_h = height; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
443 maxw = orig_w; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
444 maxh = orig_h; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
445 |
485 | 446 if (bpp_conv) { |
483 | 447 bppbuf = malloc(maxw * maxh * BYTESPERPIXEL); |
485 | 448 if (bppbuf == NULL) { |
449 printf("vo_svga: bppbuf -> Not enough memory for buffering!\n"); | |
450 uninit(); | |
451 return (1); | |
452 } | |
483 | 453 } |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
454 |
285 | 455 x_pos = (WIDTH - maxw) / 2; |
456 y_pos = (HEIGHT - maxh) / 2; | |
457 | |
458 if (pformat == IMGFMT_YV12) { | |
459 yuv2rgb_init(bpp, MODE_RGB); | |
6456 | 460 if(bpp==1) |
461 yuvbuf = malloc((maxw+7)/8 * maxh); | |
462 else | |
463 yuvbuf = malloc(maxw * maxh * BYTESPERPIXEL); | |
464 | |
483 | 465 if (yuvbuf == NULL) { |
485 | 466 printf("vo_svga: yuvbuf -> Not enough memory for buffering!\n"); |
407 | 467 uninit(); |
468 return (1); | |
469 } | |
285 | 470 } |
377 | 471 |
504 | 472 printf("vo_svga: SVGAlib resolution: %dx%d %dbpp - ", WIDTH, HEIGHT, bpp); |
293 | 473 if (maxw != orig_w || maxh != orig_h) printf("Video scaled to: %dx%d\n",maxw,maxh); |
285 | 474 else printf("No video scaling\n"); |
475 | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
476 vga_setdisplaystart(0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
477 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
478 return (0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
479 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
480 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
481 static const vo_info_t* get_info(void) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
482 return (&vo_info); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
483 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
484 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
485 static uint32_t draw_frame(uint8_t *src[]) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
486 if (pformat == IMGFMT_YV12) { |
6456 | 487 if(bpp==1) |
488 yuv2rgb(yuvbuf, src[0], src[1], src[2], orig_w, orig_h, (orig_w+7)/8, orig_w, orig_w / 2); | |
489 else | |
490 yuv2rgb(yuvbuf, src[0], src[1], src[2], orig_w, orig_h, orig_w * BYTESPERPIXEL, orig_w, orig_w / 2); | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
491 src[0] = yuvbuf; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
492 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
493 if (bpp_conv) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
494 switch(bpp) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
495 case 32: { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
496 uint8_t *source = src[0]; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
497 uint8_t *dest = bppbuf; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
498 register uint32_t i = 0; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
499 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
500 while (i < (maxw * maxh * 4)) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
501 dest[i] = source[i]; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
502 dest[i+1] = source[i+1]; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
503 dest[i+2] = source[i+2]; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
504 dest[i+3] = 0; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
505 i += 4; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
506 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
507 } break; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
508 case 16: { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
509 rgb15to16(src[0],bppbuf,maxw * maxh * 2); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
510 } break; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
511 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
512 src[0] = bppbuf; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
513 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
514 putbox(x_pos, y_pos, maxw, maxh, src[0], 1); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
515 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
516 return (0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
517 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
518 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
519 static uint32_t draw_slice(uint8_t *image[], int stride[], |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
520 int w, int h, int x, int y) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
521 uint8_t *src = yuvbuf; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
522 uint32_t sw, sh; |
6456 | 523 if(bpp==1) |
524 yuv2rgb(yuvbuf, image[0], image[1], image[2], w, h, (orig_w+7)/8, stride[0], stride[1]); | |
525 else | |
526 yuv2rgb(yuvbuf, image[0], image[1], image[2], w, h, orig_w * BYTESPERPIXEL, stride[0], stride[1]); | |
527 | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
528 putbox(x + x_pos, y + y_pos, w, h, src, 1); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
529 |
285 | 530 return (0); |
531 } | |
532 | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
533 static void draw_osd(void) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
534 { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
535 if(oldmethod) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
536 if (y_pos) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
537 fillbox(0, 0, WIDTH, y_pos, 0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
538 fillbox(0, HEIGHT - y_pos, WIDTH, y_pos, 0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
539 if (x_pos) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
540 int hmy=HEIGHT - (y_pos<<1); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
541 fillbox(0, y_pos, x_pos, hmy, 0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
542 fillbox(WIDTH - x_pos, y_pos, x_pos, hmy, 0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
543 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
544 } else if (x_pos) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
545 fillbox(0, y_pos, x_pos, HEIGHT, 0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
546 fillbox(WIDTH - x_pos, y_pos, x_pos, HEIGHT, 0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
547 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
548 vo_draw_text(WIDTH, HEIGHT, draw_alpha); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
549 } else |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
550 vo_draw_text(maxw, maxh, draw_alpha); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
551 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
552 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
553 static void flip_page(void) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
554 if(oldmethod) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
555 int i; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
556 uint8_t *b; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
557 b=buffer; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
558 for(i=0;i<HEIGHT;i++){ |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
559 vga_drawscansegment(b,0,i,LINEWIDTH); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
560 b+=LINEWIDTH; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
561 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
562 } else { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
563 if(maxframes) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
564 vga_setdisplaystart(frame*HEIGHT*LINEWIDTH); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
565 frame++; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
566 if(frame>maxframes)frame=0; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
567 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
568 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
569 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
570 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
571 static void check_events(void) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
572 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
573 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
574 static void uninit(void) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
575 vga_modelist_t *list = modelist; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
576 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
577 vga_setmode(TEXT); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
578 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
579 if (bppbuf != NULL) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
580 free(bppbuf); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
581 if (yuvbuf != NULL) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
582 free(yuvbuf); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
583 while (modelist != NULL) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
584 list=modelist; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
585 modelist=modelist->next; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
586 free(list); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
587 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
588 checked = 0; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
589 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
590 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
591 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
592 /* --------------------------------------------------------------------- */ |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
593 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
594 static uint32_t add_mode(uint16_t mode, vga_modeinfo minfo) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
595 vga_modelist_t *list; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
596 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
597 if (modelist == NULL) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
598 modelist = (vga_modelist_t *) malloc(sizeof(vga_modelist_t)); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
599 if (modelist == NULL) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
600 printf("vo_svga: add_mode() failed. Not enough memory for modelist."); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
601 return(1); // error |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
602 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
603 modelist->modenum = mode; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
604 modelist->modeinfo = minfo; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
605 modelist->next = NULL; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
606 } else { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
607 list = modelist; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
608 while (list->next != NULL) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
609 list = list->next; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
610 list->next = (vga_modelist_t *) malloc(sizeof(vga_modelist_t)); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
611 if (list->next == NULL) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
612 printf("vo_svga: add_mode() failed. Not enough memory for modelist."); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
613 return(1); // error |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
614 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
615 list = list->next; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
616 list->modenum = mode; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
617 list->modeinfo = minfo; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
618 list->next = NULL; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
619 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
620 return (0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
621 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
622 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
623 static int checksupportedmodes() { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
624 uint16_t i, max; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
625 vga_modeinfo *minfo; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
626 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
627 checked = 1; |
6052 | 628 getch2_disable(); |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
629 vga_init(); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
630 vga_disabledriverreport(); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
631 max = vga_lastmodenumber(); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
632 if (verbose >= 2) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
633 printf("vo_svga: Max mode : %i\n",max); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
634 for (i = 1; i <= max; i++) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
635 if (vga_hasmode(i) > 0) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
636 minfo = vga_getmodeinfo(i); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
637 switch (minfo->colors) { |
6453 | 638 case 2 : bpp_avail |= BPP_1 ; break; |
639 case 16 : bpp_avail |= BPP_4 ; break; | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
640 case 256 : bpp_avail |= BPP_8 ; break; |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
641 case 32768: bpp_avail |= BPP_15; break; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
642 case 65536: bpp_avail |= BPP_16; break; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
643 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
644 switch (minfo->bytesperpixel) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
645 case 3: bpp_avail |= BPP_24; break; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
646 case 4: bpp_avail |= BPP_32; break; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
647 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
648 if (verbose >= 2) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
649 printf("vo_svga: Mode found: %s\n",vga_getmodename(i)); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
650 if (add_mode(i, *minfo)) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
651 return(1); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
652 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
653 return(0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
654 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
655 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
656 |
285 | 657 static uint32_t query_format(uint32_t format) { |
485 | 658 uint32_t res = 0; |
407 | 659 |
483 | 660 if (!checked) { |
661 if (checksupportedmodes()) // Looking for available video modes | |
662 return(0); | |
663 } | |
485 | 664 |
665 // if (vo_dbpp) => There is NO conversion!!! | |
666 if (vo_dbpp) { | |
712 | 667 if (format == IMGFMT_YV12) return (1); |
485 | 668 switch (vo_dbpp) { |
488 | 669 case 32: if ((format == IMGFMT_RGB32) || (format == IMGFMT_BGR32)) |
485 | 670 return ((bpp_avail & BPP_32) ? 1 : 0); |
671 break; | |
488 | 672 case 24: if ((format == IMGFMT_RGB24) || (format == IMGFMT_BGR24)) |
485 | 673 return ((bpp_avail & BPP_24) ? 1 : 0); |
674 break; | |
488 | 675 case 16: if ((format == IMGFMT_RGB16) || (format == IMGFMT_BGR16)) |
485 | 676 return ((bpp_avail & BPP_16) ? 1 : 0); |
677 break; | |
488 | 678 case 15: if ((format == IMGFMT_RGB15) || (format == IMGFMT_BGR15)) |
485 | 679 return ((bpp_avail & BPP_15) ? 1 : 0); |
680 break; | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
681 case 8 : if ((format == IMGFMT_RGB8 ) || (format == IMGFMT_BGR8)) |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
682 return ((bpp_avail & BPP_8 ) ? 1 : 0); |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
683 break; |
6453 | 684 //FIXME RGB4 RGB1 ? |
407 | 685 } |
488 | 686 } else { |
485 | 687 switch (format) { |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
688 case IMGFMT_RGB32: |
488 | 689 case IMGFMT_BGR32: return ((bpp_avail & BPP_32) ? 1 : 0); break; |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
690 case IMGFMT_RGB24: |
488 | 691 case IMGFMT_BGR24: { |
485 | 692 res = (bpp_avail & BPP_24) ? 1 : 0; |
693 if (!res) | |
694 res = (bpp_avail & BPP_32) ? 1 : 0; | |
695 return (res); | |
696 } break; | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
697 case IMGFMT_RGB16: |
488 | 698 case IMGFMT_BGR16: return ((bpp_avail & BPP_16) ? 1 : 0); break; |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
699 case IMGFMT_RGB15: |
488 | 700 case IMGFMT_BGR15: { |
485 | 701 res = (bpp_avail & BPP_15) ? 1 : 0; |
702 if (!res) | |
703 res = (bpp_avail & BPP_16) ? 1 : 0; | |
704 return (res); | |
705 } break; | |
706 case IMGFMT_YV12: return (1); break; | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
707 case IMGFMT_RGB8: |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
708 case IMGFMT_BGR8: return ((bpp_avail & BPP_8) ? 1 : 0); break; |
285 | 709 } |
488 | 710 } |
285 | 711 return (0); |
712 } | |
713 | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
714 static void putbox(int x, int y, int w, int h, uint8_t *buf, int prog) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
715 int base, add, wid; |
6456 | 716 if(bpp==1) |
717 wid=(w+7)/8; | |
718 else | |
719 wid=w*BYTESPERPIXEL; | |
720 | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
721 if(oldmethod) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
722 add=wid*prog; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
723 while( (h--) > 0 ) { |
6456 | 724 if(bpp==1) |
725 memcpy(buffer+(x+7)/8+(y++)*LINEWIDTH, buf, wid); | |
726 else | |
727 memcpy(buffer+x*BYTESPERPIXEL+(y++)*LINEWIDTH, buf, wid); | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
728 buf+=add; |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
729 } |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
730 } else { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
731 add=wid*prog; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
732 base=frame*HEIGHT; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
733 while( (h--) > 0 ) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
734 vga_drawscansegment(buf, x, (y++)+base, wid); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
735 buf+=add; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
736 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
737 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
738 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
739 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
740 static void fillbox(int x, int y, int w, int h, uint32_t c) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
741 putbox(x,y,w,h,buf0,0); |
285 | 742 } |
743 | |
744 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, | |
745 unsigned char *srca, int stride) { | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
746 int base; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
747 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
748 if(oldmethod) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
749 base=buffer; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
750 } else |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
751 base=((frame*HEIGHT+y_pos)*WIDTH+x_pos)*BYTESPERPIXEL + GRAPH_MEM ; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
752 |
327 | 753 switch (bpp) { |
754 case 32: | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
755 vo_draw_alpha_rgb32(w, h, src, srca, stride, base+4*(y0*WIDTH+x0), 4*WIDTH); |
327 | 756 break; |
757 case 24: | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
758 vo_draw_alpha_rgb24(w, h, src, srca, stride, base+3*(y0*WIDTH+x0), 3*WIDTH); |
327 | 759 break; |
760 case 16: | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
761 vo_draw_alpha_rgb16(w, h, src, srca, stride, base+2*(y0*WIDTH+x0), 2*WIDTH); |
327 | 762 break; |
763 case 15: | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
764 vo_draw_alpha_rgb15(w, h, src, srca, stride, base+2*(y0*WIDTH+x0), 2*WIDTH); |
327 | 765 break; |
766 } | |
285 | 767 } |
4352 | 768 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
769 static uint32_t get_image(mp_image_t *mpi) |
4352 | 770 { |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
771 if (/* zoomFlag || */ |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
772 !IMGFMT_IS_BGR(mpi->imgfmt) || |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
773 ((mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) || |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
774 (mpi->flags & MP_IMGFLAG_PLANAR) || |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
775 (mpi->flags & MP_IMGFLAG_YUV) /* |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
776 (mpi->width != image_width) || |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
777 (mpi->height != image_height) */ |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
778 ) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
779 return(VO_FALSE); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
780 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
781 /* |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
782 if (Flip_Flag) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
783 { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
784 mpi->stride[0] = -image_width*((bpp+7)/8); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
785 mpi->planes[0] = ImageData - mpi->stride[0]*(image_height-1); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
786 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
787 else |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
788 */ |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
789 { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
790 mpi->stride[0] = LINEWIDTH; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
791 if(oldmethod) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
792 mpi->planes[0] = buffer; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
793 } else |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
794 mpi->planes[0] = GRAPH_MEM; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
795 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
796 mpi->flags |= MP_IMGFLAG_DIRECT; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
797 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
798 return(VO_TRUE); |
4352 | 799 } |
800 |