AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
+dnl check for tbm buffer
+
+AC_ARG_ENABLE(tbmbuf, AC_HELP_STRING([--enable-use-tbmbuf], [use tbm buf]),
+ [
+ case "${enableval}" in
+ yes) BOARD_USE_TBM_BUF=yes ;;
+ no) BOARD_USE_TBM_BUF=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-use-tbmbuf) ;;
+ esac
+ ],
+ [BOARD_USE_TBM_BUF=yes])
+AM_CONDITIONAL([BOARD_USE_TBM_BUF], [test "x$BOARD_USE_TBM_BUF" = "xyes"])
+
dnl check for gobject-introspection
GOBJECT_INTROSPECTION_CHECK([1.31.1])
ORC_SOURCE=gstvideoconvertorc
include $(top_srcdir)/common/orc.mak
-libgstvideoconvert_la_SOURCES = gsttbmbufferpool.c gstvideoconvert.c videoconvert.c gstcms.c
+libgstvideoconvert_la_SOURCES = gstvideoconvert.c videoconvert.c gstcms.c
nodist_libgstvideoconvert_la_SOURCES = $(ORC_NODIST_SOURCES)
libgstvideoconvert_la_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_CFLAGS) \
- $(ORC_CFLAGS) \
- $(MMCOMMON_CFLAGS) \
- $(TBM_CFLAGS)
-
-libgstvideoconvert_la_CFLAGS += -DUSE_TBM_BUFFER
+ $(ORC_CFLAGS)
libgstvideoconvert_la_LIBADD = \
$(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_API_VERSION).la \
$(GST_BASE_LIBS) \
$(GST_LIBS) \
- $(ORC_LIBS) \
- $(LIBM) \
- $(TBM_LIBS)
-libgstvideoconvert_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(TBM_LDFLAGS)
+ $(ORC_LIBS)
+libgstvideoconvert_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstvideoconvert_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
noinst_HEADERS = gstvideoconvert.h videoconvert.h gstcms.h
+if BOARD_USE_TBM_BUF
+libgstvideoconvert_la_SOURCES += gsttbmbufferpool.c
+libgstvideoconvert_la_CFLAGS += -DUSE_TBM_BUFFER $(MMCOMMON_CFLAGS) $(TBM_CFLAGS)
+libgstvideoconvert_la_LIBADD += $(TBM_LIBS) $(MM_COMMON_LIBS)
+libgstvideoconvert_la_LDFLAGS += $(TBM_LDFLAGS) $(MM_COMMON_LDFLAGS)
+endif
+
Android.mk: Makefile.am $(BUILT_SOURCES)
androgenizer \
-:PROJECT libgstvideoconvert -:SHARED libgstvideoconvert \
#include "gsttbmbufferpool.h"
#include <gst/video/gstvideofilter.h>
+
+int calc_yplane(int width, int height)
+{
+ int mbX, mbY;
+
+ mbX = DIV_ROUND_UP(width, 16);
+ mbY = DIV_ROUND_UP(height, 16);
+
+ return (ALIGN((mbX * mbY) * 256, 256) + 256);
+}
+
+int calc_uvplane(int width, int height)
+{
+ int mbX, mbY;
+
+ mbX = DIV_ROUND_UP(width, 16);
+ mbY = DIV_ROUND_UP(height, 16);
+
+ return (ALIGN((mbX * mbY) * 128, 256) + 128);
+}
+
+
static GstMemory *
gst_mm_memory_allocator_alloc_dummy (GstAllocator * allocator, gsize size,
GstAllocationParams * params)
mm_video_buf->type = MM_VIDEO_BUFFER_TYPE_TBM_BO;
mm_video_buf->plane_num = 2;
/* Setting Y plane size */
- mm_video_buf->size[0] = width * height;
+ mm_video_buf->size[0] = calc_yplane(width, height);
/* Setting UV plane size */
- mm_video_buf->size[1] = (width * height) >> 1;
+ mm_video_buf->size[1] = calc_uvplane(width, height);
mm_video_buf->handle.bo[0] = tbm_bo_alloc(pool->hTBMBufMgr, mm_video_buf->size[0], TBM_BO_WC);
mm_video_buf->handle.bo[1] = tbm_bo_alloc(pool->hTBMBufMgr, mm_video_buf->size[1], TBM_BO_WC);
+ mm_video_buf->handle.dmabuf_fd[0] = (tbm_bo_get_handle(mm_video_buf->handle.bo[0], TBM_DEVICE_MM)).u32;
+ mm_video_buf->handle.dmabuf_fd[1] = (tbm_bo_get_handle(mm_video_buf->handle.bo[1], TBM_DEVICE_MM)).u32;
+
mm_video_buf->handle.paddr[0] = (tbm_bo_map(mm_video_buf->handle.bo[0], TBM_DEVICE_CPU,TBM_OPTION_WRITE)).ptr;
mm_video_buf->handle.paddr[1] = (tbm_bo_map(mm_video_buf->handle.bo[1], TBM_DEVICE_CPU,TBM_OPTION_WRITE)).ptr;
/* Setting stride height & width for Y plane */
#include <tbm_bufmgr.h>
#endif
+#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
+#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
typedef struct _GstMMVideoMemory GstMMVideoMemory;
typedef struct _GstMMVideoMemoryAllocator GstMMVideoMemoryAllocator;
#ifdef USE_TBM_BUFFER
#include <mm_types.h>
#include "gsttbmbufferpool.h"
-#else
-#error "Not including MM_TYPES"
#endif
#include <string.h>
if (space->convert) {
videoconvert_convert_free (space->convert);
}
-
+#ifdef USE_TBM_BUFFER
+ if(space->tbm_buffer_pool) {
+ gst_buffer_pool_set_active (space->tbm_buffer_pool, FALSE);
+ gst_object_unref (space->tbm_buffer_pool);
+ space->tbm_buffer_pool = NULL;
+ }
+#endif
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
static void
gst_video_convert_init (GstVideoConvert * space)
{
+#ifdef USE_TBM_BUFFER
+ space->tbm_buffer_pool = NULL;
+#endif
}
void
if(vc->tbm_buffer_pool == NULL) {
min = 8;
max = 11;
- GST_ERROR("[%s]CREATING VIDEO_BUFFER_POOL",__FUNCTION__);
+ GST_DEBUG("[%s]CREATING VIDEO_BUFFER_POOL",__FUNCTION__);
vc->tbm_buffer_pool = gst_mm_buffer_pool_new(trans);
}
config = gst_buffer_pool_get_config (vc->tbm_buffer_pool);
gst_buffer_pool_set_active(vc->tbm_buffer_pool,TRUE);
- GST_ERROR("[%s]BUFFER_POOL max:[%d], min:[%d]",__FUNCTION__, max, min);
+ GST_DEBUG("[%s]BUFFER_POOL max:[%d], min:[%d]",__FUNCTION__, max, min);
}
return GST_BASE_TRANSFORM_CLASS (parent_class)->decide_allocation (trans, query);
if(filter->out_info.finfo->format == GST_VIDEO_FORMAT_SN12 ) {
if(gst_buffer_pool_acquire_buffer(vc->tbm_buffer_pool,outbuf,0) != GST_FLOW_OK) {
- GST_ERROR("[%s] memory prepared failed.",__FUNCTION__);
+ GST_ERROR("[%s] memory prepare failed.",__FUNCTION__);
return GST_FLOW_ERROR;
}
return GST_FLOW_OK;
gint height = convert->height;
if(gst_buffer_n_memory(dest->buffer) >= 2) {
- GST_DEBUG("[%s] Retrieving GstMemory at position 1.",__FUNCTION__);
GstMapInfo map_info = GST_MAP_INFO_INIT;
mem = gst_buffer_peek_memory (dest->buffer, 1);
if (mem != NULL) {
mY = mm_video_buf->handle.paddr[0];
mUV = mm_video_buf->handle.paddr[1];
- GST_DEBUG(" Addr Y:[%p] UV:[%p]",mY,mUV);
for (int i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
GET_LINE_OFFSETS (interlaced, i, l1, l2);
}
}
- GST_ERROR("RETURNING [%s]",__FUNCTION__);
}
static void
Name: gst-plugins-base
Version: 1.4.1
-Release: 6
+Release: 7
License: LGPL-2.1+ and GPL-2.0+
Summary: GStreamer Streaming-Media Framework Plug-Ins
Url: http://gstreamer.freedesktop.org/