This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CFA co-efficients for Previewer

/*******************************************************************************
**+--------------------------------------------------------------------------+**
**|                            ****                                          |**
**|                            ****                                          |**
**|                            ******o***                                    |**
**|                      ********_///_****                                   |**
**|                      ***** /_//_/ ****                                   |**
**|                       ** ** (__/ ****                                    |**
**|                           *********                                      |**
**|                            ****                                          |**
**|                            ***                                           |**
**|                                                                          |**
**|         Copyright (c) 2006-2010 Texas Instruments Incorporated           |**
**|                        ALL RIGHTS RESERVED                               |**
**|                                                                          |**
**| Permission is hereby granted to licensees of Texas Instruments           |**
**| Incorporated (TI) products to use this computer program for the sole     |**
**| purpose of implementing a licensee product based on TI products.         |**
**| No other rights to reproduce, use, or disseminate this computer          |**
**| program, whether in part or in whole, are granted.                       |**
**|                                                                          |**
**| TI makes no representation or warranties with respect to the             |**
**| performance of this computer program, and specifically disclaims         |**
**| any responsibility for any damages, special or consequential,            |**
**| connected with the use of this program.                                  |**
**|                                                                          |**
**+--------------------------------------------------------------------------+**
*******************************************************************************/
/** \file   psp_bios_vpfe_st_on_the_fly_sample.h
 *
 *  \brief  Header File
 *
 *  (C) Copyright 2010, Texas Instruments, Inc
 *
 *  \author     Maulik Desai
 *
 *  \version    0.1     Created
 */

/****************************************************************************
  HEADER FILE INCLUSION
 *****************************************************************************/
#include<std.h>

#ifdef __cplusplus
extern "C" {
#endif

/******************************************************************************
  Macros
 ******************************************************************************/

#define R_PHASE \
    0,   0,    0, 0, \
0,   64,   0, 0, \
0,   0,    0, 0, \
0,   0,    0, 0, \
\
0,   16,   0, 0, \
16,   0,   16, 0, \
\
16,   0,   16, 0,  \
0,    0,   0, 0, \
16,   0,   16, 0, \
0,    0,   0, 0, \
\
0,    16,  0, 0,  \
0,    0,   0, 0, \
\
0,   0,    0, 0,  \
0,   64,   0, 0, \
0,   0,    0, 0, \
0,   0,    0, 0, \
\
0,   0,    0, 0, \
32,  0,   32, 0, \
\
16, -26,   16, 0,  \
26, 0,    26, 0, \
16, -26,   16, 0, \
0,  0,    0,  0, \
\
0,  0,    0,  0, \
0,  0,    0,  0, \
\
0,  0,    0,  0,  \
0, 64,    0,  0,  \
0,  0,    0,  0, \
0,  0,    0,  0, \
\
0, 32,    0,  0, \
0,  0,    0,  0, \
\
16, 26,   16, 0, \
-26, 0,  -26, 0, \
16, 26,   16, 0, \
0,   0,    0, 0, \
\
0,  32,    0, 0, \
0,  0,     0, 0

#define GR_PHASE \
    -8,  0,   -8, 0,  \
32, 32,   32, 0, \
-8,  0,   -8, 0, \
0,   0,    0, 0, \
\
0,   0,    0, 0, \
0,  64,    0, 0, \
\
-10, 32,  -10, 0,  \
0,  40,    0, 0, \
-10, 32,  -10, 0, \
0,   0,    0, 0, \
\
0,   0,    0, 0, \
0,   0,    0, 0, \
\
0,   0,    0, 0, \
32,  0,   32, 0, \
0,   0,    0, 0, \
0,   0,    0, 0, \
\
0,   0,    0, 0, \
0,  64,    0, 0, \
\
-13, 32,  -13, 0,  \
0,  52,    0, 0, \
-13, 32,  -13, 0, \
0,   0,    0, 0, \
\
0,   0,    0, 0, \
0,   0,    0, 0, \
\
-16, 0,  -16, 0, \
32, 64,  32, 0, \
-16, 0,  -16, 0, \
0,   0,    0, 0, \
\
0,   0,    0, 0, \
0,  64,    0, 0, \
\
0,  32,    0, 0,  \
0,  0,     0, 0, \
0,  32,    0, 0, \
0,  0,     0, 0, \
\
0,  0,     0, 0, \
0,  0,     0, 0

#define GB_PHASE \
    -8, 32, -8, 0,  \
0,  32,  0, 0, \
-8, 32, -8, 0, \
0,   0,  0, 0, \
\
0,   0,  0, 0, \
0,  64,  0, 0, \
\
-8,  0, -8, 0, \
32, 32, 32, 0, \
-8, 0,  -8, 0, \
0,  0,   0, 0, \
\
0,  0,   0, 0, \
0,  0,   0, 0, \
\
-16, 32,  -16, 0,  \
0,  64,  0,   0, \
-16, 32, -16,  0, \
0,  0,   0,   0, \
\
0,  0,   0,   0, \
0, 64,   0,   0, \
\
0,  0,   0,   0, \
29, 6,  29,   0,  \
0,  0,   0,   0, \
0,  0,   0,   0, \
\
0,  0,   0,   0, \
0,  0,   0,   0, \
\
0, 32,   0,   0,  \
0,  0,   0,   0,  \
0, 32,   0,   0, \
0,  0,   0,   0, \
\
0,  0,   0,   0, \
0, 64,   0,   0, \
\
-13, 0,  -13,  0, \
32, 52, 32,   0, \
-13, 0, -13,   0, \
0,   0, 0,    0,  \
\
0,   0, 0,    0, \
0,   0,  0, 0

#define B_PHASE  \
    16, -6,    16, 0, \
6,  0,     6, 0, \
16, -6,   16, 0, \
0,   0,    0, 0, \
\
0,   16,   0, 0, \
16,   0,  16, 0, \
\
0,    0,   0, 0, \
0,   64,   0, 0,  \
0,    0,   0, 0, \
0,    0,   0, 0, \
\
0,   16,   0, 0, \
0,    0,   0, 0, \
\
16, -32,  16, 0, \
32,   0,  32, 0, \
16, -32,  16, 0, \
0,    0,   0, 0, \
\
0,    0,   0, 0, \
32,   0,  32, 0, \
\
0,    0,   0, 0, \
0,   64,   0, 0,  \
0,    0,   0, 0, \
0,    0,   0, 0, \
\
0,    0,   0, 0, \
0,    0,   0, 0, \
\
16, 26,   16, 0, \
-26, 0,  -26, 0, \
16, 26,   16, 0, \
0,   0,    0, 0, \
\
0,  32,    0, 0, \
0,   0,    0, 0, \
\
0,   0,    0, 0, \
0,  64,    0, 0, \
0,   0,    0, 0, \
0,   0,    0, 0, \
\
0,  32,    0, 0, \
0, 0,  0, 0

#define FRAME_WIDTH     640
#define FRAME_HEIGHT    480

#ifdef __cplusplus
}
#endif
Hello,

