From: Pascal Massimino Date: Sat, 16 Jul 2016 04:07:00 +0000 (-0700) Subject: sad_test: add some const to methods X-Git-Tag: v1.6.1~413^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5319e838439e54ff3d63852139b1c462e43bfd62;p=libvpx sad_test: add some const to methods Change-Id: I6f2481509b0aa94338ed6185f80c4a6b65532280 --- diff --git a/test/sad_test.cc b/test/sad_test.cc index ab9602fd9..668699ece 100644 --- a/test/sad_test.cc +++ b/test/sad_test.cc @@ -113,7 +113,7 @@ class SADTestBase : public ::testing::TestWithParam { static const int kDataBlockSize = 64 * 128; static const int kDataBufferSize = 4 * kDataBlockSize; - uint8_t *GetReference(int block_idx) { + uint8_t *GetReference(int block_idx) const { #if CONFIG_VP9_HIGHBITDEPTH if (use_high_bit_depth_) return CONVERT_TO_BYTEPTR(CONVERT_TO_SHORTPTR(reference_data_) + @@ -124,7 +124,7 @@ class SADTestBase : public ::testing::TestWithParam { // Sum of Absolute Differences. Given two blocks, calculate the absolute // difference between two pixels in the same relative location; accumulate. - uint32_t ReferenceSAD(int block_idx) { + uint32_t ReferenceSAD(int block_idx) const { uint32_t sad = 0; const uint8_t *const reference8 = GetReference(block_idx); const uint8_t *const source8 = source_data_; @@ -152,7 +152,7 @@ class SADTestBase : public ::testing::TestWithParam { // Sum of Absolute Differences Average. Given two blocks, and a prediction // calculate the absolute difference between one pixel and average of the // corresponding and predicted pixels; accumulate. - unsigned int ReferenceSADavg(int block_idx) { + unsigned int ReferenceSADavg(int block_idx) const { unsigned int sad = 0; const uint8_t *const reference8 = GetReference(block_idx); const uint8_t *const source8 = source_data_; @@ -183,7 +183,7 @@ class SADTestBase : public ::testing::TestWithParam { return sad; } - void FillConstant(uint8_t *data, int stride, uint16_t fill_constant) { + void FillConstant(uint8_t *data, int stride, uint16_t fill_constant) const { uint8_t *data8 = data; #if CONFIG_VP9_HIGHBITDEPTH uint16_t *data16 = CONVERT_TO_SHORTPTR(data); @@ -244,16 +244,16 @@ class SADx4Test : public SADTestBase { SADx4Test() : SADTestBase(GetParam()) {} protected: - void SADs(unsigned int *results) { - const uint8_t *references[] = {GetReference(0), GetReference(1), - GetReference(2), GetReference(3)}; + void SADs(unsigned int *results) const { + const uint8_t *references[] = { GetReference(0), GetReference(1), + GetReference(2), GetReference(3) }; ASM_REGISTER_STATE_CHECK(params_.func(source_data_, source_stride_, references, reference_stride_, results)); } - void CheckSADs() { + void CheckSADs() const { uint32_t reference_sad, exp_sad[4]; SADs(exp_sad); @@ -270,7 +270,7 @@ class SADTest : public SADTestBase { SADTest() : SADTestBase(GetParam()) {} protected: - unsigned int SAD(int block_idx) { + unsigned int SAD(int block_idx) const { unsigned int ret; const uint8_t *const reference = GetReference(block_idx); @@ -279,7 +279,7 @@ class SADTest : public SADTestBase { return ret; } - void CheckSAD() { + void CheckSAD() const { const unsigned int reference_sad = ReferenceSAD(0); const unsigned int exp_sad = SAD(0); @@ -292,7 +292,7 @@ class SADavgTest : public SADTestBase { SADavgTest() : SADTestBase(GetParam()) {} protected: - unsigned int SAD_avg(int block_idx) { + unsigned int SAD_avg(int block_idx) const { unsigned int ret; const uint8_t *const reference = GetReference(block_idx); @@ -302,7 +302,7 @@ class SADavgTest : public SADTestBase { return ret; } - void CheckSAD() { + void CheckSAD() const { const unsigned int reference_sad = ReferenceSADavg(0); const unsigned int exp_sad = SAD_avg(0);