Move HMVP arrays to more suitable place

This commit is contained in:
Marko Viitanen 2021-01-04 19:04:50 +02:00
parent f68ba68fb2
commit a39bc69482
6 changed files with 17 additions and 9 deletions

View file

@ -674,14 +674,14 @@ static void encoder_state_write_bitstream_seq_parameter_set(bitstream_t* stream,
WRITE_U(stream, 0, 1, "sps_mmvd_enabled_flag"); WRITE_U(stream, 0, 1, "sps_mmvd_enabled_flag");
WRITE_UE(stream, MRG_MAX_NUM_CANDS - 6, "six_minus_max_num_merge_cand"); WRITE_UE(stream, 6 - MRG_MAX_NUM_CANDS, "six_minus_max_num_merge_cand");
WRITE_U(stream, 0, 1, "sps_sbt_enabled_flag"); WRITE_U(stream, 0, 1, "sps_sbt_enabled_flag");
WRITE_U(stream, 0, 1, "sps_affine_enabled_flag"); WRITE_U(stream, 0, 1, "sps_affine_enabled_flag");
WRITE_U(stream, 0, 1, "sps_bcw_enabled_flag"); WRITE_U(stream, 0, 1, "sps_bcw_enabled_flag");
WRITE_U(stream, 0, 1, "sps_ciip_enabled_flag"); WRITE_U(stream, 0, 1, "sps_ciip_enabled_flag");
if (6 /*MAX_NUM_MERGE_CAND*/ >= 2) if (MRG_MAX_NUM_CANDS >= 2)
{ {
WRITE_U(stream, 0, 1, "sps_gpm_enabled_flag"); WRITE_U(stream, 0, 1, "sps_gpm_enabled_flag");
} }

View file

@ -83,6 +83,10 @@ static int encoder_state_config_frame_init(encoder_state_t * const state) {
state->frame->new_ratecontrol = kvz_get_rc_data(NULL); state->frame->new_ratecontrol = kvz_get_rc_data(NULL);
state->frame->hmvp_lut = malloc(sizeof(cu_info_t) * encoder->in.height_in_lcu * MAX_NUM_HMVP_CANDS);
state->frame->hmvp_size = malloc(sizeof(uint8_t) * encoder->in.height_in_lcu);
return 1; return 1;
} }
@ -96,6 +100,9 @@ static void encoder_state_config_frame_finalize(encoder_state_t * const state) {
kvz_image_list_destroy(state->frame->ref); kvz_image_list_destroy(state->frame->ref);
FREE_POINTER(state->frame->lcu_stats); FREE_POINTER(state->frame->lcu_stats);
FREE_POINTER(state->frame->aq_offsets); FREE_POINTER(state->frame->aq_offsets);
FREE_POINTER(state->frame->hmvp_lut);
FREE_POINTER(state->frame->hmvp_size);
} }
static int encoder_state_config_tile_init(encoder_state_t * const state, static int encoder_state_config_tile_init(encoder_state_t * const state,

View file

@ -1402,6 +1402,7 @@ static void encoder_state_init_new_frame(encoder_state_t * const state, kvz_pict
state->tile->frame->width, state->tile->frame->width,
state->tile->frame->height state->tile->frame->height
); );
memset(state->frame->hmvp_size, 0, sizeof(uint8_t) * state->encoder_control->in.height_in_lcu);
// Variance adaptive quantization // Variance adaptive quantization
if (cfg->vaq) { if (cfg->vaq) {

View file

@ -177,6 +177,11 @@ typedef struct encoder_state_config_frame_t {
double *c_para; double *c_para;
double *k_para; double *k_para;
cu_info_t* hmvp_lut; //!< \brief Look-up table for HMVP, one for each LCU row
uint8_t* hmvp_size; //!< \brief HMVP LUT size
} encoder_state_config_frame_t; } encoder_state_config_frame_t;
typedef struct encoder_state_config_tile_t { typedef struct encoder_state_config_tile_t {

View file

@ -224,6 +224,8 @@ typedef int16_t coeff_t;
#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
#define MAX_NUM_HMVP_CANDS 5
/* Some tools */ /* Some tools */
#define ABS(a) ((a) >= 0 ? (a) : (-a)) #define ABS(a) ((a) >= 0 ? (a) : (-a))
#define MAX(a,b) (((a)>(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b))

View file

@ -49,10 +49,6 @@ videoframe_t * kvz_videoframe_alloc(int32_t width,
frame->sao_chroma = MALLOC(sao_info_t, frame->width_in_lcu * frame->height_in_lcu); frame->sao_chroma = MALLOC(sao_info_t, frame->width_in_lcu * frame->height_in_lcu);
} }
frame->hmvp_lut = calloc(1, sizeof(cu_info_t) * frame->height_in_lcu * MAX_NUM_HMVP_CANDS);
frame->hmvp_size = calloc(1, sizeof(uint8_t) * frame->height_in_lcu);
return frame; return frame;
} }
@ -82,9 +78,6 @@ int kvz_videoframe_free(videoframe_t * const frame)
FREE_POINTER(frame->sao_luma); FREE_POINTER(frame->sao_luma);
FREE_POINTER(frame->sao_chroma); FREE_POINTER(frame->sao_chroma);
FREE_POINTER(frame->hmvp_lut);
FREE_POINTER(frame->hmvp_size);
free(frame); free(frame);
return 1; return 1;