Quantcast
Channel: Intel® Integrated Performance Primitives
Viewing all articles
Browse latest Browse all 1294

Incorrect values returned for IPP SAD computation using ippiSAD8x8_16u32s_C1R

$
0
0

Incorrect values are often returned when using the IPP function ippiSAD8x8_16u32s_C1R() to compute an 8x8 SAD for 16 bit video. Video that is 15 bit or less appears to work correctly. The maximum possible 8x8 SAD value for 15 bit video is (215 -1) * 82. Incorrect values are returned once the SAD value becomes greater than the maximum possible value for 15 bit. A list of example values is attached and the source code used to generate them is listed below.

 In the source code that follows edit the values of mainVal and addVal to test different SAD sizes. The final SAD value should equal (mainVal * 82) + addVal.

The equivalent function for 4x4 SAD appears to have the same problem. Also, I am using IPP version 7.0.

void ippiSAD_test()

{

    Ipp16u cur[64], ref[64];

    Ipp16u *pCur = cur;

    Ipp16u *pRef = ref;

    I32 curStep = 8;

    I32 refStep = 8;

    Ipp32s isad = 0;

    I32 csad = 0;

    // SAD = (mainVal * 8 * 8) + addVal

    Ipp16u mainVal = 65535;

    Ipp16u addVal = 0;

 

    // set image pixel values

    for (I32 i = 0; i < 8; ++i) {

        for (I32 j = 0; j < 8; ++j) {

            pCur[i*8+j] = mainVal;

            pRef[i*8+j] = 0;

        }

    }

    pCur[0] += addVal;

 

    IppStatus stat;

    stat = ippiSAD8x8_16u32s_C1R(pCur, curStep*2,

                                 pRef, refStep*2,

                                 &isad, IPPVC_MC_APX_FF);

    ASSERT_TRUE(ippStsNoErr == stat);

 

    for (I32 j = 0; j < 8; ++j) {

        Ipp16u *p1 = &pCur[j * curStep];

        Ipp16u *p2 = &pRef[j * refStep];

        for (I32 k = 0; k < 8; ++k) {

            csad += abs(p1[k] - p2[k]);

        }

    }

 

    printf("IPP SAD:      %d\n", isad);

    printf("COMPUTED SAD: %d\n", csad);

 

    ASSERT_TRUE(isad == csad);

}

 

AttachmentSize
Downloadtable.png5.81 KB
Downloadippisad-test.cpp1.04 KB

Viewing all articles
Browse latest Browse all 1294

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>