[x264-devel] Doubts in computing integral image

BugMaster BugMaster at narod.ru
Fri Oct 14 07:51:45 CEST 2016


On Fri, 14 Oct 2016 10:11:16 +0530, Aishwarya wrote:
> ...

 >> 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];
>      }
>  }
>  

>  
> I agree that in init8h we need only till stride-8, as we keep
> adding pix[x+8]. But that is not the case with init8v.
> In init8v we are adding one pixel with a pixel which lies below a 
> few rows. So  I think we can go till stride.
> Please clarify.
>  

In init8v we use as source not the pix[] but sum[] which was result
of init8h and which we filled only up to stride-8.

> Here what I mean is that while computing sum4, the loop should go
> till stride, and while computing sum8, it should go till stride - 4
> (since in sum8, sum8[x+4] is accessed).
>  

Same as above in init4v we use as source not pix[] but sum[] which was
result of init4h and which we filled only up to stride-4. So it looks
logical to use stide-4 for sum4 and stride-8 for sum8 (since in sum8,
sum8[x+4] is accessed).



More information about the x264-devel mailing list