/* * Copyright (c) 2013 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.
*/
protected: // Make reference arrays big enough for 16x16 functions. Six-tap filters need // 5 extra pixels outside of the macroblock. staticconstint kSrcStride = 21; staticconstint kSrcSize = kSrcStride * kSrcStride; staticconstint kBorderSize = 16;
int width_; int height_;
PredictFunc predict_;
uint8_t *src_;
uint8_t *padded_dst_;
uint8_t *dst_; int padded_dst_size_;
uint8_t *dst_c_; int dst_stride_;
bool CompareBuffers(const uint8_t *a, int a_stride, const uint8_t *b, int b_stride) const { for (int height = 0; height < height_; ++height) {
EXPECT_EQ(0, memcmp(a + height * a_stride, b + height * b_stride, sizeof(*a) * width_))
<< "Row " << height << " does not match.";
}
return !HasFailure();
}
// Given a block of memory 'a' with size 'a_size', determine if all regions // excepting block 'b' described by 'b_stride', 'b_height', and 'b_width' // match pixel value 'c'. bool CheckBorder(const uint8_t *a, int a_size, const uint8_t *b, int b_width, int b_height, int b_stride, uint8_t c) const { const uint8_t *a_end = a + a_size; constint b_size = (b_stride * b_height) + b_width; const uint8_t *b_end = b + b_size; constint left_border = (b_stride - b_width) / 2; constint right_border = left_border + ((b_stride - b_width) % 2);
EXPECT_GE(b - left_border, a) << "'b' does not start within 'a'";
EXPECT_LE(b_end + right_border, a_end) << "'b' does not end within 'a'";
// Top border. for (int pixel = 0; pixel < b - a - left_border; ++pixel) {
EXPECT_EQ(c, a[pixel]) << "Mismatch at " << pixel << " in top border.";
}
// Left border. for (int height = 0; height < b_height; ++height) { for (int width = left_border; width > 0; --width) {
EXPECT_EQ(c, b[height * b_stride - width])
<< "Mismatch at row " << height << " column " << left_border - width
<< " in left border.";
}
}
// Right border. for (int height = 0; height < b_height; ++height) { for (int width = b_width; width < b_width + right_border; ++width) {
EXPECT_EQ(c, b[height * b_stride + width])
<< "Mismatch at row " << height << " column " << width - b_width
<< " in right border.";
}
}
// Bottom border. for (int pixel = static_cast<int>(b - a + b_size); pixel < a_size;
++pixel) {
EXPECT_EQ(c, a[pixel]) << "Mismatch at " << pixel << " in bottom border.";
}
// Run tests for almost all possible offsets. for (int xoffset = 0; xoffset < 8; ++xoffset) { for (int yoffset = 0; yoffset < 8; ++yoffset) { if (xoffset == 0 && yoffset == 0) { // This represents a copy which is not required to be handled by this // module. continue;
}
for (int i = 0; i < kSrcSize; ++i) {
src_[i] = rnd.Rand8();
}
reference(&src_[kSrcStride * 2 + 2], kSrcStride, xoffset, yoffset,
dst_c_, 16);
¤ 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.0.12Bemerkung:
(vorverarbeitet)
¤
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.