Skip to content

Commit

Permalink
[cleanup] Remove mentions of SMP and AMP from the documentation and code
Browse files Browse the repository at this point in the history
  • Loading branch information
fador committed Apr 29, 2022
1 parent 1768acd commit 4005b9d
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 170 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,6 @@ where the names have been abbreviated to fit the layout in GitHub.
| transform-skip | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| mv-rdo | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| full-intra-search | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| smp | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| amp | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| cu-split-termination | zero | zero | zero | zero | zero | zero | zero | zero | zero | off |
| me-early-termination | sens. | sens. | sens. | sens. | sens. | on | on | off | off | off |
| intra-rdo-et | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Expand Down
26 changes: 0 additions & 26 deletions src/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ int uvg_config_init(uvg_config *cfg)
cfg->rdoq_enable = 1;
cfg->rdoq_skip = 1;
cfg->signhide_enable = true;
cfg->smp_enable = false;
cfg->amp_enable = false;
cfg->rdo = 1;
cfg->mv_rdo = 0;
cfg->full_intra_search = 0;
Expand Down Expand Up @@ -586,8 +584,6 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
"transform-skip", "0",
"mv-rdo", "0",
"full-intra-search", "0",
"smp", "0",
"amp", "0",
"cu-split-termination", "zero",
"me-early-termination", "sensitive",
"intra-rdo-et", "0",
Expand All @@ -614,8 +610,6 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
"transform-skip", "0",
"mv-rdo", "0",
"full-intra-search", "0",
"smp", "0",
"amp", "0",
"cu-split-termination", "zero",
"me-early-termination", "sensitive",
"intra-rdo-et", "0",
Expand All @@ -642,8 +636,6 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
"transform-skip", "0",
"mv-rdo", "0",
"full-intra-search", "0",
"smp", "0",
"amp", "0",
"cu-split-termination", "zero",
"me-early-termination", "sensitive",
"intra-rdo-et", "0",
Expand All @@ -670,8 +662,6 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
"transform-skip", "0",
"mv-rdo", "0",
"full-intra-search", "0",
"smp", "0",
"amp", "0",
"cu-split-termination", "zero",
"me-early-termination", "sensitive",
"intra-rdo-et", "0",
Expand All @@ -698,8 +688,6 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
"transform-skip", "0",
"mv-rdo", "0",
"full-intra-search", "0",
"smp", "0",
"amp", "0",
"cu-split-termination", "zero",
"me-early-termination", "sensitive",
"intra-rdo-et", "0",
Expand All @@ -726,8 +714,6 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
"transform-skip", "0",
"mv-rdo", "0",
"full-intra-search", "0",
"smp", "0",
"amp", "0",
"cu-split-termination", "zero",
"me-early-termination", "on",
"intra-rdo-et", "0",
Expand All @@ -754,8 +740,6 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
"transform-skip", "0",
"mv-rdo", "0",
"full-intra-search", "0",
"smp", "0",
"amp", "0",
"cu-split-termination", "zero",
"me-early-termination", "on",
"intra-rdo-et", "0",
Expand All @@ -782,8 +766,6 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
"transform-skip", "0",
"mv-rdo", "0",
"full-intra-search", "0",
"smp", "0",
"amp", "0",
"cu-split-termination", "zero",
"me-early-termination", "off",
"intra-rdo-et", "0",
Expand All @@ -810,8 +792,6 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
"transform-skip", "1",
"mv-rdo", "0",
"full-intra-search", "0",
"smp", "1",
"amp", "0",
"cu-split-termination", "zero",
"me-early-termination", "off",
"intra-rdo-et", "0",
Expand All @@ -838,8 +818,6 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
"transform-skip", "1",
"mv-rdo", "1",
"full-intra-search", "0",
"smp", "1",
"amp", "1",
"cu-split-termination", "off",
"me-early-termination", "off",
"intra-rdo-et", "0",
Expand Down Expand Up @@ -916,10 +894,6 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
cfg->rdoq_enable = atobool(value);
else if OPT("signhide")
cfg->signhide_enable = (bool)atobool(value);
else if OPT("smp")
cfg->smp_enable = (bool)atobool(value);
else if OPT("amp")
cfg->amp_enable = (bool)atobool(value);
else if OPT("rd")
cfg->rdo = atoi(value);
else if OPT("full-intra-search")
Expand Down
6 changes: 0 additions & 6 deletions src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ static const struct option long_options[] = {
{ "no-rdoq", no_argument, NULL, 0 },
{ "signhide", no_argument, NULL, 0 },
{ "no-signhide", no_argument, NULL, 0 },
{ "smp", no_argument, NULL, 0 },
{ "no-smp", no_argument, NULL, 0 },
{ "amp", no_argument, NULL, 0 },
{ "no-amp", no_argument, NULL, 0 },
{ "rd", required_argument, NULL, 0 },
{ "full-intra-search", no_argument, NULL, 0 },
{ "no-full-intra-search", no_argument, NULL, 0 },
Expand Down Expand Up @@ -549,8 +545,6 @@ void print_help(void)
" --(no-)rdoq : Rate-distortion optimized quantization [enabled]\n"
" --(no-)rdoq-skip : Skip RDOQ for 4x4 blocks. [disabled]\n"
" --(no-)signhide : Sign hiding [disabled]\n"
" --(no-)smp : Symmetric motion partition [disabled]\n"
" --(no-)amp : Asymmetric motion partition [disabled]\n"
" --rd <integer> : Intra mode search complexity [0]\n"
" - 0: Skip intra if inter is good enough.\n"
" - 1: Rough intra mode search with SATD.\n"
Expand Down
28 changes: 0 additions & 28 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,34 +681,6 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
inter_bitcost = mode_bitcost;
cur_cu->type = CU_INTER;
}

