/* Metrics */
int64_t i_ssd[3];
double f_ssim;
+ int i_ssim_cnt;
} frame;
/* Cumulated stats */
float x264_pixel_ssim_wxh( x264_pixel_function_t *pf,
pixel *pix1, int stride1,
pixel *pix2, int stride2,
- int width, int height, void *buf )
+ int width, int height, void *buf, int *cnt )
{
int z = 0;
float ssim = 0.0;
for( int x = 0; x < width-1; x += 4 )
ssim += pf->ssim_end4( sum0+x, sum1+x, X264_MIN(4,width-x-1) );
}
+ *cnt = (height-1) * (width-1);
return ssim;
}
void x264_pixel_init( int cpu, x264_pixel_function_t *pixf );
void x264_pixel_ssd_nv12( x264_pixel_function_t *pf, pixel *pix1, int i_pix1, pixel *pix2, int i_pix2, int i_width, int i_height, uint64_t *ssd_u, uint64_t *ssd_v );
uint64_t x264_pixel_ssd_wxh( x264_pixel_function_t *pf, pixel *pix1, int i_pix1, pixel *pix2, int i_pix2, int i_width, int i_height );
-float x264_pixel_ssim_wxh( x264_pixel_function_t *pf, pixel *pix1, int i_pix1, pixel *pix2, int i_pix2, int i_width, int i_height, void *buf );
+float x264_pixel_ssim_wxh( x264_pixel_function_t *pf, pixel *pix1, int i_pix1, pixel *pix2, int i_pix2, int i_width, int i_height, void *buf, int *cnt );
int x264_field_vsad( x264_t *h, int mb_x, int mb_y );
#endif
if( h->param.analyse.b_ssim )
{
+ int ssim_cnt;
x264_emms();
/* offset by 2 pixels to avoid alignment of ssim blocks with dct blocks,
* and overlap by 4 */
x264_pixel_ssim_wxh( &h->pixf,
h->fdec->plane[0] + 2+minpix_y*h->fdec->i_stride[0], h->fdec->i_stride[0],
h->fenc->plane[0] + 2+minpix_y*h->fenc->i_stride[0], h->fenc->i_stride[0],
- h->param.i_width-2, maxpix_y-minpix_y, h->scratch_buffer );
+ h->param.i_width-2, maxpix_y-minpix_y, h->scratch_buffer, &ssim_cnt );
+ h->stat.frame.i_ssim_cnt += ssim_cnt;
}
}
}
for( int j = 0; j < 3; j++ )
h->stat.frame.i_ssd[j] += t->stat.frame.i_ssd[j];
h->stat.frame.f_ssim += t->stat.frame.f_ssim;
+ h->stat.frame.i_ssim_cnt += t->stat.frame.i_ssim_cnt;
}
return 0;
if( h->param.analyse.b_ssim )
{
double ssim_y = h->stat.frame.f_ssim
- / (((h->param.i_width-6)>>2) * ((h->param.i_height-6)>>2));
+ / h->stat.frame.i_ssim_cnt;
h->stat.f_ssim_mean_y[h->sh.i_type] += ssim_y * dur;
snprintf( psz_message + strlen(psz_message), 80 - strlen(psz_message),
" SSIM Y:%.5f", ssim_y );
if( pixel_asm.ssim_4x4x2_core != pixel_ref.ssim_4x4x2_core ||
pixel_asm.ssim_end4 != pixel_ref.ssim_end4 )
{
+ int cnt;
float res_c, res_a;
ALIGNED_16( int sums[5][4] ) = {{0}};
used_asm = ok = 1;
x264_emms();
- res_c = x264_pixel_ssim_wxh( &pixel_c, pbuf1+2, 32, pbuf2+2, 32, 32, 28, pbuf3 );
- res_a = x264_pixel_ssim_wxh( &pixel_asm, pbuf1+2, 32, pbuf2+2, 32, 32, 28, pbuf3 );
+ res_c = x264_pixel_ssim_wxh( &pixel_c, pbuf1+2, 32, pbuf2+2, 32, 32, 28, pbuf3, &cnt );
+ res_a = x264_pixel_ssim_wxh( &pixel_asm, pbuf1+2, 32, pbuf2+2, 32, 32, 28, pbuf3, &cnt );
if( fabs( res_c - res_a ) > 1e-6 )
{
ok = 0;