diff options
author | Hans de Goede <hdegoede@redhat.com> | 2012-01-04 14:58:44 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-01-06 07:46:46 -0500 |
commit | 795e6eb3262d3b7247ce450835eea6df6571d103 (patch) | |
tree | 558c161d69a04a172f54c1edd38c44b2553bf10e /drivers/media/video/pwc/pwc-uncompress.c | |
parent | a08d2c727153dc6cea1d5d54a43fd7d69c1467c3 (diff) |
[media] pwc: Remove software emulation of arbritary resolutions
The pwc driver claims to support any resolution between 160x120
and 640x480, but emulates this by simply drawing a black border
around the image. Userspace can draw its own black border if it
really wants one.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pwc/pwc-uncompress.c')
-rw-r--r-- | drivers/media/video/pwc/pwc-uncompress.c | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/drivers/media/video/pwc/pwc-uncompress.c b/drivers/media/video/pwc/pwc-uncompress.c index e55b568cbf3d..b65903fbcf0d 100644 --- a/drivers/media/video/pwc/pwc-uncompress.c +++ b/drivers/media/video/pwc/pwc-uncompress.c | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | int pwc_decompress(struct pwc_device *pdev, struct pwc_frame_buf *fbuf) | 36 | int pwc_decompress(struct pwc_device *pdev, struct pwc_frame_buf *fbuf) |
37 | { | 37 | { |
38 | int n, line, col, stride; | 38 | int n, line, col; |
39 | void *yuv, *image; | 39 | void *yuv, *image; |
40 | u16 *src; | 40 | u16 *src; |
41 | u16 *dsty, *dstu, *dstv; | 41 | u16 *dsty, *dstu, *dstv; |
@@ -60,35 +60,23 @@ int pwc_decompress(struct pwc_device *pdev, struct pwc_frame_buf *fbuf) | |||
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | vb2_set_plane_payload(&fbuf->vb, 0, pdev->view.size); | 63 | vb2_set_plane_payload(&fbuf->vb, 0, |
64 | pdev->width * pdev->height * 3 / 2); | ||
64 | 65 | ||
65 | if (pdev->vbandlength == 0) { | 66 | if (pdev->vbandlength == 0) { |
66 | /* Uncompressed mode. | 67 | /* Uncompressed mode. |
67 | * We copy the data into the output buffer, using the viewport | ||
68 | * size (which may be larger than the image size). | ||
69 | * Unfortunately we have to do a bit of byte stuffing to get | ||
70 | * the desired output format/size. | ||
71 | * | 68 | * |
72 | * We do some byte shuffling here to go from the | 69 | * We do some byte shuffling here to go from the |
73 | * native format to YUV420P. | 70 | * native format to YUV420P. |
74 | */ | 71 | */ |
75 | src = (u16 *)yuv; | 72 | src = (u16 *)yuv; |
76 | n = pdev->view.x * pdev->view.y; | 73 | n = pdev->width * pdev->height; |
74 | dsty = (u16 *)(image); | ||
75 | dstu = (u16 *)(image + n); | ||
76 | dstv = (u16 *)(image + n + n / 4); | ||
77 | 77 | ||
78 | /* offset in Y plane */ | 78 | for (line = 0; line < pdev->height; line++) { |
79 | stride = pdev->view.x * pdev->offset.y + pdev->offset.x; | 79 | for (col = 0; col < pdev->width; col += 4) { |
80 | dsty = (u16 *)(image + stride); | ||
81 | |||
82 | /* offsets in U/V planes */ | ||
83 | stride = pdev->view.x * pdev->offset.y / 4 + pdev->offset.x / 2; | ||
84 | dstu = (u16 *)(image + n + stride); | ||
85 | dstv = (u16 *)(image + n + n / 4 + stride); | ||
86 | |||
87 | /* increment after each line */ | ||
88 | stride = (pdev->view.x - pdev->image.x) / 2; /* u16 is 2 bytes */ | ||
89 | |||
90 | for (line = 0; line < pdev->image.y; line++) { | ||
91 | for (col = 0; col < pdev->image.x; col += 4) { | ||
92 | *dsty++ = *src++; | 80 | *dsty++ = *src++; |
93 | *dsty++ = *src++; | 81 | *dsty++ = *src++; |
94 | if (line & 1) | 82 | if (line & 1) |
@@ -96,11 +84,6 @@ int pwc_decompress(struct pwc_device *pdev, struct pwc_frame_buf *fbuf) | |||
96 | else | 84 | else |
97 | *dstu++ = *src++; | 85 | *dstu++ = *src++; |
98 | } | 86 | } |
99 | dsty += stride; | ||
100 | if (line & 1) | ||
101 | dstv += (stride >> 1); | ||
102 | else | ||
103 | dstu += (stride >> 1); | ||
104 | } | 87 | } |
105 | 88 | ||
106 | return 0; | 89 | return 0; |
@@ -122,6 +105,3 @@ int pwc_decompress(struct pwc_device *pdev, struct pwc_frame_buf *fbuf) | |||
122 | } | 105 | } |
123 | return 0; | 106 | return 0; |
124 | } | 107 | } |
125 | |||
126 | |||
127 | /* vim: set cino= formatoptions=croql cindent shiftwidth=8 tabstop=8: */ | ||