Message ID | 1375483372-4354-2-git-send-email-ricardo.ribalda@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
ping? On Sat, Aug 3, 2013 at 12:42 AM, Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> wrote: > This patch adds support for V4L2_PIX_FMT_Y16 format. > > Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> > --- > lib/libv4lconvert/libv4lconvert-priv.h | 6 ++++++ > lib/libv4lconvert/libv4lconvert.c | 19 +++++++++++++++++++ > lib/libv4lconvert/rgbyuv.c | 30 ++++++++++++++++++++++++++++++ > 3 files changed, 55 insertions(+) > > diff --git a/lib/libv4lconvert/libv4lconvert-priv.h b/lib/libv4lconvert/libv4lconvert-priv.h > index c37e220..6422fdd 100644 > --- a/lib/libv4lconvert/libv4lconvert-priv.h > +++ b/lib/libv4lconvert/libv4lconvert-priv.h > @@ -152,6 +152,12 @@ void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, > void v4lconvert_grey_to_yuv420(const unsigned char *src, unsigned char *dest, > const struct v4l2_format *src_fmt); > > +void v4lconvert_y16_to_rgb24(const unsigned char *src, unsigned char *dest, > + int width, int height); > + > +void v4lconvert_y16_to_yuv420(const unsigned char *src, unsigned char *dest, > + const struct v4l2_format *src_fmt); > + > int v4lconvert_y10b_to_rgb24(struct v4lconvert_data *data, > const unsigned char *src, unsigned char *dest, int width, int height); > > diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c > index 60010f1..bc5e34f 100644 > --- a/lib/libv4lconvert/libv4lconvert.c > +++ b/lib/libv4lconvert/libv4lconvert.c > @@ -128,6 +128,7 @@ static const struct v4lconvert_pixfmt supported_src_pixfmts[] = { > { V4L2_PIX_FMT_Y4, 8, 20, 20, 0 }, > { V4L2_PIX_FMT_Y6, 8, 20, 20, 0 }, > { V4L2_PIX_FMT_Y10BPACK, 10, 20, 20, 0 }, > + { V4L2_PIX_FMT_Y16, 16, 20, 20, 0 }, > }; > > static const struct v4lconvert_pixfmt supported_dst_pixfmts[] = { > @@ -989,6 +990,24 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, > break; > } > > + case V4L2_PIX_FMT_Y16: > + switch (dest_pix_fmt) { > + case V4L2_PIX_FMT_RGB24: > + case V4L2_PIX_FMT_BGR24: > + v4lconvert_y16_to_rgb24(src, dest, width, height); > + break; > + case V4L2_PIX_FMT_YUV420: > + case V4L2_PIX_FMT_YVU420: > + v4lconvert_y16_to_yuv420(src, dest, fmt); > + break; > + } > + if (src_size < (width * height * 2)) { > + V4LCONVERT_ERR("short y16 data frame\n"); > + errno = EPIPE; > + result = -1; > + } > + break; > + > case V4L2_PIX_FMT_GREY: > case V4L2_PIX_FMT_Y4: > case V4L2_PIX_FMT_Y6: > diff --git a/lib/libv4lconvert/rgbyuv.c b/lib/libv4lconvert/rgbyuv.c > index d05abe9..bef034f 100644 > --- a/lib/libv4lconvert/rgbyuv.c > +++ b/lib/libv4lconvert/rgbyuv.c > @@ -586,6 +586,36 @@ void v4lconvert_rgb565_to_yuv420(const unsigned char *src, unsigned char *dest, > } > } > > +void v4lconvert_y16_to_rgb24(const unsigned char *src, unsigned char *dest, > + int width, int height) > +{ > + int j; > + while (--height >= 0) { > + for (j = 0; j < width; j++) { > + *dest++ = *src; > + *dest++ = *src; > + *dest++ = *src; > + src+=2; > + } > + } > +} > + > +void v4lconvert_y16_to_yuv420(const unsigned char *src, unsigned char *dest, > + const struct v4l2_format *src_fmt) > +{ > + int x, y; > + > + /* Y */ > + for (y = 0; y < src_fmt->fmt.pix.height; y++) > + for (x = 0; x < src_fmt->fmt.pix.width; x++){ > + *dest++ = *src; > + src+=2; > + } > + > + /* Clear U/V */ > + memset(dest, 0x80, src_fmt->fmt.pix.width * src_fmt->fmt.pix.height / 2); > +} > + > void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, > int width, int height) > { > -- > 1.7.10.4 >
On 8/9/13 6:04 PM, Ricardo Ribalda Delgado wrote:
> ping?
Thank you for your the updated series.
Unfortunately I'm still partially busy with moving. I hoped the
v4lconvert maintainer Hans (de Goede) will ack these patches. If this
series does not get an ack by Sunday I'll double check and commit.
What hardware did you use to test this?
Thanks,
Gregor
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello Gregor I am using some cameras from qtec.com. In fact, I am developing the firmware for them :) qv4l2 has been very useful for testing. Thanks for your response. On Mon, Aug 12, 2013 at 9:39 PM, Gregor Jasny <gjasny@googlemail.com> wrote: > On 8/9/13 6:04 PM, Ricardo Ribalda Delgado wrote: >> >> ping? > > > Thank you for your the updated series. > > Unfortunately I'm still partially busy with moving. I hoped the v4lconvert > maintainer Hans (de Goede) will ack these patches. If this series does not > get an ack by Sunday I'll double check and commit. > > What hardware did you use to test this? > > Thanks, > Gregor
Hi, On 08/12/2013 09:39 PM, Gregor Jasny wrote: > On 8/9/13 6:04 PM, Ricardo Ribalda Delgado wrote: >> ping? > > Thank you for your the updated series. > > Unfortunately I'm still partially busy with moving. I hoped the v4lconvert maintainer Hans (de Goede) will ack these patches. Series looks good to me: Acked-by: Hans de Goede <hdegoede@redhat.com> Regards, Hans -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 8/13/13 10:56 AM, Hans de Goede wrote: > Series looks good to me: > > Acked-by: Hans de Goede <hdegoede@redhat.com> I submitted it yesterday. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/lib/libv4lconvert/libv4lconvert-priv.h b/lib/libv4lconvert/libv4lconvert-priv.h index c37e220..6422fdd 100644 --- a/lib/libv4lconvert/libv4lconvert-priv.h +++ b/lib/libv4lconvert/libv4lconvert-priv.h @@ -152,6 +152,12 @@ void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, void v4lconvert_grey_to_yuv420(const unsigned char *src, unsigned char *dest, const struct v4l2_format *src_fmt); +void v4lconvert_y16_to_rgb24(const unsigned char *src, unsigned char *dest, + int width, int height); + +void v4lconvert_y16_to_yuv420(const unsigned char *src, unsigned char *dest, + const struct v4l2_format *src_fmt); + int v4lconvert_y10b_to_rgb24(struct v4lconvert_data *data, const unsigned char *src, unsigned char *dest, int width, int height); diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c index 60010f1..bc5e34f 100644 --- a/lib/libv4lconvert/libv4lconvert.c +++ b/lib/libv4lconvert/libv4lconvert.c @@ -128,6 +128,7 @@ static const struct v4lconvert_pixfmt supported_src_pixfmts[] = { { V4L2_PIX_FMT_Y4, 8, 20, 20, 0 }, { V4L2_PIX_FMT_Y6, 8, 20, 20, 0 }, { V4L2_PIX_FMT_Y10BPACK, 10, 20, 20, 0 }, + { V4L2_PIX_FMT_Y16, 16, 20, 20, 0 }, }; static const struct v4lconvert_pixfmt supported_dst_pixfmts[] = { @@ -989,6 +990,24 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, break; } + case V4L2_PIX_FMT_Y16: + switch (dest_pix_fmt) { + case V4L2_PIX_FMT_RGB24: + case V4L2_PIX_FMT_BGR24: + v4lconvert_y16_to_rgb24(src, dest, width, height); + break; + case V4L2_PIX_FMT_YUV420: + case V4L2_PIX_FMT_YVU420: + v4lconvert_y16_to_yuv420(src, dest, fmt); + break; + } + if (src_size < (width * height * 2)) { + V4LCONVERT_ERR("short y16 data frame\n"); + errno = EPIPE; + result = -1; + } + break; + case V4L2_PIX_FMT_GREY: case V4L2_PIX_FMT_Y4: case V4L2_PIX_FMT_Y6: diff --git a/lib/libv4lconvert/rgbyuv.c b/lib/libv4lconvert/rgbyuv.c index d05abe9..bef034f 100644 --- a/lib/libv4lconvert/rgbyuv.c +++ b/lib/libv4lconvert/rgbyuv.c @@ -586,6 +586,36 @@ void v4lconvert_rgb565_to_yuv420(const unsigned char *src, unsigned char *dest, } } +void v4lconvert_y16_to_rgb24(const unsigned char *src, unsigned char *dest, + int width, int height) +{ + int j; + while (--height >= 0) { + for (j = 0; j < width; j++) { + *dest++ = *src; + *dest++ = *src; + *dest++ = *src; + src+=2; + } + } +} + +void v4lconvert_y16_to_yuv420(const unsigned char *src, unsigned char *dest, + const struct v4l2_format *src_fmt) +{ + int x, y; + + /* Y */ + for (y = 0; y < src_fmt->fmt.pix.height; y++) + for (x = 0; x < src_fmt->fmt.pix.width; x++){ + *dest++ = *src; + src+=2; + } + + /* Clear U/V */ + memset(dest, 0x80, src_fmt->fmt.pix.width * src_fmt->fmt.pix.height / 2); +} + void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, int width, int height) {
This patch adds support for V4L2_PIX_FMT_Y16 format. Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> --- lib/libv4lconvert/libv4lconvert-priv.h | 6 ++++++ lib/libv4lconvert/libv4lconvert.c | 19 +++++++++++++++++++ lib/libv4lconvert/rgbyuv.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+)