Merge "Refactor rd_pick_intra_angle_" into nextgenv2
This commit is contained in:
@@ -1842,6 +1842,39 @@ static int rd_pick_ext_intra_sby(VP10_COMP *cpi, MACROBLOCK *x,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pick_intra_angle_routine_sby(VP10_COMP *cpi, MACROBLOCK *x,
|
||||||
|
int *rate, int *rate_tokenonly,
|
||||||
|
int64_t *distortion, int *skippable,
|
||||||
|
int *best_angle_delta,
|
||||||
|
TX_SIZE *best_tx_size,
|
||||||
|
TX_TYPE *best_tx_type,
|
||||||
|
INTRA_FILTER *best_filter,
|
||||||
|
BLOCK_SIZE bsize, int rate_overhead,
|
||||||
|
int64_t *best_rd) {
|
||||||
|
int this_rate, this_rate_tokenonly, s;
|
||||||
|
int64_t this_distortion, this_rd;
|
||||||
|
MB_MODE_INFO *mbmi = &x->e_mbd.mi[0]->mbmi;
|
||||||
|
super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion,
|
||||||
|
&s, NULL, bsize, *best_rd);
|
||||||
|
if (this_rate_tokenonly == INT_MAX)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this_rate = this_rate_tokenonly + rate_overhead;
|
||||||
|
this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion);
|
||||||
|
|
||||||
|
if (this_rd < *best_rd) {
|
||||||
|
*best_rd = this_rd;
|
||||||
|
*best_angle_delta = mbmi->angle_delta[0];
|
||||||
|
*best_tx_size = mbmi->tx_size;
|
||||||
|
*best_filter = mbmi->intra_filter;
|
||||||
|
*best_tx_type = mbmi->tx_type;
|
||||||
|
*rate = this_rate;
|
||||||
|
*rate_tokenonly = this_rate_tokenonly;
|
||||||
|
*distortion = this_distortion;
|
||||||
|
*skippable = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x,
|
static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x,
|
||||||
int *rate, int *rate_tokenonly,
|
int *rate, int *rate_tokenonly,
|
||||||
int64_t *distortion, int *skippable,
|
int64_t *distortion, int *skippable,
|
||||||
@@ -1917,24 +1950,14 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x,
|
|||||||
if ((FILTER_FAST_SEARCH || !pick_intra_filter(p_angle)) &&
|
if ((FILTER_FAST_SEARCH || !pick_intra_filter(p_angle)) &&
|
||||||
filter != INTRA_FILTER_LINEAR)
|
filter != INTRA_FILTER_LINEAR)
|
||||||
continue;
|
continue;
|
||||||
super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion,
|
pick_intra_angle_routine_sby(cpi, x, rate, rate_tokenonly,
|
||||||
&s, NULL, bsize, best_rd);
|
distortion, skippable,
|
||||||
if (this_rate_tokenonly == INT_MAX)
|
&best_angle_delta, &best_tx_size,
|
||||||
continue;
|
&best_tx_type, &best_filter, bsize,
|
||||||
this_rate = this_rate_tokenonly + rate_overhead +
|
rate_overhead +
|
||||||
cpi->intra_filter_cost[intra_filter_ctx][filter];
|
cpi->intra_filter_cost
|
||||||
this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion);
|
[intra_filter_ctx][filter],
|
||||||
if (this_rd < best_rd) {
|
&best_rd);
|
||||||
best_rd = this_rd;
|
|
||||||
best_angle_delta = mbmi->angle_delta[0];
|
|
||||||
best_tx_size = mbmi->tx_size;
|
|
||||||
best_filter = mbmi->intra_filter;
|
|
||||||
best_tx_type = mbmi->tx_type;
|
|
||||||
*rate = this_rate;
|
|
||||||
*rate_tokenonly = this_rate_tokenonly;
|
|
||||||
*distortion = this_distortion;
|
|
||||||
*skippable = s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1949,26 +1972,14 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x,
|
|||||||
if ((FILTER_FAST_SEARCH || !pick_intra_filter(p_angle)) &&
|
if ((FILTER_FAST_SEARCH || !pick_intra_filter(p_angle)) &&
|
||||||
filter != INTRA_FILTER_LINEAR)
|
filter != INTRA_FILTER_LINEAR)
|
||||||
continue;
|
continue;
|
||||||
super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion,
|
pick_intra_angle_routine_sby(cpi, x, rate, rate_tokenonly,
|
||||||
&s, NULL, bsize, best_rd);
|
distortion, skippable,
|
||||||
if (this_rate_tokenonly == INT_MAX)
|
&best_angle_delta, &best_tx_size,
|
||||||
continue;
|
&best_tx_type, &best_filter, bsize,
|
||||||
|
rate_overhead +
|
||||||
this_rate = this_rate_tokenonly + rate_overhead +
|
cpi->intra_filter_cost
|
||||||
cpi->intra_filter_cost[intra_filter_ctx][filter];
|
[intra_filter_ctx][filter],
|
||||||
this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion);
|
&best_rd);
|
||||||
|
|
||||||
if (this_rd < best_rd) {
|
|
||||||
best_rd = this_rd;
|
|
||||||
best_angle_delta = mbmi->angle_delta[0];
|
|
||||||
best_tx_size = mbmi->tx_size;
|
|
||||||
best_filter = mbmi->intra_filter;
|
|
||||||
best_tx_type = mbmi->tx_type;
|
|
||||||
*rate = this_rate;
|
|
||||||
*rate_tokenonly = this_rate_tokenonly;
|
|
||||||
*distortion = this_distortion;
|
|
||||||
*skippable = s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1980,26 +1991,12 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x,
|
|||||||
if (pick_intra_filter(p_angle)) {
|
if (pick_intra_filter(p_angle)) {
|
||||||
for (filter = INTRA_FILTER_LINEAR + 1; filter < INTRA_FILTERS; ++filter) {
|
for (filter = INTRA_FILTER_LINEAR + 1; filter < INTRA_FILTERS; ++filter) {
|
||||||
mic->mbmi.intra_filter = filter;
|
mic->mbmi.intra_filter = filter;
|
||||||
super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion,
|
pick_intra_angle_routine_sby(cpi, x, rate, rate_tokenonly,
|
||||||
&s, NULL, bsize, best_rd);
|
distortion, skippable,
|
||||||
if (this_rate_tokenonly == INT_MAX)
|
&best_angle_delta, &best_tx_size,
|
||||||
continue;
|
&best_tx_type, &best_filter, bsize,
|
||||||
|
rate_overhead + cpi->intra_filter_cost
|
||||||
this_rate = this_rate_tokenonly + rate_overhead +
|
[intra_filter_ctx][filter], &best_rd);
|
||||||
cpi->intra_filter_cost[intra_filter_ctx][filter];
|
|
||||||
this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion);
|
|
||||||
|
|
||||||
if (this_rd < best_rd) {
|
|
||||||
best_rd = this_rd;
|
|
||||||
best_angle_delta = mbmi->angle_delta[0];
|
|
||||||
best_tx_size = mbmi->tx_size;
|
|
||||||
best_filter = mbmi->intra_filter;
|
|
||||||
best_tx_type = mbmi->tx_type;
|
|
||||||
*rate = this_rate;
|
|
||||||
*rate_tokenonly = this_rate_tokenonly;
|
|
||||||
*distortion = this_distortion;
|
|
||||||
*skippable = s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3082,6 +3079,32 @@ static int rd_pick_ext_intra_sbuv(VP10_COMP *cpi, MACROBLOCK *x,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pick_intra_angle_routine_sbuv(VP10_COMP *cpi, MACROBLOCK *x,
|
||||||
|
int *rate, int *rate_tokenonly,
|
||||||
|
int64_t *distortion, int *skippable,
|
||||||
|
int *best_angle_delta,
|
||||||
|
BLOCK_SIZE bsize, int rate_overhead,
|
||||||
|
int64_t *best_rd) {
|
||||||
|
MB_MODE_INFO *mbmi = &x->e_mbd.mi[0]->mbmi;
|
||||||
|
int this_rate_tokenonly, this_rate, s;
|
||||||
|
int64_t this_distortion, this_sse, this_rd;
|
||||||
|
|
||||||
|
if (!super_block_uvrd(cpi, x, &this_rate_tokenonly,
|
||||||
|
&this_distortion, &s, &this_sse, bsize, *best_rd))
|
||||||
|
return;
|
||||||
|
|
||||||
|
this_rate = this_rate_tokenonly + rate_overhead;
|
||||||
|
this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion);
|
||||||
|
if (this_rd < *best_rd) {
|
||||||
|
*best_rd = this_rd;
|
||||||
|
*best_angle_delta = mbmi->angle_delta[1];
|
||||||
|
*rate = this_rate;
|
||||||
|
*rate_tokenonly = this_rate_tokenonly;
|
||||||
|
*distortion = this_distortion;
|
||||||
|
*skippable = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int rd_pick_intra_angle_sbuv(VP10_COMP *cpi, MACROBLOCK *x,
|
static int rd_pick_intra_angle_sbuv(VP10_COMP *cpi, MACROBLOCK *x,
|
||||||
PICK_MODE_CONTEXT *ctx,
|
PICK_MODE_CONTEXT *ctx,
|
||||||
int *rate, int *rate_tokenonly,
|
int *rate, int *rate_tokenonly,
|
||||||
@@ -3134,38 +3157,20 @@ static int rd_pick_intra_angle_sbuv(VP10_COMP *cpi, MACROBLOCK *x,
|
|||||||
if (best_i >= 0) {
|
if (best_i >= 0) {
|
||||||
for (j = 0; j < level2; ++j) {
|
for (j = 0; j < level2; ++j) {
|
||||||
mbmi->angle_delta[1] = deltas_level2[best_i][j];
|
mbmi->angle_delta[1] = deltas_level2[best_i][j];
|
||||||
if (!super_block_uvrd(cpi, x, &this_rate_tokenonly,
|
pick_intra_angle_routine_sbuv(cpi, x, rate, rate_tokenonly,
|
||||||
&this_distortion, &s, &this_sse, bsize, best_rd))
|
distortion, skippable,
|
||||||
continue;
|
&best_angle_delta, bsize,
|
||||||
this_rate = this_rate_tokenonly + rate_overhead;
|
rate_overhead, &best_rd);
|
||||||
this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion);
|
|
||||||
if (this_rd < best_rd) {
|
|
||||||
best_rd = this_rd;
|
|
||||||
best_angle_delta = mbmi->angle_delta[1];
|
|
||||||
*rate = this_rate;
|
|
||||||
*rate_tokenonly = this_rate_tokenonly;
|
|
||||||
*distortion = this_distortion;
|
|
||||||
*skippable = s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (angle_delta = -MAX_ANGLE_DELTAS; angle_delta <= MAX_ANGLE_DELTAS;
|
for (angle_delta = -MAX_ANGLE_DELTAS; angle_delta <= MAX_ANGLE_DELTAS;
|
||||||
++angle_delta) {
|
++angle_delta) {
|
||||||
mbmi->angle_delta[1] = angle_delta;
|
mbmi->angle_delta[1] = angle_delta;
|
||||||
if (!super_block_uvrd(cpi, x, &this_rate_tokenonly,
|
pick_intra_angle_routine_sbuv(cpi, x, rate, rate_tokenonly,
|
||||||
&this_distortion, &s, &this_sse, bsize, best_rd))
|
distortion, skippable,
|
||||||
continue;
|
&best_angle_delta, bsize,
|
||||||
this_rate = this_rate_tokenonly + rate_overhead;
|
rate_overhead, &best_rd);
|
||||||
this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion);
|
|
||||||
if (this_rd < best_rd) {
|
|
||||||
best_rd = this_rd;
|
|
||||||
best_angle_delta = mbmi->angle_delta[1];
|
|
||||||
*rate = this_rate;
|
|
||||||
*rate_tokenonly = this_rate_tokenonly;
|
|
||||||
*distortion = this_distortion;
|
|
||||||
*skippable = s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user