From f861ad2bc592e917ad207ea37939a5cb2b4a083b Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 21 Feb 2018 12:50:42 +0100 Subject: [PATCH] videoenc: don't set stride padding to 0 when copying frames Padding can be left undefined there is no point filling it with 0. https://bugzilla.gnome.org/show_bug.cgi?id=793694 --- omx/gstomxvideoenc.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 0de273bb73..192761b00d 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -2273,7 +2273,7 @@ gst_omx_video_enc_nv12_manual_copy (GstOMXVideoEnc * self, GstBuffer * inbuf, GstVideoInfo *info = &self->input_state->info; OMX_PARAM_PORTDEFINITIONTYPE *port_def = &self->enc_in_port->port_def; GstVideoFrame frame; - gint i, j, height, width, dest_height; + gint i, j, height, width; guint8 *src, *dest; gint src_stride, dest_stride; @@ -2296,10 +2296,6 @@ gst_omx_video_enc_nv12_manual_copy (GstOMXVideoEnc * self, GstBuffer * inbuf, dest += port_def->format.video.nSliceHeight * port_def->format.video.nStride; - if (i == 0) - dest_height = port_def->format.video.nSliceHeight; - else - dest_height = port_def->format.video.nSliceHeight / 2; src = GST_VIDEO_FRAME_COMP_DATA (&frame, i); height = GST_VIDEO_FRAME_COMP_HEIGHT (&frame, i); width = GST_VIDEO_FRAME_COMP_WIDTH (&frame, i) * (i == 0 ? 1 : 2); @@ -2322,12 +2318,6 @@ gst_omx_video_enc_nv12_manual_copy (GstOMXVideoEnc * self, GstBuffer * inbuf, src += src_stride; dest += dest_stride; } - for (; j < dest_height; j++) { - memset (dest, 0, dest_stride); - outbuf->omx_buf->nFilledLen += dest_stride; - src += src_stride; - dest += dest_stride; - } } gst_video_frame_unmap (&frame); @@ -2411,7 +2401,7 @@ gst_omx_video_enc_fill_buffer (GstOMXVideoEnc * self, GstBuffer * inbuf, switch (info->finfo->format) { case GST_VIDEO_FORMAT_I420:{ - gint i, j, height, width, dest_height; + gint i, j, height, width; guint8 *src, *dest; gint src_stride, dest_stride; @@ -2426,10 +2416,8 @@ gst_omx_video_enc_fill_buffer (GstOMXVideoEnc * self, GstBuffer * inbuf, for (i = 0; i < 3; i++) { if (i == 0) { dest_stride = port_def->format.video.nStride; - dest_height = port_def->format.video.nSliceHeight; } else { dest_stride = port_def->format.video.nStride / 2; - dest_height = port_def->format.video.nSliceHeight / 2; } src_stride = GST_VIDEO_FRAME_COMP_STRIDE (&frame, i); @@ -2465,12 +2453,6 @@ gst_omx_video_enc_fill_buffer (GstOMXVideoEnc * self, GstBuffer * inbuf, src += src_stride; dest += dest_stride; } - for (; j < dest_height; j++) { - memset (dest, 0, dest_stride); - outbuf->omx_buf->nFilledLen += dest_stride; - src += src_stride; - dest += dest_stride; - } } gst_video_frame_unmap (&frame); ret = TRUE;