*/
#include <math.h>
-#include "./vp9_rtcd.h"
+#include "./vpx_dsp_rtcd.h"
+#include "vpx_dsp/ssim.h"
#include "vpx_ports/mem.h"
-#include "vp9/encoder/vp9_ssim.h"
-void vp9_ssim_parms_16x16_c(uint8_t *s, int sp, uint8_t *r,
+void vpx_ssim_parms_16x16_c(uint8_t *s, int sp, uint8_t *r,
int rp, unsigned long *sum_s, unsigned long *sum_r,
unsigned long *sum_sq_s, unsigned long *sum_sq_r,
unsigned long *sum_sxr) {
}
}
}
-void vp9_ssim_parms_8x8_c(uint8_t *s, int sp, uint8_t *r, int rp,
+void vpx_ssim_parms_8x8_c(uint8_t *s, int sp, uint8_t *r, int rp,
unsigned long *sum_s, unsigned long *sum_r,
unsigned long *sum_sq_s, unsigned long *sum_sq_r,
unsigned long *sum_sxr) {
}
#if CONFIG_VP9_HIGHBITDEPTH
-void vp9_highbd_ssim_parms_8x8_c(uint16_t *s, int sp, uint16_t *r, int rp,
+void vpx_highbd_ssim_parms_8x8_c(uint16_t *s, int sp, uint16_t *r, int rp,
uint32_t *sum_s, uint32_t *sum_r,
uint32_t *sum_sq_s, uint32_t *sum_sq_r,
uint32_t *sum_sxr) {
static double ssim_8x8(uint8_t *s, int sp, uint8_t *r, int rp) {
unsigned long sum_s = 0, sum_r = 0, sum_sq_s = 0, sum_sq_r = 0, sum_sxr = 0;
- vp9_ssim_parms_8x8(s, sp, r, rp, &sum_s, &sum_r, &sum_sq_s, &sum_sq_r,
+ vpx_ssim_parms_8x8(s, sp, r, rp, &sum_s, &sum_r, &sum_sq_s, &sum_sq_r,
&sum_sxr);
return similarity(sum_s, sum_r, sum_sq_s, sum_sq_r, sum_sxr, 64);
}
unsigned int bd) {
uint32_t sum_s = 0, sum_r = 0, sum_sq_s = 0, sum_sq_r = 0, sum_sxr = 0;
const int oshift = bd - 8;
- vp9_highbd_ssim_parms_8x8(s, sp, r, rp, &sum_s, &sum_r, &sum_sq_s, &sum_sq_r,
+ vpx_highbd_ssim_parms_8x8(s, sp, r, rp, &sum_s, &sum_r, &sum_sq_s, &sum_sq_r,
&sum_sxr);
return similarity(sum_s >> oshift,
sum_r >> oshift,
// We are using a 8x8 moving window with starting location of each 8x8 window
// on the 4x4 pixel grid. Such arrangement allows the windows to overlap
// block boundaries to penalize blocking artifacts.
-double vp9_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1,
+double vpx_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1,
int stride_img2, int width, int height) {
int i, j;
int samples = 0;
}
#if CONFIG_VP9_HIGHBITDEPTH
-double vp9_highbd_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1,
+double vpx_highbd_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1,
int stride_img2, int width, int height,
unsigned int bd) {
int i, j;
}
#endif // CONFIG_VP9_HIGHBITDEPTH
-double vp9_calc_ssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
+double vpx_calc_ssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
double *weight) {
double a, b, c;
double ssimv;
- a = vp9_ssim2(source->y_buffer, dest->y_buffer,
+ a = vpx_ssim2(source->y_buffer, dest->y_buffer,
source->y_stride, dest->y_stride,
source->y_crop_width, source->y_crop_height);
- b = vp9_ssim2(source->u_buffer, dest->u_buffer,
+ b = vpx_ssim2(source->u_buffer, dest->u_buffer,
source->uv_stride, dest->uv_stride,
source->uv_crop_width, source->uv_crop_height);
- c = vp9_ssim2(source->v_buffer, dest->v_buffer,
+ c = vpx_ssim2(source->v_buffer, dest->v_buffer,
source->uv_stride, dest->uv_stride,
source->uv_crop_width, source->uv_crop_height);
return ssimv;
}
-double vp9_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
+double vpx_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
double *ssim_y, double *ssim_u, double *ssim_v) {
double ssim_all = 0;
double a, b, c;
- a = vp9_ssim2(source->y_buffer, dest->y_buffer,
+ a = vpx_ssim2(source->y_buffer, dest->y_buffer,
source->y_stride, dest->y_stride,
source->y_crop_width, source->y_crop_height);
- b = vp9_ssim2(source->u_buffer, dest->u_buffer,
+ b = vpx_ssim2(source->u_buffer, dest->u_buffer,
source->uv_stride, dest->uv_stride,
source->uv_crop_width, source->uv_crop_height);
- c = vp9_ssim2(source->v_buffer, dest->v_buffer,
+ c = vpx_ssim2(source->v_buffer, dest->v_buffer,
source->uv_stride, dest->uv_stride,
source->uv_crop_width, source->uv_crop_height);
*ssim_y = a;
}
void ssimv_parms(uint8_t *img1, int img1_pitch, uint8_t *img2, int img2_pitch,
Ssimv *sv) {
- vp9_ssim_parms_8x8(img1, img1_pitch, img2, img2_pitch,
+ vpx_ssim_parms_8x8(img1, img1_pitch, img2, img2_pitch,
&sv->sum_s, &sv->sum_r, &sv->sum_sq_s, &sv->sum_sq_r,
&sv->sum_sxr);
}
-double vp9_get_ssim_metrics(uint8_t *img1, int img1_pitch,
+double vpx_get_ssim_metrics(uint8_t *img1, int img1_pitch,
uint8_t *img2, int img2_pitch,
int width, int height,
Ssimv *sv2, Metrics *m,
int c = 0;
double norm;
double old_ssim_total = 0;
- vp9_clear_system_state();
+ vpx_clear_system_state();
// We can sample points as frequently as we like start with 1 per 4x4.
for (i = 0; i < height; i += 4,
img1 += img1_pitch * 4, img2 += img2_pitch * 4) {
#if CONFIG_VP9_HIGHBITDEPTH
-double vp9_highbd_calc_ssim(YV12_BUFFER_CONFIG *source,
+double vpx_highbd_calc_ssim(YV12_BUFFER_CONFIG *source,
YV12_BUFFER_CONFIG *dest,
double *weight, unsigned int bd) {
double a, b, c;
double ssimv;
- a = vp9_highbd_ssim2(source->y_buffer, dest->y_buffer,
+ a = vpx_highbd_ssim2(source->y_buffer, dest->y_buffer,
source->y_stride, dest->y_stride,
source->y_crop_width, source->y_crop_height, bd);
- b = vp9_highbd_ssim2(source->u_buffer, dest->u_buffer,
+ b = vpx_highbd_ssim2(source->u_buffer, dest->u_buffer,
source->uv_stride, dest->uv_stride,
source->uv_crop_width, source->uv_crop_height, bd);
- c = vp9_highbd_ssim2(source->v_buffer, dest->v_buffer,
+ c = vpx_highbd_ssim2(source->v_buffer, dest->v_buffer,
source->uv_stride, dest->uv_stride,
source->uv_crop_width, source->uv_crop_height, bd);
return ssimv;
}
-double vp9_highbd_calc_ssimg(YV12_BUFFER_CONFIG *source,
+double vpx_highbd_calc_ssimg(YV12_BUFFER_CONFIG *source,
YV12_BUFFER_CONFIG *dest, double *ssim_y,
double *ssim_u, double *ssim_v, unsigned int bd) {
double ssim_all = 0;
double a, b, c;
- a = vp9_highbd_ssim2(source->y_buffer, dest->y_buffer,
+ a = vpx_highbd_ssim2(source->y_buffer, dest->y_buffer,
source->y_stride, dest->y_stride,
source->y_crop_width, source->y_crop_height, bd);
- b = vp9_highbd_ssim2(source->u_buffer, dest->u_buffer,
+ b = vpx_highbd_ssim2(source->u_buffer, dest->u_buffer,
source->uv_stride, dest->uv_stride,
source->uv_crop_width, source->uv_crop_height, bd);
- c = vp9_highbd_ssim2(source->v_buffer, dest->v_buffer,
+ c = vpx_highbd_ssim2(source->v_buffer, dest->v_buffer,
source->uv_stride, dest->uv_stride,
source->uv_crop_width, source->uv_crop_height, bd);
*ssim_y = a;