提交 93566ad8 编写于 作者: T Trent Piepho 提交者: Mauro Carvalho Chehab

V4L/DVB (5392): Zr364xx: Use kernel's byte-swapping function

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: NTrent Piepho <xyzzy@speakeasy.org>
Acked-by: NAntoine Jacquet <royale@zerezo.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@infradead.org>
上级 cf3c34c8
...@@ -277,7 +277,7 @@ static unsigned char header3; ...@@ -277,7 +277,7 @@ static unsigned char header3;
static int read_frame(struct zr364xx_camera *cam, int framenum) static int read_frame(struct zr364xx_camera *cam, int framenum)
{ {
int i, n, temp, head, size, actual_length; int i, n, temp, head, size, actual_length;
unsigned char *ptr = NULL, *jpeg, swap; unsigned char *ptr = NULL, *jpeg;
redo: redo:
/* hardware brightness */ /* hardware brightness */
...@@ -308,11 +308,10 @@ static int read_frame(struct zr364xx_camera *cam, int framenum) ...@@ -308,11 +308,10 @@ static int read_frame(struct zr364xx_camera *cam, int framenum)
} }
/* swap bytes if camera needs it */ /* swap bytes if camera needs it */
if (cam->method == METHOD0) if (cam->method == METHOD0) {
for (i = 0; i < BUFFER_SIZE; i += 2) { u16 *buf = (u16*)cam->buffer;
swap = cam->buffer[i]; for (i = 0; i < BUFFER_SIZE/2; i++)
cam->buffer[i] = cam->buffer[i + 1]; swab16s(buf + i);
cam->buffer[i + 1] = swap;
} }
/* write the JPEG header */ /* write the JPEG header */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册