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