ssim: Add missing statics and consts
Change-Id: I2aa2a545bd2f8f170c66c2e267ea9d617ff10d87
This commit is contained in:
parent
c1f911a2ea
commit
26f4f2dc8e
@ -13,7 +13,7 @@
|
|||||||
#include "vpx_dsp/ssim.h"
|
#include "vpx_dsp/ssim.h"
|
||||||
#include "vpx_ports/mem.h"
|
#include "vpx_ports/mem.h"
|
||||||
|
|
||||||
void vpx_ssim_parms_16x16_c(uint8_t *s, int sp, uint8_t *r,
|
void vpx_ssim_parms_16x16_c(const uint8_t *s, int sp, const uint8_t *r,
|
||||||
int rp, uint32_t *sum_s, uint32_t *sum_r,
|
int rp, uint32_t *sum_s, uint32_t *sum_r,
|
||||||
uint32_t *sum_sq_s, uint32_t *sum_sq_r,
|
uint32_t *sum_sq_s, uint32_t *sum_sq_r,
|
||||||
uint32_t *sum_sxr) {
|
uint32_t *sum_sxr) {
|
||||||
@ -28,7 +28,7 @@ void vpx_ssim_parms_16x16_c(uint8_t *s, int sp, uint8_t *r,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void vpx_ssim_parms_8x8_c(uint8_t *s, int sp, uint8_t *r, int rp,
|
void vpx_ssim_parms_8x8_c(const uint8_t *s, int sp, const uint8_t *r, int rp,
|
||||||
uint32_t *sum_s, uint32_t *sum_r,
|
uint32_t *sum_s, uint32_t *sum_r,
|
||||||
uint32_t *sum_sq_s, uint32_t *sum_sq_r,
|
uint32_t *sum_sq_s, uint32_t *sum_sq_r,
|
||||||
uint32_t *sum_sxr) {
|
uint32_t *sum_sxr) {
|
||||||
@ -45,7 +45,8 @@ void vpx_ssim_parms_8x8_c(uint8_t *s, int sp, uint8_t *r, int rp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
void vpx_highbd_ssim_parms_8x8_c(uint16_t *s, int sp, uint16_t *r, int rp,
|
void vpx_highbd_ssim_parms_8x8_c(const uint16_t *s, int sp,
|
||||||
|
const uint16_t *r, int rp,
|
||||||
uint32_t *sum_s, uint32_t *sum_r,
|
uint32_t *sum_s, uint32_t *sum_r,
|
||||||
uint32_t *sum_sq_s, uint32_t *sum_sq_r,
|
uint32_t *sum_sq_s, uint32_t *sum_sq_r,
|
||||||
uint32_t *sum_sxr) {
|
uint32_t *sum_sxr) {
|
||||||
@ -85,7 +86,7 @@ static double similarity(uint32_t sum_s, uint32_t sum_r,
|
|||||||
return ssim_n * 1.0 / ssim_d;
|
return ssim_n * 1.0 / ssim_d;
|
||||||
}
|
}
|
||||||
|
|
||||||
static double ssim_8x8(uint8_t *s, int sp, uint8_t *r, int rp) {
|
static double ssim_8x8(const uint8_t *s, int sp, const uint8_t *r, int rp) {
|
||||||
uint32_t sum_s = 0, sum_r = 0, sum_sq_s = 0, sum_sq_r = 0, sum_sxr = 0;
|
uint32_t sum_s = 0, sum_r = 0, sum_sq_s = 0, sum_sq_r = 0, sum_sxr = 0;
|
||||||
vpx_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);
|
&sum_sxr);
|
||||||
@ -93,8 +94,8 @@ static double ssim_8x8(uint8_t *s, int sp, uint8_t *r, int rp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
static double highbd_ssim_8x8(uint16_t *s, int sp, uint16_t *r, int rp,
|
static double highbd_ssim_8x8(const uint16_t *s, int sp, const uint16_t *r,
|
||||||
unsigned int bd) {
|
int rp, unsigned int bd) {
|
||||||
uint32_t sum_s = 0, sum_r = 0, sum_sq_s = 0, sum_sq_r = 0, sum_sxr = 0;
|
uint32_t sum_s = 0, sum_r = 0, sum_sq_s = 0, sum_sq_r = 0, sum_sxr = 0;
|
||||||
const int oshift = bd - 8;
|
const int oshift = bd - 8;
|
||||||
vpx_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,
|
||||||
@ -111,8 +112,9 @@ static double highbd_ssim_8x8(uint16_t *s, int sp, uint16_t *r, int rp,
|
|||||||
// We are using a 8x8 moving window with starting location of each 8x8 window
|
// 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
|
// on the 4x4 pixel grid. Such arrangement allows the windows to overlap
|
||||||
// block boundaries to penalize blocking artifacts.
|
// block boundaries to penalize blocking artifacts.
|
||||||
double vpx_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1,
|
static double vpx_ssim2(const uint8_t *img1, const uint8_t *img2,
|
||||||
int stride_img2, int width, int height) {
|
int stride_img1, int stride_img2, int width,
|
||||||
|
int height) {
|
||||||
int i, j;
|
int i, j;
|
||||||
int samples = 0;
|
int samples = 0;
|
||||||
double ssim_total = 0;
|
double ssim_total = 0;
|
||||||
@ -131,9 +133,9 @@ double vpx_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
double vpx_highbd_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1,
|
static double vpx_highbd_ssim2(const uint8_t *img1, const uint8_t *img2,
|
||||||
int stride_img2, int width, int height,
|
int stride_img1, int stride_img2, int width,
|
||||||
unsigned int bd) {
|
int height, unsigned int bd) {
|
||||||
int i, j;
|
int i, j;
|
||||||
int samples = 0;
|
int samples = 0;
|
||||||
double ssim_total = 0;
|
double ssim_total = 0;
|
||||||
@ -154,7 +156,8 @@ double vpx_highbd_ssim2(uint8_t *img1, uint8_t *img2, int stride_img1,
|
|||||||
}
|
}
|
||||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
|
||||||
double vpx_calc_ssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
|
double vpx_calc_ssim(const YV12_BUFFER_CONFIG *source,
|
||||||
|
const YV12_BUFFER_CONFIG *dest,
|
||||||
double *weight) {
|
double *weight) {
|
||||||
double a, b, c;
|
double a, b, c;
|
||||||
double ssimv;
|
double ssimv;
|
||||||
@ -178,7 +181,8 @@ double vpx_calc_ssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
|
|||||||
return ssimv;
|
return ssimv;
|
||||||
}
|
}
|
||||||
|
|
||||||
double vpx_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
|
double vpx_calc_ssimg(const YV12_BUFFER_CONFIG *source,
|
||||||
|
const YV12_BUFFER_CONFIG *dest,
|
||||||
double *ssim_y, double *ssim_u, double *ssim_v) {
|
double *ssim_y, double *ssim_u, double *ssim_v) {
|
||||||
double ssim_all = 0;
|
double ssim_all = 0;
|
||||||
double a, b, c;
|
double a, b, c;
|
||||||
@ -231,7 +235,7 @@ double vpx_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
|
|||||||
// Replace c1 with n*n * c1 for the final step that leads to this code:
|
// Replace c1 with n*n * c1 for the final step that leads to this code:
|
||||||
// The final step scales by 12 bits so we don't lose precision in the constants.
|
// The final step scales by 12 bits so we don't lose precision in the constants.
|
||||||
|
|
||||||
double ssimv_similarity(Ssimv *sv, int64_t n) {
|
static double ssimv_similarity(const Ssimv *sv, int64_t n) {
|
||||||
// Scale the constants by number of pixels.
|
// Scale the constants by number of pixels.
|
||||||
const int64_t c1 = (cc1 * n * n) >> 12;
|
const int64_t c1 = (cc1 * n * n) >> 12;
|
||||||
const int64_t c2 = (cc2 * n * n) >> 12;
|
const int64_t c2 = (cc2 * n * n) >> 12;
|
||||||
@ -262,7 +266,7 @@ double ssimv_similarity(Ssimv *sv, int64_t n) {
|
|||||||
//
|
//
|
||||||
// 255 * 255 - (sum_s - sum_r) / count * (sum_s - sum_r) / count
|
// 255 * 255 - (sum_s - sum_r) / count * (sum_s - sum_r) / count
|
||||||
//
|
//
|
||||||
double ssimv_similarity2(Ssimv *sv, int64_t n) {
|
static double ssimv_similarity2(const Ssimv *sv, int64_t n) {
|
||||||
// Scale the constants by number of pixels.
|
// Scale the constants by number of pixels.
|
||||||
const int64_t c1 = (cc1 * n * n) >> 12;
|
const int64_t c1 = (cc1 * n * n) >> 12;
|
||||||
const int64_t c2 = (cc2 * n * n) >> 12;
|
const int64_t c2 = (cc2 * n * n) >> 12;
|
||||||
@ -278,8 +282,8 @@ double ssimv_similarity2(Ssimv *sv, int64_t n) {
|
|||||||
|
|
||||||
return l * v;
|
return l * v;
|
||||||
}
|
}
|
||||||
void ssimv_parms(uint8_t *img1, int img1_pitch, uint8_t *img2, int img2_pitch,
|
static void ssimv_parms(uint8_t *img1, int img1_pitch, uint8_t *img2,
|
||||||
Ssimv *sv) {
|
int img2_pitch, Ssimv *sv) {
|
||||||
vpx_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_s, &sv->sum_r, &sv->sum_sq_s, &sv->sum_sq_r,
|
||||||
&sv->sum_sxr);
|
&sv->sum_sxr);
|
||||||
@ -448,8 +452,8 @@ double vpx_get_ssim_metrics(uint8_t *img1, int img1_pitch,
|
|||||||
|
|
||||||
|
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
double vpx_highbd_calc_ssim(YV12_BUFFER_CONFIG *source,
|
double vpx_highbd_calc_ssim(const YV12_BUFFER_CONFIG *source,
|
||||||
YV12_BUFFER_CONFIG *dest,
|
const YV12_BUFFER_CONFIG *dest,
|
||||||
double *weight, unsigned int bd) {
|
double *weight, unsigned int bd) {
|
||||||
double a, b, c;
|
double a, b, c;
|
||||||
double ssimv;
|
double ssimv;
|
||||||
@ -473,8 +477,8 @@ double vpx_highbd_calc_ssim(YV12_BUFFER_CONFIG *source,
|
|||||||
return ssimv;
|
return ssimv;
|
||||||
}
|
}
|
||||||
|
|
||||||
double vpx_highbd_calc_ssimg(YV12_BUFFER_CONFIG *source,
|
double vpx_highbd_calc_ssimg(const YV12_BUFFER_CONFIG *source,
|
||||||
YV12_BUFFER_CONFIG *dest, double *ssim_y,
|
const YV12_BUFFER_CONFIG *dest, double *ssim_y,
|
||||||
double *ssim_u, double *ssim_v, unsigned int bd) {
|
double *ssim_u, double *ssim_v, unsigned int bd) {
|
||||||
double ssim_all = 0;
|
double ssim_all = 0;
|
||||||
double a, b, c;
|
double a, b, c;
|
||||||
|
@ -72,10 +72,12 @@ double vpx_get_ssim_metrics(uint8_t *img1, int img1_pitch, uint8_t *img2,
|
|||||||
int img2_pitch, int width, int height, Ssimv *sv2,
|
int img2_pitch, int width, int height, Ssimv *sv2,
|
||||||
Metrics *m, int do_inconsistency);
|
Metrics *m, int do_inconsistency);
|
||||||
|
|
||||||
double vpx_calc_ssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
|
double vpx_calc_ssim(const YV12_BUFFER_CONFIG *source,
|
||||||
|
const YV12_BUFFER_CONFIG *dest,
|
||||||
double *weight);
|
double *weight);
|
||||||
|
|
||||||
double vpx_calc_ssimg(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
|
double vpx_calc_ssimg(const YV12_BUFFER_CONFIG *source,
|
||||||
|
const YV12_BUFFER_CONFIG *dest,
|
||||||
double *ssim_y, double *ssim_u, double *ssim_v);
|
double *ssim_y, double *ssim_u, double *ssim_v);
|
||||||
|
|
||||||
double vpx_calc_fastssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
|
double vpx_calc_fastssim(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest,
|
||||||
@ -86,13 +88,13 @@ double vpx_psnrhvs(const YV12_BUFFER_CONFIG *source,
|
|||||||
double *ssim_y, double *ssim_u, double *ssim_v);
|
double *ssim_y, double *ssim_u, double *ssim_v);
|
||||||
|
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
double vpx_highbd_calc_ssim(YV12_BUFFER_CONFIG *source,
|
double vpx_highbd_calc_ssim(const YV12_BUFFER_CONFIG *source,
|
||||||
YV12_BUFFER_CONFIG *dest,
|
const YV12_BUFFER_CONFIG *dest,
|
||||||
double *weight,
|
double *weight,
|
||||||
unsigned int bd);
|
unsigned int bd);
|
||||||
|
|
||||||
double vpx_highbd_calc_ssimg(YV12_BUFFER_CONFIG *source,
|
double vpx_highbd_calc_ssimg(const YV12_BUFFER_CONFIG *source,
|
||||||
YV12_BUFFER_CONFIG *dest,
|
const YV12_BUFFER_CONFIG *dest,
|
||||||
double *ssim_y,
|
double *ssim_y,
|
||||||
double *ssim_u,
|
double *ssim_u,
|
||||||
double *ssim_v,
|
double *ssim_v,
|
||||||
|
@ -994,10 +994,10 @@ specialize qw/vpx_sad4x4x4d msa/, "$sse_x86inc";
|
|||||||
# Structured Similarity (SSIM)
|
# Structured Similarity (SSIM)
|
||||||
#
|
#
|
||||||
if (vpx_config("CONFIG_INTERNAL_STATS") eq "yes") {
|
if (vpx_config("CONFIG_INTERNAL_STATS") eq "yes") {
|
||||||
add_proto qw/void vpx_ssim_parms_8x8/, "uint8_t *s, int sp, uint8_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";
|
add_proto qw/void vpx_ssim_parms_8x8/, "const uint8_t *s, int sp, const uint8_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";
|
||||||
specialize qw/vpx_ssim_parms_8x8/, "$sse2_x86_64";
|
specialize qw/vpx_ssim_parms_8x8/, "$sse2_x86_64";
|
||||||
|
|
||||||
add_proto qw/void vpx_ssim_parms_16x16/, "uint8_t *s, int sp, uint8_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";
|
add_proto qw/void vpx_ssim_parms_16x16/, "const uint8_t *s, int sp, const uint8_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";
|
||||||
specialize qw/vpx_ssim_parms_16x16/, "$sse2_x86_64";
|
specialize qw/vpx_ssim_parms_16x16/, "$sse2_x86_64";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user