@@ -178,10 +178,10 @@ int v4lconvert_y10b_to_yuv420(struct v4lconvert_data *data,
const unsigned char *src, unsigned char *dest, int width, int height);
void v4lconvert_rgb565_to_rgb24(const unsigned char *src, unsigned char *dest,
- int width, int height);
+ int width, int height, int stride);
void v4lconvert_rgb565_to_bgr24(const unsigned char *src, unsigned char *dest,
- int width, int height);
+ int width, int height, int stride);
void v4lconvert_rgb565_to_yuv420(const unsigned char *src, unsigned char *dest,
const struct v4l2_format *src_fmt, int yvu);
@@ -1282,10 +1282,10 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
}
switch (dest_pix_fmt) {
case V4L2_PIX_FMT_RGB24:
- v4lconvert_rgb565_to_rgb24(src, dest, width, height);
+ v4lconvert_rgb565_to_rgb24(src, dest, width, height, bytesperline);
break;
case V4L2_PIX_FMT_BGR24:
- v4lconvert_rgb565_to_bgr24(src, dest, width, height);
+ v4lconvert_rgb565_to_bgr24(src, dest, width, height, bytesperline);
break;
case V4L2_PIX_FMT_YUV420:
v4lconvert_rgb565_to_yuv420(src, dest, fmt, 0);
@@ -511,7 +511,7 @@ void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dest,
}
void v4lconvert_rgb565_to_rgb24(const unsigned char *src, unsigned char *dest,
- int width, int height)
+ int width, int height, int stride)
{
int j;
while (--height >= 0) {
@@ -525,11 +525,12 @@ void v4lconvert_rgb565_to_rgb24(const unsigned char *src, unsigned char *dest,
src += 2;
}
+ src += stride - 2 * width;
}
}
void v4lconvert_rgb565_to_bgr24(const unsigned char *src, unsigned char *dest,
- int width, int height)
+ int width, int height, int stride)
{
int j;
while (--height >= 0) {
@@ -543,6 +544,7 @@ void v4lconvert_rgb565_to_bgr24(const unsigned char *src, unsigned char *dest,
src += 2;
}
+ src += stride - 2 * width;
}
}
The atomisp driver can generate V4L2_PIX_FMT_RGB565 buffers where stride != width. Where as v4lconvert_rgb565_to_rgb/bgr24() assumed that stride == width is always true. Add a stride argument to v4lconvert_rgb565_to_rgb/bgr24() to fix this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- lib/libv4lconvert/libv4lconvert-priv.h | 4 ++-- lib/libv4lconvert/libv4lconvert.c | 4 ++-- lib/libv4lconvert/rgbyuv.c | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-)