summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2015-05-12 15:02:43 -0700
committerYaowu Xu <yaowu@google.com>2015-05-12 15:12:05 -0700
commit3f42d10805d5ba5480236ec163776e5a49f6cf7c (patch)
treecf1264e45ecd594219820ec728713853e280bda0 /vp9/encoder
parent47767609fed41f0273d4786f0e26f3d44f60500e (diff)
downloadlibvpx-3f42d10805d5ba5480236ec163776e5a49f6cf7c.tar
libvpx-3f42d10805d5ba5480236ec163776e5a49f6cf7c.tar.gz
libvpx-3f42d10805d5ba5480236ec163776e5a49f6cf7c.tar.bz2
libvpx-3f42d10805d5ba5480236ec163776e5a49f6cf7c.zip
Protect new metric computation with use_highbitdepth flag
The computation of new metrics is not supported yet in highbitdepth mode. This commit adds protection to make sure the computation is done only when highbitdepth is not on. This protection shall be revised when support of highbitdpeth computation is added. This resolves the encoder crash when configured with both --enable-internal-stats --enable-vp9-highbitdepth Change-Id: Id9f4bcc4fa26d9ca0e9eabade83f3f88a5b212e6
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_encoder.c57
1 files changed, 35 insertions, 22 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index bc09a16f1..f0b0ce239 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -4180,7 +4180,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
vp9_clear_system_state();
#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);
#else
calc_psnr(orig, pp, &psnr2);
@@ -4231,31 +4231,38 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
}
}
if (cpi->b_calculate_blockiness) {
- double frame_blockiness = vp9_get_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 CONFIG_VP9_HIGHBITDEPTH
+ if (!cm->use_highbitdepth)
+#endif
+ {
+ double frame_blockiness = vp9_get_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) {
- 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);
-
-
- double consistency = vpx_sse_to_psnr(samples, peak,
+#if CONFIG_VP9_HIGHBITDEPTH
+ if (!cm->use_highbitdepth)
+#endif
+ {
+ 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);
+ double consistency = vpx_sse_to_psnr(samples, peak,
(double)cpi->total_inconsistency);
-
- if (consistency > 0.0)
- cpi->worst_consistency = MIN(cpi->worst_consistency,
- consistency);
- cpi->total_inconsistency += this_inconsistency;
+ if (consistency > 0.0)
+ cpi->worst_consistency = MIN(cpi->worst_consistency,
+ consistency);
+ cpi->total_inconsistency += this_inconsistency;
+ }
}
if (cpi->b_calculate_ssimg) {
@@ -4273,6 +4280,9 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
#endif // CONFIG_VP9_HIGHBITDEPTH
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;
frame_all = vp9_calc_fastssim(cpi->Source, cm->frame_to_show, &y, &u,
@@ -4280,6 +4290,9 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
adjust_image_stat(y, u, v, frame_all, &cpi->fastssim);
/* TODO(JBB): add 10/12 bit support */
}
+#if CONFIG_VP9_HIGHBITDEPTH
+ if (!cm->use_highbitdepth)
+#endif
{
double y, u, v, frame_all;
frame_all = vp9_psnrhvs(cpi->Source, cm->frame_to_show, &y, &u, &v);