[x264-devel] Doubts in computing integral image

BugMaster BugMaster at narod.ru
Thu Oct 13 23:48:14 CEST 2016


On Thu, 13 Oct 2016 16:32:15 +0530, Aishwarya wrote:
> Hi

Hi

> ...

> static void integral_init4v( uint16_t *sum8, uint16_t *sum4, intptr_t stride )
> {
>     for( int x = 0; x < stride-8; x++ )
>         sum4[x] = sum8[x+4*stride] - sum8[x];
>     for( int x = 0; x < stride-8; x++ )
>         sum8[x] = sum8[x+8*stride] + sum8[x+8*stride+4] - sum8[x] - sum8[x+4];
> }
> To get sum4, why the loop is upto stride-8? If my understanding is
> correct, loop had to be upto stride - 4.

I am not sure. stride - 4 really looks more correct to me also.

> static void integral_init8v( uint16_t *sum8, intptr_t stride )
> {
>     for( int x = 0; x < stride-8; x++ )
>         sum8[x] = sum8[x+8*stride] - sum8[x];
> }
> In the above function why the loop is only upto stride - 8? As far
> as I understood, since it is for vertical, loop could go well till stride.

Here stride - 8 is correct same as in integral_init4v for sum8 because
in integral_init8h we calculate sum only up to stride - 8:

static void integral_init8h( uint16_t *sum, pixel *pix, intptr_t stride )
{
    int v = pix[0]+pix[1]+pix[2]+pix[3]+pix[4]+pix[5]+pix[6]+pix[7];
    for( int x = 0; x < stride-8; x++ )
    {
        sum[x] = v + sum[x-stride];
        v += pix[x+8] - pix[x];
    }
}



More information about the x264-devel mailing list