summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
authorYunqing Wang <yunqingwang@google.com>2015-03-17 12:19:15 -0700
committerYunqing Wang <yunqingwang@google.com>2015-03-17 12:23:32 -0700
commitc0423abf003ac598fffae0638a9234be6819902d (patch)
tree009207fa2d35719a2031e8f260795ce6690037e4 /vp9/encoder
parent1f9b2b77ad794a68b267d70c88288d5700297384 (diff)
downloadlibvpx-c0423abf003ac598fffae0638a9234be6819902d.tar
libvpx-c0423abf003ac598fffae0638a9234be6819902d.tar.gz
libvpx-c0423abf003ac598fffae0638a9234be6819902d.tar.bz2
libvpx-c0423abf003ac598fffae0638a9234be6819902d.zip
Refactor set vbp thresholds function
Code refactoring. Change-Id: I73b6fcc0444155ee46c1efa5253c1d608c6439cb
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_encodeframe.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index 186c6e0f4..6c7bd16cd 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -486,32 +486,34 @@ void vp9_set_vbp_thresholds(VP9_COMP *cpi, int q) {
return;
} else {
VP9_COMMON *const cm = &cpi->common;
- const VP9EncoderConfig *const oxcf = &cpi->oxcf;
const int is_key_frame = (cm->frame_type == KEY_FRAME);
- const int use_4x4_partition = is_key_frame;
- const int low_res = (cm->width <= 352 && cm->height <= 288);
const int threshold_multiplier = is_key_frame ? 80 : 4;
const int64_t threshold_base = (int64_t)(threshold_multiplier *
vp9_convert_qindex_to_q(q, cm->bit_depth));
- cpi->vbp_threshold = threshold_base;
- cpi->vbp_threshold_bsize_min = threshold_base << oxcf->speed;
- cpi->vbp_threshold_bsize_max = threshold_base;
- if (is_key_frame) {
- cpi->vbp_threshold = threshold_base >> 2;
- cpi->vbp_threshold_bsize_min = threshold_base << 2;
- } else if (low_res) {
- cpi->vbp_threshold_bsize_min = threshold_base << 3;
- cpi->vbp_threshold_bsize_max = threshold_base >> 2;
- }
// TODO(marpan): Allow 4x4 partitions for inter-frames.
// use_4x4_partition = (variance4x4downsample[i2 + j] == 1);
// If 4x4 partition is not used, then 8x8 partition will be selected
// if variance of 16x16 block is very high, so use larger threshold
// for 16x16 (threshold_bsize_min) in that case.
- cpi->vbp_threshold_16x16 = (use_4x4_partition) ?
- cpi->vbp_threshold : cpi->vbp_threshold_bsize_min;
- cpi->vbp_bsize_min = (use_4x4_partition) ? BLOCK_8X8 : BLOCK_16X16;
+ if (is_key_frame) {
+ cpi->vbp_threshold = threshold_base >> 2;
+ cpi->vbp_threshold_bsize_max = threshold_base;
+ cpi->vbp_threshold_bsize_min = threshold_base << 2;
+ cpi->vbp_threshold_16x16 = cpi->vbp_threshold;
+ cpi->vbp_bsize_min = BLOCK_8X8;
+ } else {
+ cpi->vbp_threshold = threshold_base;
+ if (cm->width <= 352 && cm->height <= 288) {
+ cpi->vbp_threshold_bsize_max = threshold_base >> 2;
+ cpi->vbp_threshold_bsize_min = threshold_base << 3;
+ } else {
+ cpi->vbp_threshold_bsize_max = threshold_base;
+ cpi->vbp_threshold_bsize_min = threshold_base << cpi->oxcf.speed;
+ }
+ cpi->vbp_threshold_16x16 = cpi->vbp_threshold_bsize_min;
+ cpi->vbp_bsize_min = BLOCK_16X16;
+ }
}
}