Commit 204e77e0 authored by Yaowu Xu's avatar Yaowu Xu
Browse files

Remove a flavor of SSIM that is never really used.

Change-Id: I61ea7f63acbcfeecd3f7dba5a5a38b980efc802b
parent efe1b1db
......@@ -1677,7 +1677,6 @@ VP10_COMP *vp10_create_compressor(VP10EncoderConfig *oxcf,
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;
......@@ -1701,11 +1700,7 @@ VP10_COMP *vp10_create_compressor(VP10EncoderConfig *oxcf,
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) {
......@@ -1954,12 +1949,6 @@ void vp10_remove_compressor(VP10_COMP *cpi) {
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);
}
......@@ -4509,21 +4498,6 @@ int vp10_get_compressed_data(VP10_COMP *cpi, unsigned int *frame_flags,
}
}
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
......
......@@ -436,11 +436,9 @@ typedef struct VP10_COMP {
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;
......
......@@ -2007,8 +2007,6 @@ struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf)
cpi->b_calculate_psnr = CONFIG_INTERNAL_STATS;
#if CONFIG_INTERNAL_STATS
cpi->b_calculate_ssimg = 0;
cpi->count = 0;
cpi->bytes = 0;
......@@ -2029,14 +2027,6 @@ struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf)
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;
......@@ -2315,45 +2305,6 @@ void vp8_remove_compressor(VP8_COMP **ptr)
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");
......@@ -5761,38 +5712,6 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l
}
#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;
}
}
}
}
......
......@@ -637,13 +637,6 @@ typedef struct VP8_COMP
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;
......@@ -689,11 +682,6 @@ typedef struct VP8_COMP
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;
......
......@@ -1723,7 +1723,6 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf,
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;
......@@ -1747,11 +1746,7 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf,
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) {
......@@ -2042,13 +2037,6 @@ void vp9_remove_compressor(VP9_COMP *cpi) {
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);
}
......@@ -4677,21 +4665,6 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
}
}
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
......
......@@ -432,13 +432,10 @@ typedef struct VP9_COMP {
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;
......
......@@ -182,31 +182,6 @@ double vpx_calc_ssim(const YV12_BUFFER_CONFIG *source,
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 ->
......@@ -478,28 +453,4 @@ double vpx_highbd_calc_ssim(const YV12_BUFFER_CONFIG *source,
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
......@@ -70,10 +70,6 @@ double vpx_calc_ssim(const YV12_BUFFER_CONFIG *source,
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);
......@@ -87,13 +83,6 @@ double vpx_highbd_calc_ssim(const YV12_BUFFER_CONFIG *source,
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment