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.

TDA4AL-Q1: Calrification Needed on H3A parsing

Part Number: TDA4AL-Q1

Tool/software:

Hi ,

We are looking into parsing H3a data before feeding to Auto exposure. We need couple of clarifications on this regard.

In file imaging/kernels/aewb/arm/vx_aewb_target.c, In below function. Ti is Doing Avg of gr and gb values .However, we didn't get why +1 , you guys are doing (sum_gr + sum_gb + 1) >> 1).can you please explain ?Please refer below higlighted code.

static void parse_h3a_out(uint8_t h3a_buf[], int32_t n_col, int32_t n_row,
int32_t id_r, int32_t id_gr, int32_t id_gb, int32_t id_b,
h3a_aewb_paxel_data_t *h3a_data)
{
uint8_t * cur_addr = h3a_buf;
int n_win = 0;
int j, i;

for (j = 0; j < n_row; j++)
{
for (i = 0; i < n_col; i++)
{
uint16_t * pAewbWinData = (uint16_t *)cur_addr;

uint32_t sum_gr = pAewbWinData[id_gr];
uint32_t sum_gb = pAewbWinData[id_gb];
uint16_t sum_g = (uint16_t)((sum_gr + sum_gb + 1) >> 1);

h3a_data[j * n_col + i].green = sum_g;
h3a_data[j * n_col + i].red = pAewbWinData[id_r];
h3a_data[j * n_col + i].blue = pAewbWinData[id_b];

cur_addr += sizeof(uint16_t) * 8;
n_win++;

if (n_win % 8 == 0)
{
cur_addr += sizeof(uint16_t) * 8;
}
}

if ((cur_addr - h3a_buf) % 32 == 16)
{
cur_addr += 16;
}
}
}

Regards

Sriharsha

  • Hi Sriharsha,

    However, we didn't get why +1 , you guys are doing (sum_gr + sum_gb + 1) >> 1).

    That is for rounding.

  • Hi ,

    Thanks for the reply.

    Here are my follow up questions.

    Inside TI_AE_DO function in TI_aaa_ae.c , TI is calculating rY,gY,bY using below formula

        int32_t rY = (0x4d * r_gain + 128) >> 8;
        int32_t gY = (0x96 * g_gain + 128) >> 8;
        int32_t bY = (0x1d * b_gain + 128) >> 8;

    1) can you explain give below clarifications on why Initially r_gain &  g_gain & b_gain are initialized to 256

    2) Why TI need to multiply r_gain,g_gain,b_gain with 0x4d , 0x96, 0x1d respectively? on what basis

        this hexa values are needed?

    3) Why TI need to divide by 256(>> 256)?

    Regards

    Sriharsha

  • Hi Sriharsha,

    1) can you explain give below clarifications on why Initially r_gain &  g_gain & b_gain are initialized to 256

    I don't think we really change these gains.
    They should be fixed to 256.

    2) Why TI need to multiply r_gain,g_gain,b_gain with 0x4d , 0x96, 0x1d respectively? on what basis

    I suppose that is for conversion from R,G,B to Y in the commonly used conversion coefficients.

    3) Why TI need to divide by 256(>> 256)?

    I suppose you mean ">>8".
    That should be normal integer operation.