[x264-devel] Doubts in TESA implementation

BugMaster BugMaster at narod.ru
Thu Oct 6 00:11:01 CEST 2016


On Tue, 4 Oct 2016 17:16:16 +0530, Aishwarya wrote:
> Hi

Hi. Here is my understanding of this code (but I can be wrong).

> I'm trying to understand the implementation of TESA or SEA motion
> search algorithm. I understand that the algorithm tries to calculate
> DC of pixels within the search range and eliminate few cases before
> it does ADS. But I have doubts in some part of the code which I have pasted below:

>  1)
...
> Can someone please explain the logic behind the above code? 

>            if( delta == 4 )
>                 sums_base += stride * (h->fenc->i_lines[0] + PADV*2);

Change sums_base to the second plane in integral which stores 4x4 sums
instead of 8x8.

>             if( i_pixel == PIXEL_16x16 || i_pixel == PIXEL_8x16 || i_pixel == PIXEL_4x8 )
>                 delta *= stride;


There are really only 3 variants of ads:
ads4: for 16x16 which use 4x 8x8 partitions
ads2: for 16x8, 8x16, 8x4, 4x8 which use 2x 8x8/4x4 partitions
ads1: for 8x8, 4x4 which use 1x 8x8/4x4 partition

And so here we chose if we need to use 2 horizontal or 2 vertical
8x8/4x4 partitions by choosing delta or delta*stirde correspondingly.
16x16 case also expects delta to be in stride units.

>             if( i_pixel == PIXEL_8x16 || i_pixel == PIXEL_4x8 )
>                 enc_dc[1] = enc_dc[2];

As ads2 use only 2 values of enc_dc[0..1] we should copy in vertical
case enc_dc[2] to enc_dc[1]. This way we would use values of enc_dc[0]
and enc_dc[2] as reference.

> 2) Also what value gets stored in m->integral which is used in ADS calculation in SEA. 

There is comment at: http://git.videolan.org/?p=x264.git;a=blob;f=common/mc.c;h=dc39c5eb920c0e95019c490f0ec91ae13f8a5ca0;hb=72d53ab2ac7af24597a824e868f2ef363a22f5d4#l734
/* generate integral image:
 * frame->integral contains 2 planes. in the upper plane, each element is
 * the sum of an 8x8 pixel region with top-left corner on that point.
 * in the lower plane, 4x4 sums (needed only with --partitions p4x4). */

> 3)    Here delta is 8 if  i_pixel == PIXEL_8x8. What happens in the
> below code for PIXEL_8x8?         

>                 h->pixf.sad_x4[sad_size]( zero, p_fenc, p_fenc+delta,
>                 p_fenc+delta*FENC_STRIDE, p_fenc+delta+delta*FENC_STRIDE,
>                 FENC_STRIDE, enc_dc );

It calculates 4 sads with zero (i.e. dc) of 8x8 size which cover 16x16
block. From which for PIXEL_8x8 case we will use only first one in
enc_dc[0].

> Thanks



More information about the x264-devel mailing list