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.

dm6446: Previewer WB registers

Hello All,

This is regarding the previewer white balance coefficients in the case of dm6446.

WB_DGAIN, raw data is multipled by a fixed gain regardless of its color
WBGAIN, raw data is multiplied by a selected gain corresponding to the color of the processed pixel (section 4.3.3.7 of VPFE user guide sprue38e.pdf).

/* prev_config.c setup white balance gain */
params.white_balance_params.wb_dgain = 0x100;
params.white_balance_params.wb_gain[0] = 0x40;
params.white_balance_params.wb_gain[1] = 0x45;
params.white_balance_params.wb_gain[2] = 0x60;
params.white_balance_params.wb_gain[3] = 0x45;
In the above code example, the values assigned wb_dgain and wb_gain are written to the registers (WB_DGAIN, WBGAIN) as it is but how previewer treats them is the question.

How much digital gain does ‘0x100’ corresponds to? Each pixel will be multiplied with 0x100 or some equivalent gain (0x100 = 1.0 eg)
Similarly how 0x40, 0x45, 0x60 are deciphered?

If I have wb coefficients as [1.523 1.000 -1.345], how to assign fractional coefficients to wb registers?

How to select these coefficients optimally?
Please clarify the above queries.
Thanks for your help.

--
Best Regards
S Arun

  • Arun said:
    How much digital gain does ‘0x100’ corresponds to? Each pixel will be multiplied with 0x100 or some equivalent gain (0x100 = 1.0 eg)
    Similarly how 0x40, 0x45, 0x60 are deciphered?

    The wb_gain values use Q notation with 5 bits of decimal precision (i.e. U8Q5) as mentioned in section 4.3.5.2.2, the wb_dgain value does not appear to have a documented format in the user's guide but I believe it should be a similar Q format only with 8 bits of decimal precision (i.e. U10Q8), I will have to look into why this is not mentioned (or if it is somewhere I missed).

    Arun said:
    How to select these coefficients optimally?

    I am not sure how best to actually setup these values, I suspect it varies based on your system conditions, imager, etc.

  • Thanks Bernie for the clarification.

    I don't know why the same is not mentioned in the registers section, i think that is the right place for all these details or atleast a pointer to appropriate section will help.

    --

    Best Regards

    S Arun

     

  • Hello Bernie,

    Please confirm whether my understanding is correct or not.
    U8Q5 - means the total no of bits is 8 and of which 5 bits represent fractional part. 2 represents the integer part and 1 sign bit (msb).
    The wiki link explains this notation as below:

    The notation used is Qm.n, where:
        * Q designates that the number is in Q format notation — the Texas Instruments representation for signed fixed-point numbers.
        * m (optional; default=0) is the number of bits used to designate the two's complement integer portion of the number, exclusive of the sign bit.
        * n is the number of bits used to designate the two's complement fractional portion of the number, i.e. the number of bits to the right of the binary point.

    but the two's complement is not considered in the conversion section which is confusing. I did the conversion using an example without considering two's complement.

    1. to convert a number from float to Q,  first multiply the floating point no by 2^n and round it to nearest integer (where n is no of bits representing fractional part, in this case n=5 because it is U8Q5).
    Eg: 1.52345 => 1.523 * 2^5 = 49d = 31H (after rounding to nearest integer)

    2. from Q to float, Convert the number to floating point as if it were an integer and Multiply by 2^(-n)
    Eg: 49d => 49 * 2^(-5) = 49/32 = 1.53125

    Are these conversions correct? please confirm. If anything is wrong or anywhere two's complement need to be considered please correct me.

    -> U stands for unsigned right? so is it not possible to represent -ve floating point numbers with this notation.

    --
    Best Regards
    S Arun

  • I have not done much work with Q format myself but based on the wiki article description your calculations appear to be correct.

    Arun said:
    U stands for unsigned right? so is it not possible to represent -ve floating point numbers with this notation.

    It is not explicitly said in the docs, but I that would make sense to me.