示例#1
0
def GenVISS_BLCXML(directory, filebase, params, VISS_BLC_params):

    if (os.path.exists(directory) == False):
        print ('Creating directory:  %s\n' %directory)
        try:
            os.makedirs(directory)
        except OSError as err:
            utils.error('%s: %s' %(err.strerror, err.filename), skip=True)

    filename = os.path.join(directory, '%s_%s.xml' %(params['SENSOR'], filebase));
    print ('Creating XML File:  %s\n' %filename	)

    module_params = {}
    module_params['NAME']   = 'VISS_BLC'
    module_params['STRUCT_NAME'] = 'viss_clamp'
    module_params['DCC_ID'] = dcc.DCC_ID_ISIF_BLACK_CLAMP
    module_params['FUNC_GENPARAMS'] = GenVISS_BLCParams
    
    handle = dccxml.OpenFile(filename)
    dccxml.GenHeader(handle, params, module_params)
    
    # Create the DCC Structure definition
    handle.write('  <!--=======================================================================-->\n')
    handle.write('      <typedef>\n')
    handle.write('      <%s type="struct"> \n' %module_params['STRUCT_NAME'])

    handle.write('       			<viss_clamp_vshort type="struct">\n')
    handle.write('       				<dcoffset_clamp_value_0 type="int16"> </dcoffset_clamp_value_0> <!-- additive dc offset, S13 -->\n')
    handle.write('       				<dcoffset_clamp_value_1 type="int16"> </dcoffset_clamp_value_1> <!-- additive dc offset, S13 -->\n')
    handle.write('       				<dcoffset_clamp_value_2 type="int16"> </dcoffset_clamp_value_2> <!-- additive dc offset, S13 -->\n')
    handle.write('       				<dcoffset_clamp_value_3 type="int16"> </dcoffset_clamp_value_3> <!-- additive dc offset, S13 -->\n')
    handle.write('       			</viss_clamp_vshort>\n')

    handle.write('       			<viss_clamp_short type="struct">\n')
    handle.write('       				<dcoffset_clamp_value_0 type="int16"> </dcoffset_clamp_value_0> <!-- additive dc offset, S13 -->\n')
    handle.write('       				<dcoffset_clamp_value_1 type="int16"> </dcoffset_clamp_value_1> <!-- additive dc offset, S13 -->\n')
    handle.write('       				<dcoffset_clamp_value_2 type="int16"> </dcoffset_clamp_value_2> <!-- additive dc offset, S13 -->\n')
    handle.write('       				<dcoffset_clamp_value_3 type="int16"> </dcoffset_clamp_value_3> <!-- additive dc offset, S13 -->\n')
    handle.write('       			</viss_clamp_short>\n')
    
    handle.write('       			<viss_clamp_long type="struct">\n')
    handle.write('       				<dcoffset_clamp_value_0 type="int16"> </dcoffset_clamp_value_0> <!-- additive dc offset, S13 -->\n')
    handle.write('       				<dcoffset_clamp_value_1 type="int16"> </dcoffset_clamp_value_1> <!-- additive dc offset, S13 -->\n')
    handle.write('       				<dcoffset_clamp_value_2 type="int16"> </dcoffset_clamp_value_2> <!-- additive dc offset, S13 -->\n')
    handle.write('       				<dcoffset_clamp_value_3 type="int16"> </dcoffset_clamp_value_3> <!-- additive dc offset, S13 -->\n')
    handle.write('       			</viss_clamp_long>  \n')
  
    handle.write('      </%s> \n' %module_params['STRUCT_NAME'])
  
    handle.write('   </typedef>\n')
    handle.write('  <!--=======================================================================-->\n')
    
    # Create a DCC Use Case
    for i in range(VISS_BLC_params['NUM_USE_CASE']):
        dccxml.AddUseCase(handle, module_params, VISS_BLC_params['USE_CASE'][i])
    
    dccxml.GenFooter(handle, module_params)
    dccxml.CloseFile(handle)
示例#2
0
def GenDECMPXML(directory, filebase, params, decmp_params):

    if (os.path.exists(directory) == False):
        print('Creating directory:  %s\n' % directory)
        try:
            os.makedirs(directory)
        except OSError as err:
            utils.error('%s: %s' % (err.strerror, err.filename), skip=True)

    filename = os.path.join(directory,
                            '%s_%s.xml' % (params['SENSOR'], filebase))
    print('Creating XML File:  %s\n' % filename)

    module_params = {}
    module_params['NAME'] = 'VISS_RAWFE_decmp_cfg'
    module_params['STRUCT_NAME'] = 'cfg_rawfe_decompand'
    module_params['DCC_ID'] = dcc.DCC_ID_IPIPE_DECMP
    module_params['FUNC_GENPARAMS'] = GenDECMPParams

    handle = dccxml.OpenFile(filename)
    dccxml.GenHeader(handle, params, module_params)

    # Create the DCC Structure definition
    handle.write(
        '  <!--=======================================================================-->\n'
    )
    handle.write('      <typedef>\n')
    handle.write('    <%s type="struct">\n' % module_params['STRUCT_NAME'])

    handle.write('			<pwl_vshort_lut_en type="uint16"> </pwl_vshort_lut_en>\n')
    handle.write('			<pwl_vshort_mask type="uint16"> </pwl_vshort_mask>\n')
    handle.write('			<pwl_vshort_shift type="uint16"> </pwl_vshort_shift>\n')
    handle.write(
        '			<pwl_vshort_lut_bitdepth type="uint16"> </pwl_vshort_lut_bitdepth>\n'
    )
    handle.write(
        '			<pwl_vshort_lut_clip type="uint16"> </pwl_vshort_lut_clip>\n')
    handle.write('			<pwl_vshort_lut type="uint16[639]"> </pwl_vshort_lut>\n')

    handle.write('      </%s>\n' % module_params['STRUCT_NAME'])
    handle.write('   </typedef>\n')
    handle.write(
        '  <!--=======================================================================-->\n'
    )

    # Create a DCC Use Case
    for i in range(decmp_params['NUM_USE_CASE']):
        dccxml.AddUseCase(handle, module_params, decmp_params['USE_CASE'][i])

    r_table = '../tables/lut_rawfe_pwl_vshort.txt'
    shutil.copy(r_table, directory)

    dccxml.GenFooter(handle, module_params)
    dccxml.CloseFile(handle)
示例#3
0
def GenRGB2RGBXML(directory, filebase, params, RGB2RGB_params):

    if (os.path.exists(directory) == False):
        print('Creating directory:  %s\n' % directory)
        try:
            os.makedirs(directory)
        except OSError as err:
            utils.error('%s: %s' % (err.strerror, err.filename), skip=True)

    filename = os.path.join(directory,
                            '%s_%s.xml' % (params['SENSOR'], filebase))
    print('Creating XML File:  %s\n' % filename)

    module_params = {}
    module_params['NAME'] = 'ipipe_rgb2rgb_dcc.xml'
    module_params['STRUCT_NAME'] = 'cfg_rgb2rgb'
    module_params['DCC_ID'] = dcc.DCC_ID_IPIPE_RGB_RGB_1
    module_params['FUNC_GENPARAMS'] = GenRGB2RGB1Params

    handle = dccxml.OpenFile(filename)
    dccxml.GenHeader(handle, params, module_params)

    # Create the DCC Structure definition
    handle.write(
        '    <!--=======================================================================-->\n'
    )
    handle.write('  <typedef>\n')
    handle.write('			<cfg_rgb2rgb type="struct">\n')
    handle.write('        <!-- [RR] [GR] [BR] [CR]\n')
    handle.write('             [RG] [GG] [BG] [CG]\n')
    handle.write('             [RB] [GB] [BB] [CB]-->\n')
    handle.write('        <!-- Blending + Chroma values (S12Q8 format) -->\n')
    handle.write(
        '			    <ccm type="int16[3][4]"> </ccm> <!-- ipipe rgb2rgb matrix: S12Q8 -->\n'
    )
    handle.write('					<!-- Blending offset value for R,G,B - (S13) -->\n')
    handle.write(
        '					<offset type="int16[3]"> </offset> <!-- ipipe rgb2rgb1 offset: S13 -->\n'
    )
    handle.write('    </cfg_rgb2rgb>\n')
    handle.write('</typedef>\n')
    handle.write(
        '<!--=======================================================================-->\n'
    )

    # Create a DCC Use Case
    for i in range(RGB2RGB_params['NUM_USE_CASE']):
        dccxml.AddUseCase(handle, module_params, RGB2RGB_params['USE_CASE'][i])
    dccxml.GenFooter(handle, module_params)
    dccxml.CloseFile(handle)
    return
示例#4
0
def generate_dcc_gen_script(sys_params, params):
    dcc_gen_File = 'generate_dcc.sh'
    dcc_gen_Dir = sys_params['PRJ_DIR'] + '/dcc_xmls/' + params['WDR_MODE']

    if (os.path.exists(dcc_gen_Dir) == False):
        print('Creating directory:  %s\n' % dcc_gen_Dir)
        try:
            os.makedirs(dcc_gen_Dir)
        except OSError as err:
            utils.error('%s: %s' % (err.strerror, err.filename), skip=True)

    filename = os.path.join(dcc_gen_Dir, '%s' % (dcc_gen_File))
    print('Creating XML File:  %s\n' % filename)

    handle = dccxml.OpenFile(filename)
    if (params['WDR_MODE'] == 'linear'):
        wdr_suffix = ""
    else:
        wdr_suffix = "_wdr"

    handle.write('DCC_TOOL_PATH=../../../../../tools/dcc_tools/\n')
    handle.write('OUT_PATH=../../../../include\n')
    handle.write('\n')
    handle.write('rm *.bin\n')

    handle.write('bin_folder=../../dcc_bins/\n')
    handle.write('if [ ! -d "$bin_folder" ]\n')
    handle.write('then\n')
    handle.write('    mkdir "$bin_folder"\n')
    handle.write('fi\n')
    handle.write('\n')
    handle.write('bin_folder=../../dcc_bins/%s/\n' % params['SENSOR_DCC_NAME'])
    handle.write('if [ ! -d "$bin_folder" ]\n')
    handle.write('then\n')
    handle.write('    mkdir "$bin_folder"\n')
    handle.write('fi\n')
    handle.write('\n')
    handle.write('bin_folder=../../dcc_bins/%s/%s/\n' %
                 (params['SENSOR_DCC_NAME'], params['WDR_MODE']))
    handle.write('if [ ! -d "$bin_folder" ]\n')
    handle.write('then\n')
    handle.write('    mkdir "$bin_folder"\n')
    handle.write('fi\n')
    handle.write('\n')

    handle.write('rm $OUT_PATH/dcc_viss_%s_%s.h\n' %
                 (params['SENSOR'], params['WDR_MODE']))
    handle.write('$DCC_TOOL_PATH/dcc_gen_linux %s_rgb2rgb_dcc.xml\n' %
                 params['SENSOR'])
    handle.write('$DCC_TOOL_PATH/dcc_gen_linux %s_h3a_aewb_dcc.xml\n' %
                 params['SENSOR'])
    handle.write('$DCC_TOOL_PATH/dcc_gen_linux %s_viss_nsf4.xml\n' %
                 params['SENSOR'])
    handle.write('$DCC_TOOL_PATH/dcc_gen_linux %s_viss_blc.xml\n' %
                 params['SENSOR'])
    handle.write('$DCC_TOOL_PATH/dcc_gen_linux %s_cfa_dcc.xml\n' %
                 params['SENSOR'])
    if (params['WDR_MODE'] == 'wdr'):
        handle.write(
            '$DCC_TOOL_PATH/dcc_gen_linux %s_wdr_decompand_dcc.xml\n' %
            params['SENSOR'])
        handle.write('$DCC_TOOL_PATH/dcc_gen_linux %s_wdr_glbce_dcc.xml\n' %
                     params['SENSOR'])
    handle.write('$DCC_TOOL_PATH/dcc_gen_linux %s_h3a_mux_luts_dcc.xml\n' %
                 params['SENSOR'])
    handle.write('cp *.bin %s/\n' % "$bin_folder")
    handle.write('cat *.bin > ../../dcc_bins/dcc_viss%s.bin\n' % wdr_suffix)
    handle.write(
        '$DCC_TOOL_PATH/dcc_bin2c ../../dcc_bins/dcc_viss%s.bin $OUT_PATH/dcc_viss_%s%s.h dcc_viss_%s%s\n'
        % (wdr_suffix, params['SENSOR'], wdr_suffix, params['SENSOR'],
           wdr_suffix))
    handle.write('\n')
    handle.write('rm *.bin\n')

    handle.write('rm $OUT_PATH/dcc_2a_%s_%s.h\n' %
                 (params['SENSOR'], params['WDR_MODE']))
    handle.write('$DCC_TOOL_PATH/dcc_gen_linux %s_awb_alg_ti3_tuning.xml\n' %
                 params['SENSOR'])
    handle.write('$DCC_TOOL_PATH/dcc_gen_linux %s_h3a_aewb_dcc.xml\n' %
                 params['SENSOR'])
    handle.write('cp *.bin %s/\n' % "$bin_folder")
    handle.write('cat *.bin > ../../dcc_bins/dcc_2a%s.bin\n' % wdr_suffix)
    handle.write(
        '$DCC_TOOL_PATH/dcc_bin2c ../../dcc_bins/dcc_2a%s.bin $OUT_PATH/dcc_2a_%s%s.h dcc_2a_%s%s\n'
        % (wdr_suffix, params['SENSOR'], wdr_suffix, params['SENSOR'],
           wdr_suffix))
    handle.write('\n')
    handle.write('rm *.bin\n')

    handle.write('rm $OUT_PATH/dcc_ldc_%s_%s.h\n' %
                 (params['SENSOR'], params['WDR_MODE']))
    handle.write('$DCC_TOOL_PATH/dcc_gen_linux %s_mesh_ldc_dcc.xml\n' %
                 params['SENSOR'])
    handle.write('cp *.bin %s/\n' % "$bin_folder")
    handle.write('cat *.bin > ../../dcc_bins/dcc_ldc%s.bin\n' % wdr_suffix)
    handle.write(
        '$DCC_TOOL_PATH/dcc_bin2c ../../dcc_bins/dcc_ldc%s.bin $OUT_PATH/dcc_ldc_%s%s.h dcc_ldc_%s%s\n'
        % (wdr_suffix, params['SENSOR'], wdr_suffix, params['SENSOR'],
           wdr_suffix))
    handle.write('\n')
    handle.write('rm *.bin\n')

    return
示例#5
0
def GenNSF4XML(directory, filebase, params, nsf4_params):

    if (os.path.exists(directory) == False):
        print ('Creating directory:  %s\n' %directory)
        try:
            os.makedirs(directory)
        except OSError as err:
            utils.error('%s: %s' %(err.strerror, err.filename), skip=True)

    filename = os.path.join(directory, '%s_%s.xml' %(params['SENSOR'], filebase));
    print ('Creating XML File:  %s\n' %filename)
	
    module_params = {}
    module_params['NAME']   = 'VISS_NSF4_CFG'
    module_params['STRUCT_NAME'] = 'viss_nsf4_cfg'
    module_params['DCC_ID'] = dcc.DCC_ID_NSF_CFG
    module_params['FUNC_GENPARAMS'] = GenNSF4Params
    
    handle = dccxml.OpenFile(filename)
    dccxml.GenHeader(handle, params, module_params)
    
    # Create the DCC Structure definition

    handle.write('  <!--=======================================================================-->\n')
    handle.write('    <typedef>\n')
    handle.write('		<%s type="struct">\n' %module_params['STRUCT_NAME'])

    handle.write('				  <enable type="int32"> </enable> <!-- enable nsf4-->\n')
    handle.write('				  <mode type="int32"> </mode>\n')
    handle.write('				  <shading_gain type="int32"> </shading_gain>\n')
    
    handle.write('				  <u1_knee type="int32"> </u1_knee>\n')
    handle.write('				  <tn1 type="int32"> </tn1>\n')
    handle.write('				  <tn2 type="int32"> </tn2>\n')
    handle.write('				  <tn3 type="int32"> </tn3>\n')
    
    handle.write('				  <noise_thr_x type="int32[4][12]"> </noise_thr_x>\n')
    handle.write('				  <noise_thr_y type="int32[4][12]"> </noise_thr_y>\n')
    handle.write('				  <noise_thr_s type="int32[4][12]"> </noise_thr_s>\n')
    
    handle.write('				  <shd_x type="int32"> </shd_x>\n')
    handle.write('				  <shd_y type="int32"> </shd_y>\n')
    handle.write('				  <shd_t type="int32"> </shd_t>\n')
    handle.write('				  <shd_kh type="int32"> </shd_kh>\n')
    handle.write('				  <shd_kv type="int32"> </shd_kv>\n')
    handle.write('				  <shd_gmax type="int32"> </shd_gmax>\n')
    handle.write('				  <shd_set_sel type="int32"> </shd_set_sel>\n')
    
    handle.write('				  <shd_lut_x type="int32[2][16]"> </shd_lut_x>\n')
    handle.write('				  <shd_lut_y type="int32[2][16]"> </shd_lut_y>\n')
    handle.write('				  <shd_lut_s type="int32[2][16]"> </shd_lut_s>\n')
    
    handle.write('				  <wb_gains type="int32[4]"> </wb_gains>\n')

    handle.write('        </%s>\n' %module_params['STRUCT_NAME'])
    handle.write('    </typedef>\n')
    handle.write('  <!--=======================================================================-->\n')
	

    # Create a DCC Use Case
    for i in range(nsf4_params['NUM_USE_CASE']):
        dccxml.AddUseCase(handle, module_params, nsf4_params['USE_CASE'][i])
    
    dccxml.GenFooter(handle, module_params)
    dccxml.CloseFile(handle)
示例#6
0
def GenH3AMUXXML(directory, filebase, params, h3amux_params):

    if (os.path.exists(directory) == False):
        print('Creating directory:  %s\n' % directory)
        try:
            os.makedirs(directory)
        except OSError as err:
            utils.error('%s: %s' % (err.strerror, err.filename), skip=True)

    filename = os.path.join(directory,
                            '%s_%s.xml' % (params['SENSOR'], filebase))
    print('Creating XML File:  %s\n' % filename)

    global wdr_mode
    if (h3amux_params['WDR_MODE'] == 'wdr'):
        wdr_mode = 1
    else:
        wdr_mode = 0

    module_params = {}
    module_params['NAME'] = 'VISS_H3A_MUX_LUTS_CFG'
    module_params['STRUCT_NAME'] = 'iss_h3a_mux_luts'
    module_params['DCC_ID'] = dcc.DCC_ID_H3A_MUX
    module_params['FUNC_GENPARAMS'] = GenH3AMUXParams

    handle = dccxml.OpenFile(filename)
    dccxml.GenHeader(handle, params, module_params)

    # Create the DCC Structure definition
    handle.write(
        '  <!--=======================================================================-->\n'
    )
    handle.write('      <typedef>\n')
    handle.write('    <%s type="struct">\n' % module_params['STRUCT_NAME'])

    handle.write('       <enable type="uint16"> </enable> <!-- enable -->\n')
    handle.write(
        '       <num_luts type="uint16"> </num_luts> <!-- number of LUTs (0 ~ 3) -->\n'
    )
    handle.write(
        '       <h3a_mux_luts type="uint16[3][639]"> </h3a_mux_luts> <!-- H3A LUTs -->\n'
    )

    handle.write('      </%s>\n' % module_params['STRUCT_NAME'])
    handle.write('   </typedef>\n')
    handle.write(
        '  <!--=======================================================================-->\n'
    )

    # Create a DCC Use Case
    for i in range(h3amux_params['NUM_USE_CASE']):
        dccxml.AddUseCase(handle, module_params, h3amux_params['USE_CASE'][i])

    if (wdr_mode == 1):
        r_table = '../tables/lut_h3a_16b_to_10b_g07.txt'
    else:
        r_table = '../tables/lut_h3a_12b_to_10b.txt'
    shutil.copy(r_table, directory)

    dccxml.GenFooter(handle, module_params)
    dccxml.CloseFile(handle)
示例#7
0
def GenAWBXML(directory, filebase, params, AWB_params):

    if (os.path.exists(directory) == False):
        print('Creating directory:  %s\n' % directory)
        try:
            os.makedirs(directory)
        except OSError as err:
            utils.error('%s: %s' % (err.strerror, err.filename), skip=True)

    filename = os.path.join(directory,
                            '%s_%s.xml' % (params['SENSOR'], filebase))
    print('Creating XML File:  %s\n' % filename)

    module_params = {}
    module_params['NAME'] = 'AWB_DCC_xml'
    module_params['STRUCT_NAME'] = 'awb_alg_dcc_tuning'
    module_params['DCC_ID'] = dcc.DCC_ID_AAA_ALG_AWB_TI3
    module_params['FUNC_GENPARAMS'] = GenAWBParams
    global bayer_phase
    bayer_phase = params['BAYER_PATTERN']

    handle = dccxml.OpenFile(filename)
    dccxml.GenHeader(handle, params, module_params)

    handle.write(
        '  <!--=======================================================================-->\n'
    )
    handle.write('     <typedef>\n')
    handle.write('\n')
    handle.write('	     <dcc_awb_ref_gray_data_t type="struct">\n')
    handle.write('			<num_of_ref_1	type="uint8"> </num_of_ref_1>\n')
    handle.write('			<num_of_ref_2	type="uint8"> </num_of_ref_2>\n')
    handle.write('			<num_of_gray    type="uint8"> </num_of_gray>\n')
    handle.write('			<radius         type="uint16"> </radius>\n')
    handle.write('			<color_temp_1	type="uint16[]"> </color_temp_1>\n')
    handle.write('			<wbReferenceCb  type="int16[][4]"> </wbReferenceCb>\n')
    handle.write('			<wbReferenceCr  type="int16[][4]"> </wbReferenceCr>\n')
    handle.write('			<ref_gray_R_1	type="uint16[][4]"> </ref_gray_R_1>\n')
    handle.write('			<ref_gray_G_1	type="uint16[][4]"> </ref_gray_G_1>\n')
    handle.write('			<ref_gray_B_1	type="uint16[][4]"> </ref_gray_B_1>\n')
    handle.write('			<ref_index_2	type="uint8[]"> </ref_index_2>\n')
    handle.write('			<color_temp_2	type="uint16[]"> </color_temp_2>\n')
    handle.write('			<referencesCb_2 type="int16[][4]"> </referencesCb_2>\n')
    handle.write('			<referencesCr_2 type="int16[][4]"> </referencesCr_2>\n')
    handle.write('			<ref_gray_R_2	type="uint16[][4]"> </ref_gray_R_2>\n')
    handle.write('			<ref_gray_G_2	type="uint16[][4]"> </ref_gray_G_2>\n')
    handle.write('			<ref_gray_B_2	type="uint16[][4]"> </ref_gray_B_2>\n')
    handle.write('        </dcc_awb_ref_gray_data_t>\n')
    handle.write('\n')
    handle.write('        <dcc_awb_calc_data_t type="struct">\n')
    handle.write(
        '            <awb_basic_ref	            type="dcc_awb_ref_gray_data_t">	 </awb_basic_ref>\n'
    )
    handle.write('			<img_ref    	            type="uint16[]">		 </img_ref>\n')
    handle.write(
        '            <luma_awb_min	            type="int32">				</luma_awb_min>\n'
    )
    handle.write(
        '            <luma_awb_max	            type="int32">				</luma_awb_max>\n'
    )
    handle.write(
        '		    <low_color_temp_thresh	    type="uint16">				</low_color_temp_thresh>\n'
    )
    handle.write(
        '            <apply_rgb_adjust	        type="uint8">				</apply_rgb_adjust>\n'
    )
    handle.write(
        '            <R_adjust	                type="int16">				</R_adjust>\n')
    handle.write(
        '            <B_adjust	                type="int16">				</B_adjust>\n')
    handle.write(
        '            <SB_1	                    type="uint16">              </SB_1>\n'
    )
    handle.write(
        '            <SB_2	                    type="uint16">				</SB_2>\n')
    handle.write(
        '            <SB_low_bound	            type="uint16">				</SB_low_bound>\n'
    )
    handle.write(
        '            <default_T_H	            type="uint16">				</default_T_H>\n'
    )
    handle.write(
        '            <default_T_MH               type="uint16">				</default_T_MH>\n'
    )
    handle.write(
        '            <default_T_ML               type="uint16">				</default_T_ML>\n'
    )
    handle.write(
        '            <default_T_L                type="uint16">				</default_T_L>\n'
    )
    handle.write(
        '            <default_T_H_index          type="uint8">				</default_T_H_index>\n'
    )
    handle.write(
        '            <default_T_MH_index         type="uint8">				</default_T_MH_index>\n'
    )
    handle.write(
        '            <default_T_ML_index         type="uint8">				</default_T_ML_index>\n'
    )
    handle.write(
        '            <default_T_L_index	        type="uint8">				</default_T_L_index>\n'
    )
    handle.write(
        '            <best_gray_index_default    type="uint8">				</best_gray_index_default>\n'
    )
    handle.write(
        '            <flash_ref	                type="dcc_awb_ref_gray_data_t[4]">	 </flash_ref>\n'
    )
    handle.write(
        '			<skin_img_ref    	        type="uint16[]">		 </skin_img_ref>\n')
    handle.write('		</dcc_awb_calc_data_t>\n')
    handle.write('\n')
    handle.write('        <dcc_ti2_color_gain_scalers_t type="struct">\n')
    handle.write('            <dgain  type="uint16">  </dgain>\n')
    handle.write('            <gainGr type="uint16">  </gainGr>\n')
    handle.write('            <gainR  type="uint16">  </gainR>\n')
    handle.write('            <gainGb type="uint16">  </gainGb>\n')
    handle.write('            <gainB  type="uint16">  </gainB>\n')
    handle.write('        </dcc_ti2_color_gain_scalers_t>\n')
    handle.write('\n')
    handle.write('        <dcc_awb_ti2_data_t type="struct">\n')
    handle.write(
        '            <wbModeData type="dcc_ti2_color_gain_scalers_t[]">      </wbModeData>\n'
    )
    handle.write('        </dcc_awb_ti2_data_t>\n')
    handle.write('\n')
    handle.write('        <dcc_awb_supp2_alg3_t       type="struct">\n')
    handle.write(
        '            <use_calib              type="uint16">              </use_calib>\n'
    )
    handle.write(
        '			<blue_index             type="uint16">              </blue_index>\n'
    )
    handle.write(
        '            <red_index              type="uint16">              </red_index>\n'
    )
    handle.write(
        '            <green1_index           type="uint16">              </green1_index>\n'
    )
    handle.write(
        '            <green2_index           type="uint16">              </green2_index>\n'
    )
    handle.write(
        '            <enable_opt             type="uint8">               </enable_opt>\n'
    )
    handle.write(
        '            <max_Cr                 type="int16">               </max_Cr>\n'
    )
    handle.write(
        '            <max_Cb                 type="int16">               </max_Cb>\n'
    )
    handle.write(
        '            <awb_speed              type="uint16">               </awb_speed>\n'
    )
    handle.write(
        '            <awb_calc_data          type="dcc_awb_calc_data_t">     </awb_calc_data>\n'
    )
    handle.write(
        '            <awb_data               type="dcc_awb_ti2_data_t">      </awb_data>\n'
    )
    handle.write('        </dcc_awb_supp2_alg3_t>\n')
    handle.write('\n')
    handle.write('    </typedef>\n')
    handle.write(
        '  <!--=======================================================================-->\n'
    )

    if (bayer_phase == 0):
        red_index = 0
        green1_index = 1
        green2_index = 2
        blue_index = 3
    elif (bayer_phase == 1):
        green1_index = 0
        red_index = 1
        blue_index = 2
        green2_index = 3
    elif (bayer_phase == 2):
        green2_index = 0
        blue_index = 1
        red_index = 2
        green1_index = 3
    elif (bayer_phase == 3):
        blue_index = 0
        green2_index = 1
        green1_index = 2
        red_index = 3
    else:
        print('Unsupported bayer phase: Exiting \n')
        return

    handle.write(
        '  <!--=======================================================================-->\n'
    )
    handle.write('    <system_parameters>\n')
    handle.write(
        '      <awb_alg_dcc_tuning type="dcc_awb_supp2_alg3_t" main="general">\n'
    )
    handle.write('\n')
    handle.write(' {\n')
    handle.write('	1,                                   /*use_calib*/\n')
    handle.write('    %d,                                   /*blue_index*/\n' %
                 blue_index)
    handle.write('    %d,                                   /*red_index */\n' %
                 red_index)
    handle.write(
        '    %d,                                   /* green1_index*/\n' %
        green1_index)
    handle.write(
        '    %d,                                   /* green2_index*/\n' %
        green2_index)
    handle.write('    1,                                   /* opt_data */\n')
    handle.write('    200,                                   /* max_cr */\n')
    handle.write('    200,                                   /* max_cb */\n')
    handle.write('    6,                                   /* awb_speed */\n')
    handle.write('\n')
    handle.write(
        '    	{                           /* ti2_default_awb_calc_data */\n')
    handle.write('		{ //awb_ref\n')
    handle.write('			1,		// num_of_ref_1\n')
    handle.write('			1,		// num_of_ref_2\n')
    handle.write('			1,		// num_of_gray\n')
    handle.write('			50,		// radius\n')
    handle.write('\n')
    handle.write('       // color_temp_1[num_of_ref_1]\n')
    handle.write('         {3800},\n')
    handle.write('\n')
    handle.write('			   // wbReferenceCb[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0,},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // wbReferenceCr[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0,},\n')
    handle.write('\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_R_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0,},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_G_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0,},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_B_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0,},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_index_2[num_of_ref_2]\n')
    handle.write('       {0},\n')
    handle.write('\n')
    handle.write('   // color_temp_2[num_of_ref_2]\n')
    handle.write('         {3800},\n')
    handle.write('\n')
    handle.write('   // referencesCb_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0,},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // referencesCr_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0,},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_R_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0,},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_G_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0,},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_B_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0,},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('	},\n')
    handle.write('   // img_ref[NUM_OF_REF_2*1120]\n')
    handle.write('   {\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write(' 	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write(' 	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write(' 	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write(' 	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write(' 	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('	0,0,0,0,\n')
    handle.write('  \n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('		// AWB tuning parameters\n')
    handle.write('		5,	// luma_awb_min\n')
    handle.write('		250,	// luma_awb_max\n')
    handle.write('\n')
    handle.write('		3250,	// low_color_temp_thresh\n')
    handle.write('		0,	// apply_rgb_adjust\n')
    handle.write('		0,	// R_adjust()\n')
    handle.write('		0,	// B_adjust()\n')
    handle.write('\n')
    handle.write('		45,	// SB_1\n')
    handle.write('		55,	// SB_2\n')
    handle.write('		0,	    // SB_low_bound\n')
    handle.write('\n')
    handle.write('		3800,     // default_T_Hh\n')
    handle.write('		3800,     // default_T_MH\n')
    handle.write('		3800,     // default_T_ML\n')
    handle.write('		3800,     // default_T_L\n')
    handle.write('\n')
    handle.write('		0,		// default_T_Hh_index\n')
    handle.write('		0,		// default_T_MH_index\n')
    handle.write('		0,		// default_T_ML_index\n')
    handle.write('		0,		// default_T_L_index\n')
    handle.write('\n')
    handle.write('		1,     // best_gray_index_default\n')
    handle.write('\n')
    handle.write('\n')
    handle.write('		{ //started tuning for flash\n')
    handle.write('			{ //flash[0]\n')
    handle.write('			1,			// num_of_ref_1\n')
    handle.write('			1,			// num_of_ref_2\n')
    handle.write('			1,		// num_of_gray\n')
    handle.write('			50,		// radius\n')
    handle.write('\n')
    handle.write('       // color_temp_1[num_of_ref_1]\n')
    handle.write('         {3800},\n')
    handle.write('\n')
    handle.write('			   // wbReferenceCb[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // wbReferenceCr[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_R_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_G_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_B_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_index_2[num_of_ref_2]\n')
    handle.write('   {0},\n')
    handle.write('\n')
    handle.write('   // color_temp_2[num_of_ref_2]\n')
    handle.write('   {3800},\n')
    handle.write('\n')
    handle.write('   // referencesCb_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // referencesCr_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_R_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_G_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_B_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   },\n')
    handle.write('			{ //flash[1]\n')
    handle.write('			1,			// num_of_ref_1\n')
    handle.write('			1,			// num_of_ref_2\n')
    handle.write('			1,		// num_of_gray\n')
    handle.write('			50,		// radius\n')
    handle.write('\n')
    handle.write('       // color_temp_1[num_of_ref_1]\n')
    handle.write('         {3800},\n')
    handle.write('\n')
    handle.write('			   // wbReferenceCb[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // wbReferenceCr[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_R_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_G_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_B_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_index_2[num_of_ref_2]\n')
    handle.write('   {0},\n')
    handle.write('\n')
    handle.write('   // color_temp_2[num_of_ref_2]\n')
    handle.write('   {3800},\n')
    handle.write('\n')
    handle.write('\n')
    handle.write('   // referencesCb_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // referencesCr_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_R_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_G_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_B_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   },\n')
    handle.write('			{ //flash[2]\n')
    handle.write('			1,			// num_of_ref_1\n')
    handle.write('			1,			// num_of_ref_2\n')
    handle.write('			1,		// num_of_gray\n')
    handle.write('			50,		// radius\n')
    handle.write('\n')
    handle.write('       // color_temp_1[num_of_ref_1]\n')
    handle.write('         {3800},\n')
    handle.write('\n')
    handle.write('			   // wbReferenceCb[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // wbReferenceCr[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_R_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_G_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_B_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_index_2[num_of_ref_2]\n')
    handle.write('   {0},\n')
    handle.write('\n')
    handle.write('   // color_temp_2[num_of_ref_2]\n')
    handle.write('   {3800},\n')
    handle.write('\n')
    handle.write('   // referencesCb_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // referencesCr_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_R_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_G_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_B_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   },\n')
    handle.write('			{ //flash[3]\n')
    handle.write('			1,			// num_of_ref_1\n')
    handle.write('			1,			// num_of_ref_2\n')
    handle.write('			1,		// num_of_gray\n')
    handle.write('			50,		// radius\n')
    handle.write('\n')
    handle.write('       // color_temp_1[num_of_ref_1]\n')
    handle.write('         {3800},\n')
    handle.write('\n')
    handle.write('			   // wbReferenceCb[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // wbReferenceCr[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_R_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_G_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_B_1[num_of_ref_1][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_index_2[num_of_ref_2]\n')
    handle.write('   {0},\n')
    handle.write('\n')
    handle.write('   // color_temp_2[num_of_ref_2]\n')
    handle.write('   {3800},\n')
    handle.write('\n')
    handle.write('   // referencesCb_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // referencesCr_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_R_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_G_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   // ref_gray_B_2[num_of_ref_2][num_of_gray]\n')
    handle.write('   {\n')
    handle.write('       {0,0,0,0},\n')
    handle.write('   },\n')
    handle.write('\n')
    handle.write('   },\n')
    handle.write('		},//end of tuning data for flsh\n')
    handle.write('		{\n')
    handle.write('\n')
    handle.write('// skin histogram:\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('0, 0, 0, 0,\n')
    handle.write('\n')
    handle.write('		},//end of skin histogram data\n')
    handle.write('\n')
    handle.write('	}, //end of awb_calc_data\n')
    handle.write('\n')
    handle.write('\n')
    handle.write('	{\n')
    handle.write('		//User modes dcc_ti2_color_gain_scalers_t[]\n')
    handle.write('NULL,\n')
    handle.write('	},\n')
    handle.write('}\n')
    handle.write('     </awb_alg_dcc_tuning>\n')
    handle.write('  </system_parameters>\n')
    handle.write('\n')
    handle.write(
        '  <!--=====================================================================-->\n'
    )

    dccxml.GenFooter(handle, module_params)
    dccxml.CloseFile(handle)
示例#8
0
def GenLDCXML(directory, filebase, params, LDC_params):

    if (os.path.exists(directory) == False):
        print('Creating directory:  %s\n' % directory)
        try:
            os.makedirs(directory)
        except OSError as err:
            utils.error('%s: %s' % (err.strerror, err.filename), skip=True)

    filename = os.path.join(directory,
                            '%s_%s.xml' % (params['SENSOR'], filebase))
    print('Creating XML File:  %s\n' % filename)

    module_params = {}
    module_params['NAME'] = 'ldc_odc'
    module_params['STRUCT_NAME'] = 'cfg_ldc_vars'
    module_params['DCC_ID'] = dcc.DCC_ID_MESH_LDC
    module_params['FUNC_GENPARAMS'] = GenLDCParams
    width = params['SENSOR_WIDTH']
    height = params['SENSOR_HEIGHT']

    handle = dccxml.OpenFile(filename)
    dccxml.GenHeader(handle, params, module_params)

    # Create the DCC Structure definition
    handle.write(
        '  <!--=======================================================================-->\n'
    )
    handle.write('      <typedef>\n')
    handle.write('      <%s type="struct"> \n' % module_params['STRUCT_NAME'])

    handle.write('                      <ldc_en type="uint16"> </ldc_en>\n')
    handle.write(
        '                      <ldc_ldmapen type="uint16"> </ldc_ldmapen>\n')
    handle.write(
        '                      <ldc_datamode type="uint16"> </ldc_datamode>\n')
    handle.write(
        '                      <ldc_opdatamode type="uint16"> </ldc_opdatamode>\n'
    )
    handle.write(
        '                      <ldc_ip_dfmt type="uint16"> </ldc_ip_dfmt>\n')
    handle.write(
        '                      <ldc_pwarpen type="uint16"> </ldc_pwarpen>\n')
    handle.write(
        '                      <ldc_yint_typ type="uint16"> </ldc_yint_typ>\n')
    handle.write(
        '                      <ldc_regmode_en type="uint16"> </ldc_regmode_en>\n'
    )
    handle.write(
        '                      <ldc_meshtable_m type="uint16"> </ldc_meshtable_m>\n'
    )
    handle.write(
        '                      <ldc_mesh_frsz_w type="uint16"> </ldc_mesh_frsz_w>\n'
    )
    handle.write(
        '                      <ldc_mesh_frsz_h type="uint16"> </ldc_mesh_frsz_h>\n'
    )
    handle.write(
        '                      <ldc_compute_frsz_w type="uint16"> </ldc_compute_frsz_w>\n'
    )
    handle.write(
        '                      <ldc_compute_frsz_h type="uint16"> </ldc_compute_frsz_h>\n'
    )
    handle.write(
        '                      <ldc_initx type="uint16"> </ldc_initx>\n')
    handle.write(
        '                      <ldc_inity type="uint16"> </ldc_inity>\n')
    handle.write(
        '                      <ldc_input_frsz_w type="uint16"> </ldc_input_frsz_w>\n'
    )
    handle.write(
        '                      <ldc_input_frsz_h type="uint16"> </ldc_input_frsz_h>\n'
    )
    handle.write('                      <ldc_obw type="uint16"> </ldc_obw>\n')
    handle.write('                      <ldc_obh type="uint16"> </ldc_obh>\n')
    handle.write(
        '                      <ldc_pixpad type="uint16"> </ldc_pixpad>\n')
    handle.write('                      <ldc_a type="int16"> </ldc_a>\n')
    handle.write('                      <ldc_b type="int16"> </ldc_b>\n')
    handle.write('                      <ldc_c type="int16"> </ldc_c>\n')
    handle.write('                      <ldc_d type="int16"> </ldc_d>\n')
    handle.write('                      <ldc_e type="int16"> </ldc_e>\n')
    handle.write('                      <ldc_f type="int16"> </ldc_f>\n')
    handle.write('                      <ldc_g type="int16"> </ldc_g>\n')
    handle.write('                      <ldc_h type="int16"> </ldc_h>\n')
    handle.write(
        '                      <ldc_sf_width type="uint16[3]"> </ldc_sf_width>\n'
    )
    handle.write(
        '                      <ldc_sf_height type="uint16[3]"> </ldc_sf_height>\n'
    )
    handle.write(
        '                      <ldc_sf_en  type="uint16[3][3]"> </ldc_sf_en>\n'
    )
    handle.write(
        '                      <ldc_sf_obw type="uint16[3][3]"> </ldc_sf_obw>\n'
    )
    handle.write(
        '                      <ldc_sf_obh type="uint16[3][3]"> </ldc_sf_obh>\n'
    )
    handle.write(
        '                      <ldc_sf_pad type="uint16[3][3]"> </ldc_sf_pad>\n'
    )
    handle.write(
        '                      <ldc_ylut_en type="uint16"> </ldc_ylut_en>\n')
    handle.write(
        '                      <ldc_yin_bitdpth type="uint16"> </ldc_yin_bitdpth>\n'
    )
    handle.write(
        '                      <ldc_yout_bitdpth type="uint16"> </ldc_yout_bitdpth>\n'
    )
    handle.write(
        '                      <ldc_clut_en type="uint16"> </ldc_clut_en>\n')
    handle.write(
        '                      <ldc_cin_bitdpth type="uint16"> </ldc_cin_bitdpth>\n'
    )
    handle.write(
        '                      <ldc_cout_bitdpth type="uint16"> </ldc_cout_bitdpth>\n'
    )
    handle.write(
        '                      <ldc_y_lut type="uint16[513]"> </ldc_y_lut>\n')
    handle.write(
        '                      <ldc_c_lut type="uint16[513]"> </ldc_c_lut>\n')
    handle.write(
        '              		<mesh_table_pitch_in_bytes type="uint32"> </mesh_table_pitch_in_bytes>\n'
    )
    handle.write(
        '              		<mesh_table_size type="uint32"> </mesh_table_size>\n')
    handle.write('              		<mesh_lut type="uint16*"> </mesh_lut>\n')

    handle.write('      </%s> \n' % module_params['STRUCT_NAME'])

    handle.write('   </typedef>\n')
    handle.write(
        '  <!--=======================================================================-->\n'
    )

    handle.write('		<use_case val="65535"> \n')
    handle.write('        <usecase_general>\n')
    handle.write('            <ldc_dcc type="%s" main="general">\n' %
                 module_params['STRUCT_NAME'])

    handle.write('            {\n')
    handle.write(
        '                0     // LDC_CTRL  LDC_EN(0)         LDC Enable, 0: Disable,  1: Enable\n'
    )
    handle.write(
        '                1     // LDC_CTRL  LDMAPEN(1)        LD Mapping enable, 0: disable, 1: enable\n'
    )
    handle.write(
        '                2     // LDC_CTRL  DATAMODE(4:3)     Input data mode, 0:YUV422, 1:Y only, 2:YUV420, 3:YUV420 UV\n'
    )
    handle.write(
        '                1     // LDC_CTRL  OP_DATAMODE  Output data mode, 0: keep UYVY; 1: convert to 420\n'
    )
    handle.write(
        '                0     // LDC_CTRL  IP_DFMT(6:5) Input pixel format, 0:8b, 1:12b packed, 2:12b unpacked\n'
    )
    handle.write(
        '                1     // LDC_CTRL  PWARPEN(7)   Perspective warp 0: Disable . 1: Enable\n'
    )
    handle.write(
        '                1     // LDC_CFG   YINT_TYP(6)  Interpolation type for Y .  0: Bicubic,  1: Bilinear\n'
    )
    handle.write(
        '                0     // LDC_CFG   REGMODE_EN           Region mode, 0: disable, 1: enable\n'
    )
    handle.write(
        '                3     // LDC_MESHTABLE_CFG     M(2:0)   Mesh table subsampling factor (0-7)\n'
    )
    handle.write(
        '                %d  // LDC_MESH_FRSZ       W(13:0)  Mesh frame width (0-8192)\n'
        % width)
    handle.write(
        '                %d  // LDC_MESH_FRSZ       H(29:16)             Mesh frame height (0-8192)\n'
        % height)
    handle.write(
        '                %d   // LDC_COMPUTE_FRSZ      W(13:0)  Compute width (0-8192)\n'
        % width)
    handle.write(
        '                %d   // LDC_COMPUTE_FRSZ      H(29:16)             Compute height (0-8192)\n'
        % height)
    handle.write(
        '                  0     // LDC_INITXY    INITX(13:0)  Output starting horizontal coordinate (0-8192)\n'
    )
    handle.write(
        '                  0     // LDC_INITXY    INITY(29:16) Output starting vertical coordinate (0-8192)\n'
    )
    handle.write(
        '                %d  // LDC_INPUT_FRSZ        W(29:16)             Input frame width\n'
        % width)
    handle.write(
        '                %d  // LDC_INPUT_FRSZ        H(13:0)  Input frame height\n'
        % height)
    handle.write(
        '                128    // LDC_BLOCK_SIZE        OBW(7:0)             Output block width (0-255)\n'
    )
    handle.write(
        '                64    // LDC_BLOCK_SIZE        OBH(15:8)            Output block height (0-255)\n'
    )
    handle.write(
        '                1     // LDC_BLOCK_SIZE        PIXPAD(19:16)        Pixel pad (0-15)\n'
    )
    handle.write(
        '                4096  // LDC_AB    A(15:0)  Affine Transform warp, A S16Q12\n'
    )
    handle.write(
        '                0     // LDC_AB    B(31:16)             Affine Transform warp, B S16Q12\n'
    )
    handle.write(
        '                0     // LDC_CD    C(15:0)  Affine Transform warp, C S16Q3\n'
    )
    handle.write(
        '                0     // LDC_CD    D(31:16)             Affine Transform warp, D S16Q12\n'
    )
    handle.write(
        '                4096  // LDC_EF    E(15:0)  Affine Transform warp, E S16Q12\n'
    )
    handle.write(
        '                0     // LDC_EF    F(31:16)             Affine Transform warp, F S16Q3\n'
    )
    handle.write(
        '                0     // LDC_GH    G(15:0)  Affine Transform warp, G S16Q23\n'
    )
    handle.write(
        '                0     // LDC_GH    H(31:16)             Affine Transform warp, H S16Q23\n'
    )
    handle.write('                {0, 0, 0}     //ldc_sf_width [3]\n')
    handle.write('                {0, 0, 0}     //ldc_sf_height[3]\n')
    handle.write(
        '                {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}     //ldc_sf_en [3][3]\n'
    )
    handle.write(
        '                {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}     //ldc_sf_obw[3][3]\n'
    )
    handle.write(
        '                {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}     //ldc_sf_obh[3][3]\n'
    )
    handle.write(
        '                {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}     //ldc_sf_pad[3][3]\n'
    )
    handle.write(
        '                0     // LDC_DUALOUT_CFG       YLUT_EN  Luma LUT enable (0-1)\n'
    )
    handle.write(
        '                8     // LDC_DUALOUT_CFG       YIN_BITDPTH          Luma input bit depth (8-12)\n'
    )
    handle.write(
        '                8     // LDC_DUALOUT_CFG       YOUT_BITDPTH         Luma output bit depth (8-12)\n'
    )
    handle.write(
        '                0     // LDC_DUALOUT_CFG       CLUT_EN  Chroma LUT enable (0-1)\n'
    )
    handle.write(
        '                8     // LDC_DUALOUT_CFG       CIN_BITDPTH          Chroma input bit depth (8-12)\n'
    )
    handle.write(
        '                8     // LDC_DUALOUT_CFG       COUT_BITDPTH         Chroma output bit depth (8-12)\n'
    )
    handle.write(
        '                {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},\n'
    )

    handle.write(
        '                {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},\n'
    )

    handle.write('                1,\n')
    handle.write('                1,\n')
    handle.write('                {0}\n')
    handle.write('            }\n')

    handle.write('            </ldc_dcc>\n')
    handle.write('        </usecase_general>\n')
    handle.write('		</use_case> \n')

    dccxml.GenFooter(handle, module_params)
    dccxml.CloseFile(handle)
示例#9
0
def GenCFAIXML(directory, filebase, params, cfai_params):

    if (os.path.exists(directory) == False):
        print ('Creating directory:  %s\n' %directory)
        try:
            os.makedirs(directory)
        except OSError as err:
            utils.error('%s: %s' %(err.strerror, err.filename), skip=True)

    filename = os.path.join(directory, '%s_%s.xml' %(params['SENSOR'], filebase));
    print ('Creating XML File:  %s\n' %filename	)

    module_params = {}
    module_params['NAME']   = 'cfg_flxd_cfa'
    module_params['STRUCT_NAME'] = 'cfg_flxd_cfa_vars'
    module_params['DCC_ID'] = dcc.DCC_ID_IPIPE_CFA
    global bayer_phase
    bayer_phase = params['BAYER_PATTERN']
    module_params['FUNC_GENPARAMS'] = GenCFAIParams
    
    handle = dccxml.OpenFile(filename)
    dccxml.GenHeader(handle, params, module_params)
    
    # Create the DCC Structure definition
    handle.write('  <!--=======================================================================-->\n')

    handle.write('            	<typedef>\n')
    handle.write('            		<FLXD_FirCoefs type="struct">\n')
    handle.write('            			<matrix type="uint32[4][36]"></matrix>\n')
    handle.write('            		</FLXD_FirCoefs>\n')
    handle.write('            	</typedef>\n')
    
    handle.write('            	<typedef>\n')
    handle.write('            		<cfg_flxd_cfa_vars type="struct">\n')
    
    handle.write('            			<image_bits type="uint32"> </image_bits>\n')
    handle.write('            			<lut_enable type="uint32"> </lut_enable>\n')
    
    handle.write('            			<Set0GradHzMask type="uint32[4]"> </Set0GradHzMask>\n')
    handle.write('            			<Set0GradVtMask type="uint32[4]"> </Set0GradVtMask>\n')
    handle.write('            			<Set0IntensityMask type="uint32[4]"> </Set0IntensityMask>\n')
    handle.write('            			<Set0IntensityShift type="uint32[4]"> </Set0IntensityShift>\n')
    handle.write('            			<Set0Thr type="uint32[7]"> </Set0Thr>\n')
    
    handle.write('            			<Set1GradHzMask type="uint32[4]"> </Set1GradHzMask>\n')
    handle.write('            			<Set1GradVtMask type="uint32[4]"> </Set1GradVtMask>\n')
    handle.write('            			<Set1IntensityMask type="uint32[4]"> </Set1IntensityMask>\n')
    handle.write('            			<Set1IntensityShift type="uint32[4]"> </Set1IntensityShift>\n')
    handle.write('            			<Set1Thr type="uint32[7]"> </Set1Thr>\n')
    
    handle.write('            			<blendMode type="uint32[4]"> </blendMode>\n')
    handle.write('            			<bitMaskSel type="uint32[4]"> </bitMaskSel>\n')
    
    handle.write('            			<FirCoefs type="FLXD_FirCoefs[12]"> </FirCoefs>\n')
    handle.write('            			<cfa_lut type="uint32[639]"> </cfa_lut>\n')
    
    handle.write('            		</cfg_flxd_cfa_vars>\n')
    handle.write('                </typedef>    \n')
    
    handle.write('  <!--=======================================================================-->\n')
    
    # Create a DCC Use Case
    for i in range(cfai_params['NUM_USE_CASE']):
        dccxml.AddUseCase(handle, module_params, cfai_params['USE_CASE'][i])
    
    dccxml.GenFooter(handle, module_params)
    dccxml.CloseFile(handle)

    shutil.copy2('../tables/lut_cfa_16to12_g1o4_global.txt', directory)
示例#10
0
def GenH3A_AEWBXML(directory, filebase, params, h3a_aewb_params):

    if (os.path.exists(directory) == False):
        print('Creating directory:  %s\n' % directory)
        try:
            os.makedirs(directory)
        except OSError as err:
            utils.error('%s: %s' % (err.strerror, err.filename), skip=True)

    filename = os.path.join(directory,
                            '%s_%s.xml' % (params['SENSOR'], filebase))
    print('Creating XML File:  %s\n' % filename)

    module_params = {}
    module_params['NAME'] = 'VISS_H3A_AEWB_CFG'
    module_params['STRUCT_NAME'] = 'iss_h3a_grid_size'
    module_params['DCC_ID'] = dcc.DCC_ID_H3A_AEWB_CFG
    module_params['FUNC_GENPARAMS'] = GenH3A_AEWBParams

    handle = dccxml.OpenFile(filename)
    dccxml.GenHeader(handle, params, module_params)

    # Create the DCC Structure definition
    handle.write(
        '  <!--=======================================================================-->\n'
    )
    handle.write('      <typedef>\n')
    handle.write('      <%s type="struct"> \n' % module_params['STRUCT_NAME'])

    handle.write(
        '      <enable type="uint8"> </enable> <!-- enable h3a aewb-->\n')
    handle.write(
        '      <mode type="uint8"> </mode> <!-- 0 = SUM_SQ, 1=MINMAX, 2=SUM_ONLY-->\n'
    )
    handle.write(
        '      <v_start type="uint16"> </v_start> <!-- Paxel_0 Start Coordinate Y in Pixels -->\n'
    )
    handle.write(
        '      <h_start type="uint16"> </h_start> <!-- Paxel_0 Start Coordinate H in Pixels -->\n'
    )
    handle.write(
        '      <v_size type="uint8"> </v_size> <!-- Paxel Height in Pixels -->\n'
    )
    handle.write(
        '      <h_size type="uint8"> </h_size> <!-- Paxel Width in Pixels -->\n'
    )
    handle.write(
        '      <v_count type="uint8"> </v_count> <!-- number of vertical paxels -->\n'
    )
    handle.write(
        '      <h_count type="uint8"> </h_count> <!-- number of horizontal paxels -->\n'
    )
    handle.write(
        '      <v_skip type="uint8"> </v_skip> <!--   vertical subsampling factor (0-15) -->\n'
    )
    handle.write(
        '      <h_skip type="uint8"> </h_skip> <!--  horizontal subsampling factor (0-15) -->\n'
    )
    handle.write(
        '      <saturation_limit type="uint16"> </saturation_limit> <!--  saturation_limit (0-1023) -->\n'
    )
    handle.write(
        '      <blk_win_numlines type="uint16"> </blk_win_numlines> <!--  Win Height for the single black line of windows (2-256)-->\n'
    )
    handle.write(
        '      <blk_row_vpos type="uint16"> </blk_row_vpos> <!--  Vertical Position of Black Row -->\n'
    )
    handle.write(
        '      <sum_shift type="uint8"> </sum_shift> <!--  Sum Shift (0-15) -->\n'
    )
    handle.write(
        '      <ALaw_En type="uint8"> </ALaw_En> <!--  A Law Enable (0/1) -->\n'
    )
    handle.write(
        '      <MedFilt_En type="uint8"> </MedFilt_En> <!--  Median Filter Enable (0/1) -->\n'
    )

    handle.write('      </%s> \n' % module_params['STRUCT_NAME'])

    handle.write('   </typedef>\n')
    handle.write(
        '  <!--=======================================================================-->\n'
    )

    #Default config is 32x16 windows with 2x2 skip
    #64 pixels are excluded at start and end in both H and V dimensions
    h_count = 32
    v_count = 16
    h_start = 64
    v_start = 64
    h_size = 2 * ((params['SENSOR_WIDTH'] - h_start - 64) // (2 * h_count))
    v_size = 2 * ((params['SENSOR_HEIGHT'] - v_start - 64) // (2 * v_count))
    blk_win_numlines = 2
    blk_row_vpos = params['SENSOR_HEIGHT'] - blk_win_numlines
    v_skip = 2
    h_skip = 2

    handle.write('		<use_case val="65535"> \n')

    handle.write('        		<n-space>\n')
    handle.write('        			<region0 class="0">\n')
    handle.write(
        '        				<gain                      val="0" min="0" max="10240">  </gain>\n'
    )
    handle.write(
        '        				<exposure              val="1" min="0" max="10000000">  </exposure>\n'
    )
    handle.write(
        '        				<colortemperature val="2" min="0" max="10000">  </colortemperature>\n'
    )
    handle.write('        			</region0>\n')
    handle.write('        		</n-space>\n')
    handle.write('        <parameter_package>\n')
    handle.write('            <h3a_aewb_dcc type="iss_h3a_grid_size">\n')
    handle.write('              {\n')
    handle.write('                  1,     // enable:   u8\n')
    handle.write('                  2,     // mode:     u8\n')
    handle.write('                  %d,     // v_start:  u16\n' % v_start)
    handle.write('                  %d,     // h_start:  u16\n' % h_start)
    handle.write('                  %d,     // v_size:   u8\n' % v_size)
    handle.write('                  %d,     // h_size:   u8\n' % h_size)
    handle.write('                  %d,     // v_count:  u8\n' % v_count)
    handle.write('                  %d,     // h_count:  u8\n' % h_count)
    handle.write('                  %d,     // v_skip:   u8\n' % v_skip)
    handle.write('                  %d,     // h_skip:   u8\n' % h_skip)
    handle.write('                  1000,     // saturation_limit: u16\n')
    handle.write('                  %d,     // blk_win_numlines: u16\n' %
                 blk_win_numlines)
    handle.write('                  %d,     // blk_row_vpos:     u16\n' %
                 blk_row_vpos)
    handle.write('                  2,     // Sum Shift:   u8\n')
    handle.write('                  0,     // ALaw_En:     u8\n')
    handle.write('                  0,     // MedFilt_En:  u8\n')
    handle.write('              }\n')
    handle.write('            </h3a_aewb_dcc>\n')
    handle.write('        </parameter_package>\n')
    handle.write('		</use_case> \n')

    dccxml.GenFooter(handle, module_params)
    dccxml.CloseFile(handle)
示例#11
0
def GenGLBCEXML(directory, filebase, params, GLBCE_params):

    if (os.path.exists(directory) == False):
        print('Creating directory:  %s\n' % directory)
        try:
            os.makedirs(directory)
        except OSError as err:
            utils.error('%s: %s' % (err.strerror, err.filename), skip=True)

    filename = os.path.join(directory,
                            '%s_%s.xml' % (params['SENSOR'], filebase))
    print('Creating XML File:  %s\n' % filename)

    module_params = {}
    module_params['NAME'] = 'viss_glbce'
    module_params['STRUCT_NAME'] = 'viss_glbce'
    module_params['DCC_ID'] = dcc.DCC_ID_ISS_GLBCE
    module_params['FUNC_GENPARAMS'] = GenGLBCEParams

    handle = dccxml.OpenFile(filename)
    dccxml.GenHeader(handle, params, module_params)

    # Create the DCC Structure definition
    handle.write(
        '  <!--=======================================================================-->\n'
    )
    handle.write('      <typedef>\n')
    handle.write('      <%s type="struct"> \n' % module_params['STRUCT_NAME'])

    handle.write(
        '                        <strength      type="uint32"> </strength>\n')
    handle.write(
        '                        <intensity_var type="uint32"> </intensity_var>     <!-- U4 -->\n'
    )
    handle.write(
        '                        <space_var     type="uint32"> </space_var>         <!-- U4 -->\n'
    )
    handle.write(
        '                        <slope_min_lim type="uint32">  </slope_min_lim>     <!-- U8 -->\n'
    )
    handle.write(
        '                        <slope_max_lim type="uint32">  </slope_max_lim>     <!-- U8 -->\n'
    )
    handle.write(
        '                        <fwd_prcpt_en  type="uint32">  </fwd_prcpt_en>\n'
    )
    handle.write(
        '                        <fwd_prcpt_lut type="uint32[65]"> </fwd_prcpt_lut>\n'
    )
    handle.write(
        '                        <rev_prcpt_en  type="uint32">  </rev_prcpt_en>\n'
    )
    handle.write(
        '                        <rev_prcpt_lut type="uint32[65]"> </rev_prcpt_lut>\n'
    )
    handle.write(
        '                        <asym_lut      type="uint32[33]"> </asym_lut>      <!-- U16 -->\n'
    )

    handle.write('      </%s> \n' % module_params['STRUCT_NAME'])

    handle.write('   </typedef>\n')
    handle.write(
        '  <!--=======================================================================-->\n'
    )

    # Create a DCC Use Case
    for i in range(GLBCE_params['NUM_USE_CASE']):
        dccxml.AddUseCase(handle, module_params, GLBCE_params['USE_CASE'][i])

    dccxml.GenFooter(handle, module_params)
    dccxml.CloseFile(handle)