aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/w9968cf.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/media/video/w9968cf.c b/drivers/media/video/w9968cf.c
index ddce2fb83424..9f403af7b040 100644
--- a/drivers/media/video/w9968cf.c
+++ b/drivers/media/video/w9968cf.c
@@ -1827,8 +1827,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win)
1827 int err = 0; 1827 int err = 0;
1828 1828
1829 /* Work around to avoid FP arithmetics */ 1829 /* Work around to avoid FP arithmetics */
1830 #define __SC(x) ((x) << 10) 1830 #define SC(x) ((x) << 10)
1831 #define __UNSC(x) ((x) >> 10) 1831 #define UNSC(x) ((x) >> 10)
1832 1832
1833 /* Make sure we are using a supported resolution */ 1833 /* Make sure we are using a supported resolution */
1834 if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, 1834 if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width,
@@ -1836,15 +1836,15 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win)
1836 goto error; 1836 goto error;
1837 1837
1838 /* Scaling factors */ 1838 /* Scaling factors */
1839 fw = __SC(win.width) / cam->maxwidth; 1839 fw = SC(win.width) / cam->maxwidth;
1840 fh = __SC(win.height) / cam->maxheight; 1840 fh = SC(win.height) / cam->maxheight;
1841 1841
1842 /* Set up the width and height values used by the chip */ 1842 /* Set up the width and height values used by the chip */
1843 if ((win.width > cam->maxwidth) || (win.height > cam->maxheight)) { 1843 if ((win.width > cam->maxwidth) || (win.height > cam->maxheight)) {
1844 cam->vpp_flag |= VPP_UPSCALE; 1844 cam->vpp_flag |= VPP_UPSCALE;
1845 /* Calculate largest w,h mantaining the same w/h ratio */ 1845 /* Calculate largest w,h mantaining the same w/h ratio */
1846 w = (fw >= fh) ? cam->maxwidth : __SC(win.width)/fh; 1846 w = (fw >= fh) ? cam->maxwidth : SC(win.width)/fh;
1847 h = (fw >= fh) ? __SC(win.height)/fw : cam->maxheight; 1847 h = (fw >= fh) ? SC(win.height)/fw : cam->maxheight;
1848 if (w < cam->minwidth) /* just in case */ 1848 if (w < cam->minwidth) /* just in case */
1849 w = cam->minwidth; 1849 w = cam->minwidth;
1850 if (h < cam->minheight) /* just in case */ 1850 if (h < cam->minheight) /* just in case */
@@ -1861,8 +1861,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win)
1861 1861
1862 /* Calculate cropped area manteining the right w/h ratio */ 1862 /* Calculate cropped area manteining the right w/h ratio */
1863 if (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE)) { 1863 if (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE)) {
1864 cw = (fw >= fh) ? cam->maxwidth : __SC(win.width)/fh; 1864 cw = (fw >= fh) ? cam->maxwidth : SC(win.width)/fh;
1865 ch = (fw >= fh) ? __SC(win.height)/fw : cam->maxheight; 1865 ch = (fw >= fh) ? SC(win.height)/fw : cam->maxheight;
1866 } else { 1866 } else {
1867 cw = w; 1867 cw = w;
1868 ch = h; 1868 ch = h;
@@ -1901,8 +1901,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win)
1901 /* We have to scale win.x and win.y offsets */ 1901 /* We have to scale win.x and win.y offsets */
1902 if ( (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE)) 1902 if ( (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE))
1903 || (cam->vpp_flag & VPP_UPSCALE) ) { 1903 || (cam->vpp_flag & VPP_UPSCALE) ) {
1904 ax = __SC(win.x)/fw; 1904 ax = SC(win.x)/fw;
1905 ay = __SC(win.y)/fh; 1905 ay = SC(win.y)/fh;
1906 } else { 1906 } else {
1907 ax = win.x; 1907 ax = win.x;
1908 ay = win.y; 1908 ay = win.y;
@@ -1917,8 +1917,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win)
1917 /* Adjust win.x, win.y */ 1917 /* Adjust win.x, win.y */
1918 if ( (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE)) 1918 if ( (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE))
1919 || (cam->vpp_flag & VPP_UPSCALE) ) { 1919 || (cam->vpp_flag & VPP_UPSCALE) ) {
1920 win.x = __UNSC(ax*fw); 1920 win.x = UNSC(ax*fw);
1921 win.y = __UNSC(ay*fh); 1921 win.y = UNSC(ay*fh);
1922 } else { 1922 } else {
1923 win.x = ax; 1923 win.x = ax;
1924 win.y = ay; 1924 win.y = ay;