/* * Copyright (c) 2012 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
void FillConstant(uint8_t *data, int stride, uint8_t fill_constant, int width, int height) { for (int h = 0; h < height; ++h) { for (int w = 0; w < width; ++w) {
data[h * stride + w] = fill_constant;
}
}
}
void FillRandom(uint8_t *data, int stride, int width, int height) { for (int h = 0; h < height; ++h) { for (int w = 0; w < width; ++w) {
data[h * stride + w] = rnd_.Rand8();
}
}
}
void FillRandomBlocky(uint8_t *data, int stride) { for (int h = 0; h < height_; h += 4) { for (int w = 0; w < width_; w += 4) {
FillRandom(data + h * stride + w, stride, 4, 4);
}
}
}
void FillCheckerboard(uint8_t *data, int stride) { for (int h = 0; h < height_; h += 4) { for (int w = 0; w < width_; w += 4) { if (((h / 4) ^ (w / 4)) & 1) {
FillConstant(data + h * stride + w, stride, 255, 4, 4);
} else {
FillConstant(data + h * stride + w, stride, 0, 4, 4);
}
}
}
}
void Blur(uint8_t *data, int stride, int taps) { int sum = 0; int half_taps = taps / 2; for (int h = 0; h < height_; ++h) { for (int w = 0; w < taps; ++w) {
sum += data[w + h * stride];
} for (int w = taps; w < width_; ++w) {
sum += data[w + h * stride] - data[w - taps + h * stride];
data[w - half_taps + h * stride] = (sum + half_taps) / taps;
}
} for (int w = 0; w < width_; ++w) { for (int h = 0; h < taps; ++h) {
sum += data[h + w * stride];
} for (int h = taps; h < height_; ++h) {
sum += data[w + h * stride] - data[(h - taps) * stride + w];
data[(h - half_taps) * stride + w] = (sum + half_taps) / taps;
}
}
} int width_, height_; static uint8_t *source_data_; int source_stride_; static uint8_t *reference_data_; int reference_stride_;
ACMRandom rnd_;
};
#if CONFIG_VP9_ENCODER typedef std::tuple<int, int> BlockinessParam; class BlockinessVP9Test
: public BlockinessTestBase, public ::testing::WithParamInterface<BlockinessParam> { public:
BlockinessVP9Test() : BlockinessTestBase(GET_PARAM(0), GET_PARAM(1)) {}
EXPECT_GT(super_blocky, less_blocky)
<< "A straight blur should decrease blockiness.";
}
TEST_P(BlockinessVP9Test, WorstCaseBlockiness) { // Source is blockier than reference.
FillConstant(source_data_, source_stride_, 128);
FillCheckerboard(reference_data_, reference_stride_);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.