|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
程序如下: 感觉是一个低通滤波,但不知道是什么原理?各位高手指点下,万分感谢
static void x264_denoise_dct( int16_t *dct, uint32_t *sum, uint16_t *offset, int size )//*sum就是h->nr_residual_sum, *offset就是h->nr_offset
{
int i;
for( i=1; i<size; i++ )
{
int level = dct;
int sign = level>>15;
level = (level+sign)^sign;
sum += level;
level -= offset;
dct = level<0 ? 0 : (level^sign)-sign;
}
}
void x264_noise_reduction_update( x264_t *h )
{
int cat, i;
for( cat = 0; cat < 2; cat++ )
{
int size = cat ? 64 : 16;
const uint16_t *weight = cat ? x264_dct8_weight2_tab : x264_dct4_weight2_tab;
if( h->nr_count[cat] > (cat ? (1<<16) : (1<<18)) )
{
for( i = 0; i < size; i++ )
h->nr_residual_sum[cat] >>= 1;
h->nr_count[cat] >>= 1;
}
for( i = 0; i < size; i++ )
h->nr_offset[cat] =
((uint64_t)h->param.analyse.i_noise_reduction * h->nr_count[cat]
+ h->nr_residual_sum[cat]/2)
/ ((uint64_t)h->nr_residual_sum[cat] * weight/256 + 1);
}
} |
|