Make kvz_inter_get_merge_cand work with SMP blocks.

- Replaces parameter depth with parameters width and height.
- Adds parameters use_a1 and use_b1 for disabling the use of merge
  candidates A1 and B1.
This commit is contained in:
Arttu Ylä-Outinen 2015-10-12 14:44:03 +03:00
parent 1cd149fb97
commit a3df13fb99
3 changed files with 56 additions and 13 deletions

View file

@ -407,8 +407,8 @@ static void inter_clear_cu_unused(cu_info_t* cu) {
/**
* \brief Get merge candidates for current block
* \param encoder encoder control struct to use
* \param x_cu block x position in SCU
* \param y_cu block y position in SCU
* \param x block x position in SCU
* \param y block y position in SCU
* \param width current block width
* \param height current block height
* \param b0 candidate b0
@ -694,13 +694,23 @@ void kvz_inter_get_mv_cand(const encoder_state_t * const state,
/**
* \brief Get merge predictions for current block
* \param encoder encoder control struct to use
* \param x_cu block x position in SCU
* \param y_cu block y position in SCU
* \param depth current block depth
* \param mv_pred[MRG_MAX_NUM_CANDS][2] MRG_MAX_NUM_CANDS motion vector prediction
* \param state the encoder state
* \param x block x position in SCU
* \param y block y position in SCU
* \param width block width
* \param height block height
* \param use_a1 true, if candidate a1 can be used
* \param use_b1 true, if candidate b1 can be used
* \param mv_cand Returns the merge candidates.
* \param lcu lcu containing the block
* \return number of merge candidates
*/
uint8_t kvz_inter_get_merge_cand(const encoder_state_t * const state, int32_t x, int32_t y, int8_t depth, inter_merge_cand_t mv_cand[MRG_MAX_NUM_CANDS], lcu_t *lcu)
uint8_t kvz_inter_get_merge_cand(const encoder_state_t * const state,
int32_t x, int32_t y,
int32_t width, int32_t height,
bool use_a1, bool use_b1,
inter_merge_cand_t mv_cand[MRG_MAX_NUM_CANDS],
lcu_t *lcu)
{
uint8_t candidates = 0;
int8_t duplicate = 0;
@ -708,8 +718,10 @@ uint8_t kvz_inter_get_merge_cand(const encoder_state_t * const state, int32_t x,
cu_info_t *b0, *b1, *b2, *a0, *a1;
int8_t zero_idx = 0;
b0 = b1 = b2 = a0 = a1 = NULL;
kvz_inter_get_spatial_merge_candidates(x, y, LCU_WIDTH >> depth, LCU_WIDTH >> depth, &b0, &b1, &b2, &a0, &a1, lcu);
kvz_inter_get_spatial_merge_candidates(x, y, width, height, &b0, &b1, &b2, &a0, &a1, lcu);
if (!use_a1) a1 = NULL;
if (!use_b1) b1 = NULL;
#define CHECK_DUPLICATE(CU1,CU2) {duplicate = 0; if ((CU2) && \
(CU1)->inter.mv_dir == (CU2)->inter.mv_dir && \

View file

@ -42,7 +42,32 @@ typedef struct {
//void kvz_inter_set_block(image* im,uint32_t x_cu, uint32_t y_cu, uint8_t depth, cu_info *cur_cu);
void kvz_inter_recon_lcu(const encoder_state_t * const state, const kvz_picture * ref, int32_t xpos, int32_t ypos, int32_t width, const int16_t mv_param[2], lcu_t* lcu, hi_prec_buf_t *hi_prec_out);
void kvz_inter_recon_lcu_bipred(const encoder_state_t * const state, const kvz_picture * ref1, const kvz_picture * ref2, int32_t xpos, int32_t ypos, int32_t width, int16_t mv_param[2][2], lcu_t* lcu);
void kvz_inter_get_spatial_merge_candidates(int32_t x, int32_t y, int32_t width, int32_t height, cu_info_t **b0, cu_info_t **b1, cu_info_t **b2, cu_info_t **a0, cu_info_t **a1, lcu_t *lcu);
void kvz_inter_get_mv_cand(const encoder_state_t *state, int32_t x, int32_t y, int32_t width, int32_t height, int16_t mv_cand[2][2], cu_info_t* cur_cu, lcu_t *lcu, int8_t reflist);
uint8_t kvz_inter_get_merge_cand(const encoder_state_t *state, int32_t x, int32_t y, int8_t depth, inter_merge_cand_t mv_cand[MRG_MAX_NUM_CANDS], lcu_t *lcu);
void kvz_inter_get_spatial_merge_candidates(int32_t x,
int32_t y,
int32_t width,
int32_t height,
cu_info_t **b0,
cu_info_t **b1,
cu_info_t **b2,
cu_info_t **a0,
cu_info_t **a1,
lcu_t *lcu);
void kvz_inter_get_mv_cand(const encoder_state_t * const state,
int32_t x,
int32_t y,
int32_t width,
int32_t height,
int16_t mv_cand[2][2],
cu_info_t* cur_cu,
lcu_t *lcu,
int8_t reflist);
uint8_t kvz_inter_get_merge_cand(const encoder_state_t * const state,
int32_t x, int32_t y,
int32_t width, int32_t height,
bool use_a1, bool use_b1,
inter_merge_cand_t mv_cand[MRG_MAX_NUM_CANDS],
lcu_t *lcu);
#endif

View file

@ -1104,7 +1104,13 @@ int kvz_search_cu_inter(const encoder_state_t * const state, int x, int y, int d
// Search for merge mode candidate
inter_merge_cand_t merge_cand[MRG_MAX_NUM_CANDS];
// Get list of candidates
int16_t num_cand = kvz_inter_get_merge_cand(state, x, y, depth, merge_cand, lcu);
int16_t num_cand = kvz_inter_get_merge_cand(state,
x, y,
LCU_WIDTH >> depth,
LCU_WIDTH >> depth,
true, true,
merge_cand,
lcu);
uint32_t(*get_mvd_cost)(vector2d_t *, cabac_data_t*) = get_mvd_coding_cost;
if (state->encoder_control->cfg->mv_rdo) {