[Pkg-gstreamer-commits] [gstreamer-vaapi] 148/176: encoder: h264: fix level lookup constraints wrt. bitrate.
Vincent Cheng
vcheng at moszumanska.debian.org
Tue Jun 3 08:09:36 UTC 2014
This is an automated email from the git hooks/post-receive script.
vcheng pushed a commit to branch upstream
in repository gstreamer-vaapi.
commit 4c04a1bc8803ca40ecc2ef60a5324e1094ed0069
Author: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
Date: Wed Jan 22 11:25:13 2014 +0100
encoder: h264: fix level lookup constraints wrt. bitrate.
Fix the level calculation involving bitrate limits. Since we are
targetting NAL HRD conformance, the check against MaxBR from the
Table A-1 limits shall involve cpbBrNalFactor depending on the
active profile.
---
gst-libs/gst/vaapi/gstvaapiencoder_h264.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
index d4b2253..0046f96 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
@@ -123,6 +123,31 @@ h264_get_log2_max_frame_num (guint num)
return ret;
}
+/* Determines the cpbBrNalFactor based on the supplied profile */
+static guint
+h264_get_cpb_nal_factor (GstVaapiProfile profile)
+{
+ guint f;
+
+ /* Table A-2 */
+ switch (profile) {
+ case GST_VAAPI_PROFILE_H264_HIGH:
+ f = 1500;
+ break;
+ case GST_VAAPI_PROFILE_H264_HIGH10:
+ f = 3600;
+ break;
+ case GST_VAAPI_PROFILE_H264_HIGH_422:
+ case GST_VAAPI_PROFILE_H264_HIGH_444:
+ f = 4800;
+ break;
+ default:
+ f = 1200;
+ break;
+ }
+ return f;
+}
+
/* ------------------------------------------------------------------------- */
/* --- H.264 Bitstream Writer --- */
/* ------------------------------------------------------------------------- */
@@ -718,7 +743,8 @@ ensure_profile (GstVaapiEncoderH264 * encoder)
static gboolean
ensure_level (GstVaapiEncoderH264 * encoder)
{
- const guint bitrate = GST_VAAPI_ENCODER_CAST (encoder)->bitrate;
+ const guint cpb_factor = h264_get_cpb_nal_factor (encoder->profile);
+ const guint bitrate = GST_VAAPI_ENCODER_CAST (encoder)->bitrate * 1000;
const GstVaapiH264LevelLimits *limits_table;
guint i, num_limits, PicSizeMbs, MaxDpbMbs, MaxMBPS;
@@ -732,7 +758,8 @@ ensure_level (GstVaapiEncoderH264 * encoder)
const GstVaapiH264LevelLimits *const limits = &limits_table[i];
if (PicSizeMbs <= limits->MaxFS &&
MaxDpbMbs <= limits->MaxDpbMbs &&
- MaxMBPS <= limits->MaxMBPS && (!bitrate || bitrate <= limits->MaxBR))
+ MaxMBPS <= limits->MaxMBPS && (!bitrate
+ || bitrate <= (limits->MaxBR * cpb_factor)))
break;
}
if (i == num_limits)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gstreamer/gstreamer-vaapi.git
More information about the Pkg-gstreamer-commits
mailing list