summaryrefslogtreecommitdiffstats
path: root/third_party/aom/aom_dsp/ssim.c
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-10-18 21:53:44 -0500
committertrav90 <travawine@palemoon.org>2018-10-18 21:53:44 -0500
commitec910d81405c736a4490383a250299a7837c2e64 (patch)
tree4f27cc226f93a863121aef6c56313e4153a69b3e /third_party/aom/aom_dsp/ssim.c
parent01eb57073ba97b2d6cbf20f745dfcc508197adc3 (diff)
downloadUXP-ec910d81405c736a4490383a250299a7837c2e64.tar
UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.gz
UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.lz
UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.xz
UXP-ec910d81405c736a4490383a250299a7837c2e64.zip
Update aom to commit id e87fb2378f01103d5d6e477a4ef6892dc714e614
Diffstat (limited to 'third_party/aom/aom_dsp/ssim.c')
-rw-r--r--third_party/aom/aom_dsp/ssim.c56
1 files changed, 19 insertions, 37 deletions
diff --git a/third_party/aom/aom_dsp/ssim.c b/third_party/aom/aom_dsp/ssim.c
index 141bf01c7..6ae378ff2 100644
--- a/third_party/aom/aom_dsp/ssim.c
+++ b/third_party/aom/aom_dsp/ssim.c
@@ -168,23 +168,16 @@ static double aom_highbd_ssim2(const uint8_t *img1, const uint8_t *img2,
double aom_calc_ssim(const YV12_BUFFER_CONFIG *source,
const YV12_BUFFER_CONFIG *dest, double *weight) {
- double a, b, c;
- double ssimv;
-
- a = aom_ssim2(source->y_buffer, dest->y_buffer, source->y_stride,
- dest->y_stride, source->y_crop_width, source->y_crop_height);
-
- b = aom_ssim2(source->u_buffer, dest->u_buffer, source->uv_stride,
- dest->uv_stride, source->uv_crop_width, source->uv_crop_height);
-
- c = aom_ssim2(source->v_buffer, dest->v_buffer, source->uv_stride,
- dest->uv_stride, source->uv_crop_width, source->uv_crop_height);
-
- ssimv = a * .8 + .1 * (b + c);
+ double abc[3];
+ for (int i = 0; i < 3; ++i) {
+ const int is_uv = i > 0;
+ abc[i] = aom_ssim2(source->buffers[i], dest->buffers[i],
+ source->strides[is_uv], dest->strides[is_uv],
+ source->crop_widths[is_uv], source->crop_heights[is_uv]);
+ }
*weight = 1;
-
- return ssimv;
+ return abc[0] * .8 + .1 * (abc[1] + abc[2]);
}
// traditional ssim as per: http://en.wikipedia.org/wiki/Structural_similarity
@@ -433,30 +426,19 @@ double aom_get_ssim_metrics(uint8_t *img1, int img1_pitch, uint8_t *img2,
double aom_highbd_calc_ssim(const YV12_BUFFER_CONFIG *source,
const YV12_BUFFER_CONFIG *dest, double *weight,
uint32_t bd, uint32_t in_bd) {
- double a, b, c;
- double ssimv;
- uint32_t shift = 0;
-
assert(bd >= in_bd);
- shift = bd - in_bd;
-
- a = aom_highbd_ssim2(source->y_buffer, dest->y_buffer, source->y_stride,
- dest->y_stride, source->y_crop_width,
- source->y_crop_height, in_bd, shift);
-
- b = aom_highbd_ssim2(source->u_buffer, dest->u_buffer, source->uv_stride,
- dest->uv_stride, source->uv_crop_width,
- source->uv_crop_height, in_bd, shift);
-
- c = aom_highbd_ssim2(source->v_buffer, dest->v_buffer, source->uv_stride,
- dest->uv_stride, source->uv_crop_width,
- source->uv_crop_height, in_bd, shift);
-
- ssimv = a * .8 + .1 * (b + c);
+ const uint32_t shift = bd - in_bd;
+
+ double abc[3];
+ for (int i = 0; i < 3; ++i) {
+ const int is_uv = i > 0;
+ abc[i] = aom_highbd_ssim2(source->buffers[i], dest->buffers[i],
+ source->strides[is_uv], dest->strides[is_uv],
+ source->crop_widths[is_uv],
+ source->crop_heights[is_uv], in_bd, shift);
+ }
*weight = 1;
-
- return ssimv;
+ return abc[0] * .8 + .1 * (abc[1] + abc[2]);
}
-
#endif // CONFIG_HIGHBITDEPTH