cpi->b_calculate_psnr = CONFIG_INTERNAL_STATS;
#if CONFIG_INTERNAL_STATS
- cpi->b_calculate_ssimg = 0;
cpi->b_calculate_blockiness = 1;
cpi->b_calculate_consistency = 1;
cpi->total_inconsistency = 0;
cpi->summedp_weights = 0;
}
- if (cpi->b_calculate_ssimg) {
- cpi->ssimg.worst= 100.0;
- }
cpi->fastssim.worst = 100.0;
-
cpi->psnrhvs.worst = 100.0;
if (cpi->b_calculate_blockiness) {
SNPRINT2(results, "\t%7.3f", cpi->worst_consistency);
}
- if (cpi->b_calculate_ssimg) {
- SNPRINT(headings, "\t SSIMG\tWtSSIMG");
- SNPRINT2(results, "\t%7.3f", cpi->ssimg.stat[ALL] / cpi->count);
- SNPRINT2(results, "\t%7.3f", cpi->ssimg.worst);
- }
-
fprintf(f, "%s\t Time\n", headings);
fprintf(f, "%s\t%8.0f\n", results, total_encode_time);
}
}
}
- if (cpi->b_calculate_ssimg) {
- double y, u, v, frame_all;
-#if CONFIG_VP9_HIGHBITDEPTH
- if (cm->use_highbitdepth) {
- frame_all = vpx_highbd_calc_ssimg(cpi->Source, cm->frame_to_show, &y,
- &u, &v, (int)cm->bit_depth);
- } else {
- frame_all = vpx_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u,
- &v);
- }
-#else
- frame_all = vpx_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v);
-#endif // CONFIG_VP9_HIGHBITDEPTH
- adjust_image_stat(y, u, v, frame_all, &cpi->ssimg);
- }
#if CONFIG_VP9_HIGHBITDEPTH
if (!cm->use_highbitdepth)
#endif
unsigned int tot_recode_hits;
double worst_ssim;
- ImageStat ssimg;
ImageStat fastssim;
ImageStat psnrhvs;
- int b_calculate_ssimg;
int b_calculate_blockiness;
int b_calculate_consistency;
cpi->b_calculate_psnr = CONFIG_INTERNAL_STATS;
#if CONFIG_INTERNAL_STATS
- cpi->b_calculate_ssimg = 0;
-
cpi->count = 0;
cpi->bytes = 0;
cpi->summed_weights = 0;
}
- if (cpi->b_calculate_ssimg)
- {
- cpi->total_ssimg_y = 0;
- cpi->total_ssimg_u = 0;
- cpi->total_ssimg_v = 0;
- cpi->total_ssimg_all = 0;
- }
-
#endif
cpi->first_time_stamp_ever = 0x7FFFFFFF;
total_ssim, total_encode_time);
}
}
-
- if (cpi->b_calculate_ssimg)
- {
- if (cpi->oxcf.number_of_layers > 1)
- {
- int i;
-
- fprintf(f, "Layer\tBitRate\tSSIM_Y\tSSIM_U\tSSIM_V\tSSIM_A\t"
- "Time(us)\n");
- for (i=0; i<(int)cpi->oxcf.number_of_layers; i++)
- {
- double dr = (double)cpi->bytes_in_layer[i] *
- 8.0 / 1000.0 / time_encoded;
- fprintf(f, "%5d\t%7.3f\t%6.4f\t"
- "%6.4f\t%6.4f\t%6.4f\t%8.0f\n",
- i, dr,
- cpi->total_ssimg_y_in_layer[i] /
- cpi->frames_in_layer[i],
- cpi->total_ssimg_u_in_layer[i] /
- cpi->frames_in_layer[i],
- cpi->total_ssimg_v_in_layer[i] /
- cpi->frames_in_layer[i],
- cpi->total_ssimg_all_in_layer[i] /
- cpi->frames_in_layer[i],
- total_encode_time);
- }
- }
- else
- {
- fprintf(f, "BitRate\tSSIM_Y\tSSIM_U\tSSIM_V\tSSIM_A\t"
- "Time(us)\n");
- fprintf(f, "%7.3f\t%6.4f\t%6.4f\t%6.4f\t%6.4f\t%8.0f\n", dr,
- cpi->total_ssimg_y / cpi->count,
- cpi->total_ssimg_u / cpi->count,
- cpi->total_ssimg_v / cpi->count,
- cpi->total_ssimg_all / cpi->count, total_encode_time);
- }
- }
-
fclose(f);
#if 0
f = fopen("qskip.stt", "a");
}
#endif
}
-
- if (cpi->b_calculate_ssimg)
- {
- double y, u, v, frame_all;
- frame_all = vpx_calc_ssimg(cpi->Source, cm->frame_to_show,
- &y, &u, &v);
-
- if (cpi->oxcf.number_of_layers > 1)
- {
- unsigned int i;
-
- for (i=cpi->current_layer;
- i<cpi->oxcf.number_of_layers; i++)
- {
- if (!cpi->b_calculate_psnr)
- cpi->frames_in_layer[i]++;
-
- cpi->total_ssimg_y_in_layer[i] += y;
- cpi->total_ssimg_u_in_layer[i] += u;
- cpi->total_ssimg_v_in_layer[i] += v;
- cpi->total_ssimg_all_in_layer[i] += frame_all;
- }
- }
- else
- {
- cpi->total_ssimg_y += y;
- cpi->total_ssimg_u += u;
- cpi->total_ssimg_v += v;
- cpi->total_ssimg_all += frame_all;
- }
- }
-
}
}
double summed_weights;
unsigned int tot_recode_hits;
-
- double total_ssimg_y;
- double total_ssimg_u;
- double total_ssimg_v;
- double total_ssimg_all;
-
- int b_calculate_ssimg;
#endif
int b_calculate_psnr;
double sum_ssim[VPX_TS_MAX_LAYERS];
double sum_weights[VPX_TS_MAX_LAYERS];
- double total_ssimg_y_in_layer[VPX_TS_MAX_LAYERS];
- double total_ssimg_u_in_layer[VPX_TS_MAX_LAYERS];
- double total_ssimg_v_in_layer[VPX_TS_MAX_LAYERS];
- double total_ssimg_all_in_layer[VPX_TS_MAX_LAYERS];
-
#if CONFIG_MULTI_RES_ENCODING
/* Number of MBs per row at lower-resolution level */
int mr_low_res_mb_cols;
cpi->b_calculate_psnr = CONFIG_INTERNAL_STATS;
#if CONFIG_INTERNAL_STATS
- cpi->b_calculate_ssimg = 0;
cpi->b_calculate_blockiness = 1;
cpi->b_calculate_consistency = 1;
cpi->total_inconsistency = 0;
cpi->summedp_weights = 0;
}
- if (cpi->b_calculate_ssimg) {
- cpi->ssimg.worst= 100.0;
- }
cpi->fastssim.worst = 100.0;
-
cpi->psnrhvs.worst = 100.0;
if (cpi->b_calculate_blockiness) {
SNPRINT2(results, "\t%7.3f", consistency);
SNPRINT2(results, "\t%7.3f", cpi->worst_consistency);
}
-
- if (cpi->b_calculate_ssimg) {
- SNPRINT(headings, "\t SSIMG\tWtSSIMG");
- SNPRINT2(results, "\t%7.3f", cpi->ssimg.stat[ALL] / cpi->count);
- SNPRINT2(results, "\t%7.3f", cpi->ssimg.worst);
- }
-
fprintf(f, "%s\t Time\n", headings);
fprintf(f, "%s\t%8.0f\n", results, total_encode_time);
}
}
}
- if (cpi->b_calculate_ssimg) {
- double y, u, v, frame_all;
-#if CONFIG_VP9_HIGHBITDEPTH
- if (cm->use_highbitdepth) {
- frame_all = vpx_highbd_calc_ssimg(cpi->Source, cm->frame_to_show, &y,
- &u, &v, (int)cm->bit_depth);
- } else {
- frame_all = vpx_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u,
- &v);
- }
-#else
- frame_all = vpx_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v);
-#endif // CONFIG_VP9_HIGHBITDEPTH
- adjust_image_stat(y, u, v, frame_all, &cpi->ssimg);
- }
#if CONFIG_VP9_HIGHBITDEPTH
if (!cm->use_highbitdepth)
#endif
unsigned int tot_recode_hits;
double worst_ssim;
- ImageStat ssimg;
ImageStat fastssim;
ImageStat psnrhvs;
- int b_calculate_ssimg;
int b_calculate_blockiness;
-
int b_calculate_consistency;
double total_inconsistency;
return ssimv;
}
-double vpx_calc_ssimg(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *dest,
- double *ssim_y, double *ssim_u, double *ssim_v) {
- double ssim_all = 0;
- double a, b, c;
-
- a = vpx_ssim2(source->y_buffer, dest->y_buffer,
- source->y_stride, dest->y_stride,
- source->y_crop_width, source->y_crop_height);
-
- b = vpx_ssim2(source->u_buffer, dest->u_buffer,
- source->uv_stride, dest->uv_stride,
- source->uv_crop_width, source->uv_crop_height);
-
- c = vpx_ssim2(source->v_buffer, dest->v_buffer,
- source->uv_stride, dest->uv_stride,
- source->uv_crop_width, source->uv_crop_height);
- *ssim_y = a;
- *ssim_u = b;
- *ssim_v = c;
- ssim_all = (a * 4 + b + c) / 6;
-
- return ssim_all;
-}
-
// traditional ssim as per: http://en.wikipedia.org/wiki/Structural_similarity
//
// Re working out the math ->
return ssimv;
}
-double vpx_highbd_calc_ssimg(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *dest, double *ssim_y,
- double *ssim_u, double *ssim_v, unsigned int bd) {
- double ssim_all = 0;
- double a, b, c;
-
- a = vpx_highbd_ssim2(source->y_buffer, dest->y_buffer,
- source->y_stride, dest->y_stride,
- source->y_crop_width, source->y_crop_height, bd);
-
- b = vpx_highbd_ssim2(source->u_buffer, dest->u_buffer,
- source->uv_stride, dest->uv_stride,
- source->uv_crop_width, source->uv_crop_height, bd);
-
- c = vpx_highbd_ssim2(source->v_buffer, dest->v_buffer,
- source->uv_stride, dest->uv_stride,
- source->uv_crop_width, source->uv_crop_height, bd);
- *ssim_y = a;
- *ssim_u = b;
- *ssim_v = c;
- ssim_all = (a * 4 + b + c) / 6;
-
- return ssim_all;
-}
#endif // CONFIG_VP9_HIGHBITDEPTH
const YV12_BUFFER_CONFIG *dest,
double *weight);
-double vpx_calc_ssimg(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *dest,
- double *ssim_y, double *ssim_u, double *ssim_v);
-
double vpx_calc_fastssim(const YV12_BUFFER_CONFIG *source,
const YV12_BUFFER_CONFIG *dest,
double *ssim_y, double *ssim_u, double *ssim_v);
const YV12_BUFFER_CONFIG *dest,
double *weight,
unsigned int bd);
-
-double vpx_highbd_calc_ssimg(const YV12_BUFFER_CONFIG *source,
- const YV12_BUFFER_CONFIG *dest,
- double *ssim_y,
- double *ssim_u,
- double *ssim_v,
- unsigned int bd);
#endif // CONFIG_VP9_HIGHBITDEPTH
#ifdef __cplusplus