All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC Patch] omap3isp : support CFA pattern when not GRBG
@ 2012-05-21 14:36 jean-philippe francois
  0 siblings, 0 replies; only message in thread
From: jean-philippe francois @ 2012-05-21 14:36 UTC (permalink / raw)
  To: linux-media

[-- Attachment #1: Type: text/plain, Size: 591 bytes --]

Hi,

omap3 ISP previewer block can convert a raw bayer image
into a UYVY image. Debayering coefficient are stored in
an undocumented table. In the current form, only
GRBG format are converted correctly.

However, the other CFA arrangement can be transformed
in GRBG arrangement by shifting the image window one pixel
to the left or to the bottom.

Here is a patch against vanilla 3.2.17.
If such a patch can find it's way into mainline, I will
try to port it against a suitable git tree.

This was only tested with a BGGR arrangement.

Thank you,

Jean-Philippe François

[-- Attachment #2: isppreview_bayer.patch --]
[-- Type: application/octet-stream, Size: 2230 bytes --]

Index: b/drivers/media/video/omap3isp/isppreview.c
===================================================================
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -96,21 +96,26 @@
  *					  2 lines in other modes
  * Color suppression		2 pixels
  * or luma enhancement
+ *
+ * Bayer pattern shifting 2 pixels, 1 line
  * -------------------------------------------------------------
- * Maximum total		14 pixels, 8 lines
+ * Maximum total		18 pixels, 9 lines
  *
  * The color suppression and luma enhancement filters are applied after bayer to
  * YUV conversion. They thus can crop one pixel on the left and one pixel on the
  * right side of the image without changing the color pattern. When both those
  * filters are disabled, the driver must crop the two pixels on the same side of
- * the image to avoid changing the bayer pattern. The left margin is thus set to
- * 8 pixels and the right margin to 6 pixels.
+ * the image to avoid changing the bayer pattern.
+ *
+ * Bayer pattern shifting is needed for some bayer pattern. Shifting
+ * will be in the right and bottom direction.
+ * The left margin is thus set to 8 pixels and the right margin to 10 pixels.
  */
 
 #define PREV_MARGIN_LEFT	8
-#define PREV_MARGIN_RIGHT	6
+#define PREV_MARGIN_RIGHT	10
 #define PREV_MARGIN_TOP		4
-#define PREV_MARGIN_BOTTOM	4
+#define PREV_MARGIN_BOTTOM	5
 
 #define PREV_MIN_IN_WIDTH	64
 #define PREV_MIN_IN_HEIGHT	8
@@ -1038,6 +1043,34 @@
 		eph += 2;
 		slv -= 2;
 		elv += 2;
+		/* CFA table coef only handle GRBG format. Other format
+		 * can be transformed in GRBG by shifting the pattern :
+		 * BGGR -> GRBG is obtained by a 1 row shift
+		 * RGGB -> GRBG is obtained by a 1 column shift
+		 * GBRG -> GRBG is obtained by a row and column shift
+		 */
+		switch(prev->formats[PREV_PAD_SINK].code) {
+		case V4L2_MBUS_FMT_SRGGB10_1X10:
+			sph += 1;
+			eph += 1;
+			break;
+
+		case V4L2_MBUS_FMT_SBGGR10_1X10:
+			slv += 1;
+			elv += 1;
+			break;
+
+		case V4L2_MBUS_FMT_SGBRG10_1X10:
+			sph += 1;
+			eph += 1;
+			slv += 1;
+			elv += 1;
+			break;
+
+		default:
+			break;
+		}
+
 	}
 	if (params->features & (PREV_DEFECT_COR | PREV_NOISE_FILTER)) {
 		sph -= 2;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-21 14:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-21 14:36 [RFC Patch] omap3isp : support CFA pattern when not GRBG jean-philippe francois

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.