Mercurial > mplayer.hg
annotate libvo/vo_svga.c @ 6451:ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
author | michael |
---|---|
date | Sun, 16 Jun 2002 20:25:50 +0000 |
parents | a5df6daa31fb |
children | 7f06ef0d58a6 |
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 |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
67 #define BPP_2 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; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
134 case 2 : bpp_avail |= BPP_2; 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; |
483 | 196 } |
411 | 197 } else { |
198 bpp = vo_dbpp; | |
504 | 199 if (verbose) |
200 printf("vo_svga: vo_dbpp == %d\n",bpp); | |
411 | 201 switch (bpp) { |
483 | 202 case 32: if (!(bpp_avail & BPP_32)) { |
485 | 203 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 204 return(1); |
205 } | |
485 | 206 break; |
483 | 207 case 24: if (!(bpp_avail & BPP_24)) { |
485 | 208 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 209 return(1); |
210 } | |
485 | 211 break; |
483 | 212 case 16: if (!(bpp_avail & BPP_16)) { |
485 | 213 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 214 return(1); |
215 } | |
485 | 216 break; |
483 | 217 case 15: if (!(bpp_avail & BPP_15)) { |
485 | 218 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 219 return(1); |
220 } | |
485 | 221 break; |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
222 case 8: if (!(bpp_avail & BPP_8)) { |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
223 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
|
224 return(1); |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
225 } |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
226 break; |
411 | 227 } |
228 } | |
483 | 229 |
230 list = modelist; | |
504 | 231 if (verbose) { |
232 printf("vo_svga: Looking for the best resolution...\n"); | |
233 printf("vo_svga: req_w: %d, req_h: %d, bpp: %d\n",req_w,req_h,bpp); | |
234 } | |
485 | 235 while (list != NULL) { |
483 | 236 if ((list->modeinfo.width >= req_w) && (list->modeinfo.height >= req_h)) { |
504 | 237 if (verbose) { |
238 switch (list->modeinfo.colors) { | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
239 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
|
240 list->modenum,list->modeinfo.width,list->modeinfo.height); |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
241 break; |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
242 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
|
243 list->modenum,list->modeinfo.width,list->modeinfo.height); |
504 | 244 break; |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
245 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
|
246 list->modenum,list->modeinfo.width,list->modeinfo.height); |
504 | 247 break; |
248 } | |
249 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
|
250 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
|
251 list->modenum,list->modeinfo.width,list->modeinfo.height); |
504 | 252 break; |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
253 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
|
254 list->modenum,list->modeinfo.width,list->modeinfo.height); |
504 | 255 break; |
256 } | |
257 } | |
285 | 258 switch (bpp) { |
483 | 259 case 32: if (list->modeinfo.bytesperpixel == 4) |
485 | 260 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
261 vid_mode = list->modenum; | |
262 buf_w = list->modeinfo.width; | |
263 buf_h = list->modeinfo.height; | |
976 | 264 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
485 | 265 } |
266 break; | |
483 | 267 case 24: if (list->modeinfo.bytesperpixel == 3) |
485 | 268 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
269 vid_mode = list->modenum; | |
270 buf_w = list->modeinfo.width; | |
271 buf_h = list->modeinfo.height; | |
976 | 272 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
485 | 273 } |
274 break; | |
483 | 275 case 16: if (list->modeinfo.colors == 65536) |
485 | 276 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
277 vid_mode = list->modenum; | |
278 buf_w = list->modeinfo.width; | |
279 buf_h = list->modeinfo.height; | |
976 | 280 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
485 | 281 } |
282 break; | |
483 | 283 case 15: if (list->modeinfo.colors == 32768) |
485 | 284 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
285 vid_mode = list->modenum; | |
286 buf_w = list->modeinfo.width; | |
287 buf_h = list->modeinfo.height; | |
976 | 288 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
485 | 289 } |
290 break; | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
291 case 8: if (list->modeinfo.colors == 256) |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
292 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
|
293 vid_mode = list->modenum; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
294 buf_w = list->modeinfo.width; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
295 buf_h = list->modeinfo.height; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
296 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
|
297 } |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
298 break; |
285 | 299 } |
483 | 300 } |
301 list = list->next; | |
407 | 302 } |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
303 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
304 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
|
305 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
|
306 oldmethod=1; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
307 vo_subdevice+=3; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
308 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
|
309 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
310 } |
485 | 311 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
312 if((vo_subdevice) && *vo_subdevice) { |
2982
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
313 int vm; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
314 vm=vga_getmodenumber(vo_subdevice); |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
315 list=modelist; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
316 while(list) { |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
317 if(list->modenum == vm) { |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
318 buf_w = list->modeinfo.width; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
319 buf_h = list->modeinfo.height; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
320 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
|
321 switch(list->modeinfo.colors) { |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
322 case 256: |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
323 bpp=8; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
324 bpp_conv=0; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
325 break; |
2982
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
326 case 32768: |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
327 bpp=16; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
328 bpp_conv=1; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
329 break; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
330 case 65536: |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
331 bpp=16; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
332 bpp_conv=0; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
333 break; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
334 case (1<<24): |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
335 if(list->modeinfo.bytesperpixel == 3) { |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
336 bpp=32; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
337 bpp_conv=1; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
338 } else { |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
339 bpp=32; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
340 bpp_conv=0; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
341 } |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
342 break; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
343 } |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
344 vid_mode=vm; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
345 list=NULL; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
346 } else list=list->next; |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
347 } |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
348 } |
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
349 |
504 | 350 if (verbose) |
351 printf("vo_svga: vid_mode: %d\n",vid_mode); | |
485 | 352 if (vga_setmode(vid_mode) == -1) { |
286 | 353 printf("vo_svga: vga_setmode(%d) failed.\n",vid_mode); |
483 | 354 uninit(); |
285 | 355 return(1); // error |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
356 } |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
357 |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
358 /* set 332 palette for 8 bpp */ |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
359 if(bpp==8){ |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
360 int i; |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
361 for(i=0; i<256; i++) |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
362 vga_setpalette(i, (i>>2)&0x38, (i<<1)&0x38, (i<<4)&0x30); |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
363 } |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
364 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
365 WIDTH=vga_getxdim(); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
366 HEIGHT=vga_getydim(); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
367 BYTESPERPIXEL=(bpp+1)>>3; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
368 LINEWIDTH=WIDTH*BYTESPERPIXEL; |
2982
32638add0dc8
mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents:
2732
diff
changeset
|
369 vga_setlinearaddressing(); |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
370 if(oldmethod) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
371 buffer=malloc(HEIGHT*LINEWIDTH); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
372 maxframes=0; |
286 | 373 } |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
374 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
|
375 GRAPH_MEM=vga_getgraphmem(); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
376 frame=0; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
377 fillbox(0,0,WIDTH,HEIGHT*(maxframes+1),0); |
285 | 378 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
379 orig_w = width; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
380 orig_h = height; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
381 maxw = orig_w; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
382 maxh = orig_h; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
383 |
485 | 384 if (bpp_conv) { |
483 | 385 bppbuf = malloc(maxw * maxh * BYTESPERPIXEL); |
485 | 386 if (bppbuf == NULL) { |
387 printf("vo_svga: bppbuf -> Not enough memory for buffering!\n"); | |
388 uninit(); | |
389 return (1); | |
390 } | |
483 | 391 } |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
392 |
285 | 393 x_pos = (WIDTH - maxw) / 2; |
394 y_pos = (HEIGHT - maxh) / 2; | |
395 | |
396 if (pformat == IMGFMT_YV12) { | |
397 yuv2rgb_init(bpp, MODE_RGB); | |
398 yuvbuf = malloc(maxw * maxh * BYTESPERPIXEL); | |
483 | 399 if (yuvbuf == NULL) { |
485 | 400 printf("vo_svga: yuvbuf -> Not enough memory for buffering!\n"); |
407 | 401 uninit(); |
402 return (1); | |
403 } | |
285 | 404 } |
377 | 405 |
504 | 406 printf("vo_svga: SVGAlib resolution: %dx%d %dbpp - ", WIDTH, HEIGHT, bpp); |
293 | 407 if (maxw != orig_w || maxh != orig_h) printf("Video scaled to: %dx%d\n",maxw,maxh); |
285 | 408 else printf("No video scaling\n"); |
409 | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
410 vga_setdisplaystart(0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
411 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
412 return (0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
413 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
414 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
415 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
|
416 return (&vo_info); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
417 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
418 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
419 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
|
420 if (pformat == IMGFMT_YV12) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
421 yuv2rgb(yuvbuf, src[0], src[1], src[2], orig_w, orig_h, orig_w * BYTESPERPIXEL, orig_w, orig_w / 2); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
422 src[0] = yuvbuf; |
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 if (bpp_conv) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
425 switch(bpp) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
426 case 32: { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
427 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
|
428 uint8_t *dest = bppbuf; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
429 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
|
430 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
431 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
|
432 dest[i] = source[i]; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
433 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
|
434 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
|
435 dest[i+3] = 0; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
436 i += 4; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
437 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
438 } break; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
439 case 16: { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
440 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
|
441 } break; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
442 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
443 src[0] = bppbuf; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
444 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
445 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
|
446 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
447 return (0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
448 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
449 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
450 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
|
451 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
|
452 uint8_t *src = yuvbuf; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
453 uint32_t sw, sh; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
454 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
455 yuv2rgb(yuvbuf, image[0], image[1], image[2], w, h, orig_w * BYTESPERPIXEL, stride[0], stride[1]); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
456 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
|
457 |
285 | 458 return (0); |
459 } | |
460 | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
461 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
|
462 { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
463 if(oldmethod) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
464 if (y_pos) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
465 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
|
466 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
|
467 if (x_pos) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
468 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
|
469 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
|
470 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
|
471 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
472 } else if (x_pos) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
473 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
|
474 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
|
475 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
476 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
|
477 } else |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
478 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
|
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 void flip_page(void) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
482 if(oldmethod) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
483 int i; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
484 uint8_t *b; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
485 b=buffer; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
486 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
|
487 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
|
488 b+=LINEWIDTH; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
489 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
490 } else { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
491 if(maxframes) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
492 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
|
493 frame++; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
494 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
|
495 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
496 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
497 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
498 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
499 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
|
500 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
501 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
502 static void uninit(void) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
503 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
|
504 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
505 vga_setmode(TEXT); |
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 if (bppbuf != NULL) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
508 free(bppbuf); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
509 if (yuvbuf != NULL) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
510 free(yuvbuf); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
511 while (modelist != NULL) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
512 list=modelist; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
513 modelist=modelist->next; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
514 free(list); |
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 checked = 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 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
520 /* --------------------------------------------------------------------- */ |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
521 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
522 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
|
523 vga_modelist_t *list; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
524 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
525 if (modelist == NULL) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
526 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
|
527 if (modelist == NULL) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
528 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
|
529 return(1); // error |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
530 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
531 modelist->modenum = mode; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
532 modelist->modeinfo = minfo; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
533 modelist->next = NULL; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
534 } else { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
535 list = modelist; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
536 while (list->next != NULL) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
537 list = list->next; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
538 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
|
539 if (list->next == NULL) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
540 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
|
541 return(1); // error |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
542 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
543 list = list->next; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
544 list->modenum = mode; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
545 list->modeinfo = minfo; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
546 list->next = NULL; |
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 return (0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
549 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
550 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
551 static int checksupportedmodes() { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
552 uint16_t i, max; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
553 vga_modeinfo *minfo; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
554 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
555 checked = 1; |
6052 | 556 getch2_disable(); |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
557 vga_init(); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
558 vga_disabledriverreport(); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
559 max = vga_lastmodenumber(); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
560 if (verbose >= 2) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
561 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
|
562 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
|
563 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
|
564 minfo = vga_getmodeinfo(i); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
565 switch (minfo->colors) { |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
566 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
|
567 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
|
568 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
|
569 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
570 switch (minfo->bytesperpixel) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
571 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
|
572 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
|
573 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
574 if (verbose >= 2) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
575 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
|
576 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
|
577 return(1); |
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 return(0); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
580 } |
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 |
285 | 583 static uint32_t query_format(uint32_t format) { |
485 | 584 uint32_t res = 0; |
407 | 585 |
483 | 586 if (!checked) { |
587 if (checksupportedmodes()) // Looking for available video modes | |
588 return(0); | |
589 } | |
485 | 590 |
591 // if (vo_dbpp) => There is NO conversion!!! | |
592 if (vo_dbpp) { | |
712 | 593 if (format == IMGFMT_YV12) return (1); |
485 | 594 switch (vo_dbpp) { |
488 | 595 case 32: if ((format == IMGFMT_RGB32) || (format == IMGFMT_BGR32)) |
485 | 596 return ((bpp_avail & BPP_32) ? 1 : 0); |
597 break; | |
488 | 598 case 24: if ((format == IMGFMT_RGB24) || (format == IMGFMT_BGR24)) |
485 | 599 return ((bpp_avail & BPP_24) ? 1 : 0); |
600 break; | |
488 | 601 case 16: if ((format == IMGFMT_RGB16) || (format == IMGFMT_BGR16)) |
485 | 602 return ((bpp_avail & BPP_16) ? 1 : 0); |
603 break; | |
488 | 604 case 15: if ((format == IMGFMT_RGB15) || (format == IMGFMT_BGR15)) |
485 | 605 return ((bpp_avail & BPP_15) ? 1 : 0); |
606 break; | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
607 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
|
608 return ((bpp_avail & BPP_8 ) ? 1 : 0); |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
609 break; |
407 | 610 } |
488 | 611 } else { |
485 | 612 switch (format) { |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
613 case IMGFMT_RGB32: |
488 | 614 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
|
615 case IMGFMT_RGB24: |
488 | 616 case IMGFMT_BGR24: { |
485 | 617 res = (bpp_avail & BPP_24) ? 1 : 0; |
618 if (!res) | |
619 res = (bpp_avail & BPP_32) ? 1 : 0; | |
620 return (res); | |
621 } break; | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
622 case IMGFMT_RGB16: |
488 | 623 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
|
624 case IMGFMT_RGB15: |
488 | 625 case IMGFMT_BGR15: { |
485 | 626 res = (bpp_avail & BPP_15) ? 1 : 0; |
627 if (!res) | |
628 res = (bpp_avail & BPP_16) ? 1 : 0; | |
629 return (res); | |
630 } break; | |
631 case IMGFMT_YV12: return (1); break; | |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
632 case IMGFMT_RGB8: |
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
633 case IMGFMT_BGR8: return ((bpp_avail & BPP_8) ? 1 : 0); break; |
285 | 634 } |
488 | 635 } |
285 | 636 return (0); |
637 } | |
638 | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
639 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
|
640 int base, add, wid; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
641 if(oldmethod) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
642 wid=w*BYTESPERPIXEL; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
643 add=wid*prog; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
644 while( (h--) > 0 ) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
645 memcpy(buffer+x*BYTESPERPIXEL+(y++)*LINEWIDTH, buf, wid); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
646 buf+=add; |
6451
ed906af317da
8bpp support (no dithering yet, use -vop noise for now)
michael
parents:
6052
diff
changeset
|
647 } |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
648 } else { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
649 wid=w*BYTESPERPIXEL; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
650 add=wid*prog; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
651 base=frame*HEIGHT; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
652 while( (h--) > 0 ) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
653 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
|
654 buf+=add; |
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 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
657 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
658 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
659 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
|
660 putbox(x,y,w,h,buf0,0); |
285 | 661 } |
662 | |
663 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, | |
664 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
|
665 int base; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
666 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
667 if(oldmethod) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
668 base=buffer; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
669 } else |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
670 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
|
671 |
327 | 672 switch (bpp) { |
673 case 32: | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
674 vo_draw_alpha_rgb32(w, h, src, srca, stride, base+4*(y0*WIDTH+x0), 4*WIDTH); |
327 | 675 break; |
676 case 24: | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
677 vo_draw_alpha_rgb24(w, h, src, srca, stride, base+3*(y0*WIDTH+x0), 3*WIDTH); |
327 | 678 break; |
679 case 16: | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
680 vo_draw_alpha_rgb16(w, h, src, srca, stride, base+2*(y0*WIDTH+x0), 2*WIDTH); |
327 | 681 break; |
682 case 15: | |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
683 vo_draw_alpha_rgb15(w, h, src, srca, stride, base+2*(y0*WIDTH+x0), 2*WIDTH); |
327 | 684 break; |
685 } | |
285 | 686 } |
4352 | 687 |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
688 static uint32_t get_image(mp_image_t *mpi) |
4352 | 689 { |
5679
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
690 if (/* zoomFlag || */ |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
691 !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
|
692 ((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
|
693 (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
|
694 (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
|
695 (mpi->width != image_width) || |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
696 (mpi->height != image_height) */ |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
697 ) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
698 return(VO_FALSE); |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
699 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
700 /* |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
701 if (Flip_Flag) |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
702 { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
703 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
|
704 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
|
705 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
706 else |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
707 */ |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
708 { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
709 mpi->stride[0] = LINEWIDTH; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
710 if(oldmethod) { |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
711 mpi->planes[0] = buffer; |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
712 } else |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
713 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
|
714 } |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
715 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
|
716 |
30f196ff3bec
This patch replaces vo_svga.c with an improved version that does not use
arpi
parents:
4596
diff
changeset
|
717 return(VO_TRUE); |
4352 | 718 } |
719 |