summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2018-07-12 12:41:18 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2018-07-13 09:54:48 +0200
commita8638938427b819252a3efa0fc30be3f522eead3 (patch)
treefe3a2d242396a37d51ddfe49c1a221ddacd5acd4
parent1e9d7a6a236939228efa22e0f0ace0a7f7328639 (diff)
downloadgst-omx-a8638938427b819252a3efa0fc30be3f522eead3.tar.gz
omxvideoenc: fix vertical padding in NV16 formats
My previous patch to calculate the vertical padding was always halfing the height of the chroma plane which is incorrect for NV16 formats. https://bugzilla.gnome.org/show_bug.cgi?id=796749
-rw-r--r--omx/gstomxvideoenc.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
index c296b95..9abd9a8 100644
--- a/omx/gstomxvideoenc.c
+++ b/omx/gstomxvideoenc.c
@@ -2320,7 +2320,7 @@ gst_omx_video_enc_flush (GstVideoEncoder * encoder)
static gboolean
gst_omx_video_enc_semi_planar_manual_copy (GstOMXVideoEnc * self,
- GstBuffer * inbuf, GstOMXBuffer * outbuf, gboolean variant_10)
+ GstBuffer * inbuf, GstOMXBuffer * outbuf, const GstVideoFormatInfo * finfo)
{
GstVideoInfo *info = &self->input_state->info;
OMX_PARAM_PORTDEFINITIONTYPE *port_def = &self->enc_in_port->port_def;
@@ -2352,7 +2352,7 @@ gst_omx_video_enc_semi_planar_manual_copy (GstOMXVideoEnc * self,
height = GST_VIDEO_FRAME_COMP_HEIGHT (&frame, i);
width = GST_VIDEO_FRAME_COMP_WIDTH (&frame, i) * (i == 0 ? 1 : 2);
- if (variant_10)
+ if (GST_VIDEO_FORMAT_INFO_BITS (finfo) == 10)
/* Need ((width + 2) / 3) 32-bits words */
width = (width + 2) / 3 * 4;
@@ -2371,13 +2371,9 @@ gst_omx_video_enc_semi_planar_manual_copy (GstOMXVideoEnc * self,
}
/* nFilledLen should include the vertical padding in each slice (spec 3.1.3.7.1) */
- if (i == 0)
- outbuf->omx_buf->nFilledLen +=
- port_def->format.video.nSliceHeight * port_def->format.video.nStride;
- else
- outbuf->omx_buf->nFilledLen +=
- (port_def->format.video.nSliceHeight / 2) *
- port_def->format.video.nStride;
+ outbuf->omx_buf->nFilledLen +=
+ GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (finfo, i,
+ port_def->format.video.nSliceHeight) * port_def->format.video.nStride;
}
gst_video_frame_unmap (&frame);
@@ -2529,14 +2525,11 @@ gst_omx_video_enc_fill_buffer (GstOMXVideoEnc * self, GstBuffer * inbuf,
}
case GST_VIDEO_FORMAT_NV12:
case GST_VIDEO_FORMAT_NV16:
- ret =
- gst_omx_video_enc_semi_planar_manual_copy (self, inbuf, outbuf,
- FALSE);
- break;
case GST_VIDEO_FORMAT_NV12_10LE32:
case GST_VIDEO_FORMAT_NV16_10LE32:
ret =
- gst_omx_video_enc_semi_planar_manual_copy (self, inbuf, outbuf, TRUE);
+ gst_omx_video_enc_semi_planar_manual_copy (self, inbuf, outbuf,
+ info->finfo);
break;
default:
GST_ERROR_OBJECT (self, "Unsupported format");