public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH, RFC] mt9m111: Fix YUYV format for pxa-camera
@ 2008-10-29 11:34 Antonio Ospite
  2008-10-29 17:16 ` Robert Jarzmik
  0 siblings, 1 reply; 2+ messages in thread
From: Antonio Ospite @ 2008-10-29 11:34 UTC (permalink / raw)
  To: video4linux-list

Hi,

I'd like to discuss this change to mt9m111, but I am not sure if the
first hunk of the following patch is a proper fix for the problem I had:
when using YUYV the output buffer has to be WIDTH*HEIGHT*2,
and not WIDTH*HEIGHT as it is now using 8bit YUYV format.
Maybe the proper fix belongs to pxa-camera.c?

Anyway, with the following changes I have the right output from mt9m111
interfaced to pxa-camera on a Motorola A910 phone:
http://people.openezx.org/ao2/a910-camera-working.jpg
http://wiki.openezx.org/A910

Regards,
   Antonio Ospite.

Here's the patch:

Use 16 bit depth for YUYV so the pxa-camera image buffer has the correct size,
see the formula:

	*size = icd->width * icd->height *
		((icd->current_fmt->depth + 7) >> 3);

in drivers/media/video/pxa_camera.c: pxa_videobuf_setup().

Don't swap Cb and Cr components, to respect PXA Quick Capture Interface
data format.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>

---
 drivers/media/video/mt9m111.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
index da0b2d5..76fb0cb 100644
--- a/drivers/media/video/mt9m111.c
+++ b/drivers/media/video/mt9m111.c
@@ -130,7 +130,7 @@
 	COL_FMT(_name, _depth, _fourcc, V4L2_COLORSPACE_SRGB)
 
 static const struct soc_camera_data_format mt9m111_colour_formats[] = {
-	COL_FMT("YCrYCb 8 bit", 8, V4L2_PIX_FMT_YUYV, V4L2_COLORSPACE_JPEG),
+	COL_FMT("YCrYCb 16 bit", 16, V4L2_PIX_FMT_YUYV, V4L2_COLORSPACE_JPEG),
 	RGB_FMT("RGB 565", 16, V4L2_PIX_FMT_RGB565),
 	RGB_FMT("RGB 555", 16, V4L2_PIX_FMT_RGB555),
 	RGB_FMT("Bayer (sRGB) 10 bit", 10, V4L2_PIX_FMT_SBGGR16),
@@ -864,6 +864,9 @@ static int mt9m111_video_probe(struct soc_camera_device *icd)
 	mt9m111->swap_rgb_even_odd = 1;
 	mt9m111->swap_rgb_red_blue = 1;
 
+	mt9m111->swap_yuv_y_chromas = 1;
+	mt9m111->swap_yuv_cb_cr = 0;
+
 	return 0;
 eisis:
 ei2c:

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH, RFC] mt9m111: Fix YUYV format for pxa-camera
  2008-10-29 11:34 [PATCH, RFC] mt9m111: Fix YUYV format for pxa-camera Antonio Ospite
@ 2008-10-29 17:16 ` Robert Jarzmik
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Jarzmik @ 2008-10-29 17:16 UTC (permalink / raw)
  To: Antonio Ospite; +Cc: video4linux-list, Guennadi Liakhovetski

Antonio Ospite <ospite@studenti.unina.it> writes:

> Hi,
>
> I'd like to discuss this change to mt9m111, but I am not sure if the
> first hunk of the following patch is a proper fix for the problem I had:
> when using YUYV the output buffer has to be WIDTH*HEIGHT*2,
> and not WIDTH*HEIGHT as it is now using 8bit YUYV format.
> Maybe the proper fix belongs to pxa-camera.c?

No, your patch is the correct way of doing it.  Please resubmit the same patch
with your signoff, and Guennadi CCed which will give me time to make 1 test for
security, and I'll add my Acked-by.

You can safely remove the "RFC" part, it is indeed a fix.

Cheers.

--
Robert

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-29 17:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-29 11:34 [PATCH, RFC] mt9m111: Fix YUYV format for pxa-camera Antonio Ospite
2008-10-29 17:16 ` Robert Jarzmik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox