Super transform - ported from nextgen branch
Various additional changes were made to make the experiment compatible with misc_fixes. derflr: +0.979% hevcmr: +0.865% Speed-wise with --enable-supertx the encoder is only about 10% slower than without. Decoding impact is about 30% slowdown. Note this does not work with ext-tx or var-tx yet. That is a TODO. Change-Id: If25af4241a7a9efbd28f58eda3c4f044c7a7ef4b
This commit is contained in:
@@ -45,6 +45,8 @@ typedef enum {
|
|||||||
#define IsInterpolatingFilter(filter) (1)
|
#define IsInterpolatingFilter(filter) (1)
|
||||||
#endif // CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
|
#endif // CONFIG_EXT_INTERP && SUPPORT_NONINTERPOLATING_FILTERS
|
||||||
|
|
||||||
|
#define MAXTXLEN 32
|
||||||
|
|
||||||
static INLINE int is_inter_mode(PREDICTION_MODE mode) {
|
static INLINE int is_inter_mode(PREDICTION_MODE mode) {
|
||||||
return mode >= NEARESTMV && mode <= NEWMV;
|
return mode >= NEARESTMV && mode <= NEWMV;
|
||||||
}
|
}
|
||||||
@@ -291,6 +293,14 @@ static const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = {
|
|||||||
ADST_ADST, // TM
|
ADST_ADST, // TM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
static INLINE int supertx_enabled(const MB_MODE_INFO *mbmi) {
|
||||||
|
return (int)mbmi->tx_size >
|
||||||
|
VPXMIN(b_width_log2_lookup[mbmi->sb_type],
|
||||||
|
b_height_log2_lookup[mbmi->sb_type]);
|
||||||
|
}
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
#if CONFIG_EXT_TX
|
#if CONFIG_EXT_TX
|
||||||
#define ALLOW_INTRA_EXT_TX 1
|
#define ALLOW_INTRA_EXT_TX 1
|
||||||
|
|
||||||
@@ -469,8 +479,18 @@ static INLINE TX_SIZE get_uv_tx_size_impl(TX_SIZE y_tx_size, BLOCK_SIZE bsize,
|
|||||||
|
|
||||||
static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi,
|
static INLINE TX_SIZE get_uv_tx_size(const MB_MODE_INFO *mbmi,
|
||||||
const struct macroblockd_plane *pd) {
|
const struct macroblockd_plane *pd) {
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
if (!supertx_enabled(mbmi)) {
|
||||||
|
return get_uv_tx_size_impl(mbmi->tx_size, mbmi->sb_type, pd->subsampling_x,
|
||||||
|
pd->subsampling_y);
|
||||||
|
} else {
|
||||||
|
return uvsupertx_size_lookup[mbmi->tx_size][pd->subsampling_x]
|
||||||
|
[pd->subsampling_y];
|
||||||
|
}
|
||||||
|
#else
|
||||||
return get_uv_tx_size_impl(mbmi->tx_size, mbmi->sb_type, pd->subsampling_x,
|
return get_uv_tx_size_impl(mbmi->tx_size, mbmi->sb_type, pd->subsampling_x,
|
||||||
pd->subsampling_y);
|
pd->subsampling_y);
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE BLOCK_SIZE get_plane_block_size(BLOCK_SIZE bsize,
|
static INLINE BLOCK_SIZE get_plane_block_size(BLOCK_SIZE bsize,
|
||||||
|
|||||||
@@ -170,6 +170,21 @@ static const struct {
|
|||||||
{0, 0 }, // 64X64 - {0b0000, 0b0000}
|
{0, 0 }, // 64X64 - {0b0000, 0b0000}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
static const TX_SIZE uvsupertx_size_lookup[TX_SIZES][2][2] = {
|
||||||
|
// ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1
|
||||||
|
// ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1
|
||||||
|
{{TX_4X4, TX_4X4}, {TX_4X4, TX_4X4}},
|
||||||
|
{{TX_8X8, TX_4X4}, {TX_4X4, TX_4X4}},
|
||||||
|
{{TX_16X16, TX_8X8}, {TX_8X8, TX_8X8}},
|
||||||
|
{{TX_32X32, TX_16X16}, {TX_16X16, TX_16X16}},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int partition_supertx_context_lookup[PARTITION_TYPES] = {
|
||||||
|
-1, 0, 0, 1
|
||||||
|
};
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1174,6 +1174,14 @@ default_intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES]
|
|||||||
};
|
};
|
||||||
#endif // CONFIG_EXT_TX
|
#endif // CONFIG_EXT_TX
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
static const vpx_prob default_supertx_prob[PARTITION_SUPERTX_CONTEXTS]
|
||||||
|
[TX_SIZES] = {
|
||||||
|
{ 1, 160, 160, 170 },
|
||||||
|
{ 1, 200, 200, 210 },
|
||||||
|
};
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
// FIXME(someone) need real defaults here
|
// FIXME(someone) need real defaults here
|
||||||
static const struct segmentation_probs default_seg_probs = {
|
static const struct segmentation_probs default_seg_probs = {
|
||||||
{ 128, 128, 128, 128, 128, 128, 128 },
|
{ 128, 128, 128, 128, 128, 128, 128 },
|
||||||
@@ -1208,6 +1216,9 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
|
|||||||
vp10_copy(fc->inter_ext_tx_prob, default_inter_ext_tx_prob);
|
vp10_copy(fc->inter_ext_tx_prob, default_inter_ext_tx_prob);
|
||||||
vp10_copy(fc->intra_ext_tx_prob, default_intra_ext_tx_prob);
|
vp10_copy(fc->intra_ext_tx_prob, default_intra_ext_tx_prob);
|
||||||
#endif // CONFIG_EXT_TX
|
#endif // CONFIG_EXT_TX
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
vp10_copy(fc->supertx_prob, default_supertx_prob);
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
vp10_copy(fc->seg.tree_probs, default_seg_probs.tree_probs);
|
vp10_copy(fc->seg.tree_probs, default_seg_probs.tree_probs);
|
||||||
vp10_copy(fc->seg.pred_probs, default_seg_probs.pred_probs);
|
vp10_copy(fc->seg.pred_probs, default_seg_probs.pred_probs);
|
||||||
#if CONFIG_EXT_INTRA
|
#if CONFIG_EXT_INTRA
|
||||||
@@ -1346,6 +1357,16 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) {
|
|||||||
}
|
}
|
||||||
#endif // CONFIG_EXT_TX
|
#endif // CONFIG_EXT_TX
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
for (i = 0; i < PARTITION_SUPERTX_CONTEXTS; ++i) {
|
||||||
|
int j;
|
||||||
|
for (j = 1; j < TX_SIZES; ++j) {
|
||||||
|
fc->supertx_prob[i][j] = mode_mv_merge_probs(pre_fc->supertx_prob[i][j],
|
||||||
|
counts->supertx[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
if (cm->seg.temporal_update) {
|
if (cm->seg.temporal_update) {
|
||||||
for (i = 0; i < PREDICTION_PROBS; i++)
|
for (i = 0; i < PREDICTION_PROBS; i++)
|
||||||
fc->seg.pred_probs[i] = mode_mv_merge_probs(pre_fc->seg.pred_probs[i],
|
fc->seg.pred_probs[i] = mode_mv_merge_probs(pre_fc->seg.pred_probs[i],
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ typedef struct frame_contexts {
|
|||||||
vpx_prob intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
|
vpx_prob intra_ext_tx_prob[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
|
||||||
[TX_TYPES - 1];
|
[TX_TYPES - 1];
|
||||||
#endif // CONFIG_EXT_TX
|
#endif // CONFIG_EXT_TX
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
vpx_prob supertx_prob[PARTITION_SUPERTX_CONTEXTS][TX_SIZES];
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
struct segmentation_probs seg;
|
struct segmentation_probs seg;
|
||||||
#if CONFIG_EXT_INTRA
|
#if CONFIG_EXT_INTRA
|
||||||
vpx_prob ext_intra_probs[PLANE_TYPES];
|
vpx_prob ext_intra_probs[PLANE_TYPES];
|
||||||
@@ -122,6 +125,10 @@ typedef struct FRAME_COUNTS {
|
|||||||
unsigned int intra_ext_tx[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
|
unsigned int intra_ext_tx[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
|
||||||
[TX_TYPES];
|
[TX_TYPES];
|
||||||
#endif // CONFIG_EXT_TX
|
#endif // CONFIG_EXT_TX
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
unsigned int supertx[PARTITION_SUPERTX_CONTEXTS][TX_SIZES][2];
|
||||||
|
unsigned int supertx_size[TX_SIZES];
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
struct seg_counts seg;
|
struct seg_counts seg;
|
||||||
#if CONFIG_EXT_INTRA
|
#if CONFIG_EXT_INTRA
|
||||||
unsigned int ext_intra[PLANE_TYPES][2];
|
unsigned int ext_intra[PLANE_TYPES][2];
|
||||||
|
|||||||
@@ -246,6 +246,11 @@ typedef TX_SIZE TXFM_CONTEXT;
|
|||||||
#define COMP_REFS 2
|
#define COMP_REFS 2
|
||||||
#endif // CONFIG_EXT_REFS
|
#endif // CONFIG_EXT_REFS
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
#define PARTITION_SUPERTX_CONTEXTS 2
|
||||||
|
#define MAX_SUPERTX_BLOCK_SIZE BLOCK_32X32
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -787,10 +787,18 @@ static void build_masks(const loop_filter_info_n *const lfi_n,
|
|||||||
// we only update u and v masks on the first block.
|
// we only update u and v masks on the first block.
|
||||||
static void build_y_mask(const loop_filter_info_n *const lfi_n,
|
static void build_y_mask(const loop_filter_info_n *const lfi_n,
|
||||||
const MODE_INFO *mi, const int shift_y,
|
const MODE_INFO *mi, const int shift_y,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
int supertx_enabled,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
LOOP_FILTER_MASK *lfm) {
|
LOOP_FILTER_MASK *lfm) {
|
||||||
const MB_MODE_INFO *mbmi = &mi->mbmi;
|
const MB_MODE_INFO *mbmi = &mi->mbmi;
|
||||||
const BLOCK_SIZE block_size = mbmi->sb_type;
|
|
||||||
const TX_SIZE tx_size_y = mbmi->tx_size;
|
const TX_SIZE tx_size_y = mbmi->tx_size;
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
const BLOCK_SIZE block_size =
|
||||||
|
supertx_enabled ? (BLOCK_SIZE)(3 * tx_size_y) : mbmi->sb_type;
|
||||||
|
#else
|
||||||
|
const BLOCK_SIZE block_size = mbmi->sb_type;
|
||||||
|
#endif
|
||||||
const int filter_level = get_filter_level(lfi_n, mbmi);
|
const int filter_level = get_filter_level(lfi_n, mbmi);
|
||||||
uint64_t *const left_y = &lfm->left_y[tx_size_y];
|
uint64_t *const left_y = &lfm->left_y[tx_size_y];
|
||||||
uint64_t *const above_y = &lfm->above_y[tx_size_y];
|
uint64_t *const above_y = &lfm->above_y[tx_size_y];
|
||||||
@@ -899,6 +907,10 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col,
|
|||||||
break;
|
break;
|
||||||
case BLOCK_32X16:
|
case BLOCK_32X16:
|
||||||
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
if (supertx_enabled(&mip[0]->mbmi))
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
if (mi_32_row_offset + 2 >= max_rows)
|
if (mi_32_row_offset + 2 >= max_rows)
|
||||||
continue;
|
continue;
|
||||||
mip2 = mip + mode_info_stride * 2;
|
mip2 = mip + mode_info_stride * 2;
|
||||||
@@ -906,12 +918,22 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col,
|
|||||||
break;
|
break;
|
||||||
case BLOCK_16X32:
|
case BLOCK_16X32:
|
||||||
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
if (supertx_enabled(&mip[0]->mbmi))
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
if (mi_32_col_offset + 2 >= max_cols)
|
if (mi_32_col_offset + 2 >= max_cols)
|
||||||
continue;
|
continue;
|
||||||
mip2 = mip + 2;
|
mip2 = mip + 2;
|
||||||
build_masks(lfi_n, mip2[0], shift_y + 2, shift_uv + 1, lfm);
|
build_masks(lfi_n, mip2[0], shift_y + 2, shift_uv + 1, lfm);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
if (mip[0]->mbmi.tx_size == TX_32X32) {
|
||||||
|
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
for (idx_16 = 0; idx_16 < 4; mip += offset_16[idx_16], ++idx_16) {
|
for (idx_16 = 0; idx_16 < 4; mip += offset_16[idx_16], ++idx_16) {
|
||||||
const int shift_y = shift_32_y[idx_32] + shift_16_y[idx_16];
|
const int shift_y = shift_32_y[idx_32] + shift_16_y[idx_16];
|
||||||
const int shift_uv = shift_32_uv[idx_32] + shift_16_uv[idx_16];
|
const int shift_uv = shift_32_uv[idx_32] + shift_16_uv[idx_16];
|
||||||
@@ -928,23 +950,45 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col,
|
|||||||
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
||||||
break;
|
break;
|
||||||
case BLOCK_16X8:
|
case BLOCK_16X8:
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
if (supertx_enabled(&mip[0]->mbmi))
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
||||||
if (mi_16_row_offset + 1 >= max_rows)
|
if (mi_16_row_offset + 1 >= max_rows)
|
||||||
continue;
|
continue;
|
||||||
mip2 = mip + mode_info_stride;
|
mip2 = mip + mode_info_stride;
|
||||||
build_y_mask(lfi_n, mip2[0], shift_y+8, lfm);
|
build_y_mask(lfi_n, mip2[0], shift_y+8,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
0,
|
||||||
|
#endif
|
||||||
|
lfm);
|
||||||
break;
|
break;
|
||||||
case BLOCK_8X16:
|
case BLOCK_8X16:
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
if (supertx_enabled(&mip[0]->mbmi))
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
||||||
if (mi_16_col_offset +1 >= max_cols)
|
if (mi_16_col_offset +1 >= max_cols)
|
||||||
continue;
|
continue;
|
||||||
mip2 = mip + 1;
|
mip2 = mip + 1;
|
||||||
build_y_mask(lfi_n, mip2[0], shift_y+1, lfm);
|
build_y_mask(lfi_n, mip2[0], shift_y+1,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
0,
|
||||||
|
#endif
|
||||||
|
lfm);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
const int shift_y = shift_32_y[idx_32] +
|
const int shift_y = shift_32_y[idx_32] +
|
||||||
shift_16_y[idx_16] +
|
shift_16_y[idx_16] +
|
||||||
shift_8_y[0];
|
shift_8_y[0];
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
if (mip[0]->mbmi.tx_size == TX_16X16) {
|
||||||
|
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
build_masks(lfi_n, mip[0], shift_y, shift_uv, lfm);
|
||||||
mip += offset[0];
|
mip += offset[0];
|
||||||
for (idx_8 = 1; idx_8 < 4; mip += offset[idx_8], ++idx_8) {
|
for (idx_8 = 1; idx_8 < 4; mip += offset[idx_8], ++idx_8) {
|
||||||
@@ -959,7 +1003,11 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col,
|
|||||||
if (mi_8_col_offset >= max_cols ||
|
if (mi_8_col_offset >= max_cols ||
|
||||||
mi_8_row_offset >= max_rows)
|
mi_8_row_offset >= max_rows)
|
||||||
continue;
|
continue;
|
||||||
build_y_mask(lfi_n, mip[0], shift_y, lfm);
|
build_y_mask(lfi_n, mip[0], shift_y,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
supertx_enabled(&mip[0]->mbmi),
|
||||||
|
#endif
|
||||||
|
lfm);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,3 +264,227 @@ void vp10_setup_pre_planes(MACROBLOCKD *xd, int idx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
static const uint8_t mask_8[8] = {
|
||||||
|
64, 64, 62, 52, 12, 2, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint8_t mask_16[16] = {
|
||||||
|
63, 62, 60, 58, 55, 50, 43, 36, 28, 21, 14, 9, 6, 4, 2, 1
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint8_t mask_32[32] = {
|
||||||
|
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 61, 57, 52, 45, 36,
|
||||||
|
28, 19, 12, 7, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint8_t mask_8_uv[8] = {
|
||||||
|
64, 64, 62, 52, 12, 2, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint8_t mask_16_uv[16] = {
|
||||||
|
64, 64, 64, 64, 61, 53, 45, 36, 28, 19, 11, 3, 0, 0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint8_t mask_32_uv[32] = {
|
||||||
|
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 60, 54, 46, 36,
|
||||||
|
28, 18, 10, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
static void generate_1dmask(int length, uint8_t *mask, int plane) {
|
||||||
|
switch (length) {
|
||||||
|
case 8:
|
||||||
|
memcpy(mask, plane ? mask_8_uv : mask_8, length);
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
memcpy(mask, plane ? mask_16_uv : mask_16, length);
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
memcpy(mask, plane ? mask_32_uv : mask_32, length);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vp10_build_masked_inter_predictor_complex(
|
||||||
|
MACROBLOCKD *xd,
|
||||||
|
uint8_t *dst, int dst_stride, uint8_t *dst2, int dst2_stride,
|
||||||
|
const struct macroblockd_plane *pd, int mi_row, int mi_col,
|
||||||
|
int mi_row_ori, int mi_col_ori, BLOCK_SIZE bsize, BLOCK_SIZE top_bsize,
|
||||||
|
PARTITION_TYPE partition, int plane) {
|
||||||
|
int i, j;
|
||||||
|
uint8_t mask[MAXTXLEN];
|
||||||
|
int top_w = 4 << b_width_log2_lookup[top_bsize],
|
||||||
|
top_h = 4 << b_height_log2_lookup[top_bsize];
|
||||||
|
int w = 4 << b_width_log2_lookup[bsize], h = 4 << b_height_log2_lookup[bsize];
|
||||||
|
int w_offset = (mi_col - mi_col_ori) << 3,
|
||||||
|
h_offset = (mi_row - mi_row_ori) << 3;
|
||||||
|
|
||||||
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
uint16_t *dst16= CONVERT_TO_SHORTPTR(dst);
|
||||||
|
uint16_t *dst216 = CONVERT_TO_SHORTPTR(dst2);
|
||||||
|
int b_hdb = (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) ? 1 : 0;
|
||||||
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
|
||||||
|
top_w >>= pd->subsampling_x;
|
||||||
|
top_h >>= pd->subsampling_y;
|
||||||
|
w >>= pd->subsampling_x;
|
||||||
|
h >>= pd->subsampling_y;
|
||||||
|
w_offset >>= pd->subsampling_x;
|
||||||
|
h_offset >>= pd->subsampling_y;
|
||||||
|
|
||||||
|
switch (partition) {
|
||||||
|
case PARTITION_HORZ:
|
||||||
|
{
|
||||||
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
if (b_hdb) {
|
||||||
|
uint16_t *dst_tmp = dst16 + h_offset * dst_stride;
|
||||||
|
uint16_t *dst2_tmp = dst216 + h_offset * dst2_stride;
|
||||||
|
generate_1dmask(h, mask + h_offset,
|
||||||
|
plane && xd->plane[plane].subsampling_y);
|
||||||
|
|
||||||
|
for (i = h_offset; i < h_offset + h; i++) {
|
||||||
|
for (j = 0; j < top_w; j++) {
|
||||||
|
const int m = mask[i]; assert(m >= 0 && m <= 64);
|
||||||
|
if (m == 64)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (m == 0)
|
||||||
|
dst_tmp[j] = dst2_tmp[j];
|
||||||
|
else
|
||||||
|
dst_tmp[j] = (dst_tmp[j] * m + dst2_tmp[j] * (64 - m) + 32) >> 6;
|
||||||
|
}
|
||||||
|
dst_tmp += dst_stride;
|
||||||
|
dst2_tmp += dst2_stride;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; i < top_h; i ++) {
|
||||||
|
memcpy(dst_tmp, dst2_tmp, top_w * sizeof(uint16_t));
|
||||||
|
dst_tmp += dst_stride;
|
||||||
|
dst2_tmp += dst2_stride;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
uint8_t *dst_tmp = dst + h_offset * dst_stride;
|
||||||
|
uint8_t *dst2_tmp = dst2 + h_offset * dst2_stride;
|
||||||
|
generate_1dmask(h, mask + h_offset,
|
||||||
|
plane && xd->plane[plane].subsampling_y);
|
||||||
|
|
||||||
|
for (i = h_offset; i < h_offset + h; i++) {
|
||||||
|
for (j = 0; j < top_w; j++) {
|
||||||
|
const int m = mask[i]; assert(m >= 0 && m <= 64);
|
||||||
|
if (m == 64)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (m == 0)
|
||||||
|
dst_tmp[j] = dst2_tmp[j];
|
||||||
|
else
|
||||||
|
dst_tmp[j] = (dst_tmp[j] * m + dst2_tmp[j] * (64 - m) + 32) >> 6;
|
||||||
|
}
|
||||||
|
dst_tmp += dst_stride;
|
||||||
|
dst2_tmp += dst2_stride;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; i < top_h; i ++) {
|
||||||
|
memcpy(dst_tmp, dst2_tmp, top_w * sizeof(uint8_t));
|
||||||
|
dst_tmp += dst_stride;
|
||||||
|
dst2_tmp += dst2_stride;
|
||||||
|
}
|
||||||
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
}
|
||||||
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case PARTITION_VERT:
|
||||||
|
{
|
||||||
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
if (b_hdb) {
|
||||||
|
uint16_t *dst_tmp = dst16;
|
||||||
|
uint16_t *dst2_tmp = dst216;
|
||||||
|
generate_1dmask(w, mask + w_offset,
|
||||||
|
plane && xd->plane[plane].subsampling_x);
|
||||||
|
|
||||||
|
for (i = 0; i < top_h; i++) {
|
||||||
|
for (j = w_offset; j < w_offset + w; j++) {
|
||||||
|
const int m = mask[j]; assert(m >= 0 && m <= 64);
|
||||||
|
if (m == 64)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (m == 0)
|
||||||
|
dst_tmp[j] = dst2_tmp[j];
|
||||||
|
else
|
||||||
|
dst_tmp[j] = (dst_tmp[j] * m + dst2_tmp[j] * (64 - m) + 32) >> 6;
|
||||||
|
}
|
||||||
|
memcpy(dst_tmp + j, dst2_tmp + j,
|
||||||
|
(top_w - w_offset - w) * sizeof(uint16_t));
|
||||||
|
dst_tmp += dst_stride;
|
||||||
|
dst2_tmp += dst2_stride;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
uint8_t *dst_tmp = dst;
|
||||||
|
uint8_t *dst2_tmp = dst2;
|
||||||
|
generate_1dmask(w, mask + w_offset,
|
||||||
|
plane && xd->plane[plane].subsampling_x);
|
||||||
|
|
||||||
|
for (i = 0; i < top_h; i++) {
|
||||||
|
for (j = w_offset; j < w_offset + w; j++) {
|
||||||
|
const int m = mask[j]; assert(m >= 0 && m <= 64);
|
||||||
|
if (m == 64)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (m == 0)
|
||||||
|
dst_tmp[j] = dst2_tmp[j];
|
||||||
|
else
|
||||||
|
dst_tmp[j] = (dst_tmp[j] * m + dst2_tmp[j] * (64 - m) + 32) >> 6;
|
||||||
|
}
|
||||||
|
memcpy(dst_tmp + j, dst2_tmp + j,
|
||||||
|
(top_w - w_offset - w) * sizeof(uint8_t));
|
||||||
|
dst_tmp += dst_stride;
|
||||||
|
dst2_tmp += dst2_stride;
|
||||||
|
}
|
||||||
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
}
|
||||||
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
(void) xd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vp10_build_inter_predictors_sb_sub8x8(MACROBLOCKD *xd,
|
||||||
|
int mi_row, int mi_col,
|
||||||
|
BLOCK_SIZE bsize, int block) {
|
||||||
|
// Prediction function used in supertx:
|
||||||
|
// Use the mv at current block (which is less than 8x8)
|
||||||
|
// to get prediction of a block located at (mi_row, mi_col) at size of bsize
|
||||||
|
// bsize can be larger than 8x8.
|
||||||
|
// block (0-3): the sub8x8 location of current block
|
||||||
|
int plane;
|
||||||
|
const int mi_x = mi_col * MI_SIZE;
|
||||||
|
const int mi_y = mi_row * MI_SIZE;
|
||||||
|
|
||||||
|
// For sub8x8 uv:
|
||||||
|
// Skip uv prediction in supertx except the first block (block = 0)
|
||||||
|
int max_plane = block ? 1 : MAX_MB_PLANE;
|
||||||
|
|
||||||
|
for (plane = 0; plane < max_plane; plane++) {
|
||||||
|
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize,
|
||||||
|
&xd->plane[plane]);
|
||||||
|
const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
|
||||||
|
const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
|
||||||
|
const int bw = 4 * num_4x4_w;
|
||||||
|
const int bh = 4 * num_4x4_h;
|
||||||
|
|
||||||
|
build_inter_predictors(xd, plane, block, bw, bh,
|
||||||
|
0, 0, bw, bh,
|
||||||
|
mi_x, mi_y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|||||||
@@ -153,25 +153,39 @@ static INLINE MV average_split_mvs(const struct macroblockd_plane *pd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void build_inter_predictors(MACROBLOCKD *xd, int plane, int block,
|
void build_inter_predictors(MACROBLOCKD *xd, int plane, int block,
|
||||||
int bw, int bh,
|
int bw, int bh,
|
||||||
int x, int y, int w, int h,
|
int x, int y, int w, int h,
|
||||||
int mi_x, int mi_y);
|
int mi_x, int mi_y);
|
||||||
|
|
||||||
void vp10_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane,
|
void vp10_build_inter_predictor_sub8x8(MACROBLOCKD *xd, int plane,
|
||||||
int i, int ir, int ic,
|
int i, int ir, int ic,
|
||||||
int mi_row, int mi_col);
|
int mi_row, int mi_col);
|
||||||
|
|
||||||
void vp10_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
|
void vp10_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||||
BLOCK_SIZE bsize);
|
|
||||||
|
|
||||||
void vp10_build_inter_predictors_sbp(MACROBLOCKD *xd, int mi_row, int mi_col,
|
|
||||||
BLOCK_SIZE bsize, int plane);
|
|
||||||
|
|
||||||
void vp10_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
|
|
||||||
BLOCK_SIZE bsize);
|
BLOCK_SIZE bsize);
|
||||||
|
|
||||||
|
void vp10_build_inter_predictors_sbp(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||||
|
BLOCK_SIZE bsize, int plane);
|
||||||
|
|
||||||
|
void vp10_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||||
|
BLOCK_SIZE bsize);
|
||||||
|
|
||||||
void vp10_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
|
void vp10_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
|
||||||
BLOCK_SIZE bsize);
|
BLOCK_SIZE bsize);
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
void vp10_build_inter_predictors_sb_sub8x8(MACROBLOCKD *xd,
|
||||||
|
int mi_row, int mi_col,
|
||||||
|
BLOCK_SIZE bsize, int block);
|
||||||
|
struct macroblockd_plane;
|
||||||
|
void vp10_build_masked_inter_predictor_complex(
|
||||||
|
MACROBLOCKD *xd,
|
||||||
|
uint8_t *dst, int dst_stride, uint8_t *dst2, int dst2_stride,
|
||||||
|
const struct macroblockd_plane *pd, int mi_row, int mi_col,
|
||||||
|
int mi_row_ori, int mi_col_ori, BLOCK_SIZE bsize, BLOCK_SIZE top_bsize,
|
||||||
|
PARTITION_TYPE partition, int plane);
|
||||||
|
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
void vp10_build_inter_predictor(const uint8_t *src, int src_stride,
|
void vp10_build_inter_predictor(const uint8_t *src, int src_stride,
|
||||||
uint8_t *dst, int dst_stride,
|
uint8_t *dst, int dst_stride,
|
||||||
|
|||||||
@@ -477,6 +477,15 @@ void vp10_accumulate_frame_counts(VP10_COMMON *cm, FRAME_COUNTS *counts,
|
|||||||
}
|
}
|
||||||
#endif // CONFIG_EXT_TX
|
#endif // CONFIG_EXT_TX
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
for (i = 0; i < PARTITION_SUPERTX_CONTEXTS; i++)
|
||||||
|
for (j = 0; j < TX_SIZES; j++)
|
||||||
|
for (k = 0; k < 2; k++)
|
||||||
|
cm->counts.supertx[i][j][k] += counts->supertx[i][j][k];
|
||||||
|
for (i = 0; i < TX_SIZES; i++)
|
||||||
|
cm->counts.supertx_size[i] += counts->supertx_size[i];
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
for (i = 0; i < PREDICTION_PROBS; i++)
|
for (i = 0; i < PREDICTION_PROBS; i++)
|
||||||
for (j = 0; j < 2; j++)
|
for (j = 0; j < 2; j++)
|
||||||
cm->counts.seg.pred[i][j] += counts->seg.pred[i][j];
|
cm->counts.seg.pred[i][j] += counts->seg.pred[i][j];
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -929,98 +929,117 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
|
|||||||
|
|
||||||
static void read_inter_frame_mode_info(VP10Decoder *const pbi,
|
static void read_inter_frame_mode_info(VP10Decoder *const pbi,
|
||||||
MACROBLOCKD *const xd,
|
MACROBLOCKD *const xd,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
int supertx_enabled,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
int mi_row, int mi_col, vpx_reader *r) {
|
int mi_row, int mi_col, vpx_reader *r) {
|
||||||
VP10_COMMON *const cm = &pbi->common;
|
VP10_COMMON *const cm = &pbi->common;
|
||||||
MODE_INFO *const mi = xd->mi[0];
|
MODE_INFO *const mi = xd->mi[0];
|
||||||
MB_MODE_INFO *const mbmi = &mi->mbmi;
|
MB_MODE_INFO *const mbmi = &mi->mbmi;
|
||||||
int inter_block;
|
int inter_block = 1;
|
||||||
#if CONFIG_VAR_TX
|
#if CONFIG_VAR_TX
|
||||||
BLOCK_SIZE bsize = mbmi->sb_type;
|
BLOCK_SIZE bsize = mbmi->sb_type;
|
||||||
#endif
|
#endif // CONFIG_VAR_TX
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
(void) supertx_enabled;
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
mbmi->mv[0].as_int = 0;
|
mbmi->mv[0].as_int = 0;
|
||||||
mbmi->mv[1].as_int = 0;
|
mbmi->mv[1].as_int = 0;
|
||||||
mbmi->segment_id = read_inter_segment_id(cm, xd, mi_row, mi_col, r);
|
mbmi->segment_id = read_inter_segment_id(cm, xd, mi_row, mi_col, r);
|
||||||
mbmi->skip = read_skip(cm, xd, mbmi->segment_id, r);
|
#if CONFIG_SUPERTX
|
||||||
inter_block = read_is_inter_block(cm, xd, mbmi->segment_id, r);
|
if (!supertx_enabled) {
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
mbmi->skip = read_skip(cm, xd, mbmi->segment_id, r);
|
||||||
|
inter_block = read_is_inter_block(cm, xd, mbmi->segment_id, r);
|
||||||
|
|
||||||
#if CONFIG_VAR_TX
|
#if CONFIG_VAR_TX
|
||||||
xd->above_txfm_context = cm->above_txfm_context + mi_col;
|
xd->above_txfm_context = cm->above_txfm_context + mi_col;
|
||||||
xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & 0x07);
|
xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & 0x07);
|
||||||
if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT &&
|
if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT &&
|
||||||
!mbmi->skip && inter_block) {
|
!mbmi->skip && inter_block) {
|
||||||
const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
|
const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
|
||||||
const BLOCK_SIZE txb_size = txsize_to_bsize[max_tx_size];
|
const BLOCK_SIZE txb_size = txsize_to_bsize[max_tx_size];
|
||||||
const int bs = num_4x4_blocks_wide_lookup[txb_size];
|
const int bs = num_4x4_blocks_wide_lookup[txb_size];
|
||||||
const int width = num_4x4_blocks_wide_lookup[bsize];
|
|
||||||
const int height = num_4x4_blocks_high_lookup[bsize];
|
|
||||||
int idx, idy;
|
|
||||||
for (idy = 0; idy < height; idy += bs)
|
|
||||||
for (idx = 0; idx < width; idx += bs)
|
|
||||||
read_tx_size_inter(cm, xd, mbmi, xd->counts, max_tx_size,
|
|
||||||
idy, idx, r);
|
|
||||||
if (xd->counts) {
|
|
||||||
const int ctx = get_tx_size_context(xd);
|
|
||||||
++get_tx_counts(max_tx_size, ctx, &xd->counts->tx)[mbmi->tx_size];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mbmi->tx_size = read_tx_size(cm, xd, !mbmi->skip || !inter_block, r);
|
|
||||||
if (inter_block) {
|
|
||||||
const int width = num_4x4_blocks_wide_lookup[bsize];
|
const int width = num_4x4_blocks_wide_lookup[bsize];
|
||||||
const int height = num_4x4_blocks_high_lookup[bsize];
|
const int height = num_4x4_blocks_high_lookup[bsize];
|
||||||
int idx, idy;
|
int idx, idy;
|
||||||
for (idy = 0; idy < height; ++idy)
|
for (idy = 0; idy < height; idy += bs)
|
||||||
for (idx = 0; idx < width; ++idx)
|
for (idx = 0; idx < width; idx += bs)
|
||||||
mbmi->inter_tx_size[(idy >> 1) * 8 + (idx >> 1)] = mbmi->tx_size;
|
read_tx_size_inter(cm, xd, mbmi, xd->counts, max_tx_size,
|
||||||
}
|
idy, idx, r);
|
||||||
|
if (xd->counts) {
|
||||||
|
const int ctx = get_tx_size_context(xd);
|
||||||
|
++get_tx_counts(max_tx_size, ctx, &xd->counts->tx)[mbmi->tx_size];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mbmi->tx_size = read_tx_size(cm, xd, !mbmi->skip || !inter_block, r);
|
||||||
|
if (inter_block) {
|
||||||
|
const int width = num_4x4_blocks_wide_lookup[bsize];
|
||||||
|
const int height = num_4x4_blocks_high_lookup[bsize];
|
||||||
|
int idx, idy;
|
||||||
|
for (idy = 0; idy < height; ++idy)
|
||||||
|
for (idx = 0; idx < width; ++idx)
|
||||||
|
mbmi->inter_tx_size[(idy >> 1) * 8 + (idx >> 1)] = mbmi->tx_size;
|
||||||
|
}
|
||||||
|
|
||||||
set_txfm_ctx(xd->left_txfm_context, mbmi->tx_size, xd->n8_h);
|
set_txfm_ctx(xd->left_txfm_context, mbmi->tx_size, xd->n8_h);
|
||||||
set_txfm_ctx(xd->above_txfm_context, mbmi->tx_size, xd->n8_w);
|
set_txfm_ctx(xd->above_txfm_context, mbmi->tx_size, xd->n8_w);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
mbmi->tx_size = read_tx_size(cm, xd, !mbmi->skip || !inter_block, r);
|
mbmi->tx_size = read_tx_size(cm, xd, !mbmi->skip || !inter_block, r);
|
||||||
#endif
|
#endif // CONFIG_VAR_TX
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
}
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
if (inter_block)
|
if (inter_block)
|
||||||
read_inter_block_mode_info(pbi, xd, mi, mi_row, mi_col, r);
|
read_inter_block_mode_info(pbi, xd,
|
||||||
|
mi, mi_row, mi_col, r);
|
||||||
else
|
else
|
||||||
read_intra_block_mode_info(cm, xd, mi, r);
|
read_intra_block_mode_info(cm, xd, mi, r);
|
||||||
|
|
||||||
#if CONFIG_EXT_TX
|
#if CONFIG_EXT_TX
|
||||||
if (get_ext_tx_types(mbmi->tx_size, mbmi->sb_type, inter_block) > 1 &&
|
if (get_ext_tx_types(mbmi->tx_size, mbmi->sb_type, inter_block) > 1 &&
|
||||||
cm->base_qindex > 0 && !mbmi->skip &&
|
cm->base_qindex > 0 && !mbmi->skip &&
|
||||||
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
|
#if CONFIG_SUPERTX
|
||||||
int eset = get_ext_tx_set(mbmi->tx_size, mbmi->sb_type,
|
!supertx_enabled &&
|
||||||
inter_block);
|
#endif // CONFIG_SUPERTX
|
||||||
FRAME_COUNTS *counts = xd->counts;
|
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
|
||||||
|
int eset = get_ext_tx_set(mbmi->tx_size, mbmi->sb_type,
|
||||||
|
inter_block);
|
||||||
|
FRAME_COUNTS *counts = xd->counts;
|
||||||
|
|
||||||
if (inter_block) {
|
if (inter_block) {
|
||||||
if (eset > 0) {
|
if (eset > 0) {
|
||||||
mbmi->tx_type =
|
mbmi->tx_type =
|
||||||
vpx_read_tree(r, vp10_ext_tx_inter_tree[eset],
|
vpx_read_tree(r, vp10_ext_tx_inter_tree[eset],
|
||||||
cm->fc->inter_ext_tx_prob[eset][mbmi->tx_size]);
|
cm->fc->inter_ext_tx_prob[eset][mbmi->tx_size]);
|
||||||
if (counts)
|
if (counts)
|
||||||
++counts->inter_ext_tx[eset][mbmi->tx_size][mbmi->tx_type];
|
++counts->inter_ext_tx[eset][mbmi->tx_size][mbmi->tx_type];
|
||||||
}
|
}
|
||||||
} else if (ALLOW_INTRA_EXT_TX) {
|
} else if (ALLOW_INTRA_EXT_TX) {
|
||||||
if (eset > 0) {
|
if (eset > 0) {
|
||||||
mbmi->tx_type = vpx_read_tree(r, vp10_ext_tx_intra_tree[eset],
|
mbmi->tx_type = vpx_read_tree(r, vp10_ext_tx_intra_tree[eset],
|
||||||
cm->fc->intra_ext_tx_prob[eset]
|
cm->fc->intra_ext_tx_prob[eset]
|
||||||
[mbmi->tx_size][mbmi->mode]);
|
[mbmi->tx_size][mbmi->mode]);
|
||||||
if (counts)
|
if (counts)
|
||||||
++counts->intra_ext_tx[eset][mbmi->tx_size]
|
++counts->intra_ext_tx[eset][mbmi->tx_size]
|
||||||
[mbmi->mode][mbmi->tx_type];
|
[mbmi->mode][mbmi->tx_type];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
mbmi->tx_type = DCT_DCT;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
mbmi->tx_type = DCT_DCT;
|
||||||
|
}
|
||||||
#endif // CONFIG_EXT_TX
|
#endif // CONFIG_EXT_TX
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp10_read_mode_info(VP10Decoder *const pbi, MACROBLOCKD *xd,
|
void vp10_read_mode_info(VP10Decoder *const pbi, MACROBLOCKD *xd,
|
||||||
int mi_row, int mi_col, vpx_reader *r,
|
#if CONFIG_SUPERTX
|
||||||
int x_mis, int y_mis) {
|
int supertx_enabled,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
int mi_row, int mi_col, vpx_reader *r,
|
||||||
|
int x_mis, int y_mis) {
|
||||||
VP10_COMMON *const cm = &pbi->common;
|
VP10_COMMON *const cm = &pbi->common;
|
||||||
MODE_INFO *const mi = xd->mi[0];
|
MODE_INFO *const mi = xd->mi[0];
|
||||||
MV_REF* frame_mvs = cm->cur_frame->mvs + mi_row * cm->mi_cols + mi_col;
|
MV_REF* frame_mvs = cm->cur_frame->mvs + mi_row * cm->mi_cols + mi_col;
|
||||||
@@ -1039,7 +1058,11 @@ void vp10_read_mode_info(VP10Decoder *const pbi, MACROBLOCKD *xd,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
read_inter_frame_mode_info(pbi, xd, mi_row, mi_col, r);
|
read_inter_frame_mode_info(pbi, xd,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
supertx_enabled,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
mi_row, mi_col, r);
|
||||||
for (h = 0; h < y_mis; ++h) {
|
for (h = 0; h < y_mis; ++h) {
|
||||||
MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols;
|
MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols;
|
||||||
for (w = 0; w < x_mis; ++w) {
|
for (w = 0; w < x_mis; ++w) {
|
||||||
|
|||||||
@@ -20,8 +20,12 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void vp10_read_mode_info(VP10Decoder *const pbi, MACROBLOCKD *xd,
|
void vp10_read_mode_info(VP10Decoder *const pbi, MACROBLOCKD *xd,
|
||||||
int mi_row, int mi_col, vpx_reader *r,
|
#if CONFIG_SUPERTX
|
||||||
int x_mis, int y_mis);
|
int supertx_enabled,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int mi_row, int mi_col, vpx_reader *r,
|
||||||
|
int x_mis, int y_mis);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|||||||
@@ -96,6 +96,16 @@ void vp10_encode_token_init() {
|
|||||||
#endif // CONFIG_EXT_TX
|
#endif // CONFIG_EXT_TX
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
static int vp10_check_supertx(VP10_COMMON *cm, int mi_row, int mi_col,
|
||||||
|
BLOCK_SIZE bsize) {
|
||||||
|
MODE_INFO *mi;
|
||||||
|
mi = cm->mi + (mi_row * cm->mi_stride + mi_col);
|
||||||
|
return mi[0].mbmi.tx_size == max_txsize_lookup[bsize] &&
|
||||||
|
mi[0].mbmi.sb_type < bsize;
|
||||||
|
}
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
static void write_intra_mode(vpx_writer *w, PREDICTION_MODE mode,
|
static void write_intra_mode(vpx_writer *w, PREDICTION_MODE mode,
|
||||||
const vpx_prob *probs) {
|
const vpx_prob *probs) {
|
||||||
vp10_write_token(w, vp10_intra_mode_tree, probs, &intra_mode_encodings[mode]);
|
vp10_write_token(w, vp10_intra_mode_tree, probs, &intra_mode_encodings[mode]);
|
||||||
@@ -357,6 +367,32 @@ static void pack_palette_tokens(vpx_writer *w, TOKENEXTRA **tp,
|
|||||||
*tp = p;
|
*tp = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
static void update_supertx_probs(VP10_COMMON *cm, vpx_writer *w) {
|
||||||
|
const int savings_thresh = vp10_cost_one(GROUP_DIFF_UPDATE_PROB) -
|
||||||
|
vp10_cost_zero(GROUP_DIFF_UPDATE_PROB);
|
||||||
|
int i, j;
|
||||||
|
int savings = 0;
|
||||||
|
int do_update = 0;
|
||||||
|
for (i = 0; i < PARTITION_SUPERTX_CONTEXTS; ++i) {
|
||||||
|
for (j = 1; j < TX_SIZES; ++j) {
|
||||||
|
savings += vp10_cond_prob_diff_update_savings(&cm->fc->supertx_prob[i][j],
|
||||||
|
cm->counts.supertx[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
do_update = savings > savings_thresh;
|
||||||
|
vpx_write(w, do_update, GROUP_DIFF_UPDATE_PROB);
|
||||||
|
if (do_update) {
|
||||||
|
for (i = 0; i < PARTITION_SUPERTX_CONTEXTS; ++i) {
|
||||||
|
for (j = 1; j < TX_SIZES; ++j) {
|
||||||
|
vp10_cond_prob_diff_update(w, &cm->fc->supertx_prob[i][j],
|
||||||
|
cm->counts.supertx[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
static void pack_mb_tokens(vpx_writer *w,
|
static void pack_mb_tokens(vpx_writer *w,
|
||||||
TOKENEXTRA **tp, const TOKENEXTRA *const stop,
|
TOKENEXTRA **tp, const TOKENEXTRA *const stop,
|
||||||
vpx_bit_depth_t bit_depth, const TX_SIZE tx) {
|
vpx_bit_depth_t bit_depth, const TX_SIZE tx) {
|
||||||
@@ -628,6 +664,9 @@ static void write_switchable_interp_filter(VP10_COMP *cpi,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
|
static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
int supertx_enabled,
|
||||||
|
#endif
|
||||||
vpx_writer *w) {
|
vpx_writer *w) {
|
||||||
VP10_COMMON *const cm = &cpi->common;
|
VP10_COMMON *const cm = &cpi->common;
|
||||||
const nmv_context *nmvc = &cm->fc->nmvc;
|
const nmv_context *nmvc = &cm->fc->nmvc;
|
||||||
@@ -657,12 +696,25 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
if (supertx_enabled)
|
||||||
|
skip = mbmi->skip;
|
||||||
|
else
|
||||||
|
skip = write_skip(cm, xd, segment_id, mi, w);
|
||||||
|
#else
|
||||||
skip = write_skip(cm, xd, segment_id, mi, w);
|
skip = write_skip(cm, xd, segment_id, mi, w);
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
if (!segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME))
|
#if CONFIG_SUPERTX
|
||||||
vpx_write(w, is_inter, vp10_get_intra_inter_prob(cm, xd));
|
if (!supertx_enabled)
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
if (!segfeature_active(seg, segment_id, SEG_LVL_REF_FRAME))
|
||||||
|
vpx_write(w, is_inter, vp10_get_intra_inter_prob(cm, xd));
|
||||||
|
|
||||||
if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT &&
|
if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT &&
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
!supertx_enabled &&
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
!(is_inter && skip)) {
|
!(is_inter && skip)) {
|
||||||
#if CONFIG_VAR_TX
|
#if CONFIG_VAR_TX
|
||||||
if (is_inter) { // This implies skip flag is 0.
|
if (is_inter) { // This implies skip flag is 0.
|
||||||
@@ -898,6 +950,9 @@ static void write_mb_modes_kf(const VP10_COMMON *cm, const MACROBLOCKD *xd,
|
|||||||
static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile,
|
static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile,
|
||||||
vpx_writer *w, TOKENEXTRA **tok,
|
vpx_writer *w, TOKENEXTRA **tok,
|
||||||
const TOKENEXTRA *const tok_end,
|
const TOKENEXTRA *const tok_end,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
int supertx_enabled,
|
||||||
|
#endif
|
||||||
int mi_row, int mi_col) {
|
int mi_row, int mi_col) {
|
||||||
const VP10_COMMON *const cm = &cpi->common;
|
const VP10_COMMON *const cm = &cpi->common;
|
||||||
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
|
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
|
||||||
@@ -920,7 +975,11 @@ static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile,
|
|||||||
xd->above_txfm_context = cm->above_txfm_context + mi_col;
|
xd->above_txfm_context = cm->above_txfm_context + mi_col;
|
||||||
xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & 0x07);
|
xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & 0x07);
|
||||||
#endif
|
#endif
|
||||||
pack_inter_mode_mvs(cpi, m, w);
|
pack_inter_mode_mvs(cpi, m,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
supertx_enabled,
|
||||||
|
#endif
|
||||||
|
w);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->mbmi.palette_mode_info.palette_size[0] > 0) {
|
if (m->mbmi.palette_mode_info.palette_size[0] > 0) {
|
||||||
@@ -930,6 +989,10 @@ static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile,
|
|||||||
assert(*tok < tok_end);
|
assert(*tok < tok_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
if (supertx_enabled) return;
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
if (!m->mbmi.skip) {
|
if (!m->mbmi.skip) {
|
||||||
assert(*tok < tok_end);
|
assert(*tok < tok_end);
|
||||||
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
|
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
|
||||||
@@ -971,7 +1034,7 @@ static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile,
|
|||||||
TX_SIZE tx = plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane])
|
TX_SIZE tx = plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane])
|
||||||
: m->mbmi.tx_size;
|
: m->mbmi.tx_size;
|
||||||
pack_mb_tokens(w, tok, tok_end, cm->bit_depth, tx);
|
pack_mb_tokens(w, tok, tok_end, cm->bit_depth, tx);
|
||||||
#endif
|
#endif // CONFIG_VAR_TX
|
||||||
assert(*tok < tok_end && (*tok)->token == EOSB_TOKEN);
|
assert(*tok < tok_end && (*tok)->token == EOSB_TOKEN);
|
||||||
(*tok)++;
|
(*tok)++;
|
||||||
}
|
}
|
||||||
@@ -1003,6 +1066,9 @@ static void write_partition(const VP10_COMMON *const cm,
|
|||||||
static void write_modes_sb(VP10_COMP *cpi,
|
static void write_modes_sb(VP10_COMP *cpi,
|
||||||
const TileInfo *const tile, vpx_writer *w,
|
const TileInfo *const tile, vpx_writer *w,
|
||||||
TOKENEXTRA **tok, const TOKENEXTRA *const tok_end,
|
TOKENEXTRA **tok, const TOKENEXTRA *const tok_end,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
int supertx_enabled,
|
||||||
|
#endif
|
||||||
int mi_row, int mi_col, BLOCK_SIZE bsize) {
|
int mi_row, int mi_col, BLOCK_SIZE bsize) {
|
||||||
const VP10_COMMON *const cm = &cpi->common;
|
const VP10_COMMON *const cm = &cpi->common;
|
||||||
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
|
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
|
||||||
@@ -1011,7 +1077,12 @@ static void write_modes_sb(VP10_COMP *cpi,
|
|||||||
const int bs = (1 << bsl) / 4;
|
const int bs = (1 << bsl) / 4;
|
||||||
PARTITION_TYPE partition;
|
PARTITION_TYPE partition;
|
||||||
BLOCK_SIZE subsize;
|
BLOCK_SIZE subsize;
|
||||||
const MODE_INFO *m = NULL;
|
MODE_INFO *m = NULL;
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
const int pack_token = !supertx_enabled;
|
||||||
|
TX_SIZE supertx_size;
|
||||||
|
int plane;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
|
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
|
||||||
return;
|
return;
|
||||||
@@ -1021,36 +1092,118 @@ static void write_modes_sb(VP10_COMP *cpi,
|
|||||||
partition = partition_lookup[bsl][m->mbmi.sb_type];
|
partition = partition_lookup[bsl][m->mbmi.sb_type];
|
||||||
write_partition(cm, xd, bs, mi_row, mi_col, partition, bsize, w);
|
write_partition(cm, xd, bs, mi_row, mi_col, partition, bsize, w);
|
||||||
subsize = get_subsize(bsize, partition);
|
subsize = get_subsize(bsize, partition);
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
xd->mi = cm->mi_grid_visible + (mi_row * cm->mi_stride + mi_col);
|
||||||
|
set_mi_row_col(xd, tile,
|
||||||
|
mi_row, num_8x8_blocks_high_lookup[bsize],
|
||||||
|
mi_col, num_8x8_blocks_wide_lookup[bsize],
|
||||||
|
cm->mi_rows, cm->mi_cols);
|
||||||
|
if (!supertx_enabled &&
|
||||||
|
!frame_is_intra_only(cm) &&
|
||||||
|
partition != PARTITION_NONE && bsize <= MAX_SUPERTX_BLOCK_SIZE &&
|
||||||
|
!xd->lossless[0]) {
|
||||||
|
vpx_prob prob;
|
||||||
|
supertx_size = max_txsize_lookup[bsize];
|
||||||
|
prob = cm->fc->supertx_prob[partition_supertx_context_lookup[partition]]
|
||||||
|
[supertx_size];
|
||||||
|
supertx_enabled = (xd->mi[0]->mbmi.tx_size == supertx_size);
|
||||||
|
vpx_write(w, supertx_enabled, prob);
|
||||||
|
if (supertx_enabled) {
|
||||||
|
vpx_write(w, xd->mi[0]->mbmi.skip, vp10_get_skip_prob(cm, xd));
|
||||||
|
#if CONFIG_EXT_TX
|
||||||
|
if (supertx_size <= TX_16X16 && !xd->mi[0]->mbmi.skip) {
|
||||||
|
int eset = get_ext_tx_set(supertx_size, bsize, 1);
|
||||||
|
if (eset > 0) {
|
||||||
|
vp10_write_token(
|
||||||
|
w, vp10_ext_tx_inter_tree[eset],
|
||||||
|
cm->fc->inter_ext_tx_prob[eset][supertx_size],
|
||||||
|
&ext_tx_inter_encodings[eset][xd->mi[0]->mbmi.tx_type]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // CONFIG_EXT_TX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
if (subsize < BLOCK_8X8) {
|
if (subsize < BLOCK_8X8) {
|
||||||
write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
|
write_modes_b(cpi, tile, w, tok, tok_end,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
supertx_enabled,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
mi_row, mi_col);
|
||||||
} else {
|
} else {
|
||||||
switch (partition) {
|
switch (partition) {
|
||||||
case PARTITION_NONE:
|
case PARTITION_NONE:
|
||||||
write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
|
write_modes_b(cpi, tile, w, tok, tok_end,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
supertx_enabled,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
mi_row, mi_col);
|
||||||
break;
|
break;
|
||||||
case PARTITION_HORZ:
|
case PARTITION_HORZ:
|
||||||
write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
|
write_modes_b(cpi, tile, w, tok, tok_end,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
supertx_enabled,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
mi_row, mi_col);
|
||||||
if (mi_row + bs < cm->mi_rows)
|
if (mi_row + bs < cm->mi_rows)
|
||||||
write_modes_b(cpi, tile, w, tok, tok_end, mi_row + bs, mi_col);
|
write_modes_b(cpi, tile, w, tok, tok_end,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
supertx_enabled,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
mi_row + bs, mi_col);
|
||||||
break;
|
break;
|
||||||
case PARTITION_VERT:
|
case PARTITION_VERT:
|
||||||
write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col);
|
write_modes_b(cpi, tile, w, tok, tok_end,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
supertx_enabled,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
mi_row, mi_col);
|
||||||
if (mi_col + bs < cm->mi_cols)
|
if (mi_col + bs < cm->mi_cols)
|
||||||
write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col + bs);
|
write_modes_b(cpi, tile, w, tok, tok_end,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
supertx_enabled,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
mi_row, mi_col + bs);
|
||||||
break;
|
break;
|
||||||
case PARTITION_SPLIT:
|
case PARTITION_SPLIT:
|
||||||
write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col, subsize);
|
write_modes_sb(cpi, tile, w, tok, tok_end,
|
||||||
write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col + bs,
|
#if CONFIG_SUPERTX
|
||||||
subsize);
|
supertx_enabled,
|
||||||
write_modes_sb(cpi, tile, w, tok, tok_end, mi_row + bs, mi_col,
|
#endif // CONFIG_SUPERTX
|
||||||
subsize);
|
mi_row, mi_col, subsize);
|
||||||
write_modes_sb(cpi, tile, w, tok, tok_end, mi_row + bs, mi_col + bs,
|
write_modes_sb(cpi, tile, w, tok, tok_end,
|
||||||
subsize);
|
#if CONFIG_SUPERTX
|
||||||
|
supertx_enabled,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
mi_row, mi_col + bs, subsize);
|
||||||
|
write_modes_sb(cpi, tile, w, tok, tok_end,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
supertx_enabled,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
mi_row + bs, mi_col, subsize);
|
||||||
|
write_modes_sb(cpi, tile, w, tok, tok_end,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
supertx_enabled,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
mi_row + bs, mi_col + bs, subsize);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
if (partition != PARTITION_NONE && supertx_enabled && pack_token &&
|
||||||
|
!m->mbmi.skip) {
|
||||||
|
assert(*tok < tok_end);
|
||||||
|
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
|
||||||
|
TX_SIZE tx = plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane])
|
||||||
|
: m->mbmi.tx_size;
|
||||||
|
pack_mb_tokens(w, tok, tok_end, cm->bit_depth, tx);
|
||||||
|
assert(*tok < tok_end && (*tok)->token == EOSB_TOKEN);
|
||||||
|
(*tok)++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
// update partition context
|
// update partition context
|
||||||
if (bsize >= BLOCK_8X8 &&
|
if (bsize >= BLOCK_8X8 &&
|
||||||
@@ -1072,8 +1225,11 @@ static void write_modes(VP10_COMP *cpi,
|
|||||||
#endif
|
#endif
|
||||||
for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
|
for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
|
||||||
mi_col += MI_BLOCK_SIZE)
|
mi_col += MI_BLOCK_SIZE)
|
||||||
write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col,
|
write_modes_sb(cpi, tile, w, tok, tok_end,
|
||||||
BLOCK_64X64);
|
#if CONFIG_SUPERTX
|
||||||
|
0,
|
||||||
|
#endif
|
||||||
|
mi_row, mi_col, BLOCK_64X64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1762,6 +1918,9 @@ static void write_uncompressed_header(VP10_COMP *cpi,
|
|||||||
|
|
||||||
static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
|
static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
|
||||||
VP10_COMMON *const cm = &cpi->common;
|
VP10_COMMON *const cm = &cpi->common;
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
FRAME_CONTEXT *const fc = cm->fc;
|
FRAME_CONTEXT *const fc = cm->fc;
|
||||||
FRAME_COUNTS *counts = cpi->td.counts;
|
FRAME_COUNTS *counts = cpi->td.counts;
|
||||||
vpx_writer header_bc;
|
vpx_writer header_bc;
|
||||||
@@ -1843,6 +2002,10 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
|
|||||||
#if CONFIG_EXT_TX
|
#if CONFIG_EXT_TX
|
||||||
update_ext_tx_probs(cm, &header_bc);
|
update_ext_tx_probs(cm, &header_bc);
|
||||||
#endif // CONFIG_EXT_TX
|
#endif // CONFIG_EXT_TX
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
if (!xd->lossless[0])
|
||||||
|
update_supertx_probs(cm, &header_bc);
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
}
|
}
|
||||||
|
|
||||||
vpx_stop_encode(&header_bc);
|
vpx_stop_encode(&header_bc);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -696,6 +696,30 @@ void vp10_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
void vp10_encode_sb_supertx(MACROBLOCK *x, BLOCK_SIZE bsize) {
|
||||||
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
|
struct optimize_ctx ctx;
|
||||||
|
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
|
||||||
|
struct encode_b_args arg = {x, &ctx, &mbmi->skip};
|
||||||
|
int plane;
|
||||||
|
|
||||||
|
mbmi->skip = 1;
|
||||||
|
if (x->skip)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
|
||||||
|
const struct macroblockd_plane* const pd = &xd->plane[plane];
|
||||||
|
const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size;
|
||||||
|
vp10_subtract_plane(x, bsize, plane);
|
||||||
|
vp10_get_entropy_contexts(bsize, tx_size, pd,
|
||||||
|
ctx.ta[plane], ctx.tl[plane]);
|
||||||
|
vp10_foreach_transformed_block_in_plane(xd, bsize, plane, encode_block,
|
||||||
|
&arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
void vp10_encode_block_intra(int plane, int block, int blk_row, int blk_col,
|
void vp10_encode_block_intra(int plane, int block, int blk_row, int blk_col,
|
||||||
BLOCK_SIZE plane_bsize,
|
BLOCK_SIZE plane_bsize,
|
||||||
TX_SIZE tx_size, void *arg) {
|
TX_SIZE tx_size, void *arg) {
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ typedef enum VP10_XFORM_QUANT {
|
|||||||
} VP10_XFORM_QUANT;
|
} VP10_XFORM_QUANT;
|
||||||
|
|
||||||
void vp10_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize);
|
void vp10_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize);
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
void vp10_encode_sb_supertx(MACROBLOCK *x, BLOCK_SIZE bsize);
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
void vp10_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize);
|
void vp10_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize);
|
||||||
void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
|
void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
|
||||||
int blk_row, int blk_col,
|
int blk_row, int blk_col,
|
||||||
|
|||||||
@@ -457,11 +457,11 @@ static int cost_coeffs(MACROBLOCK *x,
|
|||||||
const int16_t *cat6_high_cost = vp10_get_high_cost_table(8);
|
const int16_t *cat6_high_cost = vp10_get_high_cost_table(8);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !CONFIG_VAR_TX
|
#if !CONFIG_VAR_TX && !CONFIG_SUPERTX
|
||||||
// Check for consistency of tx_size with mode info
|
// Check for consistency of tx_size with mode info
|
||||||
assert(type == PLANE_TYPE_Y ? mbmi->tx_size == tx_size
|
assert(type == PLANE_TYPE_Y ? mbmi->tx_size == tx_size
|
||||||
: get_uv_tx_size(mbmi, pd) == tx_size);
|
: get_uv_tx_size(mbmi, pd) == tx_size);
|
||||||
#endif
|
#endif // !CONFIG_VAR_TX && !CONFIG_SUPERTX
|
||||||
|
|
||||||
if (eob == 0) {
|
if (eob == 0) {
|
||||||
// single eob token
|
// single eob token
|
||||||
@@ -732,6 +732,54 @@ static void txfm_rd_in_plane(MACROBLOCK *x,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
void vp10_txfm_rd_in_plane_supertx(MACROBLOCK *x,
|
||||||
|
#if CONFIG_VAR_TX
|
||||||
|
const VP10_COMP *cpi,
|
||||||
|
#endif
|
||||||
|
int *rate, int64_t *distortion,
|
||||||
|
int *skippable, int64_t *sse,
|
||||||
|
int64_t ref_best_rd, int plane,
|
||||||
|
BLOCK_SIZE bsize, TX_SIZE tx_size,
|
||||||
|
int use_fast_coef_casting) {
|
||||||
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
|
const struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||||
|
struct rdcost_block_args args;
|
||||||
|
TX_TYPE tx_type;
|
||||||
|
|
||||||
|
vp10_zero(args);
|
||||||
|
args.x = x;
|
||||||
|
#if CONFIG_VAR_TX
|
||||||
|
args.cpi = cpi;
|
||||||
|
#endif
|
||||||
|
args.best_rd = ref_best_rd;
|
||||||
|
args.use_fast_coef_costing = use_fast_coef_casting;
|
||||||
|
|
||||||
|
if (plane == 0)
|
||||||
|
xd->mi[0]->mbmi.tx_size = tx_size;
|
||||||
|
|
||||||
|
vp10_get_entropy_contexts(bsize, tx_size, pd, args.t_above, args.t_left);
|
||||||
|
|
||||||
|
tx_type = get_tx_type(pd->plane_type, xd, 0, tx_size);
|
||||||
|
args.so = get_scan(tx_size, tx_type, is_inter_block(&xd->mi[0]->mbmi));
|
||||||
|
|
||||||
|
block_rd_txfm(plane, 0, 0, 0, get_plane_block_size(bsize, pd),
|
||||||
|
tx_size, &args);
|
||||||
|
|
||||||
|
if (args.exit_early) {
|
||||||
|
*rate = INT_MAX;
|
||||||
|
*distortion = INT64_MAX;
|
||||||
|
*sse = INT64_MAX;
|
||||||
|
*skippable = 0;
|
||||||
|
} else {
|
||||||
|
*distortion = args.this_dist;
|
||||||
|
*rate = args.this_rate;
|
||||||
|
*sse = args.this_sse;
|
||||||
|
*skippable = !x->plane[plane].eobs[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
|
static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
|
||||||
int *rate, int64_t *distortion,
|
int *rate, int64_t *distortion,
|
||||||
int *skip, int64_t *sse,
|
int *skip, int64_t *sse,
|
||||||
@@ -4855,7 +4903,11 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi,
|
|||||||
TileDataEnc *tile_data,
|
TileDataEnc *tile_data,
|
||||||
MACROBLOCK *x,
|
MACROBLOCK *x,
|
||||||
int mi_row, int mi_col,
|
int mi_row, int mi_col,
|
||||||
RD_COST *rd_cost, BLOCK_SIZE bsize,
|
RD_COST *rd_cost,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
int *returnrate_nocoef,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
BLOCK_SIZE bsize,
|
||||||
PICK_MODE_CONTEXT *ctx,
|
PICK_MODE_CONTEXT *ctx,
|
||||||
int64_t best_rd_so_far) {
|
int64_t best_rd_so_far) {
|
||||||
VP10_COMMON *const cm = &cpi->common;
|
VP10_COMMON *const cm = &cpi->common;
|
||||||
@@ -4954,6 +5006,9 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rd_cost->rate = INT_MAX;
|
rd_cost->rate = INT_MAX;
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
*returnrate_nocoef = INT_MAX;
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
|
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
|
||||||
x->pred_mv_sad[ref_frame] = INT_MAX;
|
x->pred_mv_sad[ref_frame] = INT_MAX;
|
||||||
@@ -5375,7 +5430,8 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi,
|
|||||||
if (skippable) {
|
if (skippable) {
|
||||||
// Back out the coefficient coding costs
|
// Back out the coefficient coding costs
|
||||||
rate2 -= (rate_y + rate_uv);
|
rate2 -= (rate_y + rate_uv);
|
||||||
|
rate_y = 0;
|
||||||
|
rate_uv = 0;
|
||||||
// Cost the skip mb case
|
// Cost the skip mb case
|
||||||
rate2 += vp10_cost_bit(vp10_get_skip_prob(cm, xd), 1);
|
rate2 += vp10_cost_bit(vp10_get_skip_prob(cm, xd), 1);
|
||||||
|
|
||||||
@@ -5391,6 +5447,8 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi,
|
|||||||
assert(total_sse >= 0);
|
assert(total_sse >= 0);
|
||||||
rate2 -= (rate_y + rate_uv);
|
rate2 -= (rate_y + rate_uv);
|
||||||
this_skip2 = 1;
|
this_skip2 = 1;
|
||||||
|
rate_y = 0;
|
||||||
|
rate_uv = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Add in the cost of the no skip flag.
|
// Add in the cost of the no skip flag.
|
||||||
@@ -5437,6 +5495,15 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rd_cost->rate = rate2;
|
rd_cost->rate = rate2;
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
*returnrate_nocoef = rate2 - rate_y - rate_uv;
|
||||||
|
if (!disable_skip) {
|
||||||
|
*returnrate_nocoef -= vp10_cost_bit(vp10_get_skip_prob(cm, xd),
|
||||||
|
skippable || this_skip2);
|
||||||
|
}
|
||||||
|
*returnrate_nocoef -= vp10_cost_bit(vp10_get_intra_inter_prob(cm, xd),
|
||||||
|
mbmi->ref_frame[0] != INTRA_FRAME);
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
rd_cost->dist = distortion2;
|
rd_cost->dist = distortion2;
|
||||||
rd_cost->rdcost = this_rd;
|
rd_cost->rdcost = this_rd;
|
||||||
best_rd = this_rd;
|
best_rd = this_rd;
|
||||||
@@ -5760,14 +5827,17 @@ void vp10_rd_pick_inter_mode_sb_seg_skip(VP10_COMP *cpi,
|
|||||||
best_pred_diff, best_filter_diff, 0);
|
best_pred_diff, best_filter_diff, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vp10_rd_pick_inter_mode_sub8x8(VP10_COMP *cpi,
|
void vp10_rd_pick_inter_mode_sub8x8(struct VP10_COMP *cpi,
|
||||||
TileDataEnc *tile_data,
|
TileDataEnc *tile_data,
|
||||||
MACROBLOCK *x,
|
struct macroblock *x,
|
||||||
int mi_row, int mi_col,
|
int mi_row, int mi_col,
|
||||||
RD_COST *rd_cost,
|
struct RD_COST *rd_cost,
|
||||||
BLOCK_SIZE bsize,
|
#if CONFIG_SUPERTX
|
||||||
PICK_MODE_CONTEXT *ctx,
|
int *returnrate_nocoef,
|
||||||
int64_t best_rd_so_far) {
|
#endif // CONFIG_SUPERTX
|
||||||
|
BLOCK_SIZE bsize,
|
||||||
|
PICK_MODE_CONTEXT *ctx,
|
||||||
|
int64_t best_rd_so_far) {
|
||||||
VP10_COMMON *const cm = &cpi->common;
|
VP10_COMMON *const cm = &cpi->common;
|
||||||
RD_OPT *const rd_opt = &cpi->rd;
|
RD_OPT *const rd_opt = &cpi->rd;
|
||||||
SPEED_FEATURES *const sf = &cpi->sf;
|
SPEED_FEATURES *const sf = &cpi->sf;
|
||||||
@@ -5816,6 +5886,11 @@ void vp10_rd_pick_inter_mode_sub8x8(VP10_COMP *cpi,
|
|||||||
int internal_active_edge =
|
int internal_active_edge =
|
||||||
vp10_active_edge_sb(cpi, mi_row, mi_col) && vp10_internal_image_edge(cpi);
|
vp10_active_edge_sb(cpi, mi_row, mi_col) && vp10_internal_image_edge(cpi);
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
best_rd_so_far = INT64_MAX;
|
||||||
|
best_rd = best_rd_so_far;
|
||||||
|
best_yrd = best_rd_so_far;
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
memset(x->zcoeff_blk[TX_4X4], 0, 4);
|
memset(x->zcoeff_blk[TX_4X4], 0, 4);
|
||||||
vp10_zero(best_mbmode);
|
vp10_zero(best_mbmode);
|
||||||
|
|
||||||
@@ -5843,6 +5918,9 @@ void vp10_rd_pick_inter_mode_sub8x8(VP10_COMP *cpi,
|
|||||||
rate_uv_intra = INT_MAX;
|
rate_uv_intra = INT_MAX;
|
||||||
|
|
||||||
rd_cost->rate = INT_MAX;
|
rd_cost->rate = INT_MAX;
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
*returnrate_nocoef = INT_MAX;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) {
|
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) {
|
||||||
if (cpi->ref_frame_flags & flag_list[ref_frame]) {
|
if (cpi->ref_frame_flags & flag_list[ref_frame]) {
|
||||||
@@ -6300,6 +6378,15 @@ void vp10_rd_pick_inter_mode_sub8x8(VP10_COMP *cpi,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rd_cost->rate = rate2;
|
rd_cost->rate = rate2;
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
*returnrate_nocoef = rate2 - rate_y - rate_uv;
|
||||||
|
if (!disable_skip)
|
||||||
|
*returnrate_nocoef -= vp10_cost_bit(vp10_get_skip_prob(cm, xd),
|
||||||
|
this_skip2);
|
||||||
|
*returnrate_nocoef -= vp10_cost_bit(vp10_get_intra_inter_prob(cm, xd),
|
||||||
|
mbmi->ref_frame[0] != INTRA_FRAME);
|
||||||
|
assert(*returnrate_nocoef > 0);
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
rd_cost->dist = distortion2;
|
rd_cost->dist = distortion2;
|
||||||
rd_cost->rdcost = this_rd;
|
rd_cost->rdcost = this_rd;
|
||||||
best_rd = this_rd;
|
best_rd = this_rd;
|
||||||
@@ -6402,6 +6489,9 @@ void vp10_rd_pick_inter_mode_sub8x8(VP10_COMP *cpi,
|
|||||||
if (best_rd >= best_rd_so_far) {
|
if (best_rd >= best_rd_so_far) {
|
||||||
rd_cost->rate = INT_MAX;
|
rd_cost->rate = INT_MAX;
|
||||||
rd_cost->rdcost = INT64_MAX;
|
rd_cost->rdcost = INT64_MAX;
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
*returnrate_nocoef = INT_MAX;
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6422,6 +6512,9 @@ void vp10_rd_pick_inter_mode_sub8x8(VP10_COMP *cpi,
|
|||||||
rd_cost->rate = INT_MAX;
|
rd_cost->rate = INT_MAX;
|
||||||
rd_cost->dist = INT64_MAX;
|
rd_cost->dist = INT64_MAX;
|
||||||
rd_cost->rdcost = INT64_MAX;
|
rd_cost->rdcost = INT64_MAX;
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
*returnrate_nocoef = INT_MAX;
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ void vp10_rd_pick_inter_mode_sb(struct VP10_COMP *cpi,
|
|||||||
struct macroblock *x,
|
struct macroblock *x,
|
||||||
int mi_row, int mi_col,
|
int mi_row, int mi_col,
|
||||||
struct RD_COST *rd_cost,
|
struct RD_COST *rd_cost,
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
int *returnrate_nocoef,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx,
|
BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx,
|
||||||
int64_t best_rd_so_far);
|
int64_t best_rd_so_far);
|
||||||
|
|
||||||
@@ -60,12 +63,27 @@ int vp10_active_v_edge(struct VP10_COMP *cpi, int mi_col, int mi_step);
|
|||||||
int vp10_active_edge_sb(struct VP10_COMP *cpi, int mi_row, int mi_col);
|
int vp10_active_edge_sb(struct VP10_COMP *cpi, int mi_row, int mi_col);
|
||||||
|
|
||||||
void vp10_rd_pick_inter_mode_sub8x8(struct VP10_COMP *cpi,
|
void vp10_rd_pick_inter_mode_sub8x8(struct VP10_COMP *cpi,
|
||||||
struct TileDataEnc *tile_data,
|
struct TileDataEnc *tile_data,
|
||||||
struct macroblock *x,
|
struct macroblock *x,
|
||||||
int mi_row, int mi_col,
|
int mi_row, int mi_col,
|
||||||
struct RD_COST *rd_cost,
|
struct RD_COST *rd_cost,
|
||||||
BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx,
|
#if CONFIG_SUPERTX
|
||||||
int64_t best_rd_so_far);
|
int *returnrate_nocoef,
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx,
|
||||||
|
int64_t best_rd_so_far);
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
void vp10_txfm_rd_in_plane_supertx(MACROBLOCK *x,
|
||||||
|
#if CONFIG_VAR_TX
|
||||||
|
const VP10_COMP *cpi,
|
||||||
|
#endif // CONFIG_VAR_TX
|
||||||
|
int *rate, int64_t *distortion,
|
||||||
|
int *skippable, int64_t *sse,
|
||||||
|
int64_t ref_best_rd, int plane,
|
||||||
|
BLOCK_SIZE bsize, TX_SIZE tx_size,
|
||||||
|
int use_fast_coef_casting);
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|||||||
@@ -789,3 +789,40 @@ void vp10_tokenize_sb(VP10_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
|
|||||||
vp10_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg);
|
vp10_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
void vp10_tokenize_sb_supertx(VP10_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
|
||||||
|
int dry_run, BLOCK_SIZE bsize) {
|
||||||
|
VP10_COMMON *const cm = &cpi->common;
|
||||||
|
MACROBLOCKD *const xd = &td->mb.e_mbd;
|
||||||
|
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
|
||||||
|
TOKENEXTRA *t_backup = *t;
|
||||||
|
const int ctx = vp10_get_skip_context(xd);
|
||||||
|
const int skip_inc = !segfeature_active(&cm->seg, mbmi->segment_id,
|
||||||
|
SEG_LVL_SKIP);
|
||||||
|
struct tokenize_b_args arg = {cpi, td, t};
|
||||||
|
if (mbmi->skip) {
|
||||||
|
if (!dry_run)
|
||||||
|
td->counts->skip[ctx][1] += skip_inc;
|
||||||
|
reset_skip_context(xd, bsize);
|
||||||
|
if (dry_run)
|
||||||
|
*t = t_backup;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dry_run) {
|
||||||
|
int plane;
|
||||||
|
td->counts->skip[ctx][0] += skip_inc;
|
||||||
|
|
||||||
|
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
|
||||||
|
vp10_foreach_transformed_block_in_plane(xd, bsize, plane, tokenize_b,
|
||||||
|
&arg);
|
||||||
|
(*t)->token = EOSB_TOKEN;
|
||||||
|
(*t)++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vp10_foreach_transformed_block(xd, bsize, set_entropy_context_b, &arg);
|
||||||
|
*t = t_backup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // CONFIG_SUPERTX
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ void vp10_tokenize_palette_sb(struct ThreadData *const td,
|
|||||||
TOKENEXTRA **t);
|
TOKENEXTRA **t);
|
||||||
void vp10_tokenize_sb(struct VP10_COMP *cpi, struct ThreadData *td,
|
void vp10_tokenize_sb(struct VP10_COMP *cpi, struct ThreadData *td,
|
||||||
TOKENEXTRA **t, int dry_run, BLOCK_SIZE bsize);
|
TOKENEXTRA **t, int dry_run, BLOCK_SIZE bsize);
|
||||||
|
#if CONFIG_SUPERTX
|
||||||
|
void vp10_tokenize_sb_supertx(struct VP10_COMP *cpi, struct ThreadData *td,
|
||||||
|
TOKENEXTRA **t, int dry_run, BLOCK_SIZE bsize);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const int16_t *vp10_dct_value_cost_ptr;
|
extern const int16_t *vp10_dct_value_cost_ptr;
|
||||||
/* TODO: The Token field should be broken out into a separate char array to
|
/* TODO: The Token field should be broken out into a separate char array to
|
||||||
|
|||||||
Reference in New Issue
Block a user