if (!(ctrl->cfg.early_skip && cur_cu->skipped)) {
// Try SMP and AMP partitioning.
static const part_mode_t mp_modes[] = {
// SMP
SIZE_2NxN, SIZE_Nx2N,
// AMP
SIZE_2NxnU, SIZE_2NxnD,
SIZE_nLx2N, SIZE_nRx2N,
};

const int first_mode = ctrl->cfg.smp_enable ? 0 : 2;
const int last_mode = (ctrl->cfg.amp_enable && cu_width >= 16) ? 5 : 1;
for (int i = first_mode; i <= last_mode; ++i) {
uvg_search_cu_smp(state,
x, y,
depth,
mp_modes[i],
&work_tree[depth + 1],
&mode_cost, &mode_bitcost);
if (mode_cost < cost) {
cost = mode_cost;
inter_bitcost = mode_bitcost;
// Copy inter prediction info to current level.
copy_cu_info(x_local, y_local, cu_width, &work_tree[depth + 1], lcu);
}
}
}
}

// Try to skip intra search in rd==0 mode.
Expand Down
93 changes: 0 additions & 93 deletions src/search_inter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2050,96 +2050,3 @@ void uvg_search_cu_inter(encoder_state_t * const state,
inter_bitcost);
}
}


/**
* \brief Update CU to have best modes at this depth.
*
* Only searches the given partition mode.
*
* \param state encoder state
* \param x x-coordinate of the CU
* \param y y-coordinate of the CU
* \param depth depth of the CU in the quadtree
* \param part_mode partition mode to search
* \param lcu containing LCU
*
* \param inter_cost Return inter cost
* \param inter_bitcost Return inter bitcost
*/
void uvg_search_cu_smp(encoder_state_t * const state,
int x, int y,
int depth,
part_mode_t part_mode,
lcu_t *lcu,
double *inter_cost,
uint32_t *inter_bitcost)
{
const int num_pu = uvg_part_mode_num_parts[part_mode];
const int width = LCU_WIDTH >> depth;
const int y_local = SUB_SCU(y);
const int x_local = SUB_SCU(x);

*inter_cost = 0;
*inter_bitcost = 0;

for (int i = 0; i < num_pu; ++i) {
const int x_pu = PU_GET_X(part_mode, width, x_local, i);
const int y_pu = PU_GET_Y(part_mode, width, y_local, i);
const int width_pu = PU_GET_W(part_mode, width, i);
const int height_pu = PU_GET_H(part_mode, width, i);
cu_info_t *cur_pu = LCU_GET_CU_AT_PX(lcu, x_pu, y_pu);

cur_pu->type = CU_INTER;
cur_pu->part_size = part_mode;
cur_pu->depth = depth;
cur_pu->qp = state->qp;

double cost = MAX_INT;
uint32_t bitcost = MAX_INT;

search_pu_inter(state, x, y, depth, part_mode, i, lcu, &cost, &bitcost);

if (cost >= MAX_INT) {
// Could not find any motion vector.
*inter_cost = MAX_INT;
*inter_bitcost = MAX_INT;
return;
}

*inter_cost += cost;
*inter_bitcost += bitcost;

for (int y_idx = y_pu; y_idx < y_pu + height_pu; y_idx += SCU_WIDTH) {
for (int x_idx = x_pu; x_idx < x_pu + width_pu; x_idx += SCU_WIDTH) {
cu_info_t *scu = LCU_GET_CU_AT_PX(lcu, x_idx, y_idx);
scu->type = CU_INTER;
scu->inter = cur_pu->inter;
}
}
}

// Calculate more accurate cost when needed
if (state->encoder_control->cfg.rdo >= 2) {
uvg_cu_cost_inter_rd2(state,
x, y, depth,
lcu,
inter_cost,
inter_bitcost);
}

// Count bits spent for coding the partition mode.
int smp_extra_bits = 1; // horizontal or vertical
if (state->encoder_control->cfg.amp_enable) {
smp_extra_bits += 1; // symmetric or asymmetric
if (part_mode != SIZE_2NxN && part_mode != SIZE_Nx2N) {
smp_extra_bits += 1; // U,L or D,R
}
}
// The transform is split for SMP and AMP blocks so we need more bits for
// coding the CBF.
smp_extra_bits += 6;

*inter_cost += (state->encoder_control->cfg.rdo >= 2 ? state->lambda : state->lambda_sqrt) * smp_extra_bits;
*inter_bitcost += smp_extra_bits;
}
13 changes: 0 additions & 13 deletions src/search_inter.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,5 @@ void uvg_search_cu_inter(encoder_state_t * const state,
double *inter_cost,
uint32_t *inter_bitcost);

void uvg_search_cu_smp(encoder_state_t * const state,
int x, int y,
int depth,
part_mode_t part_mode,
lcu_t *lcu,
double *inter_cost,
uint32_t *inter_bitcost);


unsigned uvg_inter_satd_cost(const encoder_state_t* state,
const lcu_t *lcu,
int x,
int y);

#endif // SEARCH_INTER_H_
2 changes: 0 additions & 2 deletions src/uvg266.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,6 @@ typedef struct uvg_config
int32_t alf_allow_predefined_filters;
int32_t rdoq_enable; /*!< \brief Flag to enable RD optimized quantization. */
int32_t signhide_enable; /*!< \brief Flag to enable sign hiding. */
int32_t smp_enable; /*!< \brief Flag to enable SMP blocks. */
int32_t amp_enable; /*!< \brief Flag to enable AMP blocks. */
int32_t rdo; /*!< \brief RD-calculation level (0..2) */
int32_t full_intra_search; /*!< \brief If true, don't skip modes in intra search. */
int32_t trskip_enable; /*!< \brief Flag to enable transform skip. */
Expand Down

0 comments on commit 4005b9d

Please sign in to comment.