ref: 0441e0a2fc6d8de954b4147dd2d065323d1b325c
parent: 1d0ae2e63c29969ac710e202391498be7f861dda
parent: 450c7b57a87dfa7027c387ad4c2e9d78d0892bcd
author: Ronald S. Bultje <[email protected]>
date: Tue Jun 25 09:51:18 EDT 2013
Merge "Only do metrics on cropped (visible) area of picture."
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -1823,8 +1823,8 @@
struct vpx_codec_cx_pkt pkt;
uint64_t sse;
int i;
- unsigned int width = cpi->common.width;
- unsigned int height = cpi->common.height;
+ unsigned int width = orig->y_crop_width;
+ unsigned int height = orig->y_crop_height;
pkt.kind = VPX_CODEC_PSNR_PKT;
sse = calc_plane_error(orig->y_buffer, orig->y_stride,
@@ -1835,8 +1835,8 @@
pkt.data.psnr.samples[0] = width * height;
pkt.data.psnr.samples[1] = width * height;
- width = orig->uv_width;
- height = orig->uv_height;
+ width = orig->uv_crop_width;
+ height = orig->uv_crop_height;
sse = calc_plane_error(orig->u_buffer, orig->uv_stride,
recon->u_buffer, recon->uv_stride,
@@ -3758,16 +3758,16 @@
double sq_error;
ye = (double)calc_plane_error(orig->y_buffer, orig->y_stride,
- recon->y_buffer, recon->y_stride, orig->y_width,
- orig->y_height);
+ recon->y_buffer, recon->y_stride,
+ orig->y_crop_width, orig->y_crop_height);
ue = (double)calc_plane_error(orig->u_buffer, orig->uv_stride,
- recon->u_buffer, recon->uv_stride, orig->uv_width,
- orig->uv_height);
+ recon->u_buffer, recon->uv_stride,
+ orig->uv_crop_width, orig->uv_crop_height);
ve = (double)calc_plane_error(orig->v_buffer, orig->uv_stride,
- recon->v_buffer, recon->uv_stride, orig->uv_width,
- orig->uv_height);
+ recon->v_buffer, recon->uv_stride,
+ orig->uv_crop_width, orig->uv_crop_height);
sq_error = ye + ue + ve;
@@ -3788,16 +3788,16 @@
vp9_clear_system_state();
ye = (double)calc_plane_error(orig->y_buffer, orig->y_stride,
- pp->y_buffer, pp->y_stride, orig->y_width,
- orig->y_height);
+ pp->y_buffer, pp->y_stride,
+ orig->y_crop_width, orig->y_crop_height);
ue = (double)calc_plane_error(orig->u_buffer, orig->uv_stride,
- pp->u_buffer, pp->uv_stride, orig->uv_width,
- orig->uv_height);
+ pp->u_buffer, pp->uv_stride,
+ orig->uv_crop_width, orig->uv_crop_height);
ve = (double)calc_plane_error(orig->v_buffer, orig->uv_stride,
- pp->v_buffer, pp->uv_stride, orig->uv_width,
- orig->uv_height);
+ pp->v_buffer, pp->uv_stride,
+ orig->uv_crop_width, orig->uv_crop_height);
sq_error = ye + ue + ve;
--- a/vp9/encoder/vp9_ssim.c
+++ b/vp9/encoder/vp9_ssim.c
@@ -105,16 +105,16 @@
double ssimv;
a = vp9_ssim2(source->y_buffer, dest->y_buffer,
- source->y_stride, dest->y_stride, source->y_width,
- source->y_height);
+ source->y_stride, dest->y_stride,
+ source->y_crop_width, source->y_crop_height);
b = vp9_ssim2(source->u_buffer, dest->u_buffer,
- source->uv_stride, dest->uv_stride, source->uv_width,
- source->uv_height);
+ source->uv_stride, dest->uv_stride,
+ source->uv_crop_width, source->uv_crop_height);
c = vp9_ssim2(source->v_buffer, dest->v_buffer,
- source->uv_stride, dest->uv_stride, source->uv_width,
- source->uv_height);
+ source->uv_stride, dest->uv_stride,
+ source->uv_crop_width, source->uv_crop_height);
ssimv = a * .8 + .1 * (b + c);
@@ -129,16 +129,16 @@
double a, b, c;
a = vp9_ssim2(source->y_buffer, dest->y_buffer,
- source->y_stride, dest->y_stride, source->y_width,
- source->y_height);
+ source->y_stride, dest->y_stride,
+ source->y_crop_width, source->y_crop_height);
b = vp9_ssim2(source->u_buffer, dest->u_buffer,
- source->uv_stride, dest->uv_stride, source->uv_width,
- source->uv_height);
+ source->uv_stride, dest->uv_stride,
+ source->uv_crop_width, source->uv_crop_height);
c = vp9_ssim2(source->v_buffer, dest->v_buffer,
- source->uv_stride, dest->uv_stride, source->uv_width,
- source->uv_height);
+ source->uv_stride, dest->uv_stride,
+ source->uv_crop_width, source->uv_crop_height);
*ssim_y = a;
*ssim_u = b;
*ssim_v = c;
--- a/vpx_scale/generic/yv12config.c
+++ b/vpx_scale/generic/yv12config.c
@@ -170,6 +170,8 @@
ybf->y_height = aligned_height;
ybf->y_stride = y_stride;
+ ybf->uv_crop_width = (width + ss_x) >> ss_x;
+ ybf->uv_crop_height = (height + ss_y) >> ss_y;
ybf->uv_width = uv_width;
ybf->uv_height = uv_height;
ybf->uv_stride = uv_stride;
--- a/vpx_scale/yv12config.h
+++ b/vpx_scale/yv12config.h
@@ -49,6 +49,8 @@
int uv_width;
int uv_height;
+ int uv_crop_width;
+ int uv_crop_height;
int uv_stride;
/* int uvinternal_width; */