diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-03-07 13:19:49 -0800 |
---|---|---|
committer | Trent Piepho <xyzzy@speakeasy.org> | 2007-03-07 13:19:49 -0800 |
commit | 94199ec22e3e0381b17ac6bc5c2fcffe4db1540a (patch) | |
tree | e1d9b720b8d718a8f7a2ed8f39b23ebd8bbf7668 /linux/drivers/media/video/zr364xx.c | |
parent | 1177ee0bf652eb68b74e90e91ef99ba93fbb1a15 (diff) | |
download | mediapointer-dvb-s2-94199ec22e3e0381b17ac6bc5c2fcffe4db1540a.tar.gz mediapointer-dvb-s2-94199ec22e3e0381b17ac6bc5c2fcffe4db1540a.tar.bz2 |
zr364xx: Use kernel's byte-swapping function
From: Trent Piepho <xyzzy@speakeasy.org>
Some code to swap bytes wasn't using the swab16() function that the
kernel provides for this. Make use of it, which results in more
efficient code.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Acked-by: Antoine Jacquet <royale@zerezo.com>
Diffstat (limited to 'linux/drivers/media/video/zr364xx.c')
-rw-r--r-- | linux/drivers/media/video/zr364xx.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/linux/drivers/media/video/zr364xx.c b/linux/drivers/media/video/zr364xx.c index 43643ce84..88b1fec85 100644 --- a/linux/drivers/media/video/zr364xx.c +++ b/linux/drivers/media/video/zr364xx.c @@ -282,7 +282,7 @@ static unsigned char header3; static int read_frame(struct zr364xx_camera *cam, int framenum) { int i, n, temp, head, size, actual_length; - unsigned char *ptr = NULL, *jpeg, swap; + unsigned char *ptr = NULL, *jpeg; redo: /* hardware brightness */ @@ -313,12 +313,11 @@ static int read_frame(struct zr364xx_camera *cam, int framenum) } /* swap bytes if camera needs it */ - if (cam->method == METHOD0) - for (i = 0; i < BUFFER_SIZE; i += 2) { - swap = cam->buffer[i]; - cam->buffer[i] = cam->buffer[i + 1]; - cam->buffer[i + 1] = swap; - } + if (cam->method == METHOD0) { + u16 *buf = (u16*)cam->buffer; + for (i = 0; i < BUFFER_SIZE/2; i++) + swab16s(buf + i); + } /* write the JPEG header */ if (!head) { |