This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Question about DM365 AF Engine output

In Document, the AF output is as the figure

In DVSDK Code

int ALG_afRun(ALG_AfRunPrm * prm, int *focus_value)
{
CSL_H3aAfOutVfDisableOverlay *pAfPaxData;
long int *phyCurAddr;
unsigned short i,j,k, numPax, idx1, idx2;
Uint8 *curAfAddr;
Uint32 accAfVal[9] = {0,0,0,0,0,0,0,0,0};
float avgAfVal[9];
int weighti, weightj, fweight;
int af_pax_vt_cnt, af_pax_hz_cnt;

af_pax_vt_cnt = prm->pH3aInfo->afNumWinV;
af_pax_hz_cnt = prm->pH3aInfo->afNumWinH;

curAfAddr = (Uint8* ) prm->h3aDataVirtAddr;

phyCurAddr = OSA_cmemGetPhysAddr(curAfAddr);
if(phyCurAddr==NULL) {
OSA_ERROR("OSA_cmemGetPhysAddr() failed\n");
}

for(i=0;i<af_pax_vt_cnt-2; i++) {
for(j=0;j<af_pax_hz_cnt-2; j++) {

pAfPaxData = (CSL_H3aAfOutVfDisableOverlay *)curAfAddr;

weighti = (i > (af_pax_vt_cnt-1 - i))?(af_pax_vt_cnt-1 - i):i;
weightj = (j > (af_pax_hz_cnt-1 - j))?(af_pax_hz_cnt-1 - j):j;
fweight = weighti*weightj;


accAfVal[0] += fweight*pAfPaxData->hfvSum_0;
。。。。。。。。。。。。。。。。。。。
accAfVal[8] += fweight*pAfPaxData->hfv2_2;

curAfAddr += sizeof(CSL_H3aAfOutVfDisableOverlay);  // the offset size is correct??

}

curAfAddr = (Uint8*)OSA_align( (Uint32)curAfAddr, 32);
}
.......................................
*focus_value = accAfVal[4];

return 0;
}

the sizeof(CSL_H3aAfOutVfDisableOverlay) = 64

typedef struct {

Uint32 hfvSum_0;
Uint32 hfv1_0;
Uint32 hfv2_0;
Uint32 reserved_0;

Uint32 hfvSum_1;
Uint32 hfv1_1;
Uint32 hfv2_1;
Uint32 reserved_1;

Uint32 hfvSum_2;
Uint32 hfv1_2;
Uint32 hfv2_2;
Uint32 reserved_2;

Uint32 hfvSum_3;
Uint32 hfv1_3;
Uint32 hfv2_3;
Uint32 reserved_3;

} CSL_H3aAfOutVfDisableOverlay;

In Document, One Paxel output is only 4*3 = 12 Unit32

But in CSL_H3aAfOutVfDisableOverlay, the size is 4*4=16 Uint32, 

Uint32 hfvSum_3;
Uint32 hfv1_3;
Uint32 hfv2_3;
Uint32 reserved_3; 

Is for Adrress align??

The reference Source code is correct?

 

Thanks

  • My DVSDK is dvsdk_2_10_01_18
    But In ti-dvsdk_dm368-evm_4_02_00_06
    ti-dvsdk_dm368-evm_4_02_00_06
    /**
    \brief AF packet format with vertical AF disabled
    */
    typedef struct {

    Uint32 hfvSum_0;
    Uint32 hfv1_0;
    Uint32 hfv2_0;
    Uint32 reserved_0;

    Uint32 hfvSum_1;
    Uint32 hfv1_1;
    Uint32 hfv2_1;
    Uint32 reserved_1;

    Uint32 hfvSum_2;
    Uint32 hfv1_2;
    Uint32 hfv2_2;
    Uint32 reserved_2;

    } CSL_H3aAfOutVfDisableOverlay;

    I think my DVSDK is too old.