[x264-devel] Doubts in computing integral image

Aishwarya aishwarya.parvathy at gmail.com
Fri Oct 14 06:41:16 CEST 2016


Thanks for the response BugMaster.


On Fri, Oct 14, 2016 at 3:18 AM, BugMaster <BugMaster at narod.ru> wrote:

> 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.
>
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).


>
> > 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.


> _______________________________________________
> x264-devel mailing list
> x264-devel at videolan.org
> https://mailman.videolan.org/listinfo/x264-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20161014/ae0ecf23/attachment.html>


More information about the x264-devel mailing list