summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHui Su <huisu@google.com>2015-11-07 00:22:50 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-11-07 00:22:50 +0000
commit908fbabe4ed6dc057a9d16ef5e9d575d57bd76be (patch)
treee0ad89bcc2bd957920457319f4901fc6a4518aa2
parenteba14ddbe7e7b69803dab770ba25ae2ba75c65e2 (diff)
parent6ab6ac450b29ea21411072297bafb9a78a78291d (diff)
downloadlibvpx-908fbabe4ed6dc057a9d16ef5e9d575d57bd76be.tar
libvpx-908fbabe4ed6dc057a9d16ef5e9d575d57bd76be.tar.gz
libvpx-908fbabe4ed6dc057a9d16ef5e9d575d57bd76be.tar.bz2
libvpx-908fbabe4ed6dc057a9d16ef5e9d575d57bd76be.zip
Merge "Use accurate bit cost for uv_mode in UV intra mode RD selection"
-rw-r--r--vp10/encoder/encoder.h2
-rw-r--r--vp10/encoder/rd.c5
-rw-r--r--vp10/encoder/rdopt.c6
-rw-r--r--vp9/encoder/vp9_encoder.h2
-rw-r--r--vp9/encoder/vp9_rd.c10
-rw-r--r--vp9/encoder/vp9_rdopt.c7
6 files changed, 20 insertions, 12 deletions
diff --git a/vp10/encoder/encoder.h b/vp10/encoder/encoder.h
index bac6b3627..7028803a6 100644
--- a/vp10/encoder/encoder.h
+++ b/vp10/encoder/encoder.h
@@ -456,7 +456,7 @@ typedef struct VP10_COMP {
int mbmode_cost[INTRA_MODES];
unsigned int inter_mode_cost[INTER_MODE_CONTEXTS][INTER_MODES];
- int intra_uv_mode_cost[INTRA_MODES];
+ int intra_uv_mode_cost[INTRA_MODES][INTRA_MODES];
int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES];
int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS];
int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES];
diff --git a/vp10/encoder/rd.c b/vp10/encoder/rd.c
index 9e35097d1..4ed1ae2be 100644
--- a/vp10/encoder/rd.c
+++ b/vp10/encoder/rd.c
@@ -76,8 +76,9 @@ static void fill_mode_costs(VP10_COMP *cpi) {
vp10_intra_mode_tree);
vp10_cost_tokens(cpi->mbmode_cost, fc->y_mode_prob[1], vp10_intra_mode_tree);
- vp10_cost_tokens(cpi->intra_uv_mode_cost,
- fc->uv_mode_prob[TM_PRED], vp10_intra_mode_tree);
+ for (i = 0; i < INTRA_MODES; ++i)
+ vp10_cost_tokens(cpi->intra_uv_mode_cost[i],
+ fc->uv_mode_prob[i], vp10_intra_mode_tree);
for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; ++i)
vp10_cost_tokens(cpi->switchable_interp_costs[i],
diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c
index cecc59c8f..8ba211017 100644
--- a/vp10/encoder/rdopt.c
+++ b/vp10/encoder/rdopt.c
@@ -1369,7 +1369,8 @@ static int64_t rd_pick_intra_sbuv_mode(VP10_COMP *cpi, MACROBLOCK *x,
if (!super_block_uvrd(cpi, x, &this_rate_tokenonly,
&this_distortion, &s, &this_sse, bsize, best_rd))
continue;
- this_rate = this_rate_tokenonly + cpi->intra_uv_mode_cost[mode];
+ this_rate = this_rate_tokenonly +
+ cpi->intra_uv_mode_cost[xd->mi[0]->mbmi.mode][mode];
this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion);
if (this_rd < best_rd) {
@@ -1398,7 +1399,8 @@ static int64_t rd_sbuv_dcpred(const VP10_COMP *cpi, MACROBLOCK *x,
memset(x->skip_txfm, SKIP_TXFM_NONE, sizeof(x->skip_txfm));
super_block_uvrd(cpi, x, rate_tokenonly, distortion,
skippable, &unused, bsize, INT64_MAX);
- *rate = *rate_tokenonly + cpi->intra_uv_mode_cost[DC_PRED];
+ *rate = *rate_tokenonly +
+ cpi->intra_uv_mode_cost[x->e_mbd.mi[0]->mbmi.mode][DC_PRED];
return RDCOST(x->rdmult, x->rddiv, *rate, *distortion);
}
diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h
index 3f3f896be..975d9f42b 100644
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -470,7 +470,7 @@ typedef struct VP9_COMP {
int mbmode_cost[INTRA_MODES];
unsigned int inter_mode_cost[INTER_MODE_CONTEXTS][INTER_MODES];
- int intra_uv_mode_cost[FRAME_TYPES][INTRA_MODES];
+ int intra_uv_mode_cost[FRAME_TYPES][INTRA_MODES][INTRA_MODES];
int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES];
int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS];
int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES];
diff --git a/vp9/encoder/vp9_rd.c b/vp9/encoder/vp9_rd.c
index b085c7a0c..eda774376 100644
--- a/vp9/encoder/vp9_rd.c
+++ b/vp9/encoder/vp9_rd.c
@@ -76,10 +76,12 @@ static void fill_mode_costs(VP9_COMP *cpi) {
vp9_intra_mode_tree);
vp9_cost_tokens(cpi->mbmode_cost, fc->y_mode_prob[1], vp9_intra_mode_tree);
- vp9_cost_tokens(cpi->intra_uv_mode_cost[KEY_FRAME],
- vp9_kf_uv_mode_prob[TM_PRED], vp9_intra_mode_tree);
- vp9_cost_tokens(cpi->intra_uv_mode_cost[INTER_FRAME],
- fc->uv_mode_prob[TM_PRED], vp9_intra_mode_tree);
+ for (i = 0; i < INTRA_MODES; ++i) {
+ vp9_cost_tokens(cpi->intra_uv_mode_cost[KEY_FRAME][i],
+ vp9_kf_uv_mode_prob[i], vp9_intra_mode_tree);
+ vp9_cost_tokens(cpi->intra_uv_mode_cost[INTER_FRAME][i],
+ fc->uv_mode_prob[i], vp9_intra_mode_tree);
+ }
for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; ++i)
vp9_cost_tokens(cpi->switchable_interp_costs[i],
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 4f3a06e99..a40050158 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1199,7 +1199,8 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x,
&this_distortion, &s, &this_sse, bsize, best_rd))
continue;
this_rate = this_rate_tokenonly +
- cpi->intra_uv_mode_cost[cpi->common.frame_type][mode];
+ cpi->intra_uv_mode_cost[cpi->common.frame_type]
+ [xd->mi[0]->mbmi.mode][mode];
this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion);
if (this_rd < best_rd) {
@@ -1229,7 +1230,9 @@ static int64_t rd_sbuv_dcpred(const VP9_COMP *cpi, MACROBLOCK *x,
memset(x->skip_txfm, SKIP_TXFM_NONE, sizeof(x->skip_txfm));
super_block_uvrd(cpi, x, rate_tokenonly, distortion,
skippable, &unused, bsize, INT64_MAX);
- *rate = *rate_tokenonly + cpi->intra_uv_mode_cost[cm->frame_type][DC_PRED];
+ *rate = *rate_tokenonly +
+ cpi->intra_uv_mode_cost[cm->frame_type]
+ [x->e_mbd.mi[0]->mbmi.mode][DC_PRED];
return RDCOST(x->rdmult, x->rddiv, *rate, *distortion);
}