Commit 57795a4c authored by Alex Converse's avatar Alex Converse

ext_partition_types: Bring into alignment with ec_multisymbol and ec_adapt

ec_multisymbol+ext_partition_types:
base_ext_types@2017-03-15T18:24:38.012Z -> 8565_3_ext_types@2017-03-17T18:29:48.794Z

   PSNR | PSNR Cb | PSNR Cr | PSNR HVS |    SSIM | MS SSIM | CIEDE 2000
-0.0346 | -0.0343 | -0.0341 |  -0.0345 | -0.0345 | -0.0344 |    -0.0345

ec_multisymbol+ec_adapt+ext_partition_types:
base_adapt_ext_types@2017-03-15T18:27:31.704Z -> 8565_3_adapt_ext_types@2017-03-17T18:30:01.108Z

   PSNR | PSNR Cb | PSNR Cr | PSNR HVS |    SSIM | MS SSIM | CIEDE 2000
-0.0422 | -0.0420 |     N/A |  -0.0425 | -0.0423 | -0.0423 |    -0.0420

Change-Id: Ia40f118f0faf546be13e02ec9ed584dd38529a59
parent c9d2fcc2
...@@ -5694,11 +5694,7 @@ void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[], ...@@ -5694,11 +5694,7 @@ void av1_average_tile_intra_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
AVERAGE_TILE_CDFS(seg.tree_cdf) AVERAGE_TILE_CDFS(seg.tree_cdf)
AVERAGE_TILE_CDFS(uv_mode_cdf) AVERAGE_TILE_CDFS(uv_mode_cdf)
#if CONFIG_EXT_PARTITION_TYPES
// FIXME
#else
AVERAGE_TILE_CDFS(partition_cdf) AVERAGE_TILE_CDFS(partition_cdf)
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_DELTA_Q #if CONFIG_DELTA_Q
AVERAGE_TILE_CDFS(delta_q_cdf) AVERAGE_TILE_CDFS(delta_q_cdf)
......
...@@ -1666,6 +1666,34 @@ static const aom_cdf_prob default_uv_mode_cdf[INTRA_MODES][CDF_SIZE( ...@@ -1666,6 +1666,34 @@ static const aom_cdf_prob default_uv_mode_cdf[INTRA_MODES][CDF_SIZE(
}; };
#endif // CONFIG_ALT_INTRA #endif // CONFIG_ALT_INTRA
#if CONFIG_EXT_PARTITION_TYPES
static const aom_cdf_prob
default_partition_cdf[PARTITION_CONTEXTS][CDF_SIZE(EXT_PARTITION_TYPES)] = {
// 8x8 -> 4x4 only supports the four legacy partition types
{ 25472, 28949, 31052, 32768, 0, 0, 0, 0, 0 },
{ 18816, 22250, 28783, 32768, 0, 0, 0, 0, 0 },
{ 18944, 26126, 29188, 32768, 0, 0, 0, 0, 0 },
{ 15488, 22508, 27077, 32768, 0, 0, 0, 0, 0 },
{ 22272, 23768, 25043, 29996, 30744, 31493, 32130, 32768, 0 },
{ 11776, 13457, 16315, 28229, 29069, 29910, 31339, 32768, 0 },
{ 10496, 14802, 16136, 27127, 29280, 31434, 32101, 32768, 0 },
{ 6784, 8763, 10440, 29110, 30100, 31090, 31929, 32768, 0 },
{ 22656, 23801, 24702, 30721, 31294, 31867, 32317, 32768, 0 },
{ 8704, 9926, 12586, 28885, 29496, 30107, 31437, 32768, 0 },
{ 6656, 10685, 11566, 27857, 29871, 31886, 32327, 32768, 0 },
{ 2176, 3012, 3690, 31253, 31671, 32090, 32429, 32768, 0 },
{ 28416, 28705, 28926, 32258, 32402, 32547, 32657, 32768, 0 },
{ 9216, 9952, 11849, 30134, 30502, 30870, 31819, 32768, 0 },
{ 7424, 9008, 9528, 30664, 31456, 32248, 32508, 32768, 0 },
{ 1280, 1710, 2069, 31978, 32193, 32409, 32588, 32768, 0 },
#if CONFIG_EXT_PARTITION
{ 28416, 28705, 28926, 32258, 32402, 32547, 32657, 32768, 0 },
{ 9216, 9952, 11849, 30134, 30502, 30870, 31819, 32768, 0 },
{ 7424, 9008, 9528, 30664, 31456, 32248, 32508, 32768, 0 },
{ 1280, 1710, 2069, 31978, 32193, 32409, 32588, 32768, 0 },
#endif
};
#else
static const aom_cdf_prob static const aom_cdf_prob
default_partition_cdf[PARTITION_CONTEXTS][CDF_SIZE(PARTITION_TYPES)] = { default_partition_cdf[PARTITION_CONTEXTS][CDF_SIZE(PARTITION_TYPES)] = {
{ 25472, 28949, 31052, 32768, 0 }, { 18816, 22250, 28783, 32768, 0 }, { 25472, 28949, 31052, 32768, 0 }, { 18816, 22250, 28783, 32768, 0 },
...@@ -1676,7 +1704,12 @@ static const aom_cdf_prob ...@@ -1676,7 +1704,12 @@ static const aom_cdf_prob
{ 6656, 14714, 16477, 32768, 0 }, { 2176, 3849, 5205, 32768, 0 }, { 6656, 14714, 16477, 32768, 0 }, { 2176, 3849, 5205, 32768, 0 },
{ 28416, 28994, 29436, 32768, 0 }, { 9216, 10688, 14483, 32768, 0 }, { 28416, 28994, 29436, 32768, 0 }, { 9216, 10688, 14483, 32768, 0 },
{ 7424, 10592, 11632, 32768, 0 }, { 1280, 2141, 2859, 32768, 0 }, { 7424, 10592, 11632, 32768, 0 }, { 1280, 2141, 2859, 32768, 0 },
#if CONFIG_EXT_PARTITION
{ 28416, 28994, 29436, 32768, 0 }, { 9216, 10688, 14483, 32768, 0 },
{ 7424, 10592, 11632, 32768, 0 }, { 1280, 2141, 2859, 32768, 0 },
#endif
}; };
#endif
static const aom_cdf_prob static const aom_cdf_prob
default_inter_mode_cdf[INTER_MODE_CONTEXTS][CDF_SIZE(INTER_MODES)] = { default_inter_mode_cdf[INTER_MODE_CONTEXTS][CDF_SIZE(INTER_MODES)] = {
...@@ -2280,7 +2313,29 @@ void av1_set_mode_cdfs(struct AV1Common *cm) { ...@@ -2280,7 +2313,29 @@ void av1_set_mode_cdfs(struct AV1Common *cm) {
av1_tree_to_cdf(av1_intra_mode_tree, fc->uv_mode_prob[i], av1_tree_to_cdf(av1_intra_mode_tree, fc->uv_mode_prob[i],
fc->uv_mode_cdf[i]); fc->uv_mode_cdf[i]);
#if CONFIG_EXT_PARTITION_TYPES #if CONFIG_EXT_PARTITION_TYPES
// FIXME for (i = 0; i < PARTITION_PLOFFSET; ++i)
av1_tree_to_cdf(av1_partition_tree, fc->partition_prob[i],
fc->partition_cdf[i]);
// Logical index (enum value) to inorder index (tree_to_cdf order)
aom_cdf_prob inorder_partition_cdf[CDF_SIZE(EXT_PARTITION_TYPES)] = {};
// TODO(aconverse): Generate this dynamically. The assumptions that
// av1_indices_from_tree() makes don't hold for this tree.
static const uint8_t av1_ext_partition_index_map[EXT_PARTITION_TYPES] = {
0, 1, 4, 7, 2, 3, 5, 6,
};
for (; i < PARTITION_CONTEXTS; ++i) {
av1_tree_to_cdf(av1_ext_partition_tree, fc->partition_prob[i],
inorder_partition_cdf);
aom_cdf_prob cum_prob = 0;
for (j = 0; j < EXT_PARTITION_TYPES; ++j) {
int inorder_idx = av1_ext_partition_index_map[j];
aom_cdf_prob prob =
inorder_partition_cdf[inorder_idx] -
(inorder_idx > 0 ? inorder_partition_cdf[inorder_idx - 1] : 0);
fc->partition_cdf[i][j] = (cum_prob += prob);
}
assert(cum_prob == CDF_PROB_TOP);
}
#else #else
for (i = 0; i < PARTITION_CONTEXTS; ++i) for (i = 0; i < PARTITION_CONTEXTS; ++i)
av1_tree_to_cdf(av1_partition_tree, fc->partition_prob[i], av1_tree_to_cdf(av1_partition_tree, fc->partition_prob[i],
......
...@@ -245,7 +245,11 @@ typedef struct frame_contexts { ...@@ -245,7 +245,11 @@ typedef struct frame_contexts {
#if CONFIG_EC_MULTISYMBOL #if CONFIG_EC_MULTISYMBOL
aom_cdf_prob y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)]; aom_cdf_prob y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)];
aom_cdf_prob uv_mode_cdf[INTRA_MODES][CDF_SIZE(INTRA_MODES)]; aom_cdf_prob uv_mode_cdf[INTRA_MODES][CDF_SIZE(INTRA_MODES)];
#if CONFIG_EXT_PARTITION_TYPES
aom_cdf_prob partition_cdf[PARTITION_CONTEXTS][CDF_SIZE(EXT_PARTITION_TYPES)];
#else
aom_cdf_prob partition_cdf[PARTITION_CONTEXTS][CDF_SIZE(PARTITION_TYPES)]; aom_cdf_prob partition_cdf[PARTITION_CONTEXTS][CDF_SIZE(PARTITION_TYPES)];
#endif
aom_cdf_prob switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS] aom_cdf_prob switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS]
[CDF_SIZE(SWITCHABLE_FILTERS)]; [CDF_SIZE(SWITCHABLE_FILTERS)];
aom_cdf_prob inter_mode_cdf[INTER_MODE_CONTEXTS][CDF_SIZE(INTER_MODES)]; aom_cdf_prob inter_mode_cdf[INTER_MODE_CONTEXTS][CDF_SIZE(INTER_MODES)];
......
...@@ -1940,8 +1940,13 @@ static PARTITION_TYPE read_partition(AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -1940,8 +1940,13 @@ static PARTITION_TYPE read_partition(AV1_COMMON *cm, MACROBLOCKD *xd,
p = (PARTITION_TYPE)aom_read_tree(r, av1_partition_tree, probs, ACCT_STR); p = (PARTITION_TYPE)aom_read_tree(r, av1_partition_tree, probs, ACCT_STR);
#endif #endif
else else
#if CONFIG_EC_MULTISYMBOL
p = (PARTITION_TYPE)aom_read_symbol(r, ec_ctx->partition_cdf[ctx],
EXT_PARTITION_TYPES, ACCT_STR);
#else
p = (PARTITION_TYPE)aom_read_tree(r, av1_ext_partition_tree, probs, p = (PARTITION_TYPE)aom_read_tree(r, av1_ext_partition_tree, probs,
ACCT_STR); ACCT_STR);
#endif
#else #else
#if CONFIG_EC_MULTISYMBOL #if CONFIG_EC_MULTISYMBOL
p = (PARTITION_TYPE)aom_read_symbol(r, ec_ctx->partition_cdf[ctx], p = (PARTITION_TYPE)aom_read_symbol(r, ec_ctx->partition_cdf[ctx],
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
static struct av1_token intra_mode_encodings[INTRA_MODES]; static struct av1_token intra_mode_encodings[INTRA_MODES];
static struct av1_token switchable_interp_encodings[SWITCHABLE_FILTERS]; static struct av1_token switchable_interp_encodings[SWITCHABLE_FILTERS];
#if CONFIG_EXT_PARTITION_TYPES #if CONFIG_EXT_PARTITION_TYPES && !CONFIG_EC_MULTISYMBOL
static const struct av1_token ext_partition_encodings[EXT_PARTITION_TYPES] = { static const struct av1_token ext_partition_encodings[EXT_PARTITION_TYPES] = {
{ 0, 1 }, { 4, 3 }, { 12, 4 }, { 7, 3 }, { 0, 1 }, { 4, 3 }, { 12, 4 }, { 7, 3 },
{ 10, 4 }, { 11, 4 }, { 26, 5 }, { 27, 5 } { 10, 4 }, { 11, 4 }, { 26, 5 }, { 27, 5 }
...@@ -2499,8 +2499,12 @@ static void write_partition(const AV1_COMMON *const cm, ...@@ -2499,8 +2499,12 @@ static void write_partition(const AV1_COMMON *const cm,
av1_write_token(w, av1_partition_tree, probs, &partition_encodings[p]); av1_write_token(w, av1_partition_tree, probs, &partition_encodings[p]);
#endif #endif
else else
#if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, p, ec_ctx->partition_cdf[ctx], EXT_PARTITION_TYPES);
#else
av1_write_token(w, av1_ext_partition_tree, probs, av1_write_token(w, av1_ext_partition_tree, probs,
&ext_partition_encodings[p]); &ext_partition_encodings[p]);
#endif // CONFIG_EC_MULTISYMBOL
#else #else
#if CONFIG_EC_MULTISYMBOL #if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, p, ec_ctx->partition_cdf[ctx], PARTITION_TYPES); aom_write_symbol(w, p, ec_ctx->partition_cdf[ctx], PARTITION_TYPES);
......
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