<?xml version="1.0" encoding="utf-8"?>
<NiceCREConfig version="0.0.1" name='FrontCamera'>
    <!-- common config  -->
    <ModelSubPath description="model sub path">FrontCamera</ModelSubPath>
    <FallBackKeepHdr>1</FallBackKeepHdr>
    <Perception use='1' description="perception paramter">
        <!--default 70-->
        <GhostDetectOn>1</GhostDetectOn>
        <ShakingTH>0.01</ShakingTH>
        <LuxIndexTh>8888888</LuxIndexTh>
        <ExpTimeTh>87944</ExpTimeTh>
        <BandingNNTh>1000</BandingNNTh>
        <BandingSSTh>1000</BandingSSTh>
        <MatchShakingThreshold>0.1</MatchShakingThreshold>
        <FirstSFrameIndex>5</FirstSFrameIndex>
        <SecondSFrameIndex>6</SecondSFrameIndex>
        <SwitchNormalMatchThreshold>1</SwitchNormalMatchThreshold>
    </Perception>
    <DeGhost description="DeGhost params">
        <nThd description="ghost detection threshold of normal frame">20</nThd>
        <s0Thd description="ghost detection threshold of s0 frame">-300</s0Thd>
        <s1Thd description="ghost detection threshold of s1 frame">-300</s1Thd>
        <shakeThd description="nThd, soThd, s1Thd will change to [nThdShake, s0ThdShake, s1ThdShake] if shaking value bigger than shakeThd">0.028</shakeThd>
        <nThdShake description="if shaking value bigger than shakeThd, use nThdShake replace nThd">20</nThdShake>
        <s0ThdShake description="if shaking value bigger than shakeThd, use s0ThdShake replace s0Thd">-300</s0ThdShake>
        <s1ThdShake description="if shaking value bigger than shakeThd, use s1ThdShake replace s1Thd">-300</s1ThdShake>
        <maskDilate description="mask dilate size">1</maskDilate>
        <diffThd description="threshold of diff mask">3</diffThd>
        <minCropSize description="minimum size of ghost cropping size">768</minCropSize>
        <cropThd1 description="the first threshold of increase ghost crop size. float type">0.02</cropThd1>
        <cropThd2 description="the second threshold of increase ghost crop size. float type">0.1</cropThd2>
        <cropThd1Shake description="if shaking value bigger than shakeThd, use s0ThdShake replace s0Thd">0.02</cropThd1Shake>
        <cropThd2Shake description="if shaking value bigger than shakeThd, use s1ThdShake replace s1Thd">0.1</cropThd2Shake>
        <flexRatio1 description="a ratio that use to increase ghost crop size if ghost area bigger than cropThd1 and les than cropThd2. float type">1</flexRatio1>
        <flexRatio2 description="a ratio that use to increase ghost crop size if ghost area bigger than cropThd2. float type">3.0</flexRatio2>
        <refineGhostThd description="param of refine ghost mask">3</refineGhostThd>
        <refineInpaintThd description="param of refine inpainting mask">9</refineInpaintThd>
        <s0Thd1 description="ghost detection threshold of s0 frame, use to detect banding ghost">19</s0Thd1>
        <s1Thd1 description="ghost detection threshold of s1 frame, use to detect banding ghost">-300</s1Thd1>
        <ghostDeleteSize description="use to delete small ghosts that pixel number lower than this param">45</ghostDeleteSize>
        <minGhostPixelNum description="decide whether to use inpainting if all ghost pixel number lower than this param">64</minGhostPixelNum>
        <InpaintingModel>
            <inputScale inw="512" inh="512" num="1">0.000030518509447574615</inputScale>
            <outScale>0.0000339735415764153</outScale>
            <ModelPath tempBufferSizeMb="38" use="1" eng="10">nice_inpainting.vdnn</ModelPath>
        </InpaintingModel>
    </DeGhost>
    <XDR use="1">
        <xmlPath>/vendor/camera3rd/nti/xdr_front</xmlPath>
    </XDR>
    <!-- normal config  -->
    <NormalConfig description="normal scene config">
        <PreBpsParam description="pre bps parameter">
            <!--0: none, 1: only for pretbps local, 2: only for prebps global, 4: only for postbps local, 5: only for postbps global, 6: vst and ivst (not support) -->
            <!--OpticalBlackCorrect use='0' method='0' description="local ob prameter file path">/vendor/camera3rd/nti/MainCamera/prebps_localobc.xml</OpticalBlackCorrect>
            <CodeFunc description="pre bps function code">512</CodeFunc-->
            <OpticalBlackCorrect use='1' method='2' description="local ob prameter file path">/vendor/camera3rd/nti/FrontCamera/prebps_localobc_normal.xml</OpticalBlackCorrect>
            <CodeFunc description="pre bps function code">2560</CodeFunc>
            <BpcParam>
                <!--define iso knee list, must be 9 number -->
                <ISOKnee>400, 800, 1600, 3200, 6400, 8200, 12000, 15000, 18000</ISOKnee>
                <!--choose logic, if isoknee = [50, 100], then when iso=75 < isoknee=100, choose iso=50 func -->
                <!--0: use SBPC apply on Every Frames -->
                <!--1: use CBPCGreenCh apply on ref/short/long Frames, use SBPC apply on Other Frames-->
                <FuncConfig>0, 0, 0, 0, 0, 0, 0, 0, 0</FuncConfig>
                <SbpcParam>
                    <bpcHotFactor description="hot bad pixel factor, lower value stronger correction of hot bad pixel.">1.5</bpcHotFactor>
                    <bpcColdFactor description="cold bad pixel factor, lower value stronger correction of cold bad pixel.">0.333</bpcColdFactor>
                    <highlightDetectThresh description="highlight detect strength.">1.2</highlightDetectThresh>
                    <highlightValueThresh description="highlight value thresh.">512</highlightValueThresh>
                    <bpcOffsetMax description="max bpc offset.">3</bpcOffsetMax>
                    <bpcOffsetMin description="min bpc offset.">2</bpcOffsetMin>
                    <bpcColdAbsThresh description="cold abs thresh.">10</bpcColdAbsThresh>
                </SbpcParam>
            </BpcParam>
        </PreBpsParam>
        <NoiseInfo num='1' name='JN1'>
            <Sensor01 >
                <a0>0.0001835544</a0>
                <a1>-0.0008409278</a1>
                <b0>0.0000000597</b0>
                <b1>0.0000271255</b1>
                <b2>0.0174165109</b2>
            </Sensor01>
        </NoiseInfo>
        <ImageAlign description="image align information">
            <FeatureTrack description="feature track information">
                <MaxCorners>1000</MaxCorners>
                <MaxCandidateCorners>32768</MaxCandidateCorners>
                <MinDistance>16</MinDistance>
                <HarrisK use='0'>0.04</HarrisK>
                <QualityLevel>0.01</QualityLevel>
            </FeatureTrack>
            <GlobalAlign description="global align information">
                <MinPointsNum>50</MinPointsNum>
                <LKEpsilon>0.01</LKEpsilon>
                <LKMaxIter>20</LKMaxIter>
                <LKNumRatio>0.7</LKNumRatio>
                <RansacMaxIter>100</RansacMaxIter>
                <RansacConfidence>0.9950</RansacConfidence>
                <RansacThreshold>3</RansacThreshold>
                <UseRegion>0</UseRegion>
                <Ratio>0.5</Ratio>
                <SwitchRegionDigitalZoom>4</SwitchRegionDigitalZoom>
                <DeltaPad>32</DeltaPad>
                <RandomDisturbDigitalZoom use="1">1</RandomDisturbDigitalZoom>
                <HMat02_s_es>28.0</HMat02_s_es>
                <HMat12_s_es>28.0</HMat12_s_es>
            </GlobalAlign>
        </ImageAlign>
        <Overlap description="block overlap, default 16">16</Overlap>
        <OverlapThred description="overlap fusion thred">
            <OverlapDigitalZoomThredHDR description="overlap Digitalzoom thred">1</OverlapDigitalZoomThredHDR>
            <OverlapISOThreshHDR description="overlap ISO thred">0</OverlapISOThreshHDR>
        </OverlapThred>
		<ROIStrategy use='1'>
            <ROIUseType>2</ROIUseType>
            <UseRoiDigitZoom>1.0</UseRoiDigitZoom>
		</ROIStrategy>
        <PostBpsParam description="post bps parameter">
            <!--CodeFunc description="post bps function code">8456</CodeFunc>
            <LTMCodeFunc description="ltm function code, 0, not ltm; 1, cvltm; 2, mtk ltm; 3, nice-tone">2</LTMCodeFunc-->
            <CodeFunc description="post bps function code">24840</CodeFunc>
            <LTMCodeFunc description="ltm function code, 0, not ltm; 1, cvltm; 2, mtk ltm; 3, nice-tone">2</LTMCodeFunc>
            <ToneFunc>1</ToneFunc>
            <NormalNiceTMDigitalZoomTH>0</NormalNiceTMDigitalZoomTH>
            <NiceTMOnlyUsePortrait>2</NiceTMOnlyUsePortrait>
            <HightLightKeepAWB>
                <use>0</use>
                <scaleratio>1.3</scaleratio>
                <DrcLowThresh>2.0</DrcLowThresh>
                <DrcHighThresh>3.5</DrcHighThresh>
                <LscSigma>0.4</LscSigma>
                <LscOffset>0.0</LscOffset>
            </HightLightKeepAWB>
        </PostBpsParam>
        <NiceTone description="nice-tone algorithm config" tnable="1">
            <ModelPath description="nice-tone model path">/vendor/camera3rd/nti/nice_tce/Model/</ModelPath>
            <XmlPath description="nice-tone xmlfile name">/vendor/camera3rd/nti/nice_tce</XmlPath>
            <SkysegConfigPath description="nice-tone SkysegConfigPath name">/vendor/camera3rd/nti/skyseg.xml</SkysegConfigPath>
            <SegmentjsonName description="nice-tone segment config path">/vendor/camera3rd/nti/aisegment_config.json</SegmentjsonName>
            <AllinoneXML description="nice-tone allinone config path">/vendor/camera3rd/nti/allinone2_0_config.xml</AllinoneXML>
            <SpeConfigPath description="spe xml path for txe">/vendor/camera3rd/nti/nice_spe/spe_config.xml</SpeConfigPath>
            <FaceDetConfigPath description="FaceDet config path for txe">/vendor/camera3rd/nti/fdcapture3_0/</FaceDetConfigPath>
            <OutlineConfigPath description="OutlineConfigPath config path for txe">/vendor/camera3rd/nti/outline/</OutlineConfigPath>
        </NiceTone>
        <DitherParam use='0' UseInCVtone='1' description="Enable dither: use=1, use dither only in MTKTone: UseInCVtone=0">
            <!-- in the case of use=1, dither will take effect if any of the three conditions DrcgainThd or LuxIndexThd or ISOThd are met-->
            <DrcgainThd>0</DrcgainThd>
            <LuxIndexThd>0</LuxIndexThd>
            <ISOThd>0</ISOThd>
            <!-- if dither takes effect, the number of arguments for DrcgainValue and DitherLevel should be equal. The last value of the DrcgainValue array must be 4-->
            <!-- if <DrcgainValue>2, 3, 4</DrcgainValue>, it means that the drcgain is divided into three segments: 1-2, 2-3, 3-4. The maximum value of DitherLevel is 65535-->
            <DrcgainValue>1.5, 2.5, 3, 4</DrcgainValue>
            <DitherLevel>1.0, 2.5, 3.0, 8.0</DitherLevel>
        </DitherParam>
        <NetUseAllRefFrame use='0' description="use refFrame replace others">0.1</NetUseAllRefFrame>
        <UseRandNoise description="random noise swith, default 0">0</UseRandNoise>
        <LogDomainMax description="Max vaule in Log Domain Convert">17034.8</LogDomainMax>
        <BitWidthNormal description="normal flow bitwidth, default 16">32</BitWidthNormal>
        <ModelsInfo descrption="normal models info">
            <UseAnalogGainMethod>0</UseAnalogGainMethod>
            <GhostModelLuxIndexThd>1000</GhostModelLuxIndexThd>
            <GhostModelScene>0</GhostModelScene>
            <UseNormalModel isoMin="0">0</UseNormalModel>
            <polarAFInfo use="0">150,160,170,180,190,204,224,249,280,300,319,350,372,400,445</polarAFInfo>
            <SingleModelInfo>
                <UseClipMap>0</UseClipMap>
                <drcgianThd>0.0</drcgianThd>
                <digitZoomUp>0.0</digitZoomUp>
                <FrameMatchSuccessThd>0</FrameMatchSuccessThd>
				<againList>0, 2, 63</againList>
				<againCoeff>1.2, 1.0, 1.1</againCoeff>
                <UseVst hdrvstmode="2" clipinput="0" maxvalue="1" vstNormCoeff="1." avst="0" vstBaseISOMode="0">1</UseVst>
                <!-- FrameTypeOrder ref='2' refn='2' clip='0' useawb='0'>1,1,1,1,1,0,3</FrameTypeOrder -->
                <inputScale inputZep="0" inw="544" inh="544" num="4">0.000030518509447574615</inputScale>
                <outScale outZep="0">0.00003469980219961144</outScale>
                <ModelPath tempBufferSizeMb="69" use="1" s2d="0" rng="1" rate="1" eng="10" dev="4" warp="2">nice_jn1_ldr_general_n_bayer_x1.vdnn</ModelPath>
            </SingleModelInfo>
        </ModelsInfo>
    </NormalConfig>
    <!-- hdr config  -->
    <HDRConfig description="hdr scene config">
        <PreBpsParam description="pre bps parameter">
            <!--0: none, 1: only for pretbps local, 2: only for prebps global, 4: only for postbps local, 5: only for postbps global, 6: vst and ivst (not support) -->
            <!--OpticalBlackCorrect use='0' method='0' description="local ob prameter file path">/vendor/camera3rd/nti/MainCamera/prebps_localobc.xml</OpticalBlackCorrect>
            <CodeFunc description="pre bps function code">512</CodeFunc-->
            <OpticalBlackCorrectHDR use='1' method='2' description="local ob prameter file path">/vendor/camera3rd/nti/FrontCamera/prebps_localobc_hdr.xml</OpticalBlackCorrectHDR>
            <CodeFunc description="pre bps function code">2560</CodeFunc>
            <BpcParam>
                <!--define iso knee list, must be 9 number -->
                <ISOKnee>400, 800, 1600, 3200, 6400, 8200, 12000, 15000, 18000</ISOKnee>
                <!--choose logic, if isoknee = [50, 100], then when iso=75 < isoknee=100, choose iso=50 func -->
                <!--0: use SBPC apply on Every Frames -->
                <!--1: use CBPCGreenCh apply on ref/short/long Frames, use SBPC apply on Other Frames-->
                <FuncConfig>0, 0, 0, 0, 0, 0, 0, 0, 0</FuncConfig>
                <SbpcParam>
                    <bpcHotFactor description="hot bad pixel factor, lower value stronger correction of hot bad pixel.">1.5</bpcHotFactor>
                    <bpcColdFactor description="cold bad pixel factor, lower value stronger correction of cold bad pixel.">0.333</bpcColdFactor>
                    <highlightDetectThresh description="highlight detect strength.">1.2</highlightDetectThresh>
                    <highlightValueThresh description="highlight value thresh.">512</highlightValueThresh>
                    <bpcOffsetMax description="max bpc offset.">3</bpcOffsetMax>
                    <bpcOffsetMin description="min bpc offset.">2</bpcOffsetMin>
                    <bpcColdAbsThresh description="cold abs thresh.">10</bpcColdAbsThresh>
                </SbpcParam>
            </BpcParam>
        </PreBpsParam>
        <NoiseInfoHDR num='1' name='JN1'>
            <limitexp>35310</limitexp>
            <coeff>1</coeff>
            <Sensor01 >
				<a0>0.0001835544</a0>
                <a1>-0.0008409278</a1>
                <b0>0.0000000597</b0>
                <b1>0.0000271255</b1>
                <b2>0.0174165109</b2>
            </Sensor01>
        </NoiseInfoHDR>
        <ImageAlign description="image align information">
            <FeatureTrack description="feature track information">
                <MaxCorners>1000</MaxCorners>
                <MaxCandidateCorners>32768</MaxCandidateCorners>
                <MinDistance>16</MinDistance>
                <HarrisK use='0'>0.04</HarrisK>
                <QualityLevel>0.01</QualityLevel>
            </FeatureTrack>
            <GlobalAlign description="global align information">
                <MinPointsNum>50</MinPointsNum>
                <LKEpsilon>0.01</LKEpsilon>
                <LKMaxIter>20</LKMaxIter>
                <LKNumRatio>0.7</LKNumRatio>
                <RansacMaxIter>100</RansacMaxIter>
                <RansacConfidence>0.9950</RansacConfidence>
                <RansacThreshold>3</RansacThreshold>
                <UseRegion>0</UseRegion>
                <Ratio>0.5</Ratio>
                <SwitchRegionDigitalZoom>4</SwitchRegionDigitalZoom>
                <DeltaPad>32</DeltaPad>
                <RandomDisturbDigitalZoom use="1">1</RandomDisturbDigitalZoom>
                <HMat02_s_es>28.0</HMat02_s_es>
                <HMat12_s_es>28.0</HMat12_s_es>
            </GlobalAlign>
        </ImageAlign>
        <Overlap description="block overlap, default 16">16</Overlap>
        <OverlapThred description="overlap fusion thred">
            <OverlapDigitalZoomThredHDR description="overlap Digitalzoom thred">1</OverlapDigitalZoomThredHDR>
            <OverlapISOThreshHDR description="overlap ISO thred">0</OverlapISOThreshHDR>
        </OverlapThred>
		<ROIStrategy use='1'>
            <ROIUseType>2</ROIUseType>
            <UseRoiDigitZoom>1.0</UseRoiDigitZoom>
		</ROIStrategy>
        <PostBpsParam description="post bps parameter">
            <!--CodeFunc description="post bps function code">8456</CodeFunc>
            <LTMCodeFunc description="ltm function code, 0, not ltm; 1, cvltm; 2, mtk ltm; 3, nice-tone">2</LTMCodeFunc-->
            <CodeFunc description="post bps function code">264</CodeFunc>
            <LTMCodeFunc description="ltm function code, 0, not ltm; 1, cvltm; 2, mtk ltm; 3, nice-tone">2</LTMCodeFunc>
            <ToneFunc>1</ToneFunc>
            <NormalNiceTMDigitalZoomTH>0</NormalNiceTMDigitalZoomTH>
            <NiceTMOnlyUsePortrait>2</NiceTMOnlyUsePortrait>
            <HightLightKeepAWBHDR>
                <use>0</use>
                <scaleratio>1.4</scaleratio>
                <DrcLowThresh>2.0</DrcLowThresh>
                <DrcHighThresh>3.5</DrcHighThresh>
                <LscSigma>0.4</LscSigma>
                <LscOffset>0.0</LscOffset>
            </HightLightKeepAWBHDR>
        </PostBpsParam>
        <NiceTone description="nice-tone algorithm config" tnable="1">
            <ModelPath description="nice-tone model path">/vendor/camera3rd/nti/nice_tce/Model/</ModelPath>
            <XmlPath description="nice-tone xmlfile name">/vendor/camera3rd/nti/nice_tce</XmlPath>
            <SkysegConfigPath description="nice-tone SkysegConfigPath name">/vendor/camera3rd/nti/skyseg.xml</SkysegConfigPath>
            <SegmentjsonName description="nice-tone segment config path">/vendor/camera3rd/nti/aisegment_config.json</SegmentjsonName>
            <AllinoneXML description="nice-tone allinone config path">/vendor/camera3rd/nti/allinone2_0_config.xml</AllinoneXML>
            <SpeConfigPath description="spe xml path for txe">/vendor/camera3rd/nti/nice_spe/spe_config.xml</SpeConfigPath>
            <FaceDetConfigPath description="FaceDet config path for txe">/vendor/camera3rd/nti/fdcapture3_0/</FaceDetConfigPath>
            <OutlineConfigPath description="OutlineConfigPath config path for txe">/vendor/camera3rd/nti/outline/</OutlineConfigPath>
        </NiceTone>
        <NetUseAllRefFrame use='0' description="use refFrame replace others">0.1</NetUseAllRefFrame>
        <UseRandNoise description="random noise swith, default 0">0</UseRandNoise>
        <LogDomainMax description="Max vaule in Log Domain Convert">17034.8</LogDomainMax>
        <BitWidthHDR description="hdr flow bitwidth, default 32">32</BitWidthHDR>
        <ModelsInfo descrption="hdr models info">
            <UseAnalogGainMethod>0</UseAnalogGainMethod>
            <GhostModelLuxIndexThd>1000</GhostModelLuxIndexThd>
            <GhostModelScene>0</GhostModelScene>
            <UseNormalModel isoMin="0">0</UseNormalModel>
            <polarAFInfo use="0">150,160,170,180,190,204,224,249,280,300,319,350,372,400,445</polarAFInfo>
            
            <SingleModelInfo>
                <UseClipMap>0</UseClipMap>
                <drcgianThd>0.0</drcgianThd>
                <digitZoomUp>0.0</digitZoomUp>
                <FrameMatchSuccessThd>0</FrameMatchSuccessThd>
                <VstBaseISOMode>0</VstBaseISOMode>
                <UseVst hdrvstmode="2" clipinput="0" maxvalue="1" vstNormCoeff="1." avst="0">1</UseVst>
                <FrameTypeOrder ref='2' refn='2' clip='0' useawb='0'>1,1,1,1,1,0,3</FrameTypeOrder>
                <inputScale inputZep="0" inw="544" inh="544" num="7">0.000030518509447574615</inputScale>
                <outScale outZep="0">0.00003146615927107632</outScale>
                <ModelPath tempBufferSizeMb="52" use="1" eng="10" dev="4" warp="2" swarp="6" oflg='1' usesqrtev="1">nice_jn1_hdr_general_n_backward_bayer_x1.vdnn</ModelPath>
            </SingleModelInfo>
        </ModelsInfo>
    </HDRConfig>
</NiceCREConfig>
