summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
authorGuillaume Martres <gmartres@google.com>2013-09-27 16:32:54 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2013-09-27 16:32:54 -0700
commitceaa3c37a91c6e15af73f3c0d1b85de12a7c5c8e (patch)
tree442ab35f90e594644bf903776a1194bc9fe4da70 /vp9/encoder
parentb1b4ba1bddf7290ff3e054e545e2d47dd70688ad (diff)
parent2b426969c3d6447c857053969ef46e3fd801d106 (diff)
downloadlibvpx-ceaa3c37a91c6e15af73f3c0d1b85de12a7c5c8e.tar
libvpx-ceaa3c37a91c6e15af73f3c0d1b85de12a7c5c8e.tar.gz
libvpx-ceaa3c37a91c6e15af73f3c0d1b85de12a7c5c8e.tar.bz2
libvpx-ceaa3c37a91c6e15af73f3c0d1b85de12a7c5c8e.zip
Merge "Simplify RDMULT and RDDIV derivation"
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_rdopt.c43
1 files changed, 10 insertions, 33 deletions
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 8b911e669..9ffb7dbd5 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -186,6 +186,7 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) {
// cpi->common.refresh_alt_ref_frame)
qindex = clamp(qindex, 0, MAXQ);
+ cpi->RDDIV = 100;
cpi->RDMULT = compute_rd_mult(qindex);
if (cpi->pass == 2 && (cpi->common.frame_type != KEY_FRAME)) {
if (cpi->twopass.next_iiratio > 31)
@@ -204,42 +205,18 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) {
if (q < 8)
q = 8;
- if (cpi->RDMULT > 1000) {
- cpi->RDDIV = 1;
- cpi->RDMULT /= 100;
+ for (bsize = 0; bsize < BLOCK_SIZES; ++bsize) {
+ for (i = 0; i < MAX_MODES; i++) {
+ // Threshold here seem unecessarily harsh but fine given actual
+ // range of values used for cpi->sf.thresh_mult[]
+ int thresh_max = INT_MAX / (q * rd_thresh_block_size_factor[bsize]);
- for (bsize = 0; bsize < BLOCK_SIZES; ++bsize) {
- for (i = 0; i < MAX_MODES; ++i) {
- // Threshold here seem unecessarily harsh but fine given actual
- // range of values used for cpi->sf.thresh_mult[]
- int thresh_max = INT_MAX / (q * rd_thresh_block_size_factor[bsize]);
-
- // *4 relates to the scaling of rd_thresh_block_size_factor[]
- if ((int64_t)cpi->sf.thresh_mult[i] < thresh_max) {
- cpi->rd_threshes[bsize][i] =
- cpi->sf.thresh_mult[i] * q *
- rd_thresh_block_size_factor[bsize] / (4 * 100);
- } else {
- cpi->rd_threshes[bsize][i] = INT_MAX;
- }
- }
- }
- } else {
- cpi->RDDIV = 100;
-
- for (bsize = 0; bsize < BLOCK_SIZES; ++bsize) {
- for (i = 0; i < MAX_MODES; i++) {
- // Threshold here seem unecessarily harsh but fine given actual
- // range of values used for cpi->sf.thresh_mult[]
- int thresh_max = INT_MAX / (q * rd_thresh_block_size_factor[bsize]);
-
- if (cpi->sf.thresh_mult[i] < thresh_max) {
- cpi->rd_threshes[bsize][i] =
+ if (cpi->sf.thresh_mult[i] < thresh_max) {
+ cpi->rd_threshes[bsize][i] =
cpi->sf.thresh_mult[i] * q *
rd_thresh_block_size_factor[bsize] / 4;
- } else {
- cpi->rd_threshes[bsize][i] = INT_MAX;
- }
+ } else {
+ cpi->rd_threshes[bsize][i] = INT_MAX;
}
}
}