From: Sakari Ailus <sakari.ailus@iki.fi>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org,
Jean-Philippe Francois <jp.francois@cynove.com>
Subject: Re: [PATCH v2 6/6] omap3isp: preview: Add support for non-GRBG Bayer patterns
Date: Fri, 13 Jul 2012 13:12:27 +0300 [thread overview]
Message-ID: <4FFFF48B.8010609@iki.fi> (raw)
In-Reply-To: <1341581569-8292-7-git-send-email-laurent.pinchart@ideasonboard.com>
Hi Laurent,
Thanks for the patch.
Laurent Pinchart wrote:
> Rearrange the CFA interpolation coefficients table based on the Bayer
> pattern. Support for non-Bayer CFA patterns is dropped as they were not
> correctly supported, and have never been tested.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/media/video/omap3isp/isppreview.c | 134 ++++++++++++++++++-----------
> drivers/media/video/omap3isp/isppreview.h | 1 +
> 2 files changed, 85 insertions(+), 50 deletions(-)
>
> diff --git a/drivers/media/video/omap3isp/isppreview.c b/drivers/media/video/omap3isp/isppreview.c
> index 71ce0f4..475908b 100644
> --- a/drivers/media/video/omap3isp/isppreview.c
> +++ b/drivers/media/video/omap3isp/isppreview.c
> @@ -236,20 +236,30 @@ static void preview_enable_hmed(struct isp_prev_device *prev, bool enable)
> ISPPRV_PCR_HMEDEN);
> }
>
> +#define OMAP3ISP_PREV_CFA_BLK_SIZE (OMAP3ISP_PREV_CFA_TBL_SIZE / 4)
> +
> /*
> - * preview_config_cfa - Configure CFA Interpolation
> - */
> -static void
> -preview_config_cfa(struct isp_prev_device *prev,
> - const struct prev_params *params)
> -{
> - struct isp_device *isp = to_isp_device(prev);
> + * preview_config_cfa - Configure CFA Interpolation for Bayer formats
> + *
> + * The CFA table is organised in four blocks, one per Bayer component. The
> + * hardware expects blocks to follow the Bayer order of the input data, while
> + * the driver stores the table in GRBG order in memory. The blocks need to be
> + * reordered to support non-GRBG Bayer patterns.
> + */
> +static void preview_config_cfa(struct isp_prev_device *prev,
> + const struct prev_params *params)
> +{
> + static const unsigned int cfa_coef_order[4][4] = {
> + { 0, 1, 2, 3 }, /* GRBG */
> + { 1, 0, 3, 2 }, /* RGGB */
> + { 2, 3, 0, 1 }, /* BGGR */
> + { 3, 2, 1, 0 }, /* GBRG */
> + };
> + const unsigned int *order = cfa_coef_order[prev->params.cfa_order];
> const struct omap3isp_prev_cfa *cfa = ¶ms->cfa;
> + struct isp_device *isp = to_isp_device(prev);
> unsigned int i;
> -
> - isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR,
> - ISPPRV_PCR_CFAFMT_MASK,
> - cfa->format << ISPPRV_PCR_CFAFMT_SHIFT);
> + unsigned int j;
>
> isp_reg_writel(isp,
> (cfa->gradthrs_vert << ISPPRV_CFA_GRADTH_VER_SHIFT) |
> @@ -259,9 +269,13 @@ preview_config_cfa(struct isp_prev_device *prev,
> isp_reg_writel(isp, ISPPRV_CFA_TABLE_ADDR,
> OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_ADDR);
>
> - for (i = 0; i < OMAP3ISP_PREV_CFA_TBL_SIZE; i++) {
> - isp_reg_writel(isp, cfa->table[i],
> - OMAP3_ISP_IOMEM_PREV, ISPPRV_SET_TBL_DATA);
> + for (i = 0; i < 4; ++i) {
> + const __u32 *block = cfa->table
> + + order[i] * OMAP3ISP_PREV_CFA_BLK_SIZE;
> +
> + for (j = 0; j < OMAP3ISP_PREV_CFA_BLK_SIZE; ++j)
> + isp_reg_writel(isp, block[j], OMAP3_ISP_IOMEM_PREV,
> + ISPPRV_SET_TBL_DATA);
> }
> }
>
I think struct omap3isp_prev_cfa would benefit from more detailed
definition of the gamma table. That would also change the API albeit not
ABI... unless you use an anonymous union which then requires a GCC newer
than or equal to 4.4, I think.
The table should be two-dimensional array, not one-dimensional.
Now that we're making changes to the user space API anyway, what would
you think about this? I think it'd make the code much nicer.
Kind regards,
--
Sakari Ailus
sakari.ailus@iki.fi
next prev parent reply other threads:[~2012-07-13 10:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-06 13:32 [PATCH v2 0/6] omap3isp: preview: Add support for non-GRBG Bayer patterns Laurent Pinchart
2012-07-06 13:32 ` [PATCH v2 1/6] omap3isp: preview: Fix contrast and brightness handling Laurent Pinchart
2012-07-06 13:32 ` [PATCH v2 2/6] omap3isp: preview: Remove lens shading compensation support Laurent Pinchart
2012-07-06 13:32 ` [PATCH v2 3/6] omap3isp: preview: Pass a prev_params pointer to configuration functions Laurent Pinchart
2012-07-06 13:32 ` [PATCH v2 4/6] omap3isp: preview: Reorder " Laurent Pinchart
2012-07-06 13:32 ` [PATCH v2 5/6] omap3isp: preview: Merge gamma correction and gamma bypass Laurent Pinchart
2012-07-13 9:51 ` Sakari Ailus
2012-07-13 10:00 ` Laurent Pinchart
2012-07-06 13:32 ` [PATCH v2 6/6] omap3isp: preview: Add support for non-GRBG Bayer patterns Laurent Pinchart
2012-07-13 10:12 ` Sakari Ailus [this message]
2012-07-13 11:25 ` Laurent Pinchart
2012-07-14 13:32 ` [PATCH v2 0/6] " jean-philippe francois
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FFFF48B.8010609@iki.fi \
--to=sakari.ailus@iki.fi \
--cc=jp.francois@cynove.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.