Commit 5bb97ed0 authored by Urvang Joshi's avatar Urvang Joshi
Browse files

ALT_INTRA experiment: Use single set of weights for SMOOTH_PRED

2nd set of weights can be derived from the 1st.

Insignificant change in BDRate.

Change-Id: I68d6fc256f532d52573583f121dd28fd8913ce3a
parent d0e23b40
......@@ -263,9 +263,9 @@ static INLINE void paeth_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
// Scale is same as 'bs'.
// TODO(urvang): Integerize the weights at a suitable precision.
#if CONFIG_TX64X64
static const double sm_weights_fwd[6][64] = {
static const double sm_weight_arrays[6][64] = {
#else
static const double sm_weights_fwd[5][32] = {
static const double sm_weight_arrays[5][32] = {
#endif // CONFIG_TX64X64
// bs = 2
{ 2, 1 },
......@@ -294,53 +294,20 @@ static const double sm_weights_fwd[5][32] = {
#endif // CONFIG_TX64X64
};
#if CONFIG_TX64X64
static const double sm_weights_rev[6][64] = {
#else
static const double sm_weights_rev[5][32] = {
#endif // CONFIG_TX64X64
// bs = 2
{ 0, 1 },
// bs = 4
{ 0, 1.66667, 2.66667, 3 },
// bs = 8
{ 0, 1.85714, 3.42857, 4.71429, 5.71429, 6.42857, 6.85714, 7 },
// bs = 16
{ 0, 1.93333, 3.73333, 5.4, 6.93333, 8.33333, 9.6, 10.7333, 11.7333, 12.6,
13.3333, 13.9333, 14.4, 14.7333, 14.9333, 15 },
// bs = 32
{ 0, 1.96774, 3.87097, 5.70968, 7.48387, 9.19355, 10.8387, 12.4194,
13.9355, 15.3871, 16.7742, 18.0968, 19.3548, 20.5484, 21.6774, 22.7419,
23.7419, 24.6774, 25.5484, 26.3548, 27.0968, 27.7742, 28.3871, 28.9355,
29.4194, 29.8387, 30.1935, 30.4839, 30.7097, 30.871, 30.9677, 31 },
#if CONFIG_TX64X64
// bs = 64
{ 0, 1.98413, 3.93651, 5.85714, 7.74603, 9.60317, 11.4286, 13.2222,
14.9841, 16.7143, 18.4127, 20.0794, 21.7143, 23.3175, 24.8889, 26.4286,
27.9365, 29.4127, 30.8571, 32.2698, 33.6508, 35, 36.3175, 37.6032,
38.8571, 40.0794, 41.2698, 42.4286, 43.5556, 44.6508, 45.7143, 46.746,
47.746, 48.7143, 49.6508, 50.5556, 51.4286, 52.2698, 53.0794, 53.8571,
54.6032, 55.3175, 56, 56.6508, 57.2698, 57.8571, 58.4127, 58.9365,
59.4286, 59.8889, 60.3175, 60.7143, 61.0794, 61.4127, 61.7143, 61.9841,
62.2222, 62.4286, 62.6032, 62.746, 62.8571, 62.9365, 62.9841, 63 },
#endif // CONFIG_TX64X64
};
static INLINE void smooth_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
const uint8_t *above, const uint8_t *left) {
const uint8_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
const uint8_t right_pred = above[bs - 1]; // estimated by top-right pixel
const int arr_index = (int)lround(log2(bs)) - 1;
const double *const fwd_weights = sm_weights_fwd[arr_index];
const double *const rev_weights = sm_weights_rev[arr_index];
const double *const sm_weights = sm_weight_arrays[arr_index];
const double scale = 2.0 * bs;
int r;
for (r = 0; r < bs; ++r) {
int c;
for (c = 0; c < bs; ++c) {
const int pixels[] = { above[c], below_pred, left[r], right_pred };
const double weights[] = { fwd_weights[r], rev_weights[r], fwd_weights[c],
rev_weights[c] };
const double weights[] = { sm_weights[r], bs - sm_weights[r],
sm_weights[c], bs - sm_weights[c] };
double this_pred = 0;
int i;
for (i = 0; i < 4; ++i) {
......@@ -1061,16 +1028,15 @@ static INLINE void highbd_smooth_predictor(uint16_t *dst, ptrdiff_t stride,
const uint16_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
const uint16_t right_pred = above[bs - 1]; // estimated by top-right pixel
const int arr_index = (int)lround(log2(bs)) - 1;
const double *const fwd_weights = sm_weights_fwd[arr_index];
const double *const rev_weights = sm_weights_rev[arr_index];
const double *const sm_weights = sm_weight_arrays[arr_index];
const double scale = 2.0 * bs;
int r;
for (r = 0; r < bs; ++r) {
int c;
for (c = 0; c < bs; ++c) {
const int pixels[] = { above[c], below_pred, left[r], right_pred };
const double weights[] = { fwd_weights[r], rev_weights[r], fwd_weights[c],
rev_weights[c] };
const double weights[] = { sm_weights[r], bs - sm_weights[r],
sm_weights[c], bs - sm_weights[c] };
double this_pred = 0;
int i;
for (i = 0; i < 4; ++i) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment