Apply branch prediction on quantize/quantize_skip functions
- On E5-2680, park_joy_1080p, 5 frames, baseline encoding time
reduces about 0.8~1.0%.
- Credit goes to Erik Niemeyer (erik.a.niemeyer@intel.com).
Change-Id: I69f191d5a4e4b96a5f9ffd8286e484b69d565c01
diff --git a/vp10/encoder/encodemb.c b/vp10/encoder/encodemb.c
index 46ee48d..2cc8575 100644
--- a/vp10/encoder/encodemb.c
+++ b/vp10/encoder/encodemb.c
@@ -452,12 +452,12 @@
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
highbd_fwd_txfm(src_diff, coeff, diff_stride, &fwd_txfm_param);
if (xform_quant_idx != VP10_XFORM_QUANT_SKIP_QUANT) {
- if (x->skip_block) {
- vp10_quantize_skip(tx2d_size, qcoeff, dqcoeff, eob);
- } else {
+ if (LIKELY(!x->skip_block)) {
quant_func_list[xform_quant_idx][QUANT_FUNC_HIGHBD](
coeff, tx2d_size, p, qcoeff, pd, dqcoeff, eob,
scan_order, &qparam);
+ } else {
+ vp10_quantize_skip(tx2d_size, qcoeff, dqcoeff, eob);
}
}
return;
@@ -466,12 +466,12 @@
fwd_txfm(src_diff, coeff, diff_stride, &fwd_txfm_param);
if (xform_quant_idx != VP10_XFORM_QUANT_SKIP_QUANT) {
- if (x->skip_block) {
- vp10_quantize_skip(tx2d_size, qcoeff, dqcoeff, eob);
- } else {
+ if (LIKELY(!x->skip_block)) {
quant_func_list[xform_quant_idx][QUANT_FUNC_LOWBD](
coeff, tx2d_size, p, qcoeff, pd, dqcoeff, eob,
scan_order, &qparam);
+ } else {
+ vp10_quantize_skip(tx2d_size, qcoeff, dqcoeff, eob);
}
}
}