Skip to contentSkip to conversation

ISP Configuration for RAW Bayer sensor

DISCUSSION Suresh Rao 3 participants 5 messages Mar 18, 2009 – Mar 20, 2009 Media (V4L/DVB)

lore
Share & tools
lore

Suresh Rao

author
#0 lore raw

Hi,

I am working with MT9V023 RAW sensor. The data format from the sensor is

B G B G B G B G ...
G R G R G R G R ...
B G B G B G B G ...
G R G R G R G R ........ [ Format 1]

The sources I am using for ISP drivers are pulled on top of linux-omap-2.6.29-rc7 from [git pull
git://git.gitorious.org/omap3camera/mainline.git v4l iommu omap3camera base].

I want to use the ISP on the OMAP for doing interpolation and format conversion to UYVY. I am able to capture the images from the sensor, however I notice that the color information is missing. I dug the sources and found that in the RAW capture mode ISP is getting configured to input format

G R G R G R G R ...
B G B G B G B G ...
G R G R G R G R ...
B G B G B G B G ... [Format 2]

Has anyone tried sensors with BGGR ( Format 1) on OMAP?

Can anyone give me some pointers or information on how to configure ISP for BGGR (Format 1)

Thanks in advance for all the help.

Thanks,
Suresh

#1 lore raw
Quoted 6 lines · On Wednesday 18 March 2009 18:17:56 ext Suresh Rao wrote:

I am working with MT9V023 RAW sensor. The data format from the sensor is

B G B G B G B G ...
G R G R G R G R ...
B G B G B G B G ...
G R G R G R G R ........ [ Format 1]

[...]

Quoted 11 lines

I want to use the ISP on the OMAP for doing interpolation and format conversion to UYVY. I am able to capture the images from the sensor, however I notice that the color information is missing. I dug the sources and found that in the RAW capture mode ISP is getting configured to input format

G R G R G R G R ...
B G B G B G B G ...
G R G R G R G R ...
B G B G B G B G ... [Format 2]

Quoted 4 lines

Has anyone tried sensors with BGGR ( Format 1) on OMAP?

Can anyone give me some pointers or information on how to configure ISP for BGGR (Format 1)

If you can live with losing a few pixels (maybe sensor has a few extra) I recommend to configure ISP to crop away the topmost line.

Here's couple of old _example_ patches how to configure the cropping. Just gives an idea where to start...

- Tuukka

drivers/media/video/isp/ispccdc.c +4 -4
index 2288bc9..87870f1 100644
@@ -1189,13 +1189,13 @@ int ispccdc_config_size(u32 input_w, u32 input_h, u32 output_w, u32 output_h)
 						ISPCCDC_HORZ_INFO);
 		} else {
 			if (ispccdc_obj.ccdc_inpfmt == CCDC_RAW) {
-				omap_writel(1 << ISPCCDC_HORZ_INFO_SPH_SHIFT
-						| ((ispccdc_obj.ccdcout_w - 1)
+				omap_writel(0 << ISPCCDC_HORZ_INFO_SPH_SHIFT
+						| (ispccdc_obj.ccdcout_w
 						<< ISPCCDC_HORZ_INFO_NPH_SHIFT),
 						ISPCCDC_HORZ_INFO);
 			} else {
 				omap_writel(0 << ISPCCDC_HORZ_INFO_SPH_SHIFT
-						| ((ispccdc_obj.ccdcout_w - 1)
+						| (ispccdc_obj.ccdcout_w
 						<< ISPCCDC_HORZ_INFO_NPH_SHIFT),
 						ISPCCDC_HORZ_INFO);
 			}
@@ -1227,7 +1227,7 @@ int ispccdc_config_size(u32 input_w, u32 input_h, u32 output_w, u32 output_h)
 					ISPCCDC_VP_OUT_VERT_NUM_SHIFT),
 					ISPCCDC_VP_OUT);
 		omap_writel(0 << ISPCCDC_HORZ_INFO_SPH_SHIFT |
-					((ispccdc_obj.ccdcout_w - 1) <<
+					(ispccdc_obj.ccdcout_w <<
 					ISPCCDC_HORZ_INFO_NPH_SHIFT),
 					ISPCCDC_HORZ_INFO);
 		omap_writel(0 << ISPCCDC_VERT_START_SLV0_SHIFT,
(quoted diff) +0 -0

b/drivers/media/video/isp/ispccdc.c
index f5957b2..6afaabf 100644

drivers/media/video/isp/ispccdc.c +1 -1
@@ -478,7 +478,7 @@ EXPORT_SYMBOL(ispccdc_enable_lsc);
   **/
  void ispccdc_config_crop(u32 left, u32 top, u32 height, u32 width)
  {
-       ispccdc_obj.ccdcin_woffset = left + ((left + 1) % 2);
+       ispccdc_obj.ccdcin_woffset = left + (left % 2);
         ispccdc_obj.ccdcin_hoffset = top + (top % 2);
 
         ispccdc_obj.crop_w = width - (width % 16);
@@ -1166,7 +1166,7 @@ int ispccdc_config_size(u32 input_w, u32 input_h, 

u32 output_w, u32 output_h)

                                         ISPCCDC_FMT_VERT);
                 omap_writel((ispccdc_obj.ccdcout_w <<
                                         ISPCCDC_VP_OUT_HORZ_NUM_SHIFT) |
-                                       (ispccdc_obj.ccdcout_h <<
+                                       (ispccdc_obj.ccdcout_h - 1 <<
                                         ISPCCDC_VP_OUT_VERT_NUM_SHIFT),
                                         ISPCCDC_VP_OUT);
                 omap_writel((((ispccdc_obj.ccdcout_h - 25) &
author
#2 lore raw

Hi Tuukka,

Thanks a lot for the patch, I will try this.

I tried similar thing but on the sensor side and it worked, ie., I skip the very first line from readout and get the desired format for the ISP.

Thanks,
Suresh

Quoted 90 lines · Tuukka.O Toivonen
Quoted 6 lines · On Wednesday 18 March 2009 18:17:56 ext Suresh Rao wrote:

I am working with MT9V023 RAW sensor.  The data format from the sensor is

B G B G B G B G ...
G R G R G R G R ...
B G B G B G B G ...
G R G R G R G R ........      [ Format 1]

[...]

Quoted 11 lines

I want to use the ISP on the OMAP for doing interpolation and format conversion to UYVY.  I am able to capture the images from the sensor, however I notice that the color information is missing.  I dug the sources and found that in the RAW capture mode ISP is getting configured to input format

G R G R G R G R ...
B G B G B G B G ...
G R G R G R G R ...
B G B G B G B G ...          [Format 2]

Quoted 4 lines

Has anyone tried sensors with BGGR ( Format 1) on OMAP?

Can anyone give me some pointers or information on how to configure ISP for BGGR (Format 1)

If you can live with losing a few pixels (maybe sensor has a few extra) I recommend to configure ISP to crop away the topmost line.

Here's couple of old _example_ patches how to configure the cropping. Just gives an idea where to start...

- Tuukka

drivers/media/video/isp/ispccdc.c +2 -2
index 2288bc9..87870f1 100644
@@ -1189,13 +1189,13 @@ int ispccdc_config_size(u32 input_w, u32 input_h, u32 output_w, u32 output_h)
                                                ISPCCDC_HORZ_INFO);
                } else {
                        if (ispccdc_obj.ccdc_inpfmt == CCDC_RAW) {
-                               omap_writel(1 << ISPCCDC_HORZ_INFO_SPH_SHIFT
-                                               | ((ispccdc_obj.ccdcout_w - 1)
+                               omap_writel(0 << ISPCCDC_HORZ_INFO_SPH_SHIFT
+                                               | (ispccdc_obj.ccdcout_w
                                                << ISPCCDC_HORZ_INFO_NPH_SHIFT),
                                                ISPCCDC_HORZ_INFO);
                        } else {

                               omap_writel(0 << ISPCCDC_HORZ_INFO_SPH_SHIFT
-                                               | ((ispccdc_obj.ccdcout_w - 1)
+                                               | (ispccdc_obj.ccdcout_w << ISPCCDC_HORZ_INFO_NPH_SHIFT), ISPCCDC_HORZ_INFO); }

drivers/media/video/isp/ispccdc.c +0 -0
@@ -1227,7 +1227,7 @@ int ispccdc_config_size(u32 input_w, u32 input_h, u32 output_w, u32 output_h)
                                        ISPCCDC_VP_OUT_VERT_NUM_SHIFT),
                                        ISPCCDC_VP_OUT);

               omap_writel(0 << ISPCCDC_HORZ_INFO_SPH_SHIFT |
-                                       ((ispccdc_obj.ccdcout_w - 1) <<
+                                       (ispccdc_obj.ccdcout_w << ISPCCDC_HORZ_INFO_NPH_SHIFT), ISPCCDC_HORZ_INFO); omap_writel(0 << ISPCCDC_VERT_START_SLV0_SHIFT,

drivers/media/video/isp/ispccdc.c +1 -1
index f5957b2..6afaabf 100644
@@ -478,7 +478,7 @@ EXPORT_SYMBOL(ispccdc_enable_lsc);
   **/
  void ispccdc_config_crop(u32 left, u32 top, u32 height, u32 width)
  {
-       ispccdc_obj.ccdcin_woffset = left + ((left + 1) % 2);
+       ispccdc_obj.ccdcin_woffset = left + (left % 2);
         ispccdc_obj.ccdcin_hoffset = top + (top % 2);
 
         ispccdc_obj.crop_w = width - (width % 16);
@@ -1166,7 +1166,7 @@ int ispccdc_config_size(u32 input_w, u32 input_h,
 u32 output_w, u32 output_h)
                                         ISPCCDC_FMT_VERT);

                omap_writel((ispccdc_obj.ccdcout_w << ISPCCDC_VP_OUT_HORZ_NUM_SHIFT) |
-                                       (ispccdc_obj.ccdcout_h <<
+                                       (ispccdc_obj.ccdcout_h - 1 << ISPCCDC_VP_OUT_VERT_NUM_SHIFT), ISPCCDC_VP_OUT); omap_writel((((ispccdc_obj.ccdcout_h - 25) &

#3 lore raw
Quoted 9 lines

-----Original Message-----
From: [email protected] [mailto:linux-media- [email protected]] On Behalf Of Suresh Rao
Sent: Thursday, March 19, 2009 7:59 AM
To: [email protected]
Cc: Tuukka.O Toivonen
Subject: Re: ISP Configuration for RAW Bayer sensor

Quoted 7 lines

Hi Tuukka,

Thanks a lot for the patch, I will try this.

I tried similar thing but on the sensor side and it worked, ie., I skip the very first line from readout and get the desired format for the ISP.

Hi Suresh,

I am currently working on a patch for solving these type of adjustments.

The main idea is to specify from the sensor to the ISP, which is the output Raw sequence: RGGB, GRBG, BGGR, GBRG. And then adjust internal ISP reading offset to interpret the image adequately...

I'll post the patch as soon as I have it ready (I'm currently busy with some other higher priority tasks for these remaining 2 weeks of the month :I)

Regards,
Sergio

Quoted 111 lines

Thanks,
Suresh

Quoted 2 lines · Tuukka.O Toivonen
Quoted 1 line · On Wednesday 18 March 2009 18:17:56 ext Suresh Rao wrote:

I am working with MT9V023 RAW sensor.  The data format from the sensor

is

Quoted 25 lines
Quoted 5 lines

B G B G B G B G ...
G R G R G R G R ...
B G B G B G B G ...
G R G R G R G R ........      [ Format 1]

[...]

Quoted 11 lines

I want to use the ISP on the OMAP for doing interpolation and format conversion to UYVY.  I am able to capture the images from the sensor, however I notice that the color information is missing.  I dug the sources and found that in the RAW capture mode ISP is getting configured to input format

G R G R G R G R ...
B G B G B G B G ...
G R G R G R G R ...
B G B G B G B G ...          [Format 2]

Quoted 4 lines

Has anyone tried sensors with BGGR ( Format 1) on OMAP?

Can anyone give me some pointers or information on how to configure ISP for BGGR (Format 1)

If you can live with losing a few pixels (maybe sensor has a few extra) I recommend to configure ISP to crop away the topmost line.

Review

Quoted 7 lines

Here's couple of old _example_ patches how to configure the cropping. Just gives an idea where to start...

- Tuukka

(quoted diff) +0 -0

b/drivers/media/video/isp/ispccdc.c

drivers/media/video/isp/ispccdc.c int ispccdc_config_size(u32 input_w, u32 input_h,

Quoted 4 lines

index 2288bc9..87870f1 100644

drivers/media/video/isp/ispccdc.c +0 -0
@@ -1189,13 +1189,13 @@ int ispccdc_config_size(u32 input_w, u32 input_h,

u32 output_w, u32 output_h)

drivers/media/video/isp/ispccdc.c int ispccdc_config_size(u32 input_w, u32 input_h, u32 output_w, u32 output_h)

Quoted 4 lines
drivers/media/video/isp/ispccdc.c +0 -1
                                                ISPCCDC_HORZ_INFO);
                } else {
                        if (ispccdc_obj.ccdc_inpfmt == CCDC_RAW) {
-                               omap_writel(1 <<

ISPCCDC_HORZ_INFO_SPH_SHIFT

drivers/media/video/isp/ispccdc.c int ispccdc_config_size(u32 input_w, u32 input_h, · line 1193

Quoted 1 line
drivers/media/video/isp/ispccdc.c +0 -1
-                                               |

((ispccdc_obj.ccdcout_w - 1)

drivers/media/video/isp/ispccdc.c int ispccdc_config_size(u32 input_w, u32 input_h, · line 1192

Quoted 1 line
drivers/media/video/isp/ispccdc.c +1 -0
+                               omap_writel(0 <<

ISPCCDC_HORZ_INFO_SPH_SHIFT

Quoted 2 lines
drivers/media/video/isp/ispccdc.c +1 -0
+                                               | (ispccdc_obj.ccdcout_w

                                               <<

ISPCCDC_HORZ_INFO_NPH_SHIFT),

Quoted 3 lines

                                               ISPCCDC_HORZ_INFO); } else {
                               omap_writel(0 <<

ISPCCDC_HORZ_INFO_SPH_SHIFT

Quoted 1 line

-                                               |

((ispccdc_obj.ccdcout_w - 1)

Quoted 2 lines

+                                               | (ispccdc_obj.ccdcout_w <<

ISPCCDC_HORZ_INFO_NPH_SHIFT),

drivers/media/video/isp/ispccdc.c int ispccdc_config_size(u32 input_w, u32 input_h,

Quoted 3 lines

                                               ISPCCDC_HORZ_INFO); }

drivers/media/video/isp/ispccdc.c +0 -0
@@ -1227,7 +1227,7 @@ int ispccdc_config_size(u32 input_w, u32 input_h,

u32 output_w, u32 output_h)

Quoted 25 lines
drivers/media/video/isp/ispccdc.c +0 -0
                                        ISPCCDC_VP_OUT_VERT_NUM_SHIFT),
                                        ISPCCDC_VP_OUT);

               omap_writel(0 << ISPCCDC_HORZ_INFO_SPH_SHIFT |
-                                       ((ispccdc_obj.ccdcout_w - 1) <<
+                                       (ispccdc_obj.ccdcout_w << ISPCCDC_HORZ_INFO_NPH_SHIFT), ISPCCDC_HORZ_INFO); omap_writel(0 << ISPCCDC_VERT_START_SLV0_SHIFT,

drivers/media/video/isp/ispccdc.c +1 -1
index f5957b2..6afaabf 100644
@@ -478,7 +478,7 @@ EXPORT_SYMBOL(ispccdc_enable_lsc);
   **/
  void ispccdc_config_crop(u32 left, u32 top, u32 height, u32 width)
  {
-       ispccdc_obj.ccdcin_woffset = left + ((left + 1) % 2);
+       ispccdc_obj.ccdcin_woffset = left + (left % 2);
         ispccdc_obj.ccdcin_hoffset = top + (top % 2);
 
         ispccdc_obj.crop_w = width - (width % 16);
@@ -1166,7 +1166,7 @@ int ispccdc_config_size(u32 input_w, u32 input_h,
 u32 output_w, u32 output_h)
                                         ISPCCDC_FMT_VERT);
Quoted 10 lines

                omap_writel((ispccdc_obj.ccdcout_w << ISPCCDC_VP_OUT_HORZ_NUM_SHIFT) |
-                                       (ispccdc_obj.ccdcout_h <<
+                                       (ispccdc_obj.ccdcout_h - 1 << ISPCCDC_VP_OUT_VERT_NUM_SHIFT), ISPCCDC_VP_OUT); omap_writel((((ispccdc_obj.ccdcout_h - 25) &

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#4 lore raw

Hi Sergio,

Thanks for the update. Sure, I love to get hands on it.

Regards,
Suresh

Quoted 140 lines · Sergio Alberto
Quoted 9 lines

-----Original Message-----
From: [email protected] [mailto:linux-media- [email protected]] On Behalf Of Suresh Rao
Sent: Thursday, March 19, 2009 7:59 AM
To: [email protected]
Cc: Tuukka.O Toivonen
Subject: Re: ISP Configuration for RAW Bayer sensor

Quoted 7 lines

Hi Tuukka,

Thanks a lot for the patch, I will try this.

I tried similar thing but on the sensor side and it worked, ie., I skip the very first line from readout and get the desired format for the ISP.

Hi Suresh,

I am currently working on a patch for solving these type of adjustments.

The main idea is to specify from the sensor to the ISP, which is the output Raw sequence: RGGB, GRBG, BGGR, GBRG. And then adjust internal ISP reading offset to interpret the image adequately...

I'll post the patch as soon as I have it ready (I'm currently busy with some other higher priority tasks for these remaining 2 weeks of the month :I)

Regards,
Sergio

Quoted 111 lines

Thanks,
Suresh

Quoted 2 lines · Tuukka.O Toivonen
Quoted 1 line · On Wednesday 18 March 2009 18:17:56 ext Suresh Rao wrote:

I am working with MT9V023 RAW sensor.  The data format from the sensor

is

Quoted 25 lines
Quoted 5 lines

B G B G B G B G ...
G R G R G R G R ...
B G B G B G B G ...
G R G R G R G R ........      [ Format 1]

[...]

Quoted 11 lines

I want to use the ISP on the OMAP for doing interpolation and format conversion to UYVY.  I am able to capture the images from the sensor, however I notice that the color information is missing.  I dug the sources and found that in the RAW capture mode ISP is getting configured to input format

G R G R G R G R ...
B G B G B G B G ...
G R G R G R G R ...
B G B G B G B G ...          [Format 2]

Quoted 4 lines

Has anyone tried sensors with BGGR ( Format 1) on OMAP?

Can anyone give me some pointers or information on how to configure ISP for BGGR (Format 1)

If you can live with losing a few pixels (maybe sensor has a few extra) I recommend to configure ISP to crop away the topmost line.

Review

Quoted 7 lines

Here's couple of old _example_ patches how to configure the cropping. Just gives an idea where to start...

- Tuukka

(quoted diff) +0 -0

b/drivers/media/video/isp/ispccdc.c

drivers/media/video/isp/ispccdc.c int ispccdc_config_size(u32 input_w, u32 input_h,

Quoted 4 lines

index 2288bc9..87870f1 100644

drivers/media/video/isp/ispccdc.c +0 -0
@@ -1189,13 +1189,13 @@ int ispccdc_config_size(u32 input_w, u32 input_h,

u32 output_w, u32 output_h)

drivers/media/video/isp/ispccdc.c int ispccdc_config_size(u32 input_w, u32 input_h, u32 output_w, u32 output_h)

Quoted 4 lines
drivers/media/video/isp/ispccdc.c +0 -1
                                                ISPCCDC_HORZ_INFO);
                } else {
                        if (ispccdc_obj.ccdc_inpfmt == CCDC_RAW) {
-                               omap_writel(1 <<

ISPCCDC_HORZ_INFO_SPH_SHIFT

drivers/media/video/isp/ispccdc.c int ispccdc_config_size(u32 input_w, u32 input_h, · line 1193

Quoted 1 line
drivers/media/video/isp/ispccdc.c +0 -1
-                                               |

((ispccdc_obj.ccdcout_w - 1)

drivers/media/video/isp/ispccdc.c int ispccdc_config_size(u32 input_w, u32 input_h, · line 1192

Quoted 1 line
drivers/media/video/isp/ispccdc.c +1 -0
+                               omap_writel(0 <<

ISPCCDC_HORZ_INFO_SPH_SHIFT

Quoted 2 lines
drivers/media/video/isp/ispccdc.c +1 -0
+                                               | (ispccdc_obj.ccdcout_w

                                               <<

ISPCCDC_HORZ_INFO_NPH_SHIFT),

Quoted 3 lines

                                               ISPCCDC_HORZ_INFO); } else {
                               omap_writel(0 <<

ISPCCDC_HORZ_INFO_SPH_SHIFT

Quoted 1 line

-                                               |

((ispccdc_obj.ccdcout_w - 1)

Quoted 2 lines

+                                               | (ispccdc_obj.ccdcout_w <<

ISPCCDC_HORZ_INFO_NPH_SHIFT),

drivers/media/video/isp/ispccdc.c int ispccdc_config_size(u32 input_w, u32 input_h,

Quoted 3 lines

                                               ISPCCDC_HORZ_INFO); }

drivers/media/video/isp/ispccdc.c +0 -0
@@ -1227,7 +1227,7 @@ int ispccdc_config_size(u32 input_w, u32 input_h,

u32 output_w, u32 output_h)

Quoted 25 lines
drivers/media/video/isp/ispccdc.c +0 -0
                                        ISPCCDC_VP_OUT_VERT_NUM_SHIFT),
                                        ISPCCDC_VP_OUT);

               omap_writel(0 << ISPCCDC_HORZ_INFO_SPH_SHIFT |
-                                       ((ispccdc_obj.ccdcout_w - 1) <<
+                                       (ispccdc_obj.ccdcout_w << ISPCCDC_HORZ_INFO_NPH_SHIFT), ISPCCDC_HORZ_INFO); omap_writel(0 << ISPCCDC_VERT_START_SLV0_SHIFT,

drivers/media/video/isp/ispccdc.c +1 -1
index f5957b2..6afaabf 100644
@@ -478,7 +478,7 @@ EXPORT_SYMBOL(ispccdc_enable_lsc);
   **/
  void ispccdc_config_crop(u32 left, u32 top, u32 height, u32 width)
  {
-       ispccdc_obj.ccdcin_woffset = left + ((left + 1) % 2);
+       ispccdc_obj.ccdcin_woffset = left + (left % 2);
         ispccdc_obj.ccdcin_hoffset = top + (top % 2);
 
         ispccdc_obj.crop_w = width - (width % 16);
@@ -1166,7 +1166,7 @@ int ispccdc_config_size(u32 input_w, u32 input_h,
 u32 output_w, u32 output_h)
                                         ISPCCDC_FMT_VERT);
Quoted 10 lines

                omap_writel((ispccdc_obj.ccdcout_w << ISPCCDC_VP_OUT_HORZ_NUM_SHIFT) |
-                                       (ispccdc_obj.ccdcout_h <<
+                                       (ispccdc_obj.ccdcout_h - 1 << ISPCCDC_VP_OUT_VERT_NUM_SHIFT), ISPCCDC_VP_OUT); omap_writel((((ispccdc_obj.ccdcout_h - 25) &

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html