示例#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 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)
示例#5
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)
示例#6
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)
示例#7
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)