From: hui su Date: Tue, 22 Sep 2015 21:08:28 +0000 (-0700) Subject: Adjust rd calculation in choose_tx_size_from_rd X-Git-Tag: v1.5.0~128^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=38cc168822f7b29602bbdb66e4702e190d32f263;p=libvpx Adjust rd calculation in choose_tx_size_from_rd Coding gain: derflr 0.142% hevclr 0.153% hevcmr 0.124% Change-Id: I63b56ae3a9002c3a266e10e2964135ed43b0ba53 --- diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c index ea527b1a8..20b7d50ec 100644 --- a/vp10/encoder/rdopt.c +++ b/vp10/encoder/rdopt.c @@ -653,6 +653,7 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x, } else if (s[n]) { if (is_inter_block(mbmi)) { rd[n][0] = rd[n][1] = RDCOST(x->rdmult, x->rddiv, s1, sse[n]); + r[n][1] -= r_tx_size; } else { rd[n][0] = RDCOST(x->rdmult, x->rddiv, s1, sse[n]); rd[n][1] = RDCOST(x->rdmult, x->rddiv, s1 + r_tx_size, sse[n]); @@ -662,6 +663,11 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x, rd[n][1] = RDCOST(x->rdmult, x->rddiv, r[n][1] + s0, d[n]); } + if (is_inter_block(mbmi) && !xd->lossless && !s[n] && sse[n] != INT64_MAX) { + rd[n][0] = VPXMIN(rd[n][0], RDCOST(x->rdmult, x->rddiv, s1, sse[n])); + rd[n][1] = VPXMIN(rd[n][1], RDCOST(x->rdmult, x->rddiv, s1, sse[n])); + } + // Early termination in transform size search. if (cpi->sf.tx_size_search_breakout && (rd[n][1] == INT64_MAX || diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 3c84a7753..0bffcbac2 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -664,6 +664,7 @@ static void choose_tx_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x, } else if (s[n]) { if (is_inter_block(mbmi)) { rd[n][0] = rd[n][1] = RDCOST(x->rdmult, x->rddiv, s1, sse[n]); + r[n][1] -= r_tx_size; } else { rd[n][0] = RDCOST(x->rdmult, x->rddiv, s1, sse[n]); rd[n][1] = RDCOST(x->rdmult, x->rddiv, s1 + r_tx_size, sse[n]); @@ -673,6 +674,11 @@ static void choose_tx_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x, rd[n][1] = RDCOST(x->rdmult, x->rddiv, r[n][1] + s0, d[n]); } + if (is_inter_block(mbmi) && !xd->lossless && !s[n] && sse[n] != INT64_MAX) { + rd[n][0] = VPXMIN(rd[n][0], RDCOST(x->rdmult, x->rddiv, s1, sse[n])); + rd[n][1] = VPXMIN(rd[n][1], RDCOST(x->rdmult, x->rddiv, s1, sse[n])); + } + // Early termination in transform size search. if (cpi->sf.tx_size_search_breakout && (rd[n][1] == INT64_MAX ||