Unify reference variance functions
Use uint32_t for all output and make all functions static Change-Id: I2c9c6f6310732dc53444607d1c1a268ac1ab83ba
This commit is contained in:
parent
275c102787
commit
d90536c1a2
@ -68,11 +68,11 @@ static unsigned int mb_ss_ref(const int16_t *src) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int variance_ref(const uint8_t *src, const uint8_t *ref,
|
static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref,
|
||||||
int l2w, int l2h, int src_stride_coeff,
|
int l2w, int l2h, int src_stride_coeff,
|
||||||
int ref_stride_coeff, uint32_t *sse_ptr,
|
int ref_stride_coeff, uint32_t *sse_ptr,
|
||||||
bool use_high_bit_depth_,
|
bool use_high_bit_depth_,
|
||||||
vpx_bit_depth_t bit_depth) {
|
vpx_bit_depth_t bit_depth) {
|
||||||
int64_t se = 0;
|
int64_t se = 0;
|
||||||
uint64_t sse = 0;
|
uint64_t sse = 0;
|
||||||
const int w = 1 << l2w;
|
const int w = 1 << l2w;
|
||||||
@ -96,15 +96,17 @@ static unsigned int variance_ref(const uint8_t *src, const uint8_t *ref,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoundHighBitDepth(bit_depth, &se, &sse);
|
RoundHighBitDepth(bit_depth, &se, &sse);
|
||||||
*sse_ptr = (uint32_t) sse;
|
*sse_ptr = static_cast<uint32_t>(sse);
|
||||||
return (unsigned int) (sse - (((int64_t) se * se) >> (l2w + l2h)));
|
return static_cast<uint32_t>(sse -
|
||||||
|
((static_cast<int64_t>(se) * se) >>
|
||||||
|
(l2w + l2h)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
|
static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
|
||||||
int l2w, int l2h, int xoff, int yoff,
|
int l2w, int l2h, int xoff, int yoff,
|
||||||
unsigned int *sse_ptr,
|
uint32_t *sse_ptr,
|
||||||
bool use_high_bit_depth_,
|
bool use_high_bit_depth_,
|
||||||
vpx_bit_depth_t bit_depth) {
|
vpx_bit_depth_t bit_depth) {
|
||||||
int64_t se = 0;
|
int64_t se = 0;
|
||||||
uint64_t sse = 0;
|
uint64_t sse = 0;
|
||||||
const int w = 1 << l2w;
|
const int w = 1 << l2w;
|
||||||
@ -142,8 +144,10 @@ static unsigned int subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoundHighBitDepth(bit_depth, &se, &sse);
|
RoundHighBitDepth(bit_depth, &se, &sse);
|
||||||
*sse_ptr = (unsigned int) sse;
|
*sse_ptr = static_cast<uint32_t>(sse);
|
||||||
return (unsigned int) (sse - (((int64_t) se * se) >> (l2w + l2h)));
|
return static_cast<uint32_t>(sse -
|
||||||
|
((static_cast<int64_t>(se) * se) >>
|
||||||
|
(l2w + l2h)));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef unsigned int (*SumOfSquaresFunction)(const int16_t *src);
|
typedef unsigned int (*SumOfSquaresFunction)(const int16_t *src);
|
||||||
@ -464,14 +468,14 @@ void MseTest<MseFunctionType>::MaxTest_sse() {
|
|||||||
EXPECT_EQ(expected, var);
|
EXPECT_EQ(expected, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int subpel_avg_variance_ref(const uint8_t *ref,
|
static uint32_t subpel_avg_variance_ref(const uint8_t *ref,
|
||||||
const uint8_t *src,
|
const uint8_t *src,
|
||||||
const uint8_t *second_pred,
|
const uint8_t *second_pred,
|
||||||
int l2w, int l2h,
|
int l2w, int l2h,
|
||||||
int xoff, int yoff,
|
int xoff, int yoff,
|
||||||
unsigned int *sse_ptr,
|
uint32_t *sse_ptr,
|
||||||
bool use_high_bit_depth,
|
bool use_high_bit_depth,
|
||||||
vpx_bit_depth_t bit_depth) {
|
vpx_bit_depth_t bit_depth) {
|
||||||
int64_t se = 0;
|
int64_t se = 0;
|
||||||
uint64_t sse = 0;
|
uint64_t sse = 0;
|
||||||
const int w = 1 << l2w;
|
const int w = 1 << l2w;
|
||||||
@ -510,8 +514,10 @@ unsigned int subpel_avg_variance_ref(const uint8_t *ref,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoundHighBitDepth(bit_depth, &se, &sse);
|
RoundHighBitDepth(bit_depth, &se, &sse);
|
||||||
*sse_ptr = (unsigned int) sse;
|
*sse_ptr = static_cast<uint32_t>(sse);
|
||||||
return (unsigned int) (sse - (((int64_t) se * se) >> (l2w + l2h)));
|
return static_cast<uint32_t>(sse -
|
||||||
|
((static_cast<int64_t>(se) * se) >>
|
||||||
|
(l2w + l2h)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename SubpelVarianceFunctionType>
|
template<typename SubpelVarianceFunctionType>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user