From 0de684adbc17b445f93ed8e6f52951b44dc12063 Mon Sep 17 00:00:00 2001 From: Tim Walker Date: Tue, 29 Mar 2016 23:09:36 +0200 Subject: libhb: fix quality limits for high bit depth video encoders. The lowest possible QP (and RF) depend on the bit depth and can be lower than zero. --- libhb/common.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'libhb/common.c') diff --git a/libhb/common.c b/libhb/common.c index 74209edfb..c3643daa1 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -1210,15 +1210,38 @@ void hb_video_quality_get_limits(uint32_t codec, float *low, float *high, switch (codec) { + /* + * H.264/H.265: *low + * = 51 - (QP_MAX_SPEC) + * = 51 - (51 + QP_BD_OFFSET) + * = 0 - (QP_BD_OFFSET) + * = 0 - (6*(BIT_DEPTH-8)) (libx264) + * = 0 - (6*(X265_DEPTH-8)) (libx265) + */ case HB_VCODEC_X264_8BIT: - case HB_VCODEC_X264_10BIT: case HB_VCODEC_X265_8BIT: + *direction = 1; + *granularity = 0.1; + *low = 0.; + *high = 51.; + break; + case HB_VCODEC_X264_10BIT: case HB_VCODEC_X265_10BIT: + *direction = 1; + *granularity = 0.1; + *low = -12.; + *high = 51.; + break; case HB_VCODEC_X265_12BIT: + *direction = 1; + *granularity = 0.1; + *low = -24.; + *high = 51.; + break; case HB_VCODEC_X265_16BIT: *direction = 1; *granularity = 0.1; - *low = 0.; + *low = -48.; *high = 51.; break; -- cgit v1.2.3