Merge "Protect new metric computation with use_highbitdepth flag"
This commit is contained in:
Коммит
a8015e217e
|
@ -4216,7 +4216,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
|
||||||
vp9_clear_system_state();
|
vp9_clear_system_state();
|
||||||
|
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
calc_highbd_psnr(orig, pp, &psnr, cpi->td.mb.e_mbd.bd,
|
calc_highbd_psnr(orig, pp, &psnr2, cpi->td.mb.e_mbd.bd,
|
||||||
cpi->oxcf.input_bit_depth);
|
cpi->oxcf.input_bit_depth);
|
||||||
#else
|
#else
|
||||||
calc_psnr(orig, pp, &psnr2);
|
calc_psnr(orig, pp, &psnr2);
|
||||||
|
@ -4267,31 +4267,38 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cpi->b_calculate_blockiness) {
|
if (cpi->b_calculate_blockiness) {
|
||||||
double frame_blockiness = vp9_get_blockiness(
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
cpi->Source->y_buffer, cpi->Source->y_stride,
|
if (!cm->use_highbitdepth)
|
||||||
cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride,
|
#endif
|
||||||
cpi->Source->y_width, cpi->Source->y_height);
|
{
|
||||||
cpi->worst_blockiness = MAX(cpi->worst_blockiness, frame_blockiness);
|
double frame_blockiness = vp9_get_blockiness(
|
||||||
cpi->total_blockiness += frame_blockiness;
|
cpi->Source->y_buffer, cpi->Source->y_stride,
|
||||||
|
cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride,
|
||||||
|
cpi->Source->y_width, cpi->Source->y_height);
|
||||||
|
cpi->worst_blockiness = MAX(cpi->worst_blockiness, frame_blockiness);
|
||||||
|
cpi->total_blockiness += frame_blockiness;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpi->b_calculate_consistency) {
|
if (cpi->b_calculate_consistency) {
|
||||||
double this_inconsistency = vp9_get_ssim_metrics(
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
cpi->Source->y_buffer, cpi->Source->y_stride,
|
if (!cm->use_highbitdepth)
|
||||||
cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride,
|
#endif
|
||||||
cpi->Source->y_width, cpi->Source->y_height, cpi->ssim_vars,
|
{
|
||||||
&cpi->metrics, 1);
|
double this_inconsistency = vp9_get_ssim_metrics(
|
||||||
|
cpi->Source->y_buffer, cpi->Source->y_stride,
|
||||||
|
cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride,
|
||||||
|
cpi->Source->y_width, cpi->Source->y_height, cpi->ssim_vars,
|
||||||
|
&cpi->metrics, 1);
|
||||||
|
|
||||||
const double peak = (double)((1 << cpi->oxcf.input_bit_depth) - 1);
|
const double peak = (double)((1 << cpi->oxcf.input_bit_depth) - 1);
|
||||||
|
double consistency = vpx_sse_to_psnr(samples, peak,
|
||||||
|
|
||||||
double consistency = vpx_sse_to_psnr(samples, peak,
|
|
||||||
(double)cpi->total_inconsistency);
|
(double)cpi->total_inconsistency);
|
||||||
|
if (consistency > 0.0)
|
||||||
if (consistency > 0.0)
|
cpi->worst_consistency = MIN(cpi->worst_consistency,
|
||||||
cpi->worst_consistency = MIN(cpi->worst_consistency,
|
consistency);
|
||||||
consistency);
|
cpi->total_inconsistency += this_inconsistency;
|
||||||
cpi->total_inconsistency += this_inconsistency;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpi->b_calculate_ssimg) {
|
if (cpi->b_calculate_ssimg) {
|
||||||
|
@ -4309,6 +4316,9 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
|
||||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||||
adjust_image_stat(y, u, v, frame_all, &cpi->ssimg);
|
adjust_image_stat(y, u, v, frame_all, &cpi->ssimg);
|
||||||
}
|
}
|
||||||
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
if (!cm->use_highbitdepth)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
double y, u, v, frame_all;
|
double y, u, v, frame_all;
|
||||||
frame_all = vp9_calc_fastssim(cpi->Source, cm->frame_to_show, &y, &u,
|
frame_all = vp9_calc_fastssim(cpi->Source, cm->frame_to_show, &y, &u,
|
||||||
|
@ -4316,6 +4326,9 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
|
||||||
adjust_image_stat(y, u, v, frame_all, &cpi->fastssim);
|
adjust_image_stat(y, u, v, frame_all, &cpi->fastssim);
|
||||||
/* TODO(JBB): add 10/12 bit support */
|
/* TODO(JBB): add 10/12 bit support */
|
||||||
}
|
}
|
||||||
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
if (!cm->use_highbitdepth)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
double y, u, v, frame_all;
|
double y, u, v, frame_all;
|
||||||
frame_all = vp9_psnrhvs(cpi->Source, cm->frame_to_show, &y, &u, &v);
|
frame_all = vp9_psnrhvs(cpi->Source, cm->frame_to_show, &y, &u, &v);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче