summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyunjun Ko <zzoon@igalia.com>2017-10-16 12:09:08 +0900
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2018-04-16 15:57:21 +0200
commite19570a8b61942d723d019e7241ede764bba0f47 (patch)
tree09a45db5f5620f340c4327e06a4a0b260059cacf
parent7fa706f05a715027d15ff3f0bbfd362feedf9d42 (diff)
libs: encoder: h265: 16 bit rounding of picture width and height
pic_width_in_luma_samples/pic_height_in_luma_samples can be 16-bit rounded instead of 32-bit. In addition, codedbuf_size must be calculated according to this change. https://bugzilla.gnome.org/show_bug.cgi?id=753229
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h265.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
index 87f3a6bc..a2186503 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
@@ -2437,8 +2437,8 @@ set_context_info (GstVaapiEncoder * base_encoder)
+ (encoder->num_bframes > 0 ? 1 : 0) + DEFAULT_SURFACES_COUNT);
/* Only YUV 4:2:0 formats are supported for now. */
- base_encoder->codedbuf_size += GST_ROUND_UP_32 (vip->width) *
- GST_ROUND_UP_32 (vip->height) * 3 / 2;
+ base_encoder->codedbuf_size += GST_ROUND_UP_16 (vip->width) *
+ GST_ROUND_UP_16 (vip->height) * 3 / 2;
return GST_VAAPI_ENCODER_STATUS_SUCCESS;
}
@@ -2456,15 +2456,15 @@ gst_vaapi_encoder_h265_reconfigure (GstVaapiEncoder * base_encoder)
if (luma_width != encoder->luma_width || luma_height != encoder->luma_height) {
GST_DEBUG ("resolution: %d %d", GST_VAAPI_ENCODER_WIDTH (encoder),
GST_VAAPI_ENCODER_HEIGHT (encoder));
- encoder->luma_width = GST_ROUND_UP_32 (luma_width);
- encoder->luma_height = GST_ROUND_UP_32 (luma_height);
+ encoder->luma_width = GST_ROUND_UP_16 (luma_width);
+ encoder->luma_height = GST_ROUND_UP_16 (luma_height);
encoder->ctu_width = (encoder->luma_width + 31) / 32;
encoder->ctu_height = (encoder->luma_height + 31) / 32;
encoder->config_changed = TRUE;
/* Frame Cropping */
- if ((GST_VAAPI_ENCODER_WIDTH (encoder) & 31) ||
- (GST_VAAPI_ENCODER_HEIGHT (encoder) & 31)) {
+ if ((GST_VAAPI_ENCODER_WIDTH (encoder) & 15) ||
+ (GST_VAAPI_ENCODER_HEIGHT (encoder) & 15)) {
static const guint SubWidthC[] = { 1, 2, 2, 1 };
static const guint SubHeightC[] = { 1, 2, 1, 1 };
encoder->conformance_window_flag = 1;