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.

How to adjust chroma saturation in DM365 IPIPE ?

Greetings:

       The IPIPE in DM365 only supports the luminance brightness and saturation in LUM_ADJ block. For example, the lum_adj struct in IPIPE is:

  if (cap.module_id == PREV_LUM_ADJ) {
            lum_adj.brightness = 0;
            lum_adj.contrast = 12;
            mod_param.len = sizeof (struct prev_lum_adj);
            mod_param.param = &lum_adj;
            printf("Setting LUM Params for %s \n",cap.module_name);
        }

       So how to adjust the chroma saturation in DM365?  Thanks;

Best Regards;

  • Hi,

    I had the same problem. A little search on the net taught me it can be achieved with a simple RGB matrix op (http://www.siliconimaging.com/RGB%20Bayer.htm). The DM36x IPIPE seems to have the feature that allows you to do so (rgb 2 rgb blending module)

    Here's some code you could use. The float k is your saturation.

    • k=0 makes a grey scale image
    • k=1 is "normal"
    • k>1 will increase the saturation
        #define expr_to_ipipe_float16(x) {                                      \
            (unsigned short)( (int)(round((x)*256.0)) >> 8  ) & 0xf,            \
            (unsigned short)( (int)(round((x)*256.0)) & 0xff)                   \
            }
        #define assign_expr_to_ipipe_float16(i, x) {                                    \
            (i)->integer = (unsigned short)( (int)(round((x)*256.0)) >> 8  ) & 0xf;     \
            (i)->decimal = (unsigned short)( (int)(round((x)*256.0)) & 0xff);           \
            }
        #define ipipe_float16_to_float(x)                   \
            (float)(                                        \
                    (                                       \
                     ( (int)(x)->integer & 0x7 ) << 8 ) +   \
                     ( (int)(x)->decimal)                   \
                    )/256.0                                 \
                    - 8 * ( ( (x)->integer & 0x8 ) >> 3)
        float k = 1.6;
        struct prev_rgb2rgb mod_param_rgbcorr = {
    	    .coef_rr = expr_to_ipipe_float16(0.299 + 0.701 * (  k)  ),
    	    .coef_gr = expr_to_ipipe_float16(        0.587 * (1-k)  ),
    	    .coef_br = expr_to_ipipe_float16(        0.114 * (1-k)  ),
    	    .coef_rg = expr_to_ipipe_float16(        0.299 * (1-k)  ),
    	    .coef_gg = expr_to_ipipe_float16(0.587 + 0.413 * (  k)  ),
    	    .coef_bg = expr_to_ipipe_float16(        0.114 * (1-k)  ),
    	    .coef_rb = expr_to_ipipe_float16(        0.299 * (1-k)  ),
    	    .coef_gb = expr_to_ipipe_float16(        0.587 * (1-k)  ),
    	    .coef_bb = expr_to_ipipe_float16(0.114 + 0.886 * (  k)  ),
    	    .out_ofst_r = 0,
    	    .out_ofst_g = 0,
    	    .out_ofst_b = 0
        };
    
  • the contrast setting of lum adj module does not really change contrast. it still changes brightness, at least from my testing. dm368 here.