summaryrefslogtreecommitdiffstats
path: root/libhb/encx264.c
diff options
context:
space:
mode:
authorTim Walker <[email protected]>2018-02-18 06:04:20 +0100
committerTim Walker <[email protected]>2018-02-18 06:04:20 +0100
commitfbc98da08ae1d455d8c672c312c817336338c224 (patch)
tree5049cb6c9c9397e65a7e951023be4b4634ecdc54 /libhb/encx264.c
parent74af20e0682cc7f75c1aae2a40b78d5a41960006 (diff)
encx264: fix apply_h264_profile's lossless check for high bit depth.
Diffstat (limited to 'libhb/encx264.c')
-rw-r--r--libhb/encx264.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libhb/encx264.c b/libhb/encx264.c
index 4adab5cc0..984d52be9 100644
--- a/libhb/encx264.c
+++ b/libhb/encx264.c
@@ -976,15 +976,23 @@ static int apply_h264_profile(const x264_api_t *api, x264_param_t *param,
/*
* lossless requires High 4:4:4 Predictive profile
*/
- if (param->rc.f_rf_constant < 1.0 &&
- param->rc.i_rc_method == X264_RC_CRF &&
- strcasecmp(h264_profile, "high444") != 0)
+ int qp_bd_offset = 6 * (api->bit_depth - 8);
+ if (strcasecmp(h264_profile, "high444") != 0 &&
+ ((param->rc.i_rc_method == X264_RC_CQP && param->rc.i_qp_constant <= 0) ||
+ (param->rc.i_rc_method == X264_RC_CRF && (int)(param->rc.f_rf_constant + qp_bd_offset) <= 0)))
{
if (verbose)
{
hb_log("apply_h264_profile [warning]: lossless requires high444 profile, disabling");
}
- param->rc.f_rf_constant = 1.0;
+ if (param->rc.i_rc_method == X264_RC_CQP)
+ {
+ param->rc.i_qp_constant = 1;
+ }
+ else
+ {
+ param->rc.f_rf_constant = 1 - qp_bd_offset;
+ }
}
return api->param_apply_profile(param, h264_profile);
}