summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vp9/encoder/vp9_onyx_if.c32
-rw-r--r--vp9/encoder/vp9_ssim.c24
-rw-r--r--vpx_scale/generic/yv12config.c2
-rw-r--r--vpx_scale/yv12config.h2
4 files changed, 32 insertions, 28 deletions
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index d6fa3fa6c..ab7a41e28 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -1823,8 +1823,8 @@ static void generate_psnr_packet(VP9_COMP *cpi) {
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 @@ static void generate_psnr_packet(VP9_COMP *cpi) {
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 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
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 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags,
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;
diff --git a/vp9/encoder/vp9_ssim.c b/vp9/encoder/vp9_ssim.c
index d417f6fe9..c15551663 100644
--- a/vp9/encoder/vp9_ssim.c
+++ b/vp9/encoder/vp9_ssim.c
@@ -105,16 +105,16 @@ double vp9_calc_ssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
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 vp9_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
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;
diff --git a/vpx_scale/generic/yv12config.c b/vpx_scale/generic/yv12config.c
index 754a615a8..b18155be6 100644
--- a/vpx_scale/generic/yv12config.c
+++ b/vpx_scale/generic/yv12config.c
@@ -170,6 +170,8 @@ int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
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;
diff --git a/vpx_scale/yv12config.h b/vpx_scale/yv12config.h
index 7b8bd850f..c35137041 100644
--- a/vpx_scale/yv12config.h
+++ b/vpx_scale/yv12config.h
@@ -49,6 +49,8 @@ extern "C" {
int uv_width;
int uv_height;
+ int uv_crop_width;
+ int uv_crop_height;
int uv_stride;
/* int uvinternal_width; */