x264 环路滤波原理系列:x264_frame_filter 函数
static void integral_init4h( uint16_t *sum, pixel *pix, intptr_t stride )
{
int v = pix[0]+pix[1]+pix[2]+pix[3];
for( int x = 0; x < stride-4; x++ )
{
sum[x] = (uint16_t)(v + sum[x-stride]);
v += pix[x+4] - pix[x];
}
}
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] = (uint16_t)(v + sum[x-stride]);
v += pix[x+8] - pix[x];
}
}
static void integral_init4v( uint16_t *sum8, uint16_t *sum4, intptr_t stride )
{
for( int x = 0; x < stride-8; x++ )
sum4[x] = (uint16_t)(sum8[x+4*stride] - sum8[x]);
for( int x = 0; x < stride-8; x++ )
sum8[x] = (uint16_t)(sum8[x+8*stride] + sum8[x+8*stride+4] - sum8[x] - sum8[x+4]);
}
static void integral_init8v( uint16_t *sum8, intptr_t stride )
{
for( int x = 0; x < stride-8; x++ )
sum8[x] = (uint16_t)(sum8[x+8*stride] - sum8[x]);
}