21 #include <linux/module.h>
22 #include <linux/errno.h>
23 #include <linux/kernel.h>
24 #include <linux/types.h>
25 #include <linux/videodev2.h>
74 if (try_win.left < 0) {
75 try_win.width += try_win.left;
78 if (try_win.top < 0) {
79 try_win.height += try_win.top;
82 try_win.width = (try_win.width < fbuf->
fmt.width) ?
83 try_win.width : fbuf->
fmt.width;
84 try_win.height = (try_win.height < fbuf->
fmt.height) ?
85 try_win.height : fbuf->
fmt.height;
86 if (try_win.left + try_win.width > fbuf->
fmt.width)
87 try_win.width = fbuf->
fmt.width - try_win.left;
88 if (try_win.top + try_win.height > fbuf->
fmt.height)
89 try_win.height = fbuf->
fmt.height - try_win.top;
93 if (try_win.width <= 0 || try_win.height <= 0)
129 if ((crop->
height/win->
w.height) >= 2)
130 crop->
height = win->
w.height * 2;
132 if ((crop->
width/win->
w.width) >= 2)
133 crop->
width = win->
w.width * 2;
135 if (crop->
width > 768) {
140 if (crop->
height != win->
w.height)
145 if ((crop->
height/win->
w.height) >= 4)
146 crop->
height = win->
w.height * 4;
148 if ((crop->
width/win->
w.width) >= 4)
149 crop->
width = win->
w.width * 4;
170 unsigned long vresize, hresize;
173 try_crop = *new_crop;
176 if (try_crop.
left < 0) {
180 if (try_crop.
top < 0) {
193 try_crop.
width &= ~1;
200 if (try_crop.
height != win->
w.height) {
204 if (try_crop.
width > 768)
205 try_crop.
width = 768;
209 vresize = (1024 * try_crop.
height) / win->
w.height;
215 win->
w.height = ((1024 * try_crop.
height) / vresize) & ~1;
216 if (win->
w.height == 0)
218 if (win->
w.height + win->
w.top > fbuf->
fmt.height) {
223 win->
w.height = (fbuf->
fmt.height - win->
w.top) & ~1;
228 hresize = (1024 * try_crop.
width) / win->
w.width;
234 win->
w.width = ((1024 * try_crop.
width) / hresize) & ~1;
235 if (win->
w.width == 0)
237 if (win->
w.width + win->
w.left > fbuf->
fmt.width) {
242 win->
w.width = (fbuf->
fmt.width - win->
w.left) & ~1;
243 if (try_crop.
width == 0)
247 if ((try_crop.
height/win->
w.height) >= 2)
248 try_crop.
height = win->
w.height * 2;
250 if ((try_crop.
width/win->
w.width) >= 2)
251 try_crop.
width = win->
w.width * 2;
258 if (try_crop.
height != win->
w.height)
259 try_crop.
width = 768;
262 if ((try_crop.
height/win->
w.height) >= 4)
263 try_crop.
height = win->
w.height * 4;
265 if ((try_crop.
width/win->
w.width) >= 4)
266 try_crop.
width = win->
w.width * 4;
291 win->
w.width = crop->
width;
293 win->
w.left = ((fbuf->
fmt.width - win->
w.width) >> 1) & ~1;
294 win->
w.top = ((fbuf->
fmt.height - win->
w.height) >> 1) & ~1;
304 unsigned long virt_addr,
addr;
328 unsigned long addr = virtaddr;