Commit 6be4a54b authored by Urvang Joshi's avatar Urvang Joshi

Add a new intra prediction mode "smooth".

This is added as part of ALT_INTRA experiment.

This uses interpolation between top row and estimated bottom row; as
well as left column and estimated right column to generate the
predicted block.The interpolation is done using a predefined weight
array.

Based on experiments, the currently chosen weight array was created
to represent a quadratic curve, but can be tuned further if needed.

Improvement from baseline on Derf set:
ALL Keyframes: 1.279%

Improvement from existing ALT_INTRA:
ALL Keyframes: 1.146%

Change-Id: I12637fa1b91bd836f1c59b27d6caee2004acbdd4
parent 862c1e5d
......@@ -139,6 +139,8 @@ specialize qw/aom_ve_predictor_4x4/;
if ((aom_config("CONFIG_ALT_INTRA") eq "yes")) {
add_proto qw/void aom_paeth_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void aom_smooth_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
} else {
add_proto qw/void aom_tm_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/aom_tm_predictor_4x4 neon dspr2 msa sse2/;
......@@ -191,6 +193,8 @@ specialize qw/aom_v_predictor_8x8 neon msa sse2/;
if ((aom_config("CONFIG_ALT_INTRA") eq "yes")) {
add_proto qw/void aom_paeth_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void aom_smooth_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
} else {
add_proto qw/void aom_tm_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/aom_tm_predictor_8x8 neon dspr2 msa sse2/;
......@@ -243,12 +247,13 @@ specialize qw/aom_v_predictor_16x16 neon msa sse2/;
if ((aom_config("CONFIG_ALT_INTRA") eq "yes")) {
add_proto qw/void aom_paeth_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void aom_smooth_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
} else {
add_proto qw/void aom_tm_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/aom_tm_predictor_16x16 neon msa sse2/;
} # CONFIG_ALT_INTRA
add_proto qw/void aom_dc_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/aom_dc_predictor_16x16 dspr2 neon msa sse2/;
......@@ -296,12 +301,13 @@ specialize qw/aom_v_predictor_32x32 neon msa sse2/;
if ((aom_config("CONFIG_ALT_INTRA") eq "yes")) {
add_proto qw/void aom_paeth_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void aom_smooth_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
} else {
add_proto qw/void aom_tm_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/aom_tm_predictor_32x32 neon msa sse2/;
} # CONFIG_ALT_INTRA
add_proto qw/void aom_dc_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/aom_dc_predictor_32x32 msa neon sse2/;
......@@ -351,6 +357,7 @@ if ((aom_config("CONFIG_TX64X64") eq "yes")) {
if ((aom_config("CONFIG_ALT_INTRA") eq "yes")) {
add_proto qw/void aom_paeth_predictor_64x64/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/aom_paeth_predictor_64x64/;
add_proto qw/void aom_smooth_predictor_64x64/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
} else {
add_proto qw/void aom_tm_predictor_64x64/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/aom_tm_predictor_64x64/;
......@@ -407,12 +414,13 @@ if (aom_config("CONFIG_AOM_HIGHBITDEPTH") eq "yes") {
if ((aom_config("CONFIG_ALT_INTRA") eq "yes")) {
add_proto qw/void aom_highbd_paeth_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void aom_highbd_smooth_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
} else {
add_proto qw/void aom_highbd_tm_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/aom_highbd_tm_predictor_4x4 sse2/;
} # CONFIG_ALT_INTRA
add_proto qw/void aom_highbd_dc_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/aom_highbd_dc_predictor_4x4 sse2/;
......@@ -460,6 +468,8 @@ if (aom_config("CONFIG_AOM_HIGHBITDEPTH") eq "yes") {
if ((aom_config("CONFIG_ALT_INTRA") eq "yes")) {
add_proto qw/void aom_highbd_paeth_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void aom_highbd_smooth_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
} else {
add_proto qw/void aom_highbd_tm_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/aom_highbd_tm_predictor_8x8 sse2/;
......@@ -512,6 +522,8 @@ if (aom_config("CONFIG_AOM_HIGHBITDEPTH") eq "yes") {
if ((aom_config("CONFIG_ALT_INTRA") eq "yes")) {
add_proto qw/void aom_highbd_paeth_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void aom_highbd_smooth_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
} else {
add_proto qw/void aom_highbd_tm_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/aom_highbd_tm_predictor_16x16 sse2/;
......@@ -564,6 +576,8 @@ if (aom_config("CONFIG_AOM_HIGHBITDEPTH") eq "yes") {
if ((aom_config("CONFIG_ALT_INTRA") eq "yes")) {
add_proto qw/void aom_highbd_paeth_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void aom_highbd_smooth_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
} else {
add_proto qw/void aom_highbd_tm_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/aom_highbd_tm_predictor_32x32 sse2/;
......@@ -617,6 +631,7 @@ if (aom_config("CONFIG_AOM_HIGHBITDEPTH") eq "yes") {
if ((aom_config("CONFIG_ALT_INTRA") eq "yes")) {
add_proto qw/void aom_highbd_paeth_predictor_64x64/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void aom_highbd_smooth_predictor_64x64/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
} else {
add_proto qw/void aom_highbd_tm_predictor_64x64/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/aom_highbd_tm_predictor_64x64/;
......
......@@ -9,6 +9,8 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include <math.h>
#include "./aom_config.h"
#include "./aom_dsp_rtcd.h"
......@@ -257,6 +259,99 @@ static INLINE void paeth_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
}
}
// Weights are quadratic from 'bs' to '1'.
// 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] = {
#else
static const double sm_weights_fwd[5][32] = {
#endif // CONFIG_TX64X64
// bs = 2
{ 2, 1 },
// bs = 4
{ 4, 2.33333, 1.33333, 1 },
// bs = 8
{ 8, 6.14286, 4.57143, 3.28571, 2.28571, 1.57143, 1.14286, 1 },
// bs = 16
{ 16, 14.0667, 12.2667, 10.6, 9.06667, 7.66667, 6.4, 5.26667, 4.26667, 3.4,
2.66667, 2.06667, 1.6, 1.26667, 1.06667, 1 },
// bs = 32
{ 32, 30.0323, 28.129, 26.2903, 24.5161, 22.8065, 21.1613, 19.5806,
18.0645, 16.6129, 15.2258, 13.9032, 12.6452, 11.4516, 10.3226, 9.25806,
8.25806, 7.32258, 6.45161, 5.64516, 4.90323, 4.22581, 3.6129, 3.06452,
2.58065, 2.16129, 1.80645, 1.51613, 1.29032, 1.12903, 1.03226, 1 },
#if CONFIG_TX64X64
// bs = 64
{ 64, 62.0159, 60.0635, 58.1429, 56.254, 54.3968, 52.5714, 50.7778,
49.0159, 47.2857, 45.5873, 43.9206, 42.2857, 40.6825, 39.1111, 37.5714,
36.0635, 34.5873, 33.1429, 31.7302, 30.3492, 29, 27.6825, 26.3968,
25.1429, 23.9206, 22.7302, 21.5714, 20.4444, 19.3492, 18.2857, 17.254,
16.254, 15.2857, 14.3492, 13.4444, 12.5714, 11.7302, 10.9206, 10.1429,
9.39683, 8.68254, 8, 7.34921, 6.73016, 6.14286, 5.5873, 5.06349,
4.57143, 4.11111, 3.68254, 3.28571, 2.92063, 2.5873, 2.28571, 2.01587,
1.77778, 1.57143, 1.39683, 1.25397, 1.14286, 1.06349, 1.01587, 1 },
#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 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] };
double this_pred = 0;
int i;
for (i = 0; i < 4; ++i) {
this_pred += weights[i] * pixels[i];
}
dst[c] = clip_pixel(lround(this_pred / scale));
}
dst += stride;
}
}
#else
static INLINE void tm_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
......@@ -874,6 +969,33 @@ static INLINE void highbd_paeth_predictor(uint16_t *dst, ptrdiff_t stride,
}
}
static INLINE void highbd_smooth_predictor(uint16_t *dst, ptrdiff_t stride,
int bs, const uint16_t *above,
const uint16_t *left, int bd) {
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 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] };
double this_pred = 0;
int i;
for (i = 0; i < 4; ++i) {
this_pred += weights[i] * pixels[i];
}
dst[c] = clip_pixel_highbd(lround(this_pred / scale), bd);
}
dst += stride;
}
}
#else
static INLINE void highbd_tm_predictor(uint16_t *dst, ptrdiff_t stride, int bs,
const uint16_t *above,
......@@ -1065,6 +1187,7 @@ intra_pred_allsizes(v)
intra_pred_allsizes(h)
#if CONFIG_ALT_INTRA
intra_pred_allsizes(paeth)
intra_pred_allsizes(smooth)
#else
intra_pred_allsizes(tm)
#endif // CONFIG_ALT_INTRA
......
......@@ -500,6 +500,9 @@ static const TX_TYPE intra_mode_to_tx_type_context[INTRA_MODES] = {
DCT_ADST, // D153
DCT_ADST, // D207
ADST_DCT, // D63
#if CONFIG_ALT_INTRA
ADST_ADST, // SMOOTH
#endif // CONFIG_ALT_INTRA
ADST_ADST, // TM
};
......
......@@ -16,6 +16,192 @@
#include "av1/common/onyxc_int.h"
#include "av1/common/seg_common.h"
#if CONFIG_DAALA_EC
aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES][INTRA_MODES];
#endif
#if CONFIG_ALT_INTRA
const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = {
{
// above = dc
{ 121, 30, 54, 128, 164, 158, 45, 41, 57, 91 }, // left = dc
{ 91, 38, 101, 102, 124, 141, 49, 48, 45, 73 }, // left = v
{ 66, 28, 27, 177, 225, 178, 32, 27, 52, 114 }, // left = h
{ 106, 23, 50, 101, 134, 148, 64, 50, 49, 107 }, // left = d45
{ 75, 24, 32, 118, 66, 143, 42, 28, 57, 74 }, // left = d135
{ 95, 24, 40, 142, 56, 141, 72, 121, 129, 255 }, // left = d117
{ 71, 14, 25, 126, 117, 201, 28, 21, 117, 89 }, // left = d153
{ 85, 16, 37, 110, 163, 178, 41, 28, 48, 134 }, // left = d207
{ 86, 25, 32, 83, 105, 133, 58, 81, 46, 95 }, // left = d63
{ 79, 25, 38, 75, 150, 255, 30, 49, 34, 51 }, // left = smooth
{ 68, 59, 48, 122, 193, 158, 43, 46, 46, 112 }, // left = paeth
},
{
// above = v
{ 66, 21, 118, 111, 145, 107, 27, 50, 27, 54 }, // left = dc
{ 52, 25, 167, 81, 120, 101, 34, 55, 19, 32 }, // left = v
{ 56, 18, 72, 134, 208, 139, 31, 34, 27, 89 }, // left = h
{ 75, 21, 94, 88, 134, 123, 49, 57, 30, 68 }, // left = d45
{ 54, 18, 95, 96, 78, 107, 33, 49, 28, 65 }, // left = d135
{ 61, 19, 121, 131, 58, 101, 56, 143, 120, 255 }, // left = d117
{ 53, 13, 78, 103, 110, 147, 31, 41, 64, 77 }, // left = d153
{ 69, 14, 78, 93, 167, 121, 31, 39, 25, 113 }, // left = d207
{ 64, 18, 103, 79, 90, 108, 34, 73, 27, 69 }, // left = d63
{ 52, 20, 103, 61, 161, 255, 22, 42, 16, 35 }, // left = smooth
{ 50, 31, 124, 92, 161, 120, 50, 53, 23, 60 }, // left = paeth
},
{
// above = h
{ 94, 29, 31, 158, 214, 178, 35, 31, 72, 111 }, // left = dc
{ 72, 37, 72, 149, 184, 177, 43, 40, 53, 105 }, // left = v
{ 53, 21, 14, 196, 242, 209, 29, 19, 55, 145 }, // left = h
{ 93, 36, 36, 104, 176, 166, 56, 37, 49, 141 }, // left = d45
{ 84, 32, 27, 124, 108, 143, 38, 36, 76, 134 }, // left = d135
{ 82, 31, 47, 142, 122, 161, 83, 73, 126, 255 }, // left = d117
{ 66, 16, 20, 133, 148, 210, 30, 17, 113, 104 }, // left = d153
{ 76, 16, 17, 129, 207, 181, 41, 20, 46, 163 }, // left = d207
{ 72, 38, 21, 100, 142, 171, 37, 70, 49, 111 }, // left = d63
{ 61, 30, 27, 115, 208, 255, 27, 31, 44, 63 }, // left = smooth
{ 53, 45, 29, 157, 222, 185, 49, 37, 55, 102 }, // left = paeth
},
{
// above = d45
{ 96, 18, 37, 98, 138, 154, 68, 56, 59, 96 }, // left = dc
{ 73, 18, 92, 81, 125, 132, 75, 64, 27, 67 }, // left = v
{ 73, 17, 27, 128, 213, 154, 56, 44, 32, 105 }, // left = h
{ 101, 20, 21, 75, 138, 138, 82, 56, 23, 154 }, // left = d45
{ 71, 15, 33, 91, 70, 150, 62, 55, 38, 118 }, // left = d135
{ 80, 19, 38, 116, 69, 122, 88, 132, 92, 255 }, // left = d117
{ 68, 11, 22, 101, 116, 179, 52, 44, 85, 96 }, // left = d153
{ 101, 8, 59, 77, 151, 170, 53, 41, 35, 172 }, // left = d207
{ 82, 19, 24, 81, 172, 129, 82, 128, 43, 108 }, // left = d63
{ 66, 18, 42, 64, 143, 255, 52, 52, 25, 83 }, // left = smooth
{ 57, 24, 42, 85, 169, 145, 104, 71, 34, 86 }, // left = paeth
},
{
// above = d135
{ 85, 15, 29, 113, 83, 176, 26, 29, 70, 110 }, // left = dc
{ 78, 28, 49, 111, 91, 141, 30, 42, 48, 75 }, // left = v
{ 56, 21, 16, 146, 190, 178, 23, 31, 49, 92 }, // left = h
{ 70, 19, 20, 65, 90, 173, 97, 36, 57, 98 }, // left = d45
{ 77, 14, 26, 110, 51, 156, 34, 35, 54, 74 }, // left = d135
{ 78, 18, 36, 153, 47, 131, 62, 102, 155, 255 }, // left = d117
{ 56, 11, 15, 115, 85, 196, 32, 45, 81, 96 }, // left = d153
{ 90, 18, 24, 95, 126, 159, 34, 31, 46, 136 }, // left = d207
{ 80, 23, 28, 90, 75, 141, 39, 50, 46, 87 }, // left = d63
{ 63, 22, 31, 91, 110, 255, 26, 43, 51, 51 }, // left = smooth
{ 66, 32, 31, 122, 145, 165, 40, 43, 56, 79 }, // left = paeth
},
{
// above = d117
{ 81, 16, 61, 170, 74, 105, 54, 105, 113, 255 }, // left = dc
{ 74, 20, 86, 163, 64, 97, 65, 129, 101, 255 }, // left = v
{ 63, 15, 47, 168, 141, 176, 69, 77, 77, 255 }, // left = h
{ 70, 17, 59, 97, 78, 114, 74, 122, 80, 255 }, // left = d45
{ 78, 13, 50, 153, 34, 126, 75, 114, 120, 255 }, // left = d135
{ 72, 16, 69, 159, 28, 108, 63, 134, 107, 255 }, // left = d117
{ 66, 9, 47, 131, 79, 148, 41, 88, 105, 255 }, // left = d153
{ 78, 12, 60, 119, 105, 133, 47, 95, 63, 255 }, // left = d207
{ 82, 21, 58, 128, 61, 98, 64, 136, 91, 255 }, // left = d63
{ 23, 26, 28, 96, 85, 128, 51, 64, 85, 128 }, // left = smooth
{ 58, 27, 62, 162, 109, 151, 75, 106, 78, 255 }, // left = paeth
},
{
// above = d153
{ 91, 18, 25, 121, 166, 173, 25, 25, 128, 102 }, // left = dc
{ 80, 27, 51, 111, 141, 147, 45, 38, 70, 85 }, // left = v
{ 53, 12, 11, 154, 197, 225, 17, 17, 74, 145 }, // left = h
{ 93, 27, 23, 111, 143, 188, 43, 39, 69, 112 }, // left = d45
{ 83, 15, 21, 118, 67, 178, 40, 33, 73, 92 }, // left = d135
{ 94, 13, 31, 132, 66, 110, 61, 82, 148, 255 }, // left = d117
{ 76, 9, 11, 96, 105, 201, 16, 13, 157, 97 }, // left = d153
{ 70, 10, 12, 100, 172, 201, 23, 17, 53, 158 }, // left = d207
{ 114, 25, 21, 104, 108, 163, 30, 47, 53, 111 }, // left = d63
{ 70, 16, 21, 80, 157, 255, 25, 30, 81, 69 }, // left = smooth
{ 87, 32, 26, 120, 191, 168, 32, 33, 70, 118 }, // left = paeth
},
{
// above = d207
{ 98, 20, 39, 122, 168, 188, 38, 36, 54, 132 }, // left = dc
{ 81, 37, 62, 97, 122, 153, 38, 43, 36, 118 }, // left = v
{ 71, 21, 22, 154, 227, 183, 37, 31, 46, 140 }, // left = h
{ 90, 34, 19, 93, 144, 194, 65, 47, 41, 163 }, // left = d45
{ 78, 20, 27, 91, 93, 173, 57, 52, 49, 113 }, // left = d135
{ 79, 25, 45, 121, 101, 147, 69, 56, 122, 255 }, // left = d117
{ 73, 13, 19, 105, 122, 206, 40, 28, 91, 126 }, // left = d153
{ 101, 14, 22, 87, 153, 169, 33, 25, 26, 175 }, // left = d207
{ 81, 28, 23, 86, 115, 169, 48, 56, 41, 111 }, // left = d63
{ 70, 24, 30, 90, 180, 255, 38, 26, 36, 82 }, // left = smooth
{ 61, 37, 30, 94, 189, 163, 76, 50, 36, 127 }, // left = paeth
},
{
// above = d63
{ 77, 13, 46, 86, 138, 117, 55, 88, 34, 68 }, // left = dc
{ 68, 17, 80, 64, 105, 108, 66, 115, 32, 45 }, // left = v
{ 62, 13, 37, 124, 210, 131, 46, 57, 28, 103 }, // left = h
{ 88, 15, 45, 73, 134, 145, 73, 101, 37, 87 }, // left = d45
{ 68, 16, 35, 78, 81, 133, 54, 71, 33, 67 }, // left = d135
{ 71, 16, 57, 108, 61, 135, 71, 184, 113, 255 }, // left = d117
{ 55, 10, 27, 69, 107, 158, 39, 76, 82, 95 }, // left = d153
{ 80, 9, 38, 78, 153, 145, 50, 63, 28, 123 }, // left = d207
{ 86, 12, 33, 49, 107, 135, 64, 134, 57, 89 }, // left = d63
{ 56, 19, 55, 60, 163, 255, 38, 84, 22, 36 }, // left = smooth
{ 53, 17, 60, 69, 151, 126, 73, 113, 26, 80 }, // left = paeth
},
{
// above = smooth
{ 79, 16, 46, 89, 167, 255, 22, 36, 29, 42 }, // left = dc
{ 63, 22, 88, 71, 131, 255, 26, 41, 21, 35 }, // left = v
{ 51, 18, 28, 142, 232, 255, 26, 25, 25, 75 }, // left = h
{ 75, 18, 43, 70, 140, 255, 37, 49, 34, 89 }, // left = d45
{ 70, 14, 35, 87, 83, 255, 30, 36, 34, 50 }, // left = d135
{ 23, 26, 28, 96, 85, 128, 51, 64, 85, 128 }, // left = d117
{ 74, 12, 33, 83, 128, 255, 27, 33, 58, 68 }, // left = d153
{ 66, 11, 30, 77, 179, 255, 21, 27, 23, 113 }, // left = d207
{ 68, 22, 40, 65, 118, 255, 28, 61, 30, 50 }, // left = d63
{ 60, 18, 44, 69, 141, 255, 18, 32, 22, 40 }, // left = smooth
{ 52, 32, 54, 96, 194, 255, 33, 37, 25, 53 }, // left = paeth
},
{
// above = paeth
{ 76, 47, 67, 123, 182, 150, 41, 52, 55, 97 }, // left = dc
{ 69, 40, 125, 102, 138, 138, 42, 55, 32, 70 }, // left = v
{ 46, 28, 27, 160, 232, 169, 34, 21, 32, 122 }, // left = h
{ 78, 35, 41, 99, 128, 124, 49, 43, 35, 111 }, // left = d45
{ 66, 28, 47, 100, 113, 145, 37, 40, 72, 93 }, // left = d135
{ 77, 37, 76, 134, 124, 124, 65, 122, 88, 255 }, // left = d117
{ 53, 23, 38, 108, 128, 204, 26, 32, 115, 114 }, // left = d153
{ 65, 20, 29, 101, 202, 186, 29, 24, 29, 188 }, // left = d207
{ 71, 24, 49, 81, 126, 151, 36, 65, 28, 93 }, // left = d63
{ 54, 36, 53, 94, 193, 255, 25, 38, 20, 64 }, // left = smooth
{ 52, 54, 60, 108, 176, 168, 47, 44, 50, 105 }, // left = paeth
},
};
static const aom_prob default_if_y_probs[BLOCK_SIZE_GROUPS][INTRA_MODES - 1] = {
{ 88, 16, 47, 133, 143, 150, 70, 48, 84, 122 }, // block_size < 8x8
{ 75, 26, 51, 120, 158, 157, 44, 45, 56, 102 }, // block_size < 16x16
{ 73, 24, 60, 115, 184, 164, 26, 36, 32, 63 }, // block_size < 32x32
{ 96, 27, 50, 107, 221, 148, 16, 22, 14, 39 }, // block_size >= 32x32
};
static const aom_prob default_uv_probs[INTRA_MODES][INTRA_MODES - 1] = {
{ 199, 3, 79, 179, 220, 109, 38, 50, 68, 138 }, // y = dc
{ 17, 2, 219, 136, 131, 58, 21, 106, 23, 41 }, // y = v
{ 26, 1, 5, 244, 253, 138, 16, 21, 68, 205 }, // y = h
{ 183, 3, 66, 94, 195, 97, 101, 104, 41, 178 }, // y = d45
{ 178, 2, 36, 158, 99, 175, 21, 29, 105, 77 }, // y = d135
{ 154, 3, 65, 219, 40, 48, 45, 95, 146, 255 }, // y = d117
{ 167, 1, 16, 160, 214, 187, 10, 10, 200, 155 }, // y = d153
{ 154, 2, 18, 178, 238, 132, 25, 21, 34, 221 }, // y = d207
{ 153, 4, 76, 85, 157, 90, 38, 165, 46, 104 }, // y = d63
{ 163, 3, 68, 87, 190, 255, 19, 27, 25, 46 }, // y = smooth
{ 185, 7, 113, 171, 203, 57, 18, 69, 49, 104 }, // y = paeth
};
#else
const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = {
{
// above = dc
......@@ -148,9 +334,6 @@ const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = {
{ 43, 81, 53, 140, 169, 204, 68, 84, 72 } // left = tm
}
};
#if CONFIG_DAALA_EC
aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES][INTRA_MODES];
#endif
static const aom_prob default_if_y_probs[BLOCK_SIZE_GROUPS][INTRA_MODES - 1] = {
{ 65, 32, 18, 144, 162, 194, 41, 51, 98 }, // block_size < 8x8
......@@ -172,6 +355,8 @@ static const aom_prob default_uv_probs[INTRA_MODES][INTRA_MODES - 1] = {
{ 101, 21, 107, 181, 192, 103, 19, 67, 125 } // y = tm
};
#endif // CONFIG_ALT_INTRA
#if CONFIG_EXT_PARTITION_TYPES
static const aom_prob
default_partition_probs[PARTITION_CONTEXTS][EXT_PARTITION_TYPES - 1] = {
......@@ -383,6 +568,20 @@ int av1_inter_mode_ind[INTER_MODES];
int av1_inter_mode_inv[INTER_MODES];
/* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */
#if CONFIG_ALT_INTRA
const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
-DC_PRED, 2, /* 0 = DC_NODE */
-TM_PRED, 4, /* 1 = TM_NODE */
-V_PRED, 6, /* 2 = V_NODE */
8, 12, /* 3 = COM_NODE */
-H_PRED, 10, /* 4 = H_NODE */
-D135_PRED, -D117_PRED, /* 5 = D135_NODE */
-D45_PRED, 14, /* 6 = D45_NODE */
-D63_PRED, 16, /* 7 = D63_NODE */
-D153_PRED, 18, /* 8 = D153_NODE */
-D207_PRED, -SMOOTH_PRED, /* 9 = D207_NODE */
};
#else
const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
-DC_PRED, 2, /* 0 = DC_NODE */
-TM_PRED, 4, /* 1 = TM_NODE */
......@@ -394,6 +593,7 @@ const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
-D63_PRED, 16, /* 7 = D63_NODE */
-D153_PRED, -D207_PRED /* 8 = D153_NODE */
};
#endif // CONFIG_ALT_INTRA
const aom_tree_index av1_inter_mode_tree[TREE_SIZE(INTER_MODES)] = {
-INTER_OFFSET(ZEROMV), 2,
......
......@@ -290,7 +290,10 @@ typedef enum ATTRIBUTE_PACKED {
D153_PRED, // Directional 153 deg = 180 - 27
D207_PRED, // Directional 207 deg = 180 + 27
D63_PRED, // Directional 63 deg = round(arctan(2/1) * 180/pi)
TM_PRED, // True-motion
#if CONFIG_ALT_INTRA
SMOOTH_PRED, // Combination of horizontal and vertical interpolation
#endif // CONFIG_ALT_INTRA
TM_PRED, // True-motion
NEARESTMV,
NEARMV,
ZEROMV,
......@@ -323,6 +326,8 @@ typedef enum {
MOTION_MODES
} MOTION_MODE;
// TODO(urvang): Make "CONFIG_ALT_INTRA" work with "CONFIG_EXT_INTER".
#if CONFIG_EXT_INTER
typedef enum {
II_DC_PRED = 0,
......@@ -345,6 +350,8 @@ typedef enum {
} COMPOUND_TYPE;
#endif // CONFIG_EXT_INTER
// TODO(urvang): Make "CONFIG_ALT_INTRA" work with "CONFIG_FILTER_INTRA".
#if CONFIG_FILTER_INTRA
typedef enum {
FILTER_DC_PRED,
......
......@@ -43,6 +43,9 @@ static const uint8_t extend_modes[INTRA_MODES] = {
NEED_LEFT | NEED_ABOVE | NEED_ABOVELEFT, // D153
NEED_LEFT | NEED_BOTTOMLEFT, // D207
NEED_ABOVE | NEED_ABOVERIGHT, // D63
#if CONFIG_ALT_INTRA
NEED_LEFT | NEED_ABOVE, // SMOOTH
#endif // CONFIG_ALT_INTRA
NEED_LEFT | NEED_ABOVE | NEED_ABOVELEFT, // TM
};
......@@ -350,6 +353,7 @@ static void av1_init_intra_predictors_internal(void) {
#if CONFIG_ALT_INTRA
INIT_ALL_SIZES(pred[TM_PRED], paeth);
INIT_ALL_SIZES(pred[SMOOTH_PRED], smooth);
#else
INIT_ALL_SIZES(pred[TM_PRED], tm);
#endif // CONFIG_ALT_INTRA
......@@ -371,6 +375,7 @@ static void av1_init_intra_predictors_internal(void) {
#if CONFIG_ALT_INTRA
INIT_ALL_SIZES(pred_high[TM_PRED], highbd_paeth);
INIT_ALL_SIZES(pred_high[SMOOTH_PRED], highbd_smooth);
#else
INIT_ALL_SIZES(pred_high[TM_PRED], highbd_tm);
#endif // CONFIG_ALT_INTRA
......
......@@ -1136,11 +1136,19 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td,
(unsigned int *)cpi->mode_chosen_counts; // Cast const away.
if (frame_is_intra_only(cm)) {
static const int kf_mode_index[] = {
THR_DC /*DC_PRED*/, THR_V_PRED /*V_PRED*/,
THR_H_PRED /*H_PRED*/, THR_D45_PRED /*D45_PRED*/,
THR_D135_PRED /*D135_PRED*/, THR_D117_PRED /*D117_PRED*/,
THR_D153_PRED /*D153_PRED*/, THR_D207_PRED /*D207_PRED*/,
THR_D63_PRED /*D63_PRED*/, THR_TM /*TM_PRED*/,
THR_DC /*DC_PRED*/,
THR_V_PRED /*V_PRED*/,
THR_H_PRED /*H_PRED*/,
THR_D45_PRED /*D45_PRED*/,
THR_D135_PRED /*D135_PRED*/,
THR_D117_PRED /*D117_PRED*/,
THR_D153_PRED /*D153_PRED*/,
THR_D207_PRED /*D207_PRED*/,
THR_D63_PRED /*D63_PRED*/,
#if CONFIG_ALT_INTRA
THR_SMOOTH, /*SMOOTH_PRED*/
#endif // CONFIG_ALT_INTRA
THR_TM /*TM_PRED*/,
};
++mode_chosen_counts[kf_mode_index[mbmi->mode]];
} else {
......
......@@ -44,24 +44,6 @@ extern "C" {
#define INVALID_MV 0x80008000
#if CONFIG_EXT_REFS
#if CONFIG_EXT_INTER
#define MAX_MODES 144
#else // CONFIG_EXT_INTER
#define MAX_MODES 66
#endif // CONFIG_EXT_INTER