I have connected a CMOS sensor to DM6437 VPFE and I'm using Previewer to convert Bayer data to YUV. I can see that image are converted, but color is not converted correctly.

I've enabled CFA interpolation and used CFA coefficients from PSP 1.10.03 sample (psp_bios_vpfe_st_on_the_fly_sample.h: see attached file for reference)

I've disabled RGB to RGB blending module by setting its metrix as Identity Metrix & offset vector to 0s.

For RGB to YCbCr conversion I've kept default settings.

I'm not sure that the CFA coeffs I'm using are correct or not. Please let me know which CFA coeffs shuold I use.

Input Image: 

 

Output image:

 

Thanks & Regards,

Mitul Chokshi

  • Hi Mitul,

     

    We have used these same CFA coefficients for many input images. I dont think this output image is because of CFA coefficients. Can you see all other parameters are correct? Btw, there is no RGB to RGB blender in previewer.

     

    Thx,

    Brijesh Jadav

  • Hi Brijesh,

    Thanks for the response.

    I've kept almost all parameters to default value. Can you provide me any sample bayer image which you have tested with this CFA coefficient? This will help me to locate the parameter where I'm setting incorrect value.

    Regarding your second comment for RGB to RGB blending: this module is shown in the VPFE User guide SPRU977A, Figure 28. Please see attached snapshot for reference.

    Regards,

    Mitul Chokshi

  • Brijesh Jadav said:
    Can you see all other parameters are correct?

    Hi Brijesh,

    I checked all other parameters. & as per my understanding they are correct.

    Below is the dump. Please check these parameters & see if you can find something.

    Address Register Value
    0x01c70800 PID 0x0002fe00
    0x01c70804 PCR 0x04120410
    0x01c70808 HORZ_INFO 0x0002027d
    0x01c7080c VERT_INFO 0x000001df
    0x01c70810 RSDR_ADDR 0x83096080
    0x01c70814 RADR_OFFSET 0x00000280
    0x01c70818 DSDR_ADDR 0x00000000
    0x01c7081c DRKF_OFFSET 0x00000000
    0x01c70820 WSDR_ADDR 0x800e3480
    0x01c70824 WADD_OFFSET 0x00000500
    0x01c70828 AVE 0x00000014
    0x01c7082c HMED 0x00000000
    0x01c70830 NF 0x00000000
    0x01c70834 WB_DGAIN 0x00000100
    0x01c70838 WBGAIN 0x20202020
    0x01c7083c WBSEL 0xee44ee44
    0x01c70840 CFA 0x00002828
    0x01c70844 BLKADJOFF 0x00000000
    0x01c70848 RGB_MAT1 0x00000100
    0x01c7084c RGB_MAT2 0x00000000
    0x01c70850 RGB_MAT3 0x00000100
    0x01c70854 RGB_MAT4 0x00000000
    0x01c70858 RGB_MAT5 0x00000100
    0x01c7085c RGB_OFF1 0x00000000
    0x01c70860 RGB_OFF2 0x00000000
    0x01c70864 CSC0 0x01c2604c
    0x01c70868 CSC1 0x080eb3d4
    0x01c7086c CSC2 0x080eb3d4
    0x01c70870 CSC_OFFSET 0x00000000
    0x01c70874 CNT_BRT 0x00001020
    0x01c70878 CSUP 0x00000000
    0x01c7087c SETUP_YC 0xff00ff00
    0x01c70880 SET_TBL_ADDRESS 0x00001700
    0x01c70884 SET_TBL_DATA 0x00000010

    Regards,

    Mitul Chokshi

  • Hi Brijesh,

    The problem is solved now. I had to change phase of CFA coefficient. Earlier I was using Gr-R-B-Gb. I modified it to R-Gr-Gb-B and now color is reproduced correctly.

    Thanks for the support.

    Regards,

    Mitul Chokshi