/* * Copyright (c) 2018, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
typedefvoid (*DrPred_Hbd)(uint16_t *dst, ptrdiff_t stride, int bw, int bh, const uint16_t *above, const uint16_t *left, int upsample_above, int upsample_left, int dx, int dy, int bd);
typedefvoid (*DrPred)(uint8_t *dst, ptrdiff_t stride, int bw, int bh, const uint8_t *above, const uint8_t *left, int upsample_above, int upsample_left, int dx, int dy, int bd);
typedefvoid (*Z1_Lbd)(uint8_t *dst, ptrdiff_t stride, int bw, int bh, const uint8_t *above, const uint8_t *left, int upsample_above, int dx, int dy); template <Z1_Lbd fn> void z1_wrapper(uint8_t *dst, ptrdiff_t stride, int bw, int bh, const uint8_t *above, const uint8_t *left, int upsample_above, int upsample_left, int dx, int dy, int bd) {
(void)bd;
(void)upsample_left;
fn(dst, stride, bw, bh, above, left, upsample_above, dx, dy);
}
typedefvoid (*Z2_Lbd)(uint8_t *dst, ptrdiff_t stride, int bw, int bh, const uint8_t *above, const uint8_t *left, int upsample_above, int upsample_left, int dx, int dy); template <Z2_Lbd fn> void z2_wrapper(uint8_t *dst, ptrdiff_t stride, int bw, int bh, const uint8_t *above, const uint8_t *left, int upsample_above, int upsample_left, int dx, int dy, int bd) {
(void)bd;
(void)upsample_left;
fn(dst, stride, bw, bh, above, left, upsample_above, upsample_left, dx, dy);
}
typedefvoid (*Z3_Lbd)(uint8_t *dst, ptrdiff_t stride, int bw, int bh, const uint8_t *above, const uint8_t *left, int upsample_left, int dx, int dy); template <Z3_Lbd fn> void z3_wrapper(uint8_t *dst, ptrdiff_t stride, int bw, int bh, const uint8_t *above, const uint8_t *left, int upsample_above, int upsample_left, int dx, int dy, int bd) {
(void)bd;
(void)upsample_above;
fn(dst, stride, bw, bh, above, left, upsample_left, dx, dy);
}
typedefvoid (*Z1_Hbd)(uint16_t *dst, ptrdiff_t stride, int bw, int bh, const uint16_t *above, const uint16_t *left, int upsample_above, int dx, int dy, int bd); template <Z1_Hbd fn> void z1_wrapper_hbd(uint16_t *dst, ptrdiff_t stride, int bw, int bh, const uint16_t *above, const uint16_t *left, int upsample_above, int upsample_left, int dx, int dy, int bd) {
(void)bd;
(void)upsample_left;
fn(dst, stride, bw, bh, above, left, upsample_above, dx, dy, bd);
}
typedefvoid (*Z2_Hbd)(uint16_t *dst, ptrdiff_t stride, int bw, int bh, const uint16_t *above, const uint16_t *left, int upsample_above, int upsample_left, int dx, int dy, int bd); template <Z2_Hbd fn> void z2_wrapper_hbd(uint16_t *dst, ptrdiff_t stride, int bw, int bh, const uint16_t *above, const uint16_t *left, int upsample_above, int upsample_left, int dx, int dy, int bd) {
(void)bd;
fn(dst, stride, bw, bh, above, left, upsample_above, upsample_left, dx, dy,
bd);
}
typedefvoid (*Z3_Hbd)(uint16_t *dst, ptrdiff_t stride, int bw, int bh, const uint16_t *above, const uint16_t *left, int upsample_left, int dx, int dy, int bd); template <Z3_Hbd fn> void z3_wrapper_hbd(uint16_t *dst, ptrdiff_t stride, int bw, int bh, const uint16_t *above, const uint16_t *left, int upsample_above, int upsample_left, int dx, int dy, int bd) {
(void)bd;
(void)upsample_above;
fn(dst, stride, bw, bh, above, left, upsample_left, dx, dy, bd);
}
template <typename FuncType> struct DrPredFunc {
DrPredFunc(FuncType pred = nullptr, FuncType tst = nullptr, int bit_depth_value = 0, int start_angle_value = 0)
: ref_fn(pred), tst_fn(tst), bit_depth(bit_depth_value),
start_angle(start_angle_value) {}
FuncType ref_fn;
FuncType tst_fn; int bit_depth; int start_angle;
};
// Declare input buffers as local arrays to allow checking for // over-reads.
DECLARE_ALIGNED(16, Pixel, left_data[kNumIntraNeighbourPixels]);
DECLARE_ALIGNED(16, Pixel, above_data[kNumIntraNeighbourPixels]);
// We need to allow reading some previous bytes from the input pointers. const Pixel *above = &above_data[kIntraPredInputPadding]; const Pixel *left = &left_data[kIntraPredInputPadding];
if (needsaturation) { const Pixel sat = (1 << bd_) - 1; for (int i = 0; i < kNumIntraNeighbourPixels; ++i) {
left_data[i] = sat;
above_data[i] = sat;
}
} else { for (int i = 0; i < kNumIntraNeighbourPixels; ++i) {
left_data[i] = rng_.Rand8();
above_data[i] = rng_.Rand8();
}
}
// Add additional padding to allow detection of over reads/writes when // the transform width is equal to MAX_TX_SIZE. constint dst_stride = MAX_TX_SIZE + 16;
std::vector<Pixel> dst_ref(dst_stride * bh_);
std::vector<Pixel> dst_tst(dst_stride * bh_);