Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
81a8138f
Commit
81a8138f
authored
Sep 15, 2014
by
Deb Mukherjee
Browse files
Adding high-bitdepth intra prediction functions
Change-Id: I6f5cb101e2dc57c3d3f4d7e0ffb4ddbed027d111
parent
5cd0aab8
Changes
7
Hide whitespace changes
Inline
Side-by-side
test/test.mk
View file @
81a8138f
...
...
@@ -128,6 +128,7 @@ LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += fdct4x4_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER)
+=
fdct8x8_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER)
+=
variance_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER)
+=
vp9_subtract_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9)
+=
vp9_intrapred_test.cc
ifeq
($(CONFIG_VP9_ENCODER),yes)
LIBVPX_TEST_SRCS-$(CONFIG_SPATIAL_SVC)
+=
svc_test.cc
...
...
test/vp9_intrapred_test.cc
0 → 100644
View file @
81a8138f
/*
* Copyright (c) 2014 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.
*/
#include
<string>
#include
"test/acm_random.h"
#include
"test/clear_system_state.h"
#include
"test/register_state_check.h"
#include
"third_party/googletest/src/include/gtest/gtest.h"
#include
"./vpx_config.h"
#include
"./vp9_rtcd.h"
#include
"vp9/common/vp9_blockd.h"
#include
"vp9/common/vp9_pred_common.h"
#include
"vpx_mem/vpx_mem.h"
#include
"test/util.h"
namespace
{
using
libvpx_test
::
ACMRandom
;
const
int
count_test_block
=
100000
;
// Base class for VP9 intra prediction tests.
class
VP9IntraPredBase
{
public:
virtual
~
VP9IntraPredBase
()
{
libvpx_test
::
ClearSystemState
();
}
protected:
virtual
void
Predict
(
PREDICTION_MODE
mode
)
=
0
;
void
CheckPrediction
(
int
test_case_number
,
int
*
error_count
)
const
{
// For each pixel ensure that the calculated value is the same as reference.
for
(
int
y
=
0
;
y
<
block_size_
;
y
++
)
{
for
(
int
x
=
0
;
x
<
block_size_
;
x
++
)
{
*
error_count
+=
ref_dst_
[
x
+
y
*
stride_
]
!=
dst_
[
x
+
y
*
stride_
];
if
(
*
error_count
==
1
)
{
ASSERT_EQ
(
ref_dst_
[
x
+
y
*
stride_
],
dst_
[
x
+
y
*
stride_
])
<<
" Failed on Test Case Number "
<<
test_case_number
;
}
}
}
}
void
RunTest
(
uint16_t
*
left_col
,
uint16_t
*
above_data
,
uint16_t
*
dst
,
uint16_t
*
ref_dst
)
{
ACMRandom
rnd
(
ACMRandom
::
DeterministicSeed
());
left_col_
=
left_col
;
dst_
=
dst
;
ref_dst_
=
ref_dst
;
above_row_
=
above_data
+
16
;
int
error_count
=
0
;
for
(
int
i
=
0
;
i
<
count_test_block
;
++
i
)
{
// Fill edges with random data, try first with saturated values.
for
(
int
x
=
-
1
;
x
<=
block_size_
*
2
;
x
++
)
{
if
(
i
==
0
)
{
above_row_
[
x
]
=
mask_
;
}
else
{
above_row_
[
x
]
=
rnd
.
Rand16
()
&
mask_
;
}
}
for
(
int
y
=
0
;
y
<
block_size_
;
y
++
)
{
if
(
i
==
0
)
{
left_col_
[
y
]
=
mask_
;
}
else
{
left_col_
[
y
]
=
rnd
.
Rand16
()
&
mask_
;
}
}
Predict
(
DC_PRED
);
CheckPrediction
(
i
,
&
error_count
);
}
ASSERT_EQ
(
0
,
error_count
);
}
int
block_size_
;
uint16_t
*
above_row_
;
uint16_t
*
left_col_
;
uint16_t
*
dst_
;
uint16_t
*
ref_dst_
;
ptrdiff_t
stride_
;
int
mask_
;
};
typedef
void
(
*
intra_pred_fn_t
)(
uint16_t
*
dst
,
ptrdiff_t
stride
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bps
);
typedef
std
::
tr1
::
tuple
<
intra_pred_fn_t
,
intra_pred_fn_t
,
int
,
int
>
intra_pred_params_t
;
class
VP9IntraPredTest
:
public
VP9IntraPredBase
,
public
::
testing
::
TestWithParam
<
intra_pred_params_t
>
{
virtual
void
SetUp
()
{
pred_fn_
=
GET_PARAM
(
0
);
ref_fn_
=
GET_PARAM
(
1
);
block_size_
=
GET_PARAM
(
2
);
bit_depth_
=
GET_PARAM
(
3
);
stride_
=
block_size_
*
3
;
mask_
=
(
1
<<
bit_depth_
)
-
1
;
}
virtual
void
Predict
(
PREDICTION_MODE
mode
)
{
const
uint16_t
*
const_above_row
=
above_row_
;
const
uint16_t
*
const_left_col
=
left_col_
;
ref_fn_
(
ref_dst_
,
stride_
,
const_above_row
,
const_left_col
,
bit_depth_
);
ASM_REGISTER_STATE_CHECK
(
pred_fn_
(
dst_
,
stride_
,
const_above_row
,
const_left_col
,
bit_depth_
));
}
intra_pred_fn_t
pred_fn_
;
intra_pred_fn_t
ref_fn_
;
int
bit_depth_
;
};
TEST_P
(
VP9IntraPredTest
,
IntraPredTests
)
{
// max block size is 32
DECLARE_ALIGNED_ARRAY
(
16
,
uint16_t
,
left_col
,
2
*
32
);
DECLARE_ALIGNED_ARRAY
(
16
,
uint16_t
,
above_data
,
2
*
32
+
32
);
DECLARE_ALIGNED_ARRAY
(
16
,
uint16_t
,
dst
,
3
*
32
*
32
);
DECLARE_ALIGNED_ARRAY
(
16
,
uint16_t
,
ref_dst
,
3
*
32
*
32
);
RunTest
(
left_col
,
above_data
,
dst
,
ref_dst
);
}
using
std
::
tr1
::
make_tuple
;
#if HAVE_SSE2
#if CONFIG_VP9_HIGHBITDEPTH
#if ARCH_X86_64
INSTANTIATE_TEST_CASE_P
(
SSE2_TO_C_8
,
VP9IntraPredTest
,
::
testing
::
Values
(
make_tuple
(
&
vp9_high_dc_predictor_32x32_sse2
,
&
vp9_high_dc_predictor_32x32_c
,
32
,
8
),
make_tuple
(
&
vp9_high_tm_predictor_16x16_sse2
,
&
vp9_high_tm_predictor_16x16_c
,
16
,
8
),
make_tuple
(
&
vp9_high_tm_predictor_32x32_sse2
,
&
vp9_high_tm_predictor_32x32_c
,
32
,
8
),
make_tuple
(
&
vp9_high_dc_predictor_4x4_sse
,
&
vp9_high_dc_predictor_4x4_c
,
4
,
8
),
make_tuple
(
&
vp9_high_dc_predictor_8x8_sse2
,
&
vp9_high_dc_predictor_8x8_c
,
8
,
8
),
make_tuple
(
&
vp9_high_dc_predictor_16x16_sse2
,
&
vp9_high_dc_predictor_16x16_c
,
16
,
8
),
make_tuple
(
&
vp9_high_v_predictor_4x4_sse
,
&
vp9_high_v_predictor_4x4_c
,
4
,
8
),
make_tuple
(
&
vp9_high_v_predictor_8x8_sse2
,
&
vp9_high_v_predictor_8x8_c
,
8
,
8
),
make_tuple
(
&
vp9_high_v_predictor_16x16_sse2
,
&
vp9_high_v_predictor_16x16_c
,
16
,
8
),
make_tuple
(
&
vp9_high_v_predictor_32x32_sse2
,
&
vp9_high_v_predictor_32x32_c
,
32
,
8
),
make_tuple
(
&
vp9_high_tm_predictor_4x4_sse
,
&
vp9_high_tm_predictor_4x4_c
,
4
,
8
),
make_tuple
(
&
vp9_high_tm_predictor_8x8_sse2
,
&
vp9_high_tm_predictor_8x8_c
,
8
,
8
)));
#else
INSTANTIATE_TEST_CASE_P
(
SSE2_TO_C_8
,
VP9IntraPredTest
,
::
testing
::
Values
(
make_tuple
(
&
vp9_high_dc_predictor_4x4_sse
,
&
vp9_high_dc_predictor_4x4_c
,
4
,
8
),
make_tuple
(
&
vp9_high_dc_predictor_8x8_sse2
,
&
vp9_high_dc_predictor_8x8_c
,
8
,
8
),
make_tuple
(
&
vp9_high_dc_predictor_16x16_sse2
,
&
vp9_high_dc_predictor_16x16_c
,
16
,
8
),
make_tuple
(
&
vp9_high_v_predictor_4x4_sse
,
&
vp9_high_v_predictor_4x4_c
,
4
,
8
),
make_tuple
(
&
vp9_high_v_predictor_8x8_sse2
,
&
vp9_high_v_predictor_8x8_c
,
8
,
8
),
make_tuple
(
&
vp9_high_v_predictor_16x16_sse2
,
&
vp9_high_v_predictor_16x16_c
,
16
,
8
),
make_tuple
(
&
vp9_high_v_predictor_32x32_sse2
,
&
vp9_high_v_predictor_32x32_c
,
32
,
8
),
make_tuple
(
&
vp9_high_tm_predictor_4x4_sse
,
&
vp9_high_tm_predictor_4x4_c
,
4
,
8
),
make_tuple
(
&
vp9_high_tm_predictor_8x8_sse2
,
&
vp9_high_tm_predictor_8x8_c
,
8
,
8
)));
#endif
#if ARCH_X86_64
INSTANTIATE_TEST_CASE_P
(
SSE2_TO_C_10
,
VP9IntraPredTest
,
::
testing
::
Values
(
make_tuple
(
&
vp9_high_dc_predictor_32x32_sse2
,
&
vp9_high_dc_predictor_32x32_c
,
32
,
10
),
make_tuple
(
&
vp9_high_tm_predictor_16x16_sse2
,
&
vp9_high_tm_predictor_16x16_c
,
16
,
10
),
make_tuple
(
&
vp9_high_tm_predictor_32x32_sse2
,
&
vp9_high_tm_predictor_32x32_c
,
32
,
10
),
make_tuple
(
&
vp9_high_dc_predictor_4x4_sse
,
&
vp9_high_dc_predictor_4x4_c
,
4
,
10
),
make_tuple
(
&
vp9_high_dc_predictor_8x8_sse2
,
&
vp9_high_dc_predictor_8x8_c
,
8
,
10
),
make_tuple
(
&
vp9_high_dc_predictor_16x16_sse2
,
&
vp9_high_dc_predictor_16x16_c
,
16
,
10
),
make_tuple
(
&
vp9_high_v_predictor_4x4_sse
,
&
vp9_high_v_predictor_4x4_c
,
4
,
10
),
make_tuple
(
&
vp9_high_v_predictor_8x8_sse2
,
&
vp9_high_v_predictor_8x8_c
,
8
,
10
),
make_tuple
(
&
vp9_high_v_predictor_16x16_sse2
,
&
vp9_high_v_predictor_16x16_c
,
16
,
10
),
make_tuple
(
&
vp9_high_v_predictor_32x32_sse2
,
&
vp9_high_v_predictor_32x32_c
,
32
,
10
),
make_tuple
(
&
vp9_high_tm_predictor_4x4_sse
,
&
vp9_high_tm_predictor_4x4_c
,
4
,
10
),
make_tuple
(
&
vp9_high_tm_predictor_8x8_sse2
,
&
vp9_high_tm_predictor_8x8_c
,
8
,
10
)));
#else
INSTANTIATE_TEST_CASE_P
(
SSE2_TO_C_10
,
VP9IntraPredTest
,
::
testing
::
Values
(
make_tuple
(
&
vp9_high_dc_predictor_4x4_sse
,
&
vp9_high_dc_predictor_4x4_c
,
4
,
10
),
make_tuple
(
&
vp9_high_dc_predictor_8x8_sse2
,
&
vp9_high_dc_predictor_8x8_c
,
8
,
10
),
make_tuple
(
&
vp9_high_dc_predictor_16x16_sse2
,
&
vp9_high_dc_predictor_16x16_c
,
16
,
10
),
make_tuple
(
&
vp9_high_v_predictor_4x4_sse
,
&
vp9_high_v_predictor_4x4_c
,
4
,
10
),
make_tuple
(
&
vp9_high_v_predictor_8x8_sse2
,
&
vp9_high_v_predictor_8x8_c
,
8
,
10
),
make_tuple
(
&
vp9_high_v_predictor_16x16_sse2
,
&
vp9_high_v_predictor_16x16_c
,
16
,
10
),
make_tuple
(
&
vp9_high_v_predictor_32x32_sse2
,
&
vp9_high_v_predictor_32x32_c
,
32
,
10
),
make_tuple
(
&
vp9_high_tm_predictor_4x4_sse
,
&
vp9_high_tm_predictor_4x4_c
,
4
,
10
),
make_tuple
(
&
vp9_high_tm_predictor_8x8_sse2
,
&
vp9_high_tm_predictor_8x8_c
,
8
,
10
)));
#endif
#if ARCH_X86_64
INSTANTIATE_TEST_CASE_P
(
SSE2_TO_C_12
,
VP9IntraPredTest
,
::
testing
::
Values
(
make_tuple
(
&
vp9_high_dc_predictor_32x32_sse2
,
&
vp9_high_dc_predictor_32x32_c
,
32
,
12
),
make_tuple
(
&
vp9_high_tm_predictor_16x16_sse2
,
&
vp9_high_tm_predictor_16x16_c
,
16
,
12
),
make_tuple
(
&
vp9_high_tm_predictor_32x32_sse2
,
&
vp9_high_tm_predictor_32x32_c
,
32
,
12
),
make_tuple
(
&
vp9_high_dc_predictor_4x4_sse
,
&
vp9_high_dc_predictor_4x4_c
,
4
,
12
),
make_tuple
(
&
vp9_high_dc_predictor_8x8_sse2
,
&
vp9_high_dc_predictor_8x8_c
,
8
,
12
),
make_tuple
(
&
vp9_high_dc_predictor_16x16_sse2
,
&
vp9_high_dc_predictor_16x16_c
,
16
,
12
),
make_tuple
(
&
vp9_high_v_predictor_4x4_sse
,
&
vp9_high_v_predictor_4x4_c
,
4
,
12
),
make_tuple
(
&
vp9_high_v_predictor_8x8_sse2
,
&
vp9_high_v_predictor_8x8_c
,
8
,
12
),
make_tuple
(
&
vp9_high_v_predictor_16x16_sse2
,
&
vp9_high_v_predictor_16x16_c
,
16
,
12
),
make_tuple
(
&
vp9_high_v_predictor_32x32_sse2
,
&
vp9_high_v_predictor_32x32_c
,
32
,
12
),
make_tuple
(
&
vp9_high_tm_predictor_4x4_sse
,
&
vp9_high_tm_predictor_4x4_c
,
4
,
12
),
make_tuple
(
&
vp9_high_tm_predictor_8x8_sse2
,
&
vp9_high_tm_predictor_8x8_c
,
8
,
12
)));
#else
INSTANTIATE_TEST_CASE_P
(
SSE2_TO_C_12
,
VP9IntraPredTest
,
::
testing
::
Values
(
make_tuple
(
&
vp9_high_dc_predictor_4x4_sse
,
&
vp9_high_dc_predictor_4x4_c
,
4
,
12
),
make_tuple
(
&
vp9_high_dc_predictor_8x8_sse2
,
&
vp9_high_dc_predictor_8x8_c
,
8
,
12
),
make_tuple
(
&
vp9_high_dc_predictor_16x16_sse2
,
&
vp9_high_dc_predictor_16x16_c
,
16
,
12
),
make_tuple
(
&
vp9_high_v_predictor_4x4_sse
,
&
vp9_high_v_predictor_4x4_c
,
4
,
12
),
make_tuple
(
&
vp9_high_v_predictor_8x8_sse2
,
&
vp9_high_v_predictor_8x8_c
,
8
,
12
),
make_tuple
(
&
vp9_high_v_predictor_16x16_sse2
,
&
vp9_high_v_predictor_16x16_c
,
16
,
12
),
make_tuple
(
&
vp9_high_v_predictor_32x32_sse2
,
&
vp9_high_v_predictor_32x32_c
,
32
,
12
),
make_tuple
(
&
vp9_high_tm_predictor_4x4_sse
,
&
vp9_high_tm_predictor_4x4_c
,
4
,
12
),
make_tuple
(
&
vp9_high_tm_predictor_8x8_sse2
,
&
vp9_high_tm_predictor_8x8_c
,
8
,
12
)));
#endif
#endif // CONFIG_VP9_HIGHBITDEPTH
#endif // HAVE_SSE2
}
// namespace
vp9/common/vp9_common.h
View file @
81a8138f
...
...
@@ -65,6 +65,18 @@ static INLINE int get_unsigned_bits(unsigned int num_values) {
}
#if CONFIG_VP9_HIGHBITDEPTH
static
INLINE
uint16_t
clip_pixel_high
(
int
val
,
int
bd
)
{
switch
(
bd
)
{
case
8
:
default:
return
(
uint16_t
)
clamp
(
val
,
0
,
255
);
case
10
:
return
(
uint16_t
)
clamp
(
val
,
0
,
1023
);
case
12
:
return
(
uint16_t
)
clamp
(
val
,
0
,
4095
);
}
}
#define CONVERT_TO_SHORTPTR(x) ((uint16_t*)(((uintptr_t)x) << 1))
#define CONVERT_TO_BYTEPTR(x) ((uint8_t*)(((uintptr_t)x) >> 1 ))
#endif // CONFIG_VP9_HIGHBITDEPTH
...
...
vp9/common/vp9_reconintra.c
View file @
81a8138f
...
...
@@ -40,11 +40,291 @@ const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = {
type##_predictor(dst, stride, size, above, left); \
}
#if CONFIG_VP9_HIGHBITDEPTH
#define intra_pred_high_sized(type, size) \
void vp9_high_##type##_predictor_##size##x##size##_c( \
uint16_t *dst, ptrdiff_t stride, const uint16_t *above, \
const uint16_t *left, int bd) { \
high_##type##_predictor(dst, stride, size, above, left, bd); \
}
#define intra_pred_allsizes(type) \
intra_pred_sized(type, 4) \
intra_pred_sized(type, 8) \
intra_pred_sized(type, 16) \
intra_pred_sized(type, 32) \
intra_pred_high_sized(type, 4) \
intra_pred_high_sized(type, 8) \
intra_pred_high_sized(type, 16) \
intra_pred_high_sized(type, 32)
#else
#define intra_pred_allsizes(type) \
intra_pred_sized(type, 4) \
intra_pred_sized(type, 8) \
intra_pred_sized(type, 16) \
intra_pred_sized(type, 32)
#endif // CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH
static
INLINE
void
high_d207_predictor
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int
bs
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bd
)
{
(
void
)
above
;
(
void
)
bd
;
int
r
,
c
;
// First column.
for
(
r
=
0
;
r
<
bs
-
1
;
++
r
)
{
dst
[
r
*
stride
]
=
ROUND_POWER_OF_TWO
(
left
[
r
]
+
left
[
r
+
1
],
1
);
}
dst
[(
bs
-
1
)
*
stride
]
=
left
[
bs
-
1
];
dst
++
;
// Second column.
for
(
r
=
0
;
r
<
bs
-
2
;
++
r
)
{
dst
[
r
*
stride
]
=
ROUND_POWER_OF_TWO
(
left
[
r
]
+
left
[
r
+
1
]
*
2
+
left
[
r
+
2
],
2
);
}
dst
[(
bs
-
2
)
*
stride
]
=
ROUND_POWER_OF_TWO
(
left
[
bs
-
2
]
+
left
[
bs
-
1
]
*
3
,
2
);
dst
[(
bs
-
1
)
*
stride
]
=
left
[
bs
-
1
];
dst
++
;
// Rest of last row.
for
(
c
=
0
;
c
<
bs
-
2
;
++
c
)
dst
[(
bs
-
1
)
*
stride
+
c
]
=
left
[
bs
-
1
];
for
(
r
=
bs
-
2
;
r
>=
0
;
--
r
)
{
for
(
c
=
0
;
c
<
bs
-
2
;
++
c
)
dst
[
r
*
stride
+
c
]
=
dst
[(
r
+
1
)
*
stride
+
c
-
2
];
}
}
static
INLINE
void
high_d63_predictor
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int
bs
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bd
)
{
(
void
)
left
;
(
void
)
bd
;
int
r
,
c
;
for
(
r
=
0
;
r
<
bs
;
++
r
)
{
for
(
c
=
0
;
c
<
bs
;
++
c
)
{
dst
[
c
]
=
r
&
1
?
ROUND_POWER_OF_TWO
(
above
[
r
/
2
+
c
]
+
above
[
r
/
2
+
c
+
1
]
*
2
+
above
[
r
/
2
+
c
+
2
],
2
)
:
ROUND_POWER_OF_TWO
(
above
[
r
/
2
+
c
]
+
above
[
r
/
2
+
c
+
1
],
1
);
}
dst
+=
stride
;
}
}
static
INLINE
void
high_d45_predictor
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int
bs
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bd
)
{
(
void
)
left
;
(
void
)
bd
;
int
r
,
c
;
for
(
r
=
0
;
r
<
bs
;
++
r
)
{
for
(
c
=
0
;
c
<
bs
;
++
c
)
{
dst
[
c
]
=
r
+
c
+
2
<
bs
*
2
?
ROUND_POWER_OF_TWO
(
above
[
r
+
c
]
+
above
[
r
+
c
+
1
]
*
2
+
above
[
r
+
c
+
2
],
2
)
:
above
[
bs
*
2
-
1
];
}
dst
+=
stride
;
}
}
static
INLINE
void
high_d117_predictor
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int
bs
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bd
)
{
(
void
)
bd
;
int
r
,
c
;
// first row
for
(
c
=
0
;
c
<
bs
;
c
++
)
dst
[
c
]
=
ROUND_POWER_OF_TWO
(
above
[
c
-
1
]
+
above
[
c
],
1
);
dst
+=
stride
;
// second row
dst
[
0
]
=
ROUND_POWER_OF_TWO
(
left
[
0
]
+
above
[
-
1
]
*
2
+
above
[
0
],
2
);
for
(
c
=
1
;
c
<
bs
;
c
++
)
dst
[
c
]
=
ROUND_POWER_OF_TWO
(
above
[
c
-
2
]
+
above
[
c
-
1
]
*
2
+
above
[
c
],
2
);
dst
+=
stride
;
// the rest of first col
dst
[
0
]
=
ROUND_POWER_OF_TWO
(
above
[
-
1
]
+
left
[
0
]
*
2
+
left
[
1
],
2
);
for
(
r
=
3
;
r
<
bs
;
++
r
)
dst
[(
r
-
2
)
*
stride
]
=
ROUND_POWER_OF_TWO
(
left
[
r
-
3
]
+
left
[
r
-
2
]
*
2
+
left
[
r
-
1
],
2
);
// the rest of the block
for
(
r
=
2
;
r
<
bs
;
++
r
)
{
for
(
c
=
1
;
c
<
bs
;
c
++
)
dst
[
c
]
=
dst
[
-
2
*
stride
+
c
-
1
];
dst
+=
stride
;
}
}
static
INLINE
void
high_d135_predictor
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int
bs
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bd
)
{
(
void
)
bd
;
int
r
,
c
;
dst
[
0
]
=
ROUND_POWER_OF_TWO
(
left
[
0
]
+
above
[
-
1
]
*
2
+
above
[
0
],
2
);
for
(
c
=
1
;
c
<
bs
;
c
++
)
dst
[
c
]
=
ROUND_POWER_OF_TWO
(
above
[
c
-
2
]
+
above
[
c
-
1
]
*
2
+
above
[
c
],
2
);
dst
[
stride
]
=
ROUND_POWER_OF_TWO
(
above
[
-
1
]
+
left
[
0
]
*
2
+
left
[
1
],
2
);
for
(
r
=
2
;
r
<
bs
;
++
r
)
dst
[
r
*
stride
]
=
ROUND_POWER_OF_TWO
(
left
[
r
-
2
]
+
left
[
r
-
1
]
*
2
+
left
[
r
],
2
);
dst
+=
stride
;
for
(
r
=
1
;
r
<
bs
;
++
r
)
{
for
(
c
=
1
;
c
<
bs
;
c
++
)
dst
[
c
]
=
dst
[
-
stride
+
c
-
1
];
dst
+=
stride
;
}
}
static
INLINE
void
high_d153_predictor
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int
bs
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bd
)
{
(
void
)
bd
;
int
r
,
c
;
dst
[
0
]
=
ROUND_POWER_OF_TWO
(
above
[
-
1
]
+
left
[
0
],
1
);
for
(
r
=
1
;
r
<
bs
;
r
++
)
dst
[
r
*
stride
]
=
ROUND_POWER_OF_TWO
(
left
[
r
-
1
]
+
left
[
r
],
1
);
dst
++
;
dst
[
0
]
=
ROUND_POWER_OF_TWO
(
left
[
0
]
+
above
[
-
1
]
*
2
+
above
[
0
],
2
);
dst
[
stride
]
=
ROUND_POWER_OF_TWO
(
above
[
-
1
]
+
left
[
0
]
*
2
+
left
[
1
],
2
);
for
(
r
=
2
;
r
<
bs
;
r
++
)
dst
[
r
*
stride
]
=
ROUND_POWER_OF_TWO
(
left
[
r
-
2
]
+
left
[
r
-
1
]
*
2
+
left
[
r
],
2
);
dst
++
;
for
(
c
=
0
;
c
<
bs
-
2
;
c
++
)
dst
[
c
]
=
ROUND_POWER_OF_TWO
(
above
[
c
-
1
]
+
above
[
c
]
*
2
+
above
[
c
+
1
],
2
);
dst
+=
stride
;
for
(
r
=
1
;
r
<
bs
;
++
r
)
{
for
(
c
=
0
;
c
<
bs
-
2
;
c
++
)
dst
[
c
]
=
dst
[
-
stride
+
c
-
2
];
dst
+=
stride
;
}
}
static
INLINE
void
high_v_predictor
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int
bs
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bd
)
{
(
void
)
left
;
(
void
)
bd
;
int
r
;
for
(
r
=
0
;
r
<
bs
;
r
++
)
{
vpx_memcpy
(
dst
,
above
,
bs
*
sizeof
(
uint16_t
));
dst
+=
stride
;
}
}
static
INLINE
void
high_h_predictor
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int
bs
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bd
)
{
(
void
)
above
;
(
void
)
bd
;
int
r
;
for
(
r
=
0
;
r
<
bs
;
r
++
)
{
vpx_memset16
(
dst
,
left
[
r
],
bs
);
dst
+=
stride
;
}
}
static
INLINE
void
high_tm_predictor
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int
bs
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bd
)
{
(
void
)
bd
;
int
r
,
c
;
int
ytop_left
=
above
[
-
1
];
for
(
r
=
0
;
r
<
bs
;
r
++
)
{
for
(
c
=
0
;
c
<
bs
;
c
++
)
dst
[
c
]
=
clip_pixel_high
(
left
[
r
]
+
above
[
c
]
-
ytop_left
,
bd
);
dst
+=
stride
;
}
}
static
INLINE
void
high_dc_128_predictor
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int
bs
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bd
)
{
(
void
)
above
;
(
void
)
left
;
int
r
;
for
(
r
=
0
;
r
<
bs
;
r
++
)
{
vpx_memset16
(
dst
,
128
<<
(
bd
-
8
),
bs
);
dst
+=
stride
;
}
}
static
INLINE
void
high_dc_left_predictor
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int
bs
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bd
)
{
(
void
)
above
;
(
void
)
bd
;
int
i
,
r
,
expected_dc
,
sum
=
0
;
for
(
i
=
0
;
i
<
bs
;
i
++
)
sum
+=
left
[
i
];
expected_dc
=
(
sum
+
(
bs
>>
1
))
/
bs
;
for
(
r
=
0
;
r
<
bs
;
r
++
)
{
vpx_memset16
(
dst
,
expected_dc
,
bs
);
dst
+=
stride
;
}
}
static
INLINE
void
high_dc_top_predictor
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int
bs
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bd
)
{
(
void
)
left
;
(
void
)
bd
;
int
i
,
r
,
expected_dc
,
sum
=
0
;
for
(
i
=
0
;
i
<
bs
;
i
++
)
sum
+=
above
[
i
];
expected_dc
=
(
sum
+
(
bs
>>
1
))
/
bs
;
for
(
r
=
0
;
r
<
bs
;
r
++
)
{
vpx_memset16
(
dst
,
expected_dc
,
bs
);
dst
+=
stride
;
}
}
static
INLINE
void
high_dc_predictor
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int
bs
,
const
uint16_t
*
above
,
const
uint16_t
*
left
,
int
bd
)
{
(
void
)
bd
;
int
i
,
r
,
expected_dc
,
sum
=
0
;
const
int
count
=
2
*
bs
;
for
(
i
=
0
;
i
<
bs
;
i
++
)
{
sum
+=
above
[
i
];
sum
+=
left
[
i
];
}