Hello, On 8/1/13 3:04 PM, Ricardo Ribalda Delgado wrote:
--- a/lib/libv4lconvert/libv4lconvert-priv.h +++ b/lib/libv4lconvert/libv4lconvert-priv.h @@ -108,7 +108,7 @@ unsigned char *v4lconvert_alloc_buffer(int needed, int v4lconvert_oom_error(struct v4lconvert_data *data); void v4lconvert_rgb24_to_yuv420(const unsigned char *src, unsigned char *dest, - const struct v4l2_format *src_fmt, int bgr, int yvu); + const struct v4l2_format *src_fmt, int bgr, int yvu, int rgb32); void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dst, int width, int height, int yvu);
@@ -47,9 +47,15 @@ void v4lconvert_rgb24_to_yuv420(const unsigned char *src, unsigned char *dest, RGB2Y(src[2], src[1], src[0], *dest++); else RGB2Y(src[0], src[1], src[2], *dest++); - src += 3; + if (rgb32) + src += 4; + else + src += 3;
Instead of passing a 0/1 flag here I would call this variable bits_per_pixel or bpp and pass 3 or 4 here. This would reduce the if condition ugliness.
Thanks, Gregor -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html