summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordon.darling <don.darling@24075187-2e39-4e88-bbb8-bc8aa768f540>2010-11-16 20:47:01 +0000
committerdon.darling <don.darling@24075187-2e39-4e88-bbb8-bc8aa768f540>2010-11-16 20:47:01 +0000
commitd695b47105b47b7c902c173f4b5110b3a7744dfd (patch)
tree7dd5e1c7e02e53d8ab8e6ae35854fa890931c613
parentd888bbd106e75bce3f42e909a4416d5ae3637c7a (diff)
Pass DMAI transport buffers directly to encoder.
If the input buffer is a DMAI transport buffer, we know it is already in physically contiguous CMEM memory, and can be passed directly to the encoder without a copy (on all platforms). git-svn-id: https://gstreamer.ti.com/svn/gstreamer_ti/trunk@871 24075187-2e39-4e88-bbb8-bc8aa768f540
-rw-r--r--gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c
index f8d8eff..4cb874f 100644
--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c
+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c
@@ -1577,11 +1577,21 @@ gst_tividenc1_encode(GstTIVidenc1 *videnc1, GstBuffer *inBuf,
/* Get the time stamp from the input buffer */
encDataTime = GST_BUFFER_TIMESTAMP(inBuf);
- /* If zero-copy encode is enabled, we can pass the input buffer directly
- * to the encoder without a copy. Otherwise, copy the input buffer into
- * our physically contiguous buffer for the codec.
+ /* Prepare the codec input buffer (hContigInBuf):
+ * 1) If the input buffer is a physically contiguous DMAI buffer, it can
+ * be passed directly to the codec.
+ * 2) If zeroCopyEncode is TRUE, we have a non-DMAI buffer that can still
+ * be used directly by the codec. Wrap it in a DMAI buffer reference
+ * so it can be passed to Venc1_process.
+ * 3) If the above scenarios don't apply, copy the buffer contents into
+ * our local physically contiguous DMAI buffer and pass it to the
+ * codec. The gst_tividenc1_copy_input function will copy using
+ * hardware acceleration if possible.
*/
- if (videnc1->zeroCopyEncode) {
+ if (GST_IS_TIDMAIBUFFERTRANSPORT(inBuf)) {
+ hContigInBuf = GST_TIDMAIBUFFERTRANSPORT_DMAIBUF(inBuf);
+ }
+ else if (videnc1->zeroCopyEncode) {
if (!videnc1->hInBufRef) {
videnc1->hInBufRef =
gst_tividenc1_convert_gst_to_dmai(videnc1, inBuf, TRUE);