[Pkg-gstreamer-commits] [gstreamer-vaapi] 43/176: encoder: fix computation of max coded buffer size.
Vincent Cheng
vcheng at moszumanska.debian.org
Tue Jun 3 08:09:26 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 b864d1f71acc47bd41b8e7171c4ad4d6628849f4
Author: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
Date: Wed Dec 4 19:10:13 2013 +0100
encoder: fix computation of max coded buffer size.
Fix coded buffer size for each codec. A generic issue was that the
number of macroblocks was incorrectly computed. The second issue was
specific to MPEG-2 were the max number of bits per macroblock, and
as defined by the standard, was incorrectly mapped to the (lower)
H.264 requirement. i.e. 4608 bits vs. 3200 bits limit.
---
gst-libs/gst/vaapi/gstvaapiencoder.c | 3 ---
gst-libs/gst/vaapi/gstvaapiencoder_h264.c | 6 ++++++
gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c | 5 +++++
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c
index e56886f..e0be314 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder.c
@@ -371,9 +371,6 @@ gst_vaapi_encoder_set_format (GstVaapiEncoder * encoder,
if (!gst_vaapi_encoder_ensure_context (encoder))
goto error;
- encoder->codedbuf_size = (GST_VAAPI_ENCODER_WIDTH (encoder) *
- GST_VAAPI_ENCODER_HEIGHT (encoder) * 400) / (16 * 16);
-
encoder->codedbuf_pool = gst_vaapi_coded_buffer_pool_new (encoder,
encoder->codedbuf_size);
if (!encoder->codedbuf_pool) {
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
index d23646f..a9a9b13 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
@@ -1594,6 +1594,12 @@ gst_vaapi_encoder_h264_set_context_info (GstVaapiEncoder * base_encoder)
cip->profile = encoder->profile;
cip->ref_frames = (encoder->b_frame_num ? 2 : 1) + DEFAULT_SURFACES_COUNT;
+
+ /* Only YUV 4:2:0 formats are supported for now. This means that we
+ have a limit of 3200 bits per macroblock. */
+ /* XXX: check profile and compute RawMbBits */
+ base_encoder->codedbuf_size = (GST_ROUND_UP_16 (cip->width) *
+ GST_ROUND_UP_16 (cip->height) / 256) * 400;
}
static GstCaps *
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c b/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
index 876dc6d..90a6e23 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
@@ -635,6 +635,11 @@ gst_vaapi_encoder_mpeg2_set_context_info (GstVaapiEncoder * base_encoder)
cip->profile = to_vaapi_profile (encoder->profile);
cip->ref_frames = 2;
+
+ /* Only YUV 4:2:0 formats are supported for now. This means that we
+ have a limit of 4608 bits per macroblock. */
+ base_encoder->codedbuf_size = (GST_ROUND_UP_16 (cip->width) *
+ GST_ROUND_UP_16 (cip->height) / 256) * 576;
}
static gboolean
--
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