summaryrefslogtreecommitdiff
path: root/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2013-12-04 19:10:13 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2013-12-04 19:14:38 +0100
commitb864d1f71acc47bd41b8e7171c4ad4d6628849f4 (patch)
tree32e633be01642a7a7c2d9893c50a88f87e44f1c8 /gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
parentfd9c855f140af83f34081403c09d6bfac005ca78 (diff)
downloadgst-vaapi-b864d1f71acc47bd41b8e7171c4ad4d6628849f4.tar.gz
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.
Diffstat (limited to 'gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c')
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c b/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
index 876dc6d9..90a6e23d 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