mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Removed 'emt' variable from cu_info_t and changed 'emt' globally to 'mts' for consistency.
This commit is contained in:
parent
d0b7dd95f7
commit
c5570abe1b
3
src/cu.h
3
src/cu.h
|
@ -53,7 +53,7 @@ typedef enum {
|
|||
SIZE_nRx2N = 7,
|
||||
} part_mode_t;
|
||||
|
||||
//EMT transform combinations
|
||||
//MTS transform combinations
|
||||
typedef enum {
|
||||
MTS_DCT2_DCT2 = 0,
|
||||
MTS_SKIP = 1,
|
||||
|
@ -135,7 +135,6 @@ typedef struct
|
|||
uint8_t merged : 1; //!< \brief flag to indicate this block is merged
|
||||
uint8_t merge_idx : 3; //!< \brief merge index
|
||||
uint8_t tr_skip : 1; //!< \brief transform skip flag
|
||||
uint8_t emt : 1; //!< \brief enable multiple transforms
|
||||
uint8_t tr_idx : 3; //!< \brief transform index
|
||||
|
||||
uint16_t cbf;
|
||||
|
|
12
src/search.c
12
src/search.c
|
@ -139,7 +139,6 @@ static void lcu_fill_cu_info(lcu_t *lcu, int x_local, int y_local, int width, in
|
|||
to->depth = cu->depth;
|
||||
to->part_size = cu->part_size;
|
||||
to->qp = cu->qp;
|
||||
//to->emt = cu->emt;
|
||||
//to->tr_idx = cu->tr_idx;
|
||||
|
||||
if (cu->type == CU_INTRA) {
|
||||
|
@ -526,7 +525,6 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
|
|||
cur_cu->qp = state->qp;
|
||||
cur_cu->intra.multi_ref_idx = 0;
|
||||
cur_cu->bdpcmMode = 0;
|
||||
cur_cu->emt = 0;
|
||||
cur_cu->tr_idx = 0;
|
||||
cur_cu->violates_mts_coeff_constraint = 0;
|
||||
cur_cu->mts_last_scan_pos = 0;
|
||||
|
@ -622,15 +620,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
|
|||
cur_cu->intra.mode = intra_mode;
|
||||
|
||||
//If the CU is not split from 64x64 block, the MTS is disabled for that CU.
|
||||
if (depth > 0) {
|
||||
cur_cu->emt = intra_trafo > 0;
|
||||
cur_cu->tr_idx = intra_trafo;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur_cu->emt = 0;
|
||||
cur_cu->tr_idx = 0;
|
||||
}
|
||||
cur_cu->tr_idx = (depth > 0) ? intra_trafo : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -283,7 +283,6 @@ static double search_intra_trdepth(encoder_state_t * const state,
|
|||
|
||||
const int8_t chroma_mode = reconstruct_chroma ? intra_mode : -1;
|
||||
double best_rd_cost = MAX_INT;
|
||||
int best_emt = 0;
|
||||
int best_tr_idx = 0;
|
||||
|
||||
int trafo = 0;
|
||||
|
@ -299,24 +298,16 @@ static double search_intra_trdepth(encoder_state_t * const state,
|
|||
num_transforms = (mts_enabled ? MTS_TR_NUM : 1);
|
||||
}
|
||||
for (; trafo < num_transforms; trafo++) {
|
||||
if (mts_enabled && (trafo > 0))
|
||||
pred_cu->tr_idx = trafo;
|
||||
if (mts_enabled)
|
||||
{
|
||||
pred_cu->emt = 1;
|
||||
pred_cu->mts_last_scan_pos = 0;
|
||||
pred_cu->violates_mts_coeff_constraint = 0;
|
||||
|
||||
if (trafo == 1) {
|
||||
if (trafo == MTS_SKIP) {
|
||||
//TODO: Consider tranform skip
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
pred_cu->tr_idx = trafo;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pred_cu->emt = 0;
|
||||
pred_cu->tr_idx = 0;
|
||||
}
|
||||
|
||||
kvz_intra_recon_cu(state,
|
||||
|
@ -342,13 +333,10 @@ static double search_intra_trdepth(encoder_state_t * const state,
|
|||
|
||||
if (rd_cost < best_rd_cost) {
|
||||
best_rd_cost = rd_cost;
|
||||
best_emt = pred_cu->emt;
|
||||
best_tr_idx = pred_cu->tr_idx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pred_cu->emt = best_emt;
|
||||
pred_cu->tr_idx = best_tr_idx;
|
||||
nosplit_cost += best_rd_cost;
|
||||
|
||||
|
@ -741,7 +729,7 @@ static int8_t search_intra_rdo(encoder_state_t * const state,
|
|||
|
||||
double mode_cost = search_intra_trdepth(state, x_px, y_px, depth, tr_depth, modes[rdo_mode], MAX_INT, &pred_cu, lcu, -1);
|
||||
costs[rdo_mode] += mode_cost;
|
||||
trafo[rdo_mode] = pred_cu.emt ? pred_cu.tr_idx : 0;
|
||||
trafo[rdo_mode] = pred_cu.tr_idx;
|
||||
|
||||
// Early termination if no coefficients has to be coded
|
||||
if (state->encoder_control->cfg.intra_rdo_et && !cbf_is_set_any(pred_cu.cbf, depth)) {
|
||||
|
|
|
@ -2290,7 +2290,7 @@ static void fastInverseDST7_B8(const int16_t *src, int16_t *dst, int32_t shift,
|
|||
|
||||
|
||||
|
||||
#define DCT_EMT_NXN_GENERIC(t, n) \
|
||||
#define DCT_MTS_NXN_GENERIC(t, n) \
|
||||
static void fastForward ## t ## _B ## n (const int16_t *src, int16_t *dst, int32_t shift, int line, int skip_line, int skip_line2) {\
|
||||
\
|
||||
const int tr_size = n;\
|
||||
|
@ -2329,7 +2329,7 @@ static void fastForward ## t ## _B ## n (const int16_t *src, int16_t *dst, int32
|
|||
}\
|
||||
}
|
||||
|
||||
#define IDCT_EMT_NXN_GENERIC(t, n) \
|
||||
#define IDCT_MTS_NXN_GENERIC(t, n) \
|
||||
static void fastInverse ## t ## _B ## n (const int16_t *src, int16_t *dst, int32_t shift, int line, int skip_line, int skip_line2) {\
|
||||
\
|
||||
const int tr_size = n;\
|
||||
|
@ -2359,47 +2359,47 @@ static void fastInverse ## t ## _B ## n (const int16_t *src, int16_t *dst, int32
|
|||
|
||||
|
||||
// DCT 8
|
||||
//IDCT_EMT_NXN_GENERIC(DCT8, 8);
|
||||
//IDCT_EMT_NXN_GENERIC(DCT8, 16);
|
||||
//IDCT_EMT_NXN_GENERIC(DCT8, 32);
|
||||
//IDCT_MTS_NXN_GENERIC(DCT8, 8);
|
||||
//IDCT_MTS_NXN_GENERIC(DCT8, 16);
|
||||
//IDCT_MTS_NXN_GENERIC(DCT8, 32);
|
||||
|
||||
//DCT_EMT_NXN_GENERIC(DCT8, 8);
|
||||
//DCT_EMT_NXN_GENERIC(DCT8, 16);
|
||||
//DCT_EMT_NXN_GENERIC(DCT8, 32);
|
||||
//DCT_MTS_NXN_GENERIC(DCT8, 8);
|
||||
//DCT_MTS_NXN_GENERIC(DCT8, 16);
|
||||
//DCT_MTS_NXN_GENERIC(DCT8, 32);
|
||||
/*
|
||||
// DCT 5
|
||||
IDCT_EMT_NXN_GENERIC(DCT5, 4);
|
||||
IDCT_EMT_NXN_GENERIC(DCT5, 8);
|
||||
IDCT_EMT_NXN_GENERIC(DCT5, 16);
|
||||
IDCT_EMT_NXN_GENERIC(DCT5, 32);
|
||||
IDCT_MTS_NXN_GENERIC(DCT5, 4);
|
||||
IDCT_MTS_NXN_GENERIC(DCT5, 8);
|
||||
IDCT_MTS_NXN_GENERIC(DCT5, 16);
|
||||
IDCT_MTS_NXN_GENERIC(DCT5, 32);
|
||||
|
||||
DCT_EMT_NXN_GENERIC(DCT5, 4);
|
||||
DCT_EMT_NXN_GENERIC(DCT5, 8);
|
||||
DCT_EMT_NXN_GENERIC(DCT5, 16);
|
||||
DCT_EMT_NXN_GENERIC(DCT5, 32);
|
||||
DCT_MTS_NXN_GENERIC(DCT5, 4);
|
||||
DCT_MTS_NXN_GENERIC(DCT5, 8);
|
||||
DCT_MTS_NXN_GENERIC(DCT5, 16);
|
||||
DCT_MTS_NXN_GENERIC(DCT5, 32);
|
||||
|
||||
// DST 1
|
||||
IDCT_EMT_NXN_GENERIC(DST1, 8);
|
||||
IDCT_EMT_NXN_GENERIC(DST1, 16);
|
||||
IDCT_EMT_NXN_GENERIC(DST1, 32);
|
||||
IDCT_MTS_NXN_GENERIC(DST1, 8);
|
||||
IDCT_MTS_NXN_GENERIC(DST1, 16);
|
||||
IDCT_MTS_NXN_GENERIC(DST1, 32);
|
||||
|
||||
DCT_EMT_NXN_GENERIC(DST1, 8);
|
||||
DCT_EMT_NXN_GENERIC(DST1, 16);
|
||||
DCT_EMT_NXN_GENERIC(DST1, 32);
|
||||
DCT_MTS_NXN_GENERIC(DST1, 8);
|
||||
DCT_MTS_NXN_GENERIC(DST1, 16);
|
||||
DCT_MTS_NXN_GENERIC(DST1, 32);
|
||||
*/
|
||||
// DST 7
|
||||
//IDCT_EMT_NXN_GENERIC(DST7, 8);
|
||||
//IDCT_EMT_NXN_GENERIC(DST7, 16);
|
||||
//IDCT_EMT_NXN_GENERIC(DST7, 32);
|
||||
//IDCT_MTS_NXN_GENERIC(DST7, 8);
|
||||
//IDCT_MTS_NXN_GENERIC(DST7, 16);
|
||||
//IDCT_MTS_NXN_GENERIC(DST7, 32);
|
||||
|
||||
//DCT_EMT_NXN_GENERIC(DST7, 8);
|
||||
//DCT_EMT_NXN_GENERIC(DST7, 16);
|
||||
//DCT_EMT_NXN_GENERIC(DST7, 32);
|
||||
//DCT_MTS_NXN_GENERIC(DST7, 8);
|
||||
//DCT_MTS_NXN_GENERIC(DST7, 16);
|
||||
//DCT_MTS_NXN_GENERIC(DST7, 32);
|
||||
|
||||
|
||||
typedef void partial_tr_func(const int16_t*, int16_t*, int32_t, int, int, int);
|
||||
|
||||
// ToDo: Enable EMT 2x2 and 64x64 transforms
|
||||
// ToDo: Enable MTS 2x2 and 64x64 transforms
|
||||
static partial_tr_func* dct_table[3][5] = {
|
||||
{ fastForwardDCT2_B4, fastForwardDCT2_B8, fastForwardDCT2_B16, fastForwardDCT2_B32, NULL },
|
||||
{ fastForwardDCT8_B4, fastForwardDCT8_B8, fastForwardDCT8_B16, fastForwardDCT8_B32, NULL },
|
||||
|
@ -2413,28 +2413,17 @@ static partial_tr_func* idct_table[3][5] = {
|
|||
};
|
||||
|
||||
|
||||
//EMT transform tags
|
||||
//MTS transform tags
|
||||
typedef enum tr_type_t {
|
||||
DCT2 = 0,
|
||||
DCT8 = 1,
|
||||
DST7 = 2,
|
||||
NUM_TRANS_TYPE = 3,
|
||||
DCT2_EMT = 4
|
||||
DCT2_MTS = 4
|
||||
} tr_type_t;
|
||||
|
||||
static const tr_type_t emt_subset_intra[4][2] = { { DST7, DST7 }, { DCT8, DST7 }, { DST7, DCT8 }, { DCT8, DCT8 } };
|
||||
static const tr_type_t emt_subset_inter[2] = { DCT8, DST7 };
|
||||
|
||||
/*static const int intra_mode_to_emt_subset_ver[67] =
|
||||
{//0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
||||
2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0
|
||||
};
|
||||
|
||||
static const int intra_mode_to_emt_subset_hor[67] =
|
||||
{//0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
||||
2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0
|
||||
};*/
|
||||
|
||||
static const tr_type_t mts_subset_intra[4][2] = { { DST7, DST7 }, { DCT8, DST7 }, { DST7, DCT8 }, { DCT8, DCT8 } };
|
||||
static const tr_type_t mts_subset_inter[2] = { DCT8, DST7 };
|
||||
|
||||
static INLINE void get_tr_type(
|
||||
int8_t width,
|
||||
|
@ -2447,13 +2436,13 @@ static INLINE void get_tr_type(
|
|||
*ver_out = DCT2;
|
||||
|
||||
if (tu->tr_idx > MTS_SKIP) {
|
||||
*hor_out = emt_subset_intra[tu->tr_idx - MTS_DST7_DST7][0];
|
||||
*ver_out = emt_subset_intra[tu->tr_idx - MTS_DST7_DST7][1];
|
||||
*hor_out = mts_subset_intra[tu->tr_idx - MTS_DST7_DST7][0];
|
||||
*ver_out = mts_subset_intra[tu->tr_idx - MTS_DST7_DST7][1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void emt_dct_generic(
|
||||
static void mts_dct_generic(
|
||||
const int8_t bitdepth,
|
||||
const color_t color,
|
||||
const cu_info_t* tu,
|
||||
|
@ -2483,7 +2472,7 @@ static void emt_dct_generic(
|
|||
}
|
||||
|
||||
|
||||
static void emt_idct_generic(
|
||||
static void mts_idct_generic(
|
||||
const int8_t bitdepth,
|
||||
const color_t color,
|
||||
const cu_info_t* tu,
|
||||
|
@ -2531,8 +2520,8 @@ int kvz_strategy_register_dct_generic(void* opaque, uint8_t bitdepth)
|
|||
success &= kvz_strategyselector_register(opaque, "idct_16x16", "generic", 0, &idct_16x16_generic);
|
||||
success &= kvz_strategyselector_register(opaque, "idct_32x32", "generic", 0, &idct_32x32_generic);
|
||||
|
||||
success &= kvz_strategyselector_register(opaque, "emt_dct", "generic", 0, &emt_dct_generic);
|
||||
success &= kvz_strategyselector_register(opaque, "emt_idct", "generic", 0, &emt_idct_generic);
|
||||
success &= kvz_strategyselector_register(opaque, "mts_dct", "generic", 0, &mts_dct_generic);
|
||||
success &= kvz_strategyselector_register(opaque, "mts_idct", "generic", 0, &mts_idct_generic);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
|
|
@ -40,13 +40,13 @@ dct_func * kvz_idct_8x8= 0;
|
|||
dct_func * kvz_idct_16x16 = 0;
|
||||
dct_func * kvz_idct_32x32 = 0;
|
||||
|
||||
void(*kvz_emt_dct)(int8_t bitdepth,
|
||||
void(*kvz_mts_dct)(int8_t bitdepth,
|
||||
color_t color,
|
||||
const cu_info_t *tu,
|
||||
int8_t width,
|
||||
const int16_t *input,
|
||||
int16_t *output);
|
||||
void(*kvz_emt_idct)(int8_t bitdepth,
|
||||
void(*kvz_mts_idct)(int8_t bitdepth,
|
||||
color_t color,
|
||||
const cu_info_t *tu,
|
||||
int8_t width,
|
||||
|
|
|
@ -48,14 +48,14 @@ extern dct_func * kvz_idct_16x16;
|
|||
extern dct_func * kvz_idct_32x32;
|
||||
|
||||
|
||||
extern void(*kvz_emt_dct)(
|
||||
extern void(*kvz_mts_dct)(
|
||||
int8_t bitdepth,
|
||||
color_t color,
|
||||
const cu_info_t *tu,
|
||||
int8_t width,
|
||||
const int16_t *input,
|
||||
int16_t *output);
|
||||
extern void(*kvz_emt_idct)(
|
||||
extern void(*kvz_mts_idct)(
|
||||
int8_t bitdepth,
|
||||
color_t color,
|
||||
const cu_info_t *tu,
|
||||
|
@ -83,8 +83,8 @@ dct_func * kvz_get_idct_func(int8_t width, color_t color, cu_type_t type);
|
|||
{"idct_8x8", (void**)&kvz_idct_8x8}, \
|
||||
{"idct_16x16", (void**)&kvz_idct_16x16}, \
|
||||
{"idct_32x32", (void**)&kvz_idct_32x32}, \
|
||||
{"emt_dct", (void**)&kvz_emt_dct }, \
|
||||
{"emt_idct", (void**)&kvz_emt_idct }, \
|
||||
{"mts_dct", (void**)&kvz_mts_dct }, \
|
||||
{"mts_idct", (void**)&kvz_mts_idct }, \
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -194,9 +194,9 @@ void kvz_transform2d(const encoder_control_t * const encoder,
|
|||
color_t color,
|
||||
const cu_info_t *tu)
|
||||
{
|
||||
if (tu->emt && color == COLOR_Y)
|
||||
if (tu->tr_idx > MTS_SKIP && color == COLOR_Y)
|
||||
{
|
||||
kvz_emt_dct(encoder->bitdepth, color, tu, block_size, block, coeff);
|
||||
kvz_mts_dct(encoder->bitdepth, color, tu, block_size, block, coeff);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -212,9 +212,9 @@ void kvz_itransform2d(const encoder_control_t * const encoder,
|
|||
color_t color,
|
||||
const cu_info_t *tu)
|
||||
{
|
||||
if (tu->emt && color == COLOR_Y)
|
||||
if (tu->tr_idx > MTS_SKIP && color == COLOR_Y)
|
||||
{
|
||||
kvz_emt_idct(encoder->bitdepth, color, tu, block_size, coeff, block);
|
||||
kvz_mts_idct(encoder->bitdepth, color, tu, block_size, coeff, block);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue