[ibc] Add --ibc parameter and config values for Intra Block Copy

This commit is contained in:
Marko Viitanen 2022-06-17 09:15:01 +03:00
parent cd2d4066d5
commit 20d0a9b65e
6 changed files with 27 additions and 1 deletions

View file

@ -221,6 +221,9 @@ int uvg_config_init(uvg_config *cfg)
cfg->cabac_debug_file_name = NULL; cfg->cabac_debug_file_name = NULL;
cfg->dual_tree = 0; cfg->dual_tree = 0;
cfg->ibc = 0;
return 1; return 1;
} }
@ -1475,6 +1478,14 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
else if OPT("dual-tree") { else if OPT("dual-tree") {
cfg->dual_tree = atobool(value); cfg->dual_tree = atobool(value);
} }
else if OPT ("ibc") {
int ibc_value = atoi(value);
if (ibc_value < 0 || ibc_value > 2) {
fprintf(stderr, "ibc supports only range from 0 to 2\n");
return 0;
}
cfg->ibc = (uint8_t)ibc_value;
}
else { else {
return 0; return 0;
} }

View file

@ -191,6 +191,7 @@ static const struct option long_options[] = {
{ "dual-tree", no_argument, NULL, 0 }, { "dual-tree", no_argument, NULL, 0 },
{ "no-dual-tree", no_argument, NULL, 0 }, { "no-dual-tree", no_argument, NULL, 0 },
{ "cabac-debug-file", required_argument, NULL, 0 }, { "cabac-debug-file", required_argument, NULL, 0 },
{ "ibc", required_argument, NULL, 0 },
{0, 0, 0, 0} {0, 0, 0, 0}
}; };

View file

@ -52,6 +52,7 @@ typedef enum {
CU_INTRA = 1, CU_INTRA = 1,
CU_INTER = 2, CU_INTER = 2,
CU_PCM = 3, CU_PCM = 3,
CU_IBC = 4,
} cu_type_t; } cu_type_t;
typedef enum { typedef enum {

View file

@ -694,7 +694,11 @@ static void encoder_state_write_bitstream_seq_parameter_set(bitstream_t* stream,
WRITE_UE(stream, 0, "sps_internal_bit_depth_minus_input_bit_depth"); WRITE_UE(stream, 0, "sps_internal_bit_depth_minus_input_bit_depth");
} }
WRITE_U(stream, 0, 1, "sps_ibc_enabled_flag"); WRITE_U(stream, encoder->cfg.ibc > 0 ? 1 : 0, 1, "sps_ibc_enabled_flag");
if (encoder->cfg.ibc) {
WRITE_UE(stream,6 - IBC_MRG_MAX_NUM_CANDS, "sps_six_minus_max_num_ibc_merge_cand");
}
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET #if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
// if(!no_ladf_constraint_flag) // if(!no_ladf_constraint_flag)

View file

@ -254,6 +254,12 @@ typedef int32_t mv_t;
#define AMVP_MAX_NUM_CANDS 2 #define AMVP_MAX_NUM_CANDS 2
#define AMVP_MAX_NUM_CANDS_MEM 3 #define AMVP_MAX_NUM_CANDS_MEM 3
#define MRG_MAX_NUM_CANDS 6 #define MRG_MAX_NUM_CANDS 6
/**
* \brief Max number of merge candidates in Intra Block Copy
*
*/
#define IBC_MRG_MAX_NUM_CANDS 6
#define MAX_NUM_HMVP_CANDS 5 #define MAX_NUM_HMVP_CANDS 5

View file

@ -541,6 +541,9 @@ typedef struct uvg_config
char* cabac_debug_file_name; char* cabac_debug_file_name;
uint8_t dual_tree; uint8_t dual_tree;
uint8_t ibc; /* \brief Intra Block Copy parameter */
} uvg_config; } uvg_config;
/** /**