-I/usr/include \
$(srcdir)/../imgp/libmmutil_imgp.la
-libmmutil_bmp_la_LIBADD = $(GLIB_LIBS) -lnsbmp -lbmp -ldl -lttrace\
+libmmutil_bmp_la_LIBADD = $(GLIB_LIBS) -lnsbmp -lbmp -ldl \
$(GMODULE_LIBS) \
$(MEDIA_LIBS)
#define FONT_COLOR_RESET "\033[0m"
#define FONT_COLOR_RED "\033[31m"
+#define FONT_COLOR_YELLOW "\033[33m"
#define mm_util_debug(fmt, arg...) do { \
LOGD(FONT_COLOR_RESET""fmt"", ##arg); \
} while (0)
#define mm_util_fenter() do { \
- LOGD(FONT_COLOR_RESET"<Enter>"); \
+ LOGD(FONT_COLOR_YELLOW"<ENTER>"FONT_COLOR_RESET); \
} while (0)
#define mm_util_fleave() do { \
- LOGD(FONT_COLOR_RESET"<Leave>"); \
+ LOGD(FONT_COLOR_YELLOW"<LEAVE>"FONT_COLOR_RESET); \
} while (0)
#define mm_util_retm_if(expr, fmt, arg...) do { \
#include <stdlib.h>
#include "mm_util_debug.h"
#include "mm_util_type.h"
-#ifdef ENABLE_TTRACE
-#include <ttrace.h>
-#endif
#ifdef __cplusplus
extern "C" {
#endif
-/* For_TTRACE performance checker */
-#ifdef ENABLE_TTRACE
-#define TTRACE_BEGIN(NAME) traceBegin(TTRACE_TAG_IMAGE, NAME)
-#define TTRACE_END() traceEnd(TTRACE_TAG_IMAGE)
-#else /* ENABLE_TTRACE */
-#define TTRACE_BEGIN(NAME)
-#define TTRACE_END()
-#endif /* ENABLE_TTRACE */
/* For memory management */
#define MMUTIL_SAFE_FREE(x) { if (x) { free(x); x = NULL; } }
AC_SUBST(OPENCV_CFLAGS)
AC_SUBST(OPENCV_LIBS)
-PKG_CHECK_MODULES(TTRACE, [ttrace], AC_DEFINE(ENABLE_TTRACE, 1, [ttrace available]))
-AC_SUBST(TTRACE)
-
#tz-platform-config lib
PKG_CHECK_MODULES(TZ_PLATFORM_CONFIG, libtzplatform-config)
AC_SUBST(TZ_PLATFORM_CONFIG_CFLAGS)
-I/usr/include \
$(srcdir)/../imgp/libmmutil_imgp.la
-libmmutil_gif_la_LIBADD = $(GLIB_LIBS) -lgif -ldl -lttrace\
+libmmutil_gif_la_LIBADD = $(GLIB_LIBS) -lgif -ldl \
$(GIO_LIBS) \
$(GMODULE_LIBS) \
$(MEDIA_LIBS)
$(MEDIA_LIBS) \
$(OPENCV_LIBS)
-libmmutil_imgcv_la_CFLAGS += -lttrace -DLIBPREFIX=\"$(libdir)\"
+libmmutil_imgcv_la_CFLAGS += -DLIBPREFIX=\"$(libdir)\"
pcfiles = mmutil-imgcv.pc
pkgconfigdir = $(libdir)/pkgconfig
static int _mm_util_imgcv_init(mm_util_imgcv_s *handle, int width, int height)
{
- mm_util_debug("Enter _mm_util_imgcv_init");
+ mm_util_fenter();
handle->width = width;
handle->height = height;
handle->vRanges[0] = 0;
handle->vRanges[1] = DEFAULT_RANGE_VALUE;
- mm_util_debug("Leave _mm_util_imgcv_uninit");
+ mm_util_fleave();
return MM_UTIL_ERROR_NONE;
}
static void _mm_util_imgcv_uninit(mm_util_imgcv_s *handle)
{
- mm_util_debug("Enter _mm_util_imgcv_uninit");
+ mm_util_fenter();
if (handle->inImg != NULL) {
cvReleaseImageHeader(&handle->inImg);
handle->inImg = NULL;
}
- mm_util_debug("Leave _mm_util_imgcv_uninit");
+ mm_util_fleave();
}
static int _mm_util_imgcv_set_buffer(mm_util_imgcv_s *handle, void *image_buffer)
{
- mm_util_debug("Enter _mm_util_imgcv_set_buffer");
+ mm_util_fenter();
unsigned char *buffer = (unsigned char *)image_buffer;
if (handle->inImg == NULL)
return MM_UTIL_ERROR_INVALID_OPERATION;
- mm_util_debug("Leave _mm_util_imgcv_set_buffer");
+ mm_util_fleave();
return MM_UTIL_ERROR_NONE;
}
static void _convert_hsv_to_rgb(int hVal, int sVal, int vVal, float *rVal, float *gVal, float *bVal)
{
- mm_util_debug("Enter _convert_hsv_to_rgb");
+ mm_util_fenter();
CvMat *mat1 = cvCreateMat(1, 1 , CV_8UC3);
cvSet2D(mat1, 0, 0, cvScalar((double)hVal, (double)sVal, (double)vVal, 0.0));
mm_util_debug("from HSV[%f, %f, %f]", (float)hVal, (float)sVal, (float)vVal);
mm_util_debug("to BGR[%f, %f, %f]", *bVal, *gVal, *rVal);
- mm_util_debug("Leave _convert_hsv_to_rgb");
}
static int _mm_util_imgcv_calculate_hist(mm_util_imgcv_s *handle, unsigned char *rgb_r, unsigned char *rgb_g, unsigned char *rgb_b)
{
- mm_util_debug("Enter _mm_util_imgcv_calculate_hist");
-
int nh = 0;
int ns = 0;
int nv = 0;
unsigned int maxBinVal = 0;
int max_bin_idx[3] = {-1, -1, -1};
+ mm_util_fenter();
+
IplImage *hsvImg = cvCreateImage(cvSize(handle->width, handle->height), IPL_DEPTH_8U, HSV_COLOR_CHANNELS);
IplImage *hImg = cvCreateImage(cvSize(handle->width, handle->height), IPL_DEPTH_8U, 1);
IplImage *sImg = cvCreateImage(cvSize(handle->width, handle->height), IPL_DEPTH_8U, 1);
cvReleaseHist(&hist);
- mm_util_debug("Leave _mm_util_imgcv_calculate_hist");
+ mm_util_fleave();
return MM_UTIL_ERROR_NONE;
}
int mm_util_cv_extract_representative_color(void *image_buffer, int width, int height, unsigned char *r_color, unsigned char *g_color, unsigned char *b_color)
{
- mm_util_debug("Enter mm_util_cv_extract_representative_color");
+ mm_util_fenter();
+
if (image_buffer == NULL) {
mm_util_error("#ERROR#: image buffer is NULL");
-
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
mm_util_imgcv_s *handle = (mm_util_imgcv_s *)calloc(1, sizeof(mm_util_imgcv_s));
if (handle == NULL) {
mm_util_error("#ERROR#: fail to create handle");
-
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
if (ret != MM_UTIL_ERROR_NONE) {
_mm_util_imgcv_uninit(handle);
MMUTIL_SAFE_FREE(handle);
-
mm_util_error("#ERROR#: Fail to mm_util_imgcv_init: ret=%d", ret);
-
return ret;
}
if (ret != MM_UTIL_ERROR_NONE) {
_mm_util_imgcv_uninit(handle);
MMUTIL_SAFE_FREE(handle);
-
mm_util_error("#ERROR#: Fail to mm_util_imgcv_set_buffer: ret=%d", ret);
-
return ret;
}
if (ret != MM_UTIL_ERROR_NONE) {
_mm_util_imgcv_uninit(handle);
MMUTIL_SAFE_FREE(handle);
-
mm_util_error("#ERROR#: Fail to mm_util_imgcv_calculate_hist: ret=%d", ret);
-
return ret;
}
MMUTIL_SAFE_FREE(handle);
- mm_util_debug("Leave mm_util_cv_extract_representative_color");
+ mm_util_fleave();
return MM_UTIL_ERROR_NONE;
}
$(DRI2_LIBS) \
$(DLOG_LIBS)
-libmmutil_imgp_la_CFLAGS += -lcapi-media-tool -lttrace -DLIBPREFIX=\"$(libdir)\"
+libmmutil_imgp_la_CFLAGS += -lcapi-media-tool -DLIBPREFIX=\"$(libdir)\"
pcfiles = mmutil-imgp.pc
pkgconfigdir = $(libdir)/pkgconfig
int size, w2, h2, size2;
int stride, stride2;
- TTRACE_BEGIN("MM_UTILITY:IMGP:GET_SIZE");
+ mm_util_fenter();
if (!imgsize) {
mm_util_error("imgsize can't be null");
- TTRACE_END();
return MM_UTIL_ERROR_NO_SUCH_FILE;
}
if (check_valid_picture_size(width, height) < 0) {
mm_util_error("invalid width and height");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
default:
mm_util_error("Not supported format");
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
+
mm_util_debug("format: %d, *imgsize: %d", format, *imgsize);
- TTRACE_END();
return ret;
}
int size, w2, h2, size2;
int stride, stride2;
- TTRACE_BEGIN("MM_UTILITY:IMGP:GET_SIZE");
+ mm_util_fenter();
if (!imgsize) {
mm_util_error("imgsize can't be null");
- TTRACE_END();
return MM_UTIL_ERROR_NO_SUCH_FILE;
}
if (check_valid_picture_size(width, height) < 0) {
mm_util_error("invalid width and height");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
default:
mm_util_error("Not supported format");
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
+
mm_util_debug("format: %d, *imgsize: %d", format, *imgsize);
- TTRACE_END();
return ret;
}
{
int ret = MM_UTIL_ERROR_NONE;
- TTRACE_BEGIN("MM_UTILITY:IMGP:CREATE");
-
if (imgp_handle == NULL) {
mm_util_error("Invalid arguments [tag null]");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
mm_util_s *handle = calloc(1, sizeof(mm_util_s));
if (!handle) {
mm_util_error("[ERROR] - _handle");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_OPERATION;
}
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("_mm_util_handle_init failed");
MMUTIL_SAFE_FREE(handle);
- TTRACE_END();
return ret;
}
*imgp_handle = (mm_util_imgp_h)handle;
- TTRACE_END();
return ret;
}
int ret = MM_UTIL_ERROR_NONE;
mm_util_s *handle = (mm_util_s *) imgp_handle;
- TTRACE_BEGIN("MM_UTILITY:IMGP:SET_HARDWARE_ACCELERATION");
-
if (!handle) {
mm_util_error("[ERROR] - handle");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_OPERATION;
}
handle->hardware_acceleration = mode;
- TTRACE_END();
return ret;
}
int ret = MM_UTIL_ERROR_NONE;
mm_util_s *handle = (mm_util_s *) imgp_handle;
- TTRACE_BEGIN("MM_UTILITY:IMGP:SET_HARDWARE_ACCELERATION");
-
if (!handle) {
mm_util_error("[ERROR] - handle");
return MM_UTIL_ERROR_INVALID_OPERATION;
handle->dst_format = colorspace;
mm_util_debug("imgp fmt: %d", handle->dst_format);
- TTRACE_END();
return ret;
}
int ret = MM_UTIL_ERROR_NONE;
mm_util_s *handle = (mm_util_s *) imgp_handle;
- TTRACE_BEGIN("MM_UTILITY:IMGP:SET_RESOLUTION");
-
if (!handle) {
mm_util_error("[ERROR] - handle");
return MM_UTIL_ERROR_INVALID_OPERATION;
handle->dst_width = width;
handle->dst_height = height;
- TTRACE_END();
return ret;
}
int ret = MM_UTIL_ERROR_NONE;
mm_util_s *handle = (mm_util_s *) imgp_handle;
- TTRACE_BEGIN("MM_UTILITY:IMGP:SET_ROTATION");
if (!handle) {
mm_util_error("[ERROR] - handle");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_OPERATION;
}
handle->set_rotate = TRUE;
handle->dst_rotation = rotation;
- TTRACE_END();
return ret;
}
int ret = MM_UTIL_ERROR_NONE;
mm_util_s *handle = (mm_util_s *) imgp_handle;
- TTRACE_BEGIN("MM_UTILITY:IMGP:SET_CROP_AREA");
-
unsigned int dest_width = end_x - start_x;
unsigned int dest_height = end_y - start_y;
if (!handle) {
mm_util_error("[ERROR] - handle");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_OPERATION;
}
handle->dst_width = dest_width;
handle->dst_height = dest_height;
- TTRACE_END();
return ret;
}
int ret = MM_UTIL_ERROR_NONE;
mm_util_s *handle = (mm_util_s *) imgp_handle;
- TTRACE_BEGIN("MM_UTILITY:IMGP:TRANSFORM");
+ mm_util_fenter();
if (!handle) {
mm_util_error("[ERROR] - handle");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_OPERATION;
}
if (!src_packet) {
mm_util_error("[ERROR] - src_packet");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
} else {
mm_util_debug("src: %p", src_packet);
if (!completed_callback) {
mm_util_error("[ERROR] - completed_callback");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
ret = __mm_util_create_thread(handle);
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("ERROR - Create thread");
- TTRACE_END();
return ret;
} else {
mm_util_debug("Success -__mm_util_create_thread");
}
}
- TTRACE_END();
+ mm_util_fleave();
+
return ret;
}
mm_util_s *handle = (mm_util_s *) imgp_handle;
- TTRACE_BEGIN("MM_UTILITY:IMGP:TRANSFORM_IS_COMPLETED");
-
if (!handle) {
mm_util_error("[ERROR] - handle");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if (!is_completed) {
mm_util_error("[ERROR] - is_completed");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
*is_completed = handle->is_completed;
mm_util_debug("[Transform....] %d", *is_completed);
- TTRACE_END();
return ret;
}
int ret = MM_UTIL_ERROR_NONE;
mm_util_s *handle = (mm_util_s *) imgp_handle;
- TTRACE_BEGIN("MM_UTILITY:IMGP:DESTROY");
- mm_util_debug("enter");
+ mm_util_fenter();
if (!handle) {
mm_util_error("[ERROR] - handle");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
/* Close */
if (_mm_util_handle_finalize(handle) != MM_UTIL_ERROR_NONE) {
mm_util_error("_mm_util_handle_finalize)");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
MMUTIL_SAFE_FREE(handle->_util_cb);
MMUTIL_SAFE_FREE(handle);
- mm_util_debug("Success - Destroy Handle");
- TTRACE_END();
+ mm_util_fleave();
+
return ret;
}
unsigned char *output_buffer = NULL;
unsigned int output_buffer_size = 0;
- TTRACE_BEGIN("MM_UTILITY:IMGP:CONVERT_COLORSPACE");
-
mm_util_fenter();
if (!src || !dst) {
mm_util_error("invalid src or dst");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format > MM_UTIL_IMG_FMT_NUM) || (dst_format < MM_UTIL_IMG_FMT_YUV420) || (dst_format > MM_UTIL_IMG_FMT_NUM)) {
mm_util_error("#ERROR# src_format : [%d] dst_format : [%d] value ", src_format, dst_format);
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if (__mm_cannot_convert_format(src_format, dst_format)) {
mm_util_error("#ERROR# Cannot Support Image Format Convert");
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
imgp_info_s *_imgp_info_s = (imgp_info_s *) calloc(1, sizeof(imgp_info_s));
if (_imgp_info_s == NULL) {
mm_util_error("ERROR - alloc handle");
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("__mm_set_imgp_info_s failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
mm_util_debug("Sucess __mm_set_imgp_info_s");
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("__mm_set_imgp_info_s failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
- TTRACE_END();
return ret;
}
if (output_buffer == NULL) {
mm_util_error("memory allocation failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
mm_util_debug("memory allocation outputbuffer: %p (%d)", output_buffer, output_buffer_size);
mm_util_error("image processing failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
MMUTIL_SAFE_FREE(output_buffer);
- TTRACE_END();
return ret;
}
} else {
mm_util_error("g_module_symbol failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
MMUTIL_SAFE_FREE(output_buffer);
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("__mm_util_imgp_finalize failed");
MMUTIL_SAFE_FREE(output_buffer);
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
} else {
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("__mm_util_imgp_finalize failed");
MMUTIL_SAFE_FREE(output_buffer);
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
mm_util_fleave();
- TTRACE_END();
-
return ret;
}
unsigned char *output_buffer = NULL;
unsigned int output_buffer_size = 0;
- TTRACE_BEGIN("MM_UTILITY:IMGP:RESIZE_IMAGE");
-
mm_util_fenter();
if (!src || !dst) {
mm_util_error("invalid argument");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format > MM_UTIL_IMG_FMT_NUM)) {
mm_util_error("#ERROR# src_format value ");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if (!dst_width || !dst_height) {
mm_util_error("#ERROR# dst width/height buffer is NULL");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if (!src_width || !src_height) {
mm_util_error("#ERROR# src_width || src_height valuei is 0 ");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
imgp_info_s *_imgp_info_s = (imgp_info_s *) calloc(1, sizeof(imgp_info_s));
if (_imgp_info_s == NULL) {
mm_util_error("ERROR - alloc handle");
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("__mm_set_imgp_info_s failed [%d]", ret);
__mm_util_imgp_finalize(_module, _imgp_info_s);
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if (__mm_gst_can_resize_format(_imgp_info_s->input_format_label) == FALSE) {
mm_util_error("#RESIZE ERROR# IMAGE_NOT_SUPPORT_FORMAT");
__mm_util_imgp_finalize(_module, _imgp_info_s);
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
}
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("__mm_set_imgp_info_s failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
- TTRACE_END();
return ret;
}
if (output_buffer == NULL) {
mm_util_error("memory allocation failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
mm_util_error("image processing failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
MMUTIL_SAFE_FREE(output_buffer);
- TTRACE_END();
return ret;
}
} else {
mm_util_error("g_module_symbol failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
MMUTIL_SAFE_FREE(output_buffer);
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("__mm_util_imgp_finalize failed");
MMUTIL_SAFE_FREE(output_buffer);
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
MMUTIL_SAFE_FREE(output_buffer);
- mm_util_fenter();
-
- TTRACE_END();
+ mm_util_fleave();
return ret;
}
unsigned char *output_buffer = NULL;
unsigned int output_buffer_size = 0;
- TTRACE_BEGIN("MM_UTILITY:IMGP:ROTATE_IMAGE");
-
mm_util_fenter();
if (!src || !dst) {
mm_util_error("invalid argument");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format > MM_UTIL_IMG_FMT_NUM)) {
mm_util_error("#ERROR# src_format value");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if (!dst_width || !dst_height) {
mm_util_error("#ERROR# dst width/height buffer is NUL");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if (!src_width || !src_height) {
mm_util_error("#ERROR# src_width || src_height value is 0 ");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((angle < MM_UTIL_ROTATE_0) || (angle > MM_UTIL_ROTATE_NUM)) {
mm_util_error("#ERROR# angle vaule");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
imgp_info_s *_imgp_info_s = (imgp_info_s *) calloc(1, sizeof(imgp_info_s));
if (_imgp_info_s == NULL) {
mm_util_error("ERROR - alloc handle");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
IMGPInfoFunc _mm_util_imgp_func = NULL;
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("dst_width || dest_height size Error");
__mm_util_imgp_finalize(_module, _imgp_info_s);
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("__mm_set_imgp_info_s failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
mm_util_debug("Sucess __mm_set_imgp_info_s");
if (__mm_gst_can_rotate_format(_imgp_info_s->input_format_label) == FALSE) {
mm_util_error("#gstreamer ROTATE ERROR# IMAGE_NOT_SUPPORT_FORMAT");
__mm_util_imgp_finalize(_module, _imgp_info_s);
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
}
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("__mm_set_imgp_info_s failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
- TTRACE_END();
return ret;
}
if (output_buffer == NULL) {
mm_util_error("memory allocation failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
mm_util_error("image processing failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
MMUTIL_SAFE_FREE(output_buffer);
- TTRACE_END();
return ret;
}
} else {
mm_util_error("g_module_symbol failed");
__mm_util_imgp_finalize(_module, _imgp_info_s);
MMUTIL_SAFE_FREE(output_buffer);
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
if (ret != MM_UTIL_ERROR_NONE) {
mm_util_error("__mm_util_imgp_finalize failed");
MMUTIL_SAFE_FREE(output_buffer);
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
mm_util_fleave();
- TTRACE_END();
-
return ret;
}
{
int ret = MM_UTIL_ERROR_NONE;
- TTRACE_BEGIN("MM_UTILITY:IMGP:CROP_IMAGE");
+ mm_util_fenter();
if (!src || !dst) {
mm_util_error("invalid argument");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((src_format < MM_UTIL_IMG_FMT_YUV420) || (src_format > MM_UTIL_IMG_FMT_NUM)) {
mm_util_error("#ERROR# src_format value");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((crop_start_x + *crop_dest_width > src_width) || (crop_start_y + *crop_dest_height > src_height)) {
mm_util_error("#ERROR# dest width | height value");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
ret = MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
- TTRACE_END();
+ mm_util_fleave();
+
return ret;
}
int size, w2, h2, size2;
int stride, stride2;
- TTRACE_BEGIN("MM_UTILITY:IMGP:GET_SIZE");
+ mm_util_fenter();
if (!imgsize) {
mm_util_error("imgsize can't be null");
- TTRACE_END();
return MM_UTIL_ERROR_NO_SUCH_FILE;
}
if (check_valid_picture_size(width, height) < 0) {
mm_util_error("invalid width and height");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
default:
mm_util_error("Not supported format");
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
+
mm_util_debug("format: %d, *imgsize: %d", format, *imgsize);
- TTRACE_END();
return ret;
}
-I/usr/include \
$(srcdir)/../imgp/libmmutil_imgp.la
-libmmutil_jpeg_la_LIBADD = $(GLIB_LIBS) -ljpeg -ldl -lttrace -lturbojpeg\
+libmmutil_jpeg_la_LIBADD = $(GLIB_LIBS) -ljpeg -ldl -lturbojpeg\
$(GMODULE_LIBS) \
$(MEDIA_LIBS)
data[1] = cb;
data[2] = cr;
- mm_util_debug("Enter");
+ mm_util_fenter();
cinfo.err = jpeg_std_error(&jerr);
data[1] = cb;
data[2] = cr;
- mm_util_debug("Enter");
- mm_util_debug("#Before Enter#, mem: %p\t rawdata:%p\t width: %d\t height: %d\t fmt: %d\t quality: %d"
- , mem, rawdata, width, height, fmt, quality);
+ mm_util_debug("#Before Enter#, mem: %p\t rawdata:%p\t width: %d\t height: %d\t fmt: %d\t quality: %d", mem, rawdata, width, height, fmt, quality);
if (rawdata == NULL) {
mm_util_error("Exit on error -rawdata");
JSAMPROW image, u_image, v_image;
JSAMPROW row; /* point to buffer[0] */
- mm_util_debug("Enter");
+ mm_util_fenter();
if (!pFileName) {
mm_util_error("pFileName");
jpeg_destroy_decompress(&dinfo);
MMUTIL_SAFE_FREE(decoded_data->data);
fclose(infile);
- mm_util_debug("fclose");
+ mm_util_fleave();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
jpeg_destroy_decompress(&dinfo);
fclose(infile);
- mm_util_debug("fclose");
+
+ mm_util_fleave();
return iErrorCode;
}
JSAMPROW image, u_image, v_image;
JSAMPROW row; /* point to buffer[0] */
- mm_util_debug("Enter");
+ mm_util_fenter();
if (src == NULL) {
mm_util_error("[infile] Exit on error");
jpeg_destroy_decompress(&dinfo);
mm_util_debug("jpeg_destroy_decompress");
- mm_util_debug("fclose");
+ mm_util_fleave();
return iErrorCode;
}
{
int ret = MM_UTIL_ERROR_NONE;
- TTRACE_BEGIN("MM_UTILITY:JPEG:ENCODE_TO_FILE");
+ mm_util_fenter();
if (!filename || !src) {
mm_util_error("#ERROR# filename || src buffer is NULL");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((width <= 0) || (height <= 0)) {
- mm_util_error("#ERROR# src_width || src_height value ");
- TTRACE_END();
+ mm_util_error("#ERROR# src_width [%d] || src_height value [%d]", width, height);
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
- mm_util_error("#ERROR# fmt value");
- TTRACE_END();
+ mm_util_error("#ERROR# fmt value [%d]", fmt);
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((quality < 1) || (quality > 100)) {
- mm_util_error("#ERROR# quality vaule");
- TTRACE_END();
+ mm_util_error("#ERROR# quality vaule [%d]", quality);
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
#if LIBJPEG_TURBO
mm_util_debug("#START# LIBJPEG_TURBO");
ret = __mm_image_encode_to_jpeg_file_with_libjpeg_turbo(filename, src, width, height, fmt, quality);
- mm_util_debug("#End# libjpeg, Success!! ret: %d", ret);
-
#else
mm_util_debug("#START# LIBJPEG");
if (fmt == MM_UTIL_JPEG_FMT_NV12) {
ret = __mm_image_encode_to_jpeg_file_with_libjpeg(filename, dst, width, height, MM_UTIL_JPEG_FMT_YUV420, quality);
MMUTIL_SAFE_FREE(dst);
} else {
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
} else if (fmt == MM_UTIL_JPEG_FMT_NV21) {
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
} else {
ret = __mm_image_encode_to_jpeg_file_with_libjpeg(filename, src, width, height, fmt, quality);
}
- mm_util_debug("#END# libjpeg, Success!! ret: %d", ret);
#endif
- TTRACE_END();
+
+ mm_util_debug("#End# libjpeg, Success!! ret: %d", ret);
+
return ret;
}
{
int ret = MM_UTIL_ERROR_NONE;
- TTRACE_BEGIN("MM_UTILITY:JPEG:ENCODE_TO_MEMORY");
+ mm_util_fenter();
if (!mem || !size || !src) {
mm_util_error("#ERROR# filename ||size || src buffer is NULL");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((width <= 0) || (height <= 0)) {
- mm_util_error("#ERROR# src_width || src_height value ");
- TTRACE_END();
+ mm_util_error("#ERROR# src_width [%d] || src_height value [%d]", width, height);
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
- mm_util_error("#ERROR# fmt value");
- TTRACE_END();
+ mm_util_error("#ERROR# fmt value [%d]", fmt);
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((quality < 1) || (quality > 100)) {
- mm_util_error("#ERROR# quality vaule");
- TTRACE_END();
+ mm_util_error("#ERROR# quality vaule [%d]", quality);
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
- #if LIBJPEG_TURBO
+#if LIBJPEG_TURBO
mm_util_debug("#START# libjpeg-turbo");
ret = __mm_image_encode_to_jpeg_memory_with_libjpeg_turbo(mem, size, src, width, height, fmt, quality);
- mm_util_debug("#END# libjpeg-turbo, Success!! ret: %d", ret);
- #else /* LIBJPEG_TURBO */
+#else /* LIBJPEG_TURBO */
mm_util_debug("#START# libjpeg");
if (fmt == MM_UTIL_JPEG_FMT_NV12) {
unsigned int dst_size = 0;
ret = __mm_image_encode_to_jpeg_memory_with_libjpeg(mem, size, dst, width, height, MM_UTIL_JPEG_FMT_YUV420, quality);
MMUTIL_SAFE_FREE(dst);
} else {
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
} else if (fmt == MM_UTIL_JPEG_FMT_NV21) {
- TTRACE_END();
return MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
} else {
ret = __mm_image_encode_to_jpeg_memory_with_libjpeg(mem, size, src, width, height, fmt, quality);
#endif /* LIBJPEG_TURBO */
mm_util_debug("#END# libjpeg, Success!! ret: %d", ret);
- TTRACE_END();
return ret;
}
{
int ret = MM_UTIL_ERROR_NONE;
- TTRACE_BEGIN("MM_UTILITY:JPEG:DECODE_FROM_JPEG_FILE");
+ mm_util_fenter();
if (!decoded || !filename) {
mm_util_error("#ERROR# decoded || filename buffer is NULL");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
- mm_util_error("#ERROR# fmt value");
- TTRACE_END();
+ mm_util_error("#ERROR# fmt value [%d]", fmt);
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
} else {
mm_util_error("[infile] file open [%s]", filename);
mm_util_stderror("file open failed");
- TTRACE_END();
return MM_UTIL_ERROR_NO_SUCH_FILE;
}
if (magic[0] == 0xff && magic[1] == 0xd8) {
- #if LIBJPEG_TURBO
+#if LIBJPEG_TURBO
mm_util_debug("#START# LIBJPEG_TURBO");
ret = __mm_image_decode_from_jpeg_file_with_libjpeg_turbo(decoded, filename, fmt);
- mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u", decoded->data, decoded->width, decoded->height, decoded->size);
- mm_util_debug("#End# LIBJPEG_TURBO, Success!! ret: %d", ret);
- #else
+#else
mm_util_debug("#START# libjpeg");
if (fmt == MM_UTIL_JPEG_FMT_NV12) {
unsigned int dst_size = 0;
if (decoded->data == NULL) {
mm_util_debug("memory allocation failed");
MMUTIL_SAFE_FREE(dst);
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
memcpy(decoded->data, dst, dst_size);
MMUTIL_SAFE_FREE(dst);
} else {
mm_util_debug("memory allocation failed");
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
}
} else {
ret = __mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, fmt, MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1);
}
-
- mm_util_debug("decoded->data: %p\t width: %d\t height:%d\t size: %u", decoded->data, decoded->width, decoded->height, decoded->size);
+#endif
+ mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u", decoded->data, decoded->width, decoded->height, decoded->size);
mm_util_debug("#End# libjpeg, Success!! ret: %d", ret);
- #endif
} else if (magic[0] == 0x47 && magic[1] == 0x49) {
mm_util_error("Not JPEG IMAGE - GIF");
ret = MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
ret = MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
- TTRACE_END();
+ mm_util_fleave();
+
return ret;
}
{
int ret = MM_UTIL_ERROR_NONE;
- TTRACE_BEGIN("MM_UTILITY:JPEG:DECODE_FROM_JPEG_MEMORY");
+ mm_util_fenter();
if (!decoded || !src) {
mm_util_error("#ERROR# decoded || src buffer is NULL");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
- mm_util_error("#ERROR# fmt value");
- TTRACE_END();
+ mm_util_error("#ERROR# fmt value [%d]", fmt);
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
- #if LIBJPEG_TURBO
+#if LIBJPEG_TURBO
mm_util_debug("#START# libjpeg");
ret = __mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(decoded, src, size, fmt);
-
- mm_util_debug("decoded->data: %p\t width: %d\t height: %u\t size: %u", decoded->data, decoded->width, decoded->height, decoded->size);
- mm_util_debug("#END# libjpeg, Success!! ret: %d", ret);
-
- #else
+#else
mm_util_debug("#START# libjpeg");
if (fmt == MM_UTIL_JPEG_FMT_NV12) {
unsigned int dst_size = 0;
if (decoded->data == NULL) {
mm_util_debug("memory allocation failed");
MMUTIL_SAFE_FREE(dst);
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
memcpy(decoded->data, dst, dst_size);
MMUTIL_SAFE_FREE(dst);
} else {
mm_util_debug("memory allocation failed");
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
}
} else {
ret = __mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, fmt, MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1);
}
-
+#endif
mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u", decoded->data, decoded->width, decoded->height, decoded->size);
mm_util_debug("#END# libjpeg, Success!! ret: %d", ret);
- #endif
- TTRACE_END();
return ret;
}
{
int ret = MM_UTIL_ERROR_NONE;
- TTRACE_BEGIN("MM_UTILITY:JPEG:DECODE_FROM_JPEG_FILE_WITH_DOWNSCALE");
+ mm_util_fenter();
if (!decoded || !filename) {
mm_util_error("#ERROR# decoded || filename buffer is NULL");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
- mm_util_error("#ERROR# fmt value");
- TTRACE_END();
+ mm_util_error("#ERROR# fmt value [%d]", fmt);
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1) && (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_2)
&& (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_4) && (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_8)) {
- mm_util_error("#ERROR# fmt value");
- TTRACE_END();
+ mm_util_error("#ERROR# downscale value [%d]", downscale);
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
} else {
mm_util_error("[infile] file open [%s]", filename);
mm_util_stderror("file open failed");
- TTRACE_END();
return MM_UTIL_ERROR_NO_SUCH_FILE;
}
if (magic[0] == 0xff && magic[1] == 0xd8) {
- #if LIBJPEG_TURBO
+#if LIBJPEG_TURBO
mm_util_debug("#START# LIBJPEG_TURBO");
ret = __mm_image_decode_from_jpeg_file_with_libjpeg_turbo(decoded, filename, fmt);
- mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u", decoded->data, decoded->width, decoded->height, decoded->size);
- mm_util_debug("#End# LIBJPEG_TURBO, Success!! ret: %d", ret);
- #else
+#else
mm_util_debug("#START# libjpeg");
if (fmt == MM_UTIL_JPEG_FMT_NV12) {
unsigned int dst_size = 0;
if (decoded->data == NULL) {
mm_util_debug("memory allocation failed");
MMUTIL_SAFE_FREE(dst);
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
memcpy(decoded->data, dst, dst_size);
MMUTIL_SAFE_FREE(dst);
} else {
mm_util_debug("memory allocation failed");
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
}
ret = __mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, fmt, downscale);
}
- mm_util_debug("decoded->data: %p\t width: %d\t height:%d\t size: %u", decoded->data, decoded->width, decoded->height, decoded->size);
+#endif
+ mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u", decoded->data, decoded->width, decoded->height, decoded->size);
mm_util_debug("#End# libjpeg, Success!! ret: %d", ret);
- #endif
} else if (magic[0] == 0x47 && magic[1] == 0x49) {
mm_util_error("Not JPEG IMAGE - GIF");
ret = MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
ret = MM_UTIL_ERROR_NOT_SUPPORTED_FORMAT;
}
- TTRACE_END();
+ mm_util_fleave();
return ret;
}
{
int ret = MM_UTIL_ERROR_NONE;
- TTRACE_BEGIN("MM_UTILITY:JPEG:DECODE_FROM_JPEG_MEMORY_WITH_DOWNSCALE");
+ mm_util_fenter();
if (!decoded || !src) {
mm_util_error("#ERROR# decoded || src buffer is NULL");
- TTRACE_END();
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888)) {
- mm_util_error("#ERROR# fmt value");
- TTRACE_END();
+ mm_util_error("#ERROR# fmt value [%d]", fmt);
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
if ((downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1) && (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_2)
&& (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_4) && (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_8)) {
- mm_util_error("#ERROR# fmt value");
- TTRACE_END();
+ mm_util_error("#ERROR# downscale value [%d]", downscale);
return MM_UTIL_ERROR_INVALID_PARAMETER;
}
- #if LIBJPEG_TURBO
+#if LIBJPEG_TURBO
mm_util_debug("#START# libjpeg");
ret = __mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(decoded, src, size, fmt);
-
- mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u", decoded->data, decoded->width, decoded->height, decoded->size);
- mm_util_debug("#END# libjpeg, Success!! ret: %d", ret);
-
- #else
+#else
mm_util_debug("#START# libjpeg");
if (fmt == MM_UTIL_JPEG_FMT_NV12) {
unsigned int dst_size = 0;
if (decoded->data == NULL) {
mm_util_debug("memory allocation failed");
MMUTIL_SAFE_FREE(dst);
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
memcpy(decoded->data, dst, dst_size);
MMUTIL_SAFE_FREE(dst);
} else {
mm_util_debug("memory allocation failed");
- TTRACE_END();
return MM_UTIL_ERROR_OUT_OF_MEMORY;
}
}
} else {
ret = __mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, fmt, downscale);
}
+#endif
mm_util_debug("decoded->data: %p\t width: %d\t height: %d\t size: %u", decoded->data, decoded->width, decoded->height, decoded->size);
mm_util_debug("#END# libjpeg, Success!! ret: %d", ret);
- #endif
- TTRACE_END();
return ret;
}
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(capi-media-tool)
BuildRequires: pkgconfig(opencv)
-BuildRequires: pkgconfig(ttrace)
BuildRequires: libpng-devel
BuildRequires: giflib-devel
BuildRequires: libbmp-devel
-I/usr/include \
$(srcdir)/../imgp/libmmutil_imgp.la
-libmmutil_png_la_LIBADD = $(GLIB_LIBS) -lpng -ldl -lttrace\
+libmmutil_png_la_LIBADD = $(GLIB_LIBS) -lpng -ldl \
$(GMODULE_LIBS) \
$(MEDIA_LIBS)