ssim: Replace unsigned long with uint32_t.
The assembly only writes the low 4 bytes, and the HBD version only uses uint32_t bytes. Change-Id: Ie3694ecda511c231e55870df814cbae30e588073
This commit is contained in:
parent
17cfee3cb5
commit
c65e79d2e5
@ -14,9 +14,9 @@
|
|||||||
#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(uint8_t *s, int sp, uint8_t *r,
|
||||||
int rp, unsigned long *sum_s, unsigned long *sum_r,
|
int rp, uint32_t *sum_s, uint32_t *sum_r,
|
||||||
unsigned long *sum_sq_s, unsigned long *sum_sq_r,
|
uint32_t *sum_sq_s, uint32_t *sum_sq_r,
|
||||||
unsigned long *sum_sxr) {
|
uint32_t *sum_sxr) {
|
||||||
int i, j;
|
int i, j;
|
||||||
for (i = 0; i < 16; i++, s += sp, r += rp) {
|
for (i = 0; i < 16; i++, s += sp, r += rp) {
|
||||||
for (j = 0; j < 16; j++) {
|
for (j = 0; j < 16; j++) {
|
||||||
@ -29,9 +29,9 @@ 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(uint8_t *s, int sp, uint8_t *r, int rp,
|
||||||
unsigned long *sum_s, unsigned long *sum_r,
|
uint32_t *sum_s, uint32_t *sum_r,
|
||||||
unsigned long *sum_sq_s, unsigned long *sum_sq_r,
|
uint32_t *sum_sq_s, uint32_t *sum_sq_r,
|
||||||
unsigned long *sum_sxr) {
|
uint32_t *sum_sxr) {
|
||||||
int i, j;
|
int i, j;
|
||||||
for (i = 0; i < 8; i++, s += sp, r += rp) {
|
for (i = 0; i < 8; i++, s += sp, r += rp) {
|
||||||
for (j = 0; j < 8; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
@ -65,9 +65,9 @@ void vpx_highbd_ssim_parms_8x8_c(uint16_t *s, int sp, uint16_t *r, int rp,
|
|||||||
static const int64_t cc1 = 26634; // (64^2*(.01*255)^2
|
static const int64_t cc1 = 26634; // (64^2*(.01*255)^2
|
||||||
static const int64_t cc2 = 239708; // (64^2*(.03*255)^2
|
static const int64_t cc2 = 239708; // (64^2*(.03*255)^2
|
||||||
|
|
||||||
static double similarity(unsigned long sum_s, unsigned long sum_r,
|
static double similarity(uint32_t sum_s, uint32_t sum_r,
|
||||||
unsigned long sum_sq_s, unsigned long sum_sq_r,
|
uint32_t sum_sq_s, uint32_t sum_sq_r,
|
||||||
unsigned long sum_sxr, int count) {
|
uint32_t sum_sxr, int count) {
|
||||||
int64_t ssim_n, ssim_d;
|
int64_t ssim_n, ssim_d;
|
||||||
int64_t c1, c2;
|
int64_t c1, c2;
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ static double similarity(unsigned long sum_s, unsigned long sum_r,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static double ssim_8x8(uint8_t *s, int sp, uint8_t *r, int rp) {
|
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;
|
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);
|
||||||
return similarity(sum_s, sum_r, sum_sq_s, sum_sq_r, sum_sxr, 64);
|
return similarity(sum_s, sum_r, sum_sq_s, sum_sq_r, sum_sxr, 64);
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef VPX_ENCODER_VP9_SSIM_H_
|
#ifndef VPX_DSP_SSIM_H_
|
||||||
#define VPX_ENCODER_VP9_SSIM_H_
|
#define VPX_DSP_SSIM_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -29,19 +29,19 @@ void vpx_reset_mmx_state(void);
|
|||||||
// metrics used for calculating ssim, ssim2, dssim, and ssimc
|
// metrics used for calculating ssim, ssim2, dssim, and ssimc
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// source sum ( over 8x8 region )
|
// source sum ( over 8x8 region )
|
||||||
uint64_t sum_s;
|
uint32_t sum_s;
|
||||||
|
|
||||||
// reference sum (over 8x8 region )
|
// reference sum (over 8x8 region )
|
||||||
uint64_t sum_r;
|
uint32_t sum_r;
|
||||||
|
|
||||||
// source sum squared ( over 8x8 region )
|
// source sum squared ( over 8x8 region )
|
||||||
uint64_t sum_sq_s;
|
uint32_t sum_sq_s;
|
||||||
|
|
||||||
// reference sum squared (over 8x8 region )
|
// reference sum squared (over 8x8 region )
|
||||||
uint64_t sum_sq_r;
|
uint32_t sum_sq_r;
|
||||||
|
|
||||||
// sum of source times reference (over 8x8 region)
|
// sum of source times reference (over 8x8 region)
|
||||||
uint64_t sum_sxr;
|
uint32_t sum_sxr;
|
||||||
|
|
||||||
// calculated ssim score between source and reference
|
// calculated ssim score between source and reference
|
||||||
double ssim;
|
double ssim;
|
||||||
@ -102,4 +102,4 @@ double vpx_highbd_calc_ssimg(YV12_BUFFER_CONFIG *source,
|
|||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // VPX_ENCODER_VP9_SSIM_H_
|
#endif // VPX_DSP_SSIM_H_
|
||||||
|
@ -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, unsigned long *sum_s, unsigned long *sum_r, unsigned long *sum_sq_s, unsigned long *sum_sq_r, unsigned long *sum_sxr";
|
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";
|
||||||
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, unsigned long *sum_s, unsigned long *sum_r, unsigned long *sum_sq_s, unsigned long *sum_sq_r, unsigned long *sum_sxr";
|
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";
|
||||||
specialize qw/vpx_ssim_parms_16x16/, "$sse2_x86_64";
|
specialize qw/vpx_ssim_parms_16x16/, "$sse2_x86_64";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,11 +49,11 @@
|
|||||||
; int sp,
|
; int sp,
|
||||||
; unsigned char *r,
|
; unsigned char *r,
|
||||||
; int rp
|
; int rp
|
||||||
; unsigned long *sum_s,
|
; uint32_t *sum_s,
|
||||||
; unsigned long *sum_r,
|
; uint32_t *sum_r,
|
||||||
; unsigned long *sum_sq_s,
|
; uint32_t *sum_sq_s,
|
||||||
; unsigned long *sum_sq_r,
|
; uint32_t *sum_sq_r,
|
||||||
; unsigned long *sum_sxr);
|
; uint32_t *sum_sxr);
|
||||||
;
|
;
|
||||||
; TODO: Use parm passing through structure, probably don't need the pxors
|
; TODO: Use parm passing through structure, probably don't need the pxors
|
||||||
; ( calling app will initialize to 0 ) could easily fit everything in sse2
|
; ( calling app will initialize to 0 ) could easily fit everything in sse2
|
||||||
@ -139,11 +139,11 @@ sym(vpx_ssim_parms_16x16_sse2):
|
|||||||
; int sp,
|
; int sp,
|
||||||
; unsigned char *r,
|
; unsigned char *r,
|
||||||
; int rp
|
; int rp
|
||||||
; unsigned long *sum_s,
|
; uint32_t *sum_s,
|
||||||
; unsigned long *sum_r,
|
; uint32_t *sum_r,
|
||||||
; unsigned long *sum_sq_s,
|
; uint32_t *sum_sq_s,
|
||||||
; unsigned long *sum_sq_r,
|
; uint32_t *sum_sq_r,
|
||||||
; unsigned long *sum_sxr);
|
; uint32_t *sum_sxr);
|
||||||
;
|
;
|
||||||
; TODO: Use parm passing through structure, probably don't need the pxors
|
; TODO: Use parm passing through structure, probably don't need the pxors
|
||||||
; ( calling app will initialize to 0 ) could easily fit everything in sse2
|
; ( calling app will initialize to 0 ) could easily fit everything in sse2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user