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
This commit is contained in:
Guillaume Desmottes 2018-02-21 12:50:42 +01:00 committed by Nicolas Dufresne
parent ea2df994f3
commit f861ad2bc5

View file

@ -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;