See the License for the specific language governing permissions and\r
limitations under the License.\r
\r
+*******************************************************************************\r
+** License\r
+*******************************************************************************\r
+\r
+Most of libjpeg-turbo inherits the non-restrictive, BSD-style license used by\r
+libjpeg (see README.) The TurboJPEG/OSS wrapper (both C and Java versions) and\r
+associated test programs bear a similar license, which is reproduced below:\r
+\r
+Redistribution and use in source and binary forms, with or without\r
+modification, are permitted provided that the following conditions are met:\r
+\r
+- Redistributions of source code must retain the above copyright notice,\r
+ this list of conditions and the following disclaimer.\r
+- Redistributions in binary form must reproduce the above copyright notice,\r
+ this list of conditions and the following disclaimer in the documentation\r
+ and/or other materials provided with the distribution.\r
+- Neither the name of the libjpeg-turbo Project nor the names of its\r
+ contributors may be used to endorse or promote products derived from this\r
+ software without specific prior written permission.\r
+\r
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",\r
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE\r
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+POSSIBILITY OF SUCH DAMAGE.\r
+++ /dev/null
-#./_export_env.sh # setting environment variables
-#!/bin/sh
-export ARCH=target
-export TET_INSTALL_PATH=/scratchbox/TETware/
-export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
-export PATH=$TET_TARGET_PATH/bin:$PATH
-export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
-
-export TET_ROOT=$TET_TARGET_PATH
-
-set $(pwd)
-export TET_SUITE_ROOT=$1
-
-set $(date +%s)
-FILE_NAME_EXTENSION=$1
-
-echo PATH=$PATH
-echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
-echo TET_ROOT=$TET_ROOT
-echo TET_SUITE_ROOT=$TET_SUITE_ROOT
-echo ARCH=$ARCH
-
-RESULT_DIR=results-$ARCH
-HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
-JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
-
-mkdir $RESULT_DIR
-
-tcc -c -p ./ # executing tcc, with clean option (-c)
-tcc -b -j $JOURNAL_RESULT -p ./ # executing tcc to build test cases (-b)
-grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT # reporting the result
-
+++ /dev/null
-#!/bin/sh
-
-export ARCH=target
-
-export TET_INSTALL_PATH=/mnt/nfs/TETware # path to mount
-export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
-export PATH=$TET_TARGET_PATH/bin:$PATH
-export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
-
-export TET_ROOT=$TET_TARGET_PATH
-
-set $(pwd)
-export TET_SUITE_ROOT=$1
-
-set $(date +%s)
-FILE_NAME_EXTENSION=$1
-
-echo PATH=$PATH
-echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
-echo TET_ROOT=$TET_ROOT
-echo TET_SUITE_ROOT=$TET_SUITE_ROOT
-echo ARCH=$ARCH
-
-RESULT_DIR=results-$ARCH
-HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
-JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
-
-mkdir $RESULT_DIR
-
-tcc -e -j $JOURNAL_RESULT -p ./
-grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT # reporting the result
-
+++ /dev/null
-#!/usr/bin/python
-
-#############################################
-# tet_scen auto generator
-#
-# ** argv[1] = TC root
-#############################################
-
-import sys,string,os
-
-
-write_file = open("tet_scen", 'w')
-
-#
-# making new tet_scen
-#
-def making_tet_scen (filename):
- #tmp_list = filename.strip().split('/')
- n_filename = filename.replace(' ', '\\ ')
- #print n_filename
- #new_path = "/"+ sys.argv[1] +"/"+n_filename[2:-6]
- new_path = "/"+n_filename[:-6]
- #print new_path
- file = open(filename, 'r')
- lines = file.readlines()
- for line in lines:
- if len(line.strip()) > 1:
- list = line.strip().split('/')
- #print new_path + list[-1]
- write_file.write("\t"+new_path+list[-1]+"\n")
-
-#
-# usage()
-#
-def usage():
- print(" ")
- print("./making_new_tet_scen.py tc_root")
- print("Put the Test Case's root directory.")
- print("Do not include '/' at the end")
- print(" ")
-
-#
-# main()
-#
-def main():
- if len(sys.argv) < 2:
- usage()
- sys.exit(0)
-
- os.system('find '+ sys.argv[1] +' -name "tslist" > tslist.txt')
-
- #write_file = open("tetscen", w)
- write_file.write("# auto generated tet_scen\n")
- write_file.write("all\n")
- write_file.write("\t\"Starting Full Test Suite\"\n")
-
- for file in open("tslist.txt", 'r'):
- #print file.strip()
- making_tet_scen(file.strip())
-
- write_file.write("\t\"Completed Full Test Suite\"\n")
- write_file.write("# EOF\n")
- write_file.close()
- print(" ")
- print("==============================")
- print("New tet_scen file is made~~~~")
- print("==============================")
- print(" ")
-main()
+++ /dev/null
-# auto generated tet_scen
-all
- "Starting Full Test Suite"
- /utc/utc_mm_util_convert_colorspace_func
- /utc/utc_mm_util_resize_image_func
- /utc/utc_mm_util_rotate_image_func
- /utc/utc_mm_util_jpeg_encode_to_file_func
- /utc/utc_mm_util_jpeg_encode_to_memory_func
- /utc/utc_mm_util_decode_from_jpeg_file_func
- /utc/utc_mm_util_decode_from_jpeg_memory_func
- "Completed Full Test Suite"
-# EOF
+++ /dev/null
-TET_OUTPUT_CAPTURE=True # capture option for build operation checking
-TET_BUILD_TOOL=make # build with using make command
-TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
-TET_API_COMPLIANT=True # use TET API in Test Case ?
-TET_PASS_TC_NAME=True # report passed TC name in Journal file?
-
-
+++ /dev/null
-TET_OUTPUT_CAPTURE=True # capture option
-TET_CLEAN_TOOL= make clean # clean tool
-TET_CLEAN_FILE= Makefile # file for clean
-TET_API_COMPLIANT=True # TET API useage
-TET_PASS_TC_NAME=True # showing name , passed TC
-
+++ /dev/null
-TET_OUTPUT_CAPTURE=True # capturing execution or not
-TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional
-TET_EXEC_FILE= # ex) exectool : execution file/ Optional
-TET_API_COMPLIANT=True # Test case or Tool usesTET API?
-TET_PASS_TC_NAME=True # showing Passed TC name ?
-
+++ /dev/null
-utc/tslist
+++ /dev/null
-ifeq ($(ARCH),target)\r
- PKG_CONFIG_PATH=/usr/lib/pkgconfig\r
- export PKG_CONFIG_PATH\r
- CC=arm-linux-gcc -Wall\r
- CXX=arm-linux-g++ -Wall\r
-else\r
- PKG_CONFIG_PATH=/usr/lib/pkgconfig\r
- export PKG_CONFIG_PATH\r
- CC=gcc -Wall\r
- CXX=gcc -Wall\r
-endif\r
-\r
-TS1=utc_mm_util_convert_colorspace_func\r
-TS2=utc_mm_util_decode_from_jpeg_file_func\r
-TS3=utc_mm_util_decode_from_jpeg_memory_func\r
-TS4=utc_mm_util_get_image_size_func\r
-TS5=utc_mm_util_jpeg_encode_to_file_func\r
-TS6=utc_mm_util_jpeg_encode_to_memory_func\r
-TS7=utc_mm_util_resize_image_func\r
-TS8=utc_mm_util_rotate_image_func\r
-\r
-LIBS = `pkg-config --libs mmutil-imgp mmutil-jpeg glib-2.0` \r
-LIBS +=-L/usr/lib/:/usr/lib/pkgconfig\r
-LIBS +=$(TET_ROOT)/lib/tet3/tcm_s.o\r
-LIBS +=-L$(TET_ROOT)/lib/tet3 -ltcm_s\r
-LIBS +=-L$(TET_ROOT)/lib/tet3/ -lapi_s\r
-\r
-INCS = -I. `pkg-config --cflags mmutil-imgp mmutil-jpeg glib-2.0`\r
-INCS += -I$(TET_ROOT)/inc/tet3\r
-INCS += -I/usr/include/mmf\r
-\r
-CFLAGS = $(INCS) \r
-CC += $(CFLAGS)\r
-LDFLAGS = $(LIBS)\r
-\r
-all : $(TS1) $(TS2) $(TS3) $(TS4) $(TS5) $(TS6) $(TS7) $(TS8)\r
-\r
-$(TS1): $(TS1).c\r
- $(CC) -o $(TS1) $(TS1).c $(LDFLAGS)\r
-\r
-$(TS2): $(TS2).c\r
- $(CC) -o $(TS2) $(TS2).c $(LDFLAGS)\r
- \r
-$(TS3): $(TS3).c\r
- $(CC) -o $(TS3) $(TS3).c $(LDFLAGS)\r
-\r
-$(TS4): $(TS4).c\r
- $(CC) -o $(TS4) $(TS4).c $(LDFLAGS)\r
-\r
-$(TS5): $(TS5).c\r
- $(CC) -o $(TS5) $(TS5).c $(LDFLAGS)\r
- \r
-$(TS6): $(TS6).c\r
- $(CC) -o $(TS6) $(TS6).c $(LDFLAGS)\r
-\r
-$(TS7): $(TS7).c\r
- $(CC) -o $(TS7) $(TS7).c $(LDFLAGS)\r
-\r
-$(TS8): $(TS8).c\r
- $(CC) -o $(TS8) $(TS8).c $(LDFLAGS)\r
-\r
-clean:\r
- rm -rf *~ *.o $(TS1) $(TS2) $(TS3) $(TS4) $(TS5) $(TS6) $(TS7) $(TS8)\r
- \r
-\r
-\r
+++ /dev/null
-./utc_mm_util_convert_colorspace_func
-./utc_mm_util_resize_image_func
-./utc_mm_util_rotate_image_func
-./utc_mm_util_jpeg_encode_to_file_func
-./utc_mm_util_jpeg_encode_to_memory_func
-./utc_mm_util_decode_from_jpeg_file_func
-./utc_mm_util_decode_from_jpeg_memory_func
+++ /dev/null
-/*
- * libmm-utility\r
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
- *
- * Contact: YoungHun Kim <yh8004.kim@samsung.com>
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- */\r
-\r
-\r
-#ifndef UTS_MM_FRAMEWORK_UTIL_COMMON_H\r
-#define UTS_MM_FRAMEWORK_UTIL_COMMON_H\r
-\r
-#include <mm_util_imgp.h>\r
-#include <mm_util_jpeg.h>\r
-#include <mm_message.h>\r
-#include <mm_error.h>\r
-#include <mm_types.h>\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <tet_api.h>\r
-#include <unistd.h>\r
-#include <glib-2.0/glib.h>\r
-\r
-void startup();\r
-void cleanup();\r
-\r
-void (*tet_startup)() = startup;\r
-void (*tet_cleanup)() = cleanup;\r
-\r
-\r
-\r
-/* Audio File Define */\r
-#define JPG_IMAGE_FILE "test_data/test.jpg"\r
-#define YUV_IMAGE_FILE "test_data/test.yuv"\r
-\r
-\r
-void utc_mm_util_get_image_size_func_01 ();\r
-void utc_mm_util_get_image_size_func_02 ();\r
-void utc_mm_util_get_image_size_func_03 ();\r
-void utc_mm_util_get_image_size_func_04 ();\r
-void utc_mm_util_get_image_size_func_05 ();\r
-void utc_mm_util_get_image_size_func_06 ();\r
-\r
-void utc_mm_util_convert_colorspace_func_01 ();\r
-void utc_mm_util_convert_colorspace_func_02 ();\r
-void utc_mm_util_convert_colorspace_func_03 ();\r
-void utc_mm_util_convert_colorspace_func_04 ();\r
-void utc_mm_util_convert_colorspace_func_05 ();\r
-void utc_mm_util_convert_colorspace_func_06 ();\r
-void utc_mm_util_convert_colorspace_func_07 ();\r
-void utc_mm_util_convert_colorspace_func_08 ();\r
-void utc_mm_util_convert_colorspace_func_09 ();\r
-\r
-void utc_mm_util_resize_image_func_01 ();\r
-void utc_mm_util_resize_image_func_02 ();\r
-void utc_mm_util_resize_image_func_03 ();\r
-void utc_mm_util_resize_image_func_04 ();\r
-void utc_mm_util_resize_image_func_05 ();\r
-void utc_mm_util_resize_image_func_06 ();\r
-void utc_mm_util_resize_image_func_07 ();\r
-void utc_mm_util_resize_image_func_08 ();\r
-void utc_mm_util_resize_image_func_09 ();\r
-\r
-void utc_mm_util_rotate_image_func_01 ();\r
-void utc_mm_util_rotate_image_func_02 ();\r
-void utc_mm_util_rotate_image_func_03 ();\r
-void utc_mm_util_rotate_image_func_04 ();\r
-void utc_mm_util_rotate_image_func_05 ();\r
-void utc_mm_util_rotate_image_func_06 ();\r
-void utc_mm_util_rotate_image_func_07 ();\r
-void utc_mm_util_rotate_image_func_08 ();\r
-void utc_mm_util_rotate_image_func_09 ();\r
-void utc_mm_util_rotate_image_func_10 ();\r
-void utc_mm_util_rotate_image_func_11 ();\r
-\r
-void utc_mm_util_jpeg_encode_to_file_func_01 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_02 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_03 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_04 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_05 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_06 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_07 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_08 ();\r
-void utc_mm_util_jpeg_encode_to_file_func_09 ();\r
-\r
-void utc_mm_util_jpeg_encode_to_memory_func_01 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_02 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_03 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_04 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_05 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_06 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_07 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_08 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_09 ();\r
-void utc_mm_util_jpeg_encode_to_memory_func_10 ();\r
-\r
-void utc_mm_util_decode_from_jpeg_file_func_01 ();\r
-void utc_mm_util_decode_from_jpeg_file_func_02 ();\r
-void utc_mm_util_decode_from_jpeg_file_func_03 ();\r
-void utc_mm_util_decode_from_jpeg_file_func_04 ();\r
-void utc_mm_util_decode_from_jpeg_file_func_05 ();\r
-\r
-void utc_mm_util_decode_from_jpeg_memory_func_01 ();\r
-void utc_mm_util_decode_from_jpeg_memory_func_02 ();\r
-void utc_mm_util_decode_from_jpeg_memory_func_03 ();\r
-void utc_mm_util_decode_from_jpeg_memory_func_04 ();\r
-void utc_mm_util_decode_from_jpeg_memory_func_05 ();\r
-void utc_mm_util_decode_from_jpeg_memory_func_06 ();\r
-\r
-\r
-#endif /* UTS_MM_FRAMEWORK_UTIL_COMMON_H */\r
+++ /dev/null
-/*
- * libmm-utility
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: YoungHun Kim <yh8004.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/**
-* @ingroup MMF_UTIL_API
-* @addtogroup UTIL
-*/
-
-/**
-* @ingroup UTIL
-* @addtogroup UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup UTS_MMF_UTIL Unit
-* @addtogroup UTS_MMF_UTIL_CONVERT_COLORSPACE Uts_Mmf_Util_Convert_Colorspace
-* @{
-*/
-
-/**
-* @file uts_mm_util_convert_colorspace.c
-* @brief This is a suit of unit test cases to test mm_util_convert_colorspace API
-* @version Initial Creation Version 0.1
-* @date 2010.06.08
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
- {utc_mm_util_convert_colorspace_func_01 , 1},
- {utc_mm_util_convert_colorspace_func_02 , 2},
- {utc_mm_util_convert_colorspace_func_03 , 3},
- {utc_mm_util_convert_colorspace_func_04 , 4},
- {utc_mm_util_convert_colorspace_func_05 , 5},
- {utc_mm_util_convert_colorspace_func_06 , 6},
- {utc_mm_util_convert_colorspace_func_07 , 7},
- {utc_mm_util_convert_colorspace_func_08 , 8},
- {utc_mm_util_convert_colorspace_func_09 , 9},
- {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
- tet_infoline("[[ COMMON ]]::Inside startup \n");
-
- tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_convert_colorspace_func_01()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_convert_colorspace(src, src_width, src_height, src_format,dst, dst_format);
-
- dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_02()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_convert_colorspace(NULL, src_width, src_height, src_format,dst, dst_format);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_03()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_convert_colorspace(src, -1, src_height, src_format,dst, dst_format);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_04()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_convert_colorspace(src, src_width, -1, src_format,dst, dst_format);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_05()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_convert_colorspace(src, src_width, src_height, -1,dst, dst_format);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_06()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_convert_colorspace(src, src_width, src_height, 20,dst, dst_format);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_07()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_convert_colorspace(src, src_width, src_height, src_format,NULL, dst_format);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_08()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_convert_colorspace(src, src_width, src_height, src_format,dst, -1);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_convert_colorspace_func_09()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_format dst_format = MM_UTIL_IMG_FMT_RGB888;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Convert colorspace of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(dst_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_convert_colorspace(src, src_width, src_height, src_format,dst, 20);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-
-/** @} */
-
-
-
-
+++ /dev/null
-/*
- * libmm-utility
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: YoungHun Kim <yh8004.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/**
-* @ingroup MMF_UTIL_API
-* @addtogroup UTIL
-*/
-
-/**
-* @ingroup UTIL
-* @addtogroup UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup UTS_MMF_UTIL Unit
-* @addtogroup UTS_MMF_UTIL_DECODE_FROM_JPEG_FILE Uts_Mmf_Util_Decode_From_Jpeg_File
-* @{
-*/
-
-/**
-* @file uts_mm_util_decode_from_jpeg_file.c
-* @brief This is a suit of unit test cases to test mm_util_decode_from_jpeg_file API
-* @version Initial Creation Version 0.1
-* @date 2010.07.21
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
- {utc_mm_util_decode_from_jpeg_file_func_01 , 1},
- {utc_mm_util_decode_from_jpeg_file_func_02 , 2},
- {utc_mm_util_decode_from_jpeg_file_func_03 , 3},
- {utc_mm_util_decode_from_jpeg_file_func_04 , 4},
- {utc_mm_util_decode_from_jpeg_file_func_05 , 5},
- {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
- tet_infoline("[[ COMMON ]]::Inside startup \n");
-
- tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_decode_from_jpeg_file_func_01()
-{
- int ret = 0;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- mm_util_jpeg_yuv_data decoded;
-
- tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG file" );
-
- ret = mm_util_decode_from_jpeg_file(&decoded, JPG_IMAGE_FILE, src_format);
-
- dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_file_func_02()
-{
- int ret = 0;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- //mm_util_jpeg_yuv_data decoded;
-
- tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG file" );
-
- ret = mm_util_decode_from_jpeg_file(NULL, JPG_IMAGE_FILE, src_format);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_file_func_03()
-{
- int ret = 0;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- mm_util_jpeg_yuv_data decoded;
-
- tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG file" );
-
- ret = mm_util_decode_from_jpeg_file(&decoded, NULL, src_format);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_file_func_04()
-{
- int ret = 0;
- //mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- mm_util_jpeg_yuv_data decoded;
-
- tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG file" );
-
- ret = mm_util_decode_from_jpeg_file(&decoded, JPG_IMAGE_FILE, -1);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_file_func_05()
-{
- int ret = 0;
- //mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- mm_util_jpeg_yuv_data decoded;
-
- tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG file" );
-
- ret = mm_util_decode_from_jpeg_file(&decoded, JPG_IMAGE_FILE, 100);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- return;
-}
-
-
-/** @} */
-
-
-
-
+++ /dev/null
-/*
- * libmm-utility
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: YoungHun Kim <yh8004.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/**
-* @ingroup MMF_UTIL_API
-* @addtogroup UTIL
-*/
-
-/**
-* @ingroup UTIL
-* @addtogroup UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup UTS_MMF_UTIL Unit
-* @addtogroup UTS_MMF_UTIL_DECODE_FROM_JPEG_MEMORY Uts_Mmf_Util_Decode_From_Jpeg_Memory
-* @{
-*/
-
-/**
-* @file uts_mm_util_decode_from_jpeg_memory.c
-* @brief This is a suit of unit test cases to test mm_util_decode_from_jpeg_memory API
-* @version Initial Creation Version 0.1
-* @date 2010.07.21
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
- {utc_mm_util_decode_from_jpeg_memory_func_01 , 1},
- {utc_mm_util_decode_from_jpeg_memory_func_02 , 2},
- {utc_mm_util_decode_from_jpeg_memory_func_03 , 3},
- {utc_mm_util_decode_from_jpeg_memory_func_04 , 4},
- {utc_mm_util_decode_from_jpeg_memory_func_05 , 5},
- {utc_mm_util_decode_from_jpeg_memory_func_06 , 6},
- {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
- tet_infoline("[[ COMMON ]]::Inside startup \n");
-
- tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_decode_from_jpeg_memory_func_01()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 50;
- unsigned int src_height = 50;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- mm_util_jpeg_yuv_data decoded;
-
- FILE *fp = fopen(JPG_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG buffer" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_decode_from_jpeg_memory(&decoded, src, src_size, src_format);
-
- dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_memory_func_02()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 50;
- unsigned int src_height = 50;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- //mm_util_jpeg_yuv_data decoded;
-
- FILE *fp = fopen(JPG_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG buffer" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_decode_from_jpeg_memory(NULL, src, src_size, src_format);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_memory_func_03()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 50;
- unsigned int src_height = 50;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- mm_util_jpeg_yuv_data decoded;
-
- FILE *fp = fopen(JPG_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG buffer" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_decode_from_jpeg_memory(&decoded, NULL, src_size, src_format);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_memory_func_04()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 50;
- unsigned int src_height = 50;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- mm_util_jpeg_yuv_data decoded;
-
- FILE *fp = fopen(JPG_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG buffer" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_decode_from_jpeg_memory(&decoded, src, -1, src_format);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_memory_func_05()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 50;
- unsigned int src_height = 50;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- mm_util_jpeg_yuv_data decoded;
-
- FILE *fp = fopen(JPG_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG buffer" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_decode_from_jpeg_memory(&decoded, src, src_size, -1);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_decode_from_jpeg_memory_func_06()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 50;
- unsigned int src_height = 50;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- mm_util_jpeg_yuv_data decoded;
-
- FILE *fp = fopen(JPG_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Extract YUV data from JPEG buffer" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_decode_from_jpeg_memory(&decoded, src, src_size, 100);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-/** @} */
-
-
-
-
+++ /dev/null
-/*
- * libmm-utility
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: YoungHun Kim <yh8004.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/**
-* @ingroup MMF_UTIL_API
-* @addtogroup UTIL
-*/
-
-/**
-* @ingroup UTIL
-* @addtogroup UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup UTS_MMF_UTIL Unit
-* @addtogroup UTS_MMF_UTIL_GET_IMAGE_SIZE Uts_Mmf_Util_Get_Image_Size
-* @{
-*/
-
-/**
-* @file uts_mm_util_get_image_size.c
-* @brief This is a suit of unit test cases to test mm_util_get_image_size API
-* @version Initial Creation Version 0.1
-* @date 2010.06.08
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
- {utc_mm_util_get_image_size_func_01 , 1},
- {utc_mm_util_get_image_size_func_02 , 2},
- {utc_mm_util_get_image_size_func_03 , 3},
- {utc_mm_util_get_image_size_func_04 , 4},
- {utc_mm_util_get_image_size_func_05 , 5},
- {utc_mm_util_get_image_size_func_06 , 6},
- {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
- tet_infoline("[[ COMMON ]]::Inside startup \n");
-
- tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_get_image_size_func_01()
-{
- int ret = 0;
- mm_util_img_format format = MM_UTIL_IMG_FMT_YUV420;
- unsigned int width = 50;
- unsigned int height = 50;
- unsigned int size;
-
- tet_infoline( "[[ TET_MSG ]]:: Get size of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(format, width, height, &size);
-
- dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- return;
-}
-
-
-void utc_mm_util_get_image_size_func_02()
-{
- int ret = 0;
- mm_util_img_format format = -1;
- unsigned int width = 50;
- unsigned int height = 50;
- unsigned int size;
-
- tet_infoline( "[[ TET_MSG ]]:: Get size of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(format, width, height, &size);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- return;
-}
-
-
-void utc_mm_util_get_image_size_func_03()
-{
- int ret = 0;
- mm_util_img_format format = 20;
- unsigned int width = 50;
- unsigned int height = 50;
- unsigned int size;
-
- tet_infoline( "[[ TET_MSG ]]:: Get size of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(format, width, height, &size);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- return;
-}
-
-
-void utc_mm_util_get_image_size_func_04()
-{
- int ret = 0;
- mm_util_img_format format = MM_UTIL_IMG_FMT_YUV420;
- unsigned int width = -50;
- unsigned int height = 50;
- unsigned int size;
-
- tet_infoline( "[[ TET_MSG ]]:: Get size of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(format, width, height, &size);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- return;
-}
-
-
-void utc_mm_util_get_image_size_func_05()
-{
- int ret = 0;
- mm_util_img_format format = MM_UTIL_IMG_FMT_YUV420;
- unsigned int width = 50;
- unsigned int height = -50;
- unsigned int size;
-
- tet_infoline( "[[ TET_MSG ]]:: Get size of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(format, width, height, &size);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- return;
-}
-
-
-void utc_mm_util_get_image_size_func_06()
-{
- int ret = 0;
- mm_util_img_format format = MM_UTIL_IMG_FMT_YUV420;
- unsigned int width = 50;
- unsigned int height = 50;
- unsigned int size;
-
- tet_infoline( "[[ TET_MSG ]]:: Get size of the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(format, width, height, NULL);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- return;
-}
-
-
-
-/** @} */
-
-
-
-
+++ /dev/null
-/*
- * libmm-utility
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: YoungHun Kim <yh8004.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/**
-* @ingroup MMF_UTIL_API
-* @addtogroup UTIL
-*/
-
-/**
-* @ingroup UTIL
-* @addtogroup UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup UTS_MMF_UTIL Unit
-* @addtogroup UTS_MMF_UTIL_JPEG_ENCODE_TO_FILE Uts_Mmf_Util_Jpeg_Encode_To_File
-* @{
-*/
-
-/**
-* @file uts_mm_util_jpeg_encode_to_file.c
-* @brief This is a suit of unit test cases to test mm_util_jpeg_encode_to_file API
-* @version Initial Creation Version 0.1
-* @date 2010.07.21
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
- {utc_mm_util_jpeg_encode_to_file_func_01 , 1},
- {utc_mm_util_jpeg_encode_to_file_func_02 , 2},
- {utc_mm_util_jpeg_encode_to_file_func_03 , 3},
- {utc_mm_util_jpeg_encode_to_file_func_04 , 4},
- {utc_mm_util_jpeg_encode_to_file_func_05 , 5},
- {utc_mm_util_jpeg_encode_to_file_func_06 , 6},
- {utc_mm_util_jpeg_encode_to_file_func_07 , 7},
- {utc_mm_util_jpeg_encode_to_file_func_08 , 8},
- {utc_mm_util_jpeg_encode_to_file_func_09 , 9},
- {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
- tet_infoline("[[ COMMON ]]::Inside startup \n");
-
- tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_jpeg_encode_to_file_func_01()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, src_width, src_height, src_format, quality);
-
- dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_02()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_jpeg_encode_to_file(NULL, src, src_width, src_height, src_format, quality);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_03()
-{
- int ret = 0;
- //unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- //unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
-
- //FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
- /* Get the data of the Image */
- /*ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);*/
-
- ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", NULL, src_width, src_height, src_format, quality);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- /*free(src);
- fclose(fp);*/
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_04()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, -1, src_height, src_format, quality);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_05()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, src_width, -1, src_format, quality);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_06()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, src_width, src_height, -1, quality);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_07()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, src_width, src_height, 100, quality);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_08()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- //int quality = 50;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, src_width, src_height, src_format, -1);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_file_func_09()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- //int quality = 50;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "r");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file to JPEG file" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_jpeg_encode_to_file("EncodedFile.jpg", src, src_width, src_height, src_format, 200);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-
-/** @} */
-
-
-
-
+++ /dev/null
-/*
- * libmm-utility
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: YoungHun Kim <yh8004.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/**
-* @ingroup MMF_UTIL_API
-* @addtogroup UTIL
-*/
-
-/**
-* @ingroup UTIL
-* @addtogroup UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup UTS_MMF_UTIL Unit
-* @addtogroup UTS_MMF_UTIL_JPEG_ENCODE_TO_MEMORY Uts_Mmf_Util_Jpeg_Encode_To_Memory
-* @{
-*/
-
-/**
-* @file uts_mm_util_jpeg_encode_to_memory.c
-* @brief This is a suit of unit test cases to test mm_util_jpeg_encode_to_memory API
-* @version Initial Creation Version 0.1
-* @date 2010.07.21
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
- {utc_mm_util_jpeg_encode_to_memory_func_01 , 1},
- {utc_mm_util_jpeg_encode_to_memory_func_02 , 2},
- {utc_mm_util_jpeg_encode_to_memory_func_03 , 3},
- {utc_mm_util_jpeg_encode_to_memory_func_04 , 4},
- {utc_mm_util_jpeg_encode_to_memory_func_05 , 5},
- {utc_mm_util_jpeg_encode_to_memory_func_06 , 6},
- {utc_mm_util_jpeg_encode_to_memory_func_07 , 7},
- {utc_mm_util_jpeg_encode_to_memory_func_08 , 8},
- {utc_mm_util_jpeg_encode_to_memory_func_09 , 9},
- {utc_mm_util_jpeg_encode_to_memory_func_10 , 10},
- {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
- tet_infoline("[[ COMMON ]]::Inside startup \n");
-
- tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_jpeg_encode_to_memory_func_01()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- int size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
- void* mem;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- mem = malloc(src_size);
- size = (int)src_size;
- ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, src_width, src_height, src_format, quality);
-
- dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_02()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- int size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
- //void* mem;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
- size = (int)src_size;
- //mem = malloc(src_size);
- ret = mm_util_jpeg_encode_to_memory(NULL, &size, src, src_width, src_height, src_format, quality);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_03()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
- void* mem;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- mem = malloc(src_size);
- ret = mm_util_jpeg_encode_to_memory(&mem, NULL, src, src_width, src_height, src_format, quality);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_04()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- int size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
- void* mem;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- mem = malloc(src_size);
- size = (int)src_size;
- ret = mm_util_jpeg_encode_to_memory(&mem, &size, NULL, src_width, src_height, src_format, quality);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_05()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- int size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
- void* mem;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- mem = malloc(src_size);
- size = (int)src_size;
- ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, -1, src_height, src_format, quality);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_06()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- int size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
- void* mem;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- mem = malloc(src_size);
- size = (int)src_size;
- ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, src_width, -1, src_format, quality);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_07()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- int size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
- void* mem;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- mem = malloc(src_size);
- size = (int)src_size;
- ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, src_width, src_height, -1, quality);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_08()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- int size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
- void* mem;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- mem = malloc(src_size);
- size = (int)src_size;
- ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, src_width, src_height, 100, quality);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_09()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- int size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
- void* mem;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- mem = malloc(src_size);
- size = (int)src_size;
- ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, src_width, src_height, src_format, -1);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_jpeg_encode_to_memory_func_10()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- int size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- int quality = 50;
- void* mem;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Encode raw file into memory" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- mem = malloc(src_size);
- size = (int)src_size;
- ret = mm_util_jpeg_encode_to_memory(&mem, &size, src, src_width, src_height, src_format, 200);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
-
- free(src);
- fclose(fp);
- return;
-}
-
-
-
-/** @} */
-
-
-
-
+++ /dev/null
-/*
- * libmm-utility
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: YoungHun Kim <yh8004.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/**
-* @ingroup MMF_UTIL_API
-* @addtogroup UTIL
-*/
-
-/**
-* @ingroup UTIL
-* @addtogroup UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup UTS_MMF_UTIL Unit
-* @addtogroup UTS_MMF_UTIL_RESIZE_IMAGE Uts_Mmf_Util_Resize_Image
-* @{
-*/
-
-/**
-* @file uts_mm_util_resize_image.c
-* @brief This is a suit of unit test cases to test mm_util_resize_image API
-* @version Initial Creation Version 0.1
-* @date 2010.06.08
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
- {utc_mm_util_resize_image_func_01 , 1},
- {utc_mm_util_resize_image_func_02 , 2},
- {utc_mm_util_resize_image_func_03 , 3},
- {utc_mm_util_resize_image_func_04 , 4},
- {utc_mm_util_resize_image_func_05 , 5},
- {utc_mm_util_resize_image_func_06 , 6},
- {utc_mm_util_resize_image_func_07 , 7},
- {utc_mm_util_resize_image_func_08 , 8},
- {utc_mm_util_resize_image_func_09 , 9},
- {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
- tet_infoline("[[ COMMON ]]::Inside startup \n");
-
-
- tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_resize_image_func_01()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 50;
- unsigned int dst_height = 50;
- unsigned int dst_size;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_resize_image(src, src_width, src_height, src_format, dst, &dst_width, &dst_height);
-
- dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_resize_image_func_02()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 50;
- unsigned int dst_height = 50;
- unsigned int dst_size;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_resize_image(NULL, src_width, src_height, src_format, dst, &dst_width, &dst_height);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-
-void utc_mm_util_resize_image_func_03()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 50;
- unsigned int dst_height = 50;
- unsigned int dst_size;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_resize_image(src, -1, src_height, src_format, dst, &dst_width, &dst_height);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-
-void utc_mm_util_resize_image_func_04()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 50;
- unsigned int dst_height = 50;
- unsigned int dst_size;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_resize_image(src, src_width, -1, src_format, dst, &dst_width, &dst_height);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-
-void utc_mm_util_resize_image_func_05()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 50;
- unsigned int dst_height = 50;
- unsigned int dst_size;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_resize_image(src, src_width, src_height, -1, dst, &dst_width, &dst_height);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-
-void utc_mm_util_resize_image_func_06()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 50;
- unsigned int dst_height = 50;
- unsigned int dst_size;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_resize_image(src, src_width, src_height, src_format, NULL, &dst_width, &dst_height);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-
-void utc_mm_util_resize_image_func_07()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 50;
- unsigned int dst_height = 50;
- unsigned int dst_size;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_resize_image(src, src_width, src_height, src_format, dst, NULL, &dst_height);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-
-void utc_mm_util_resize_image_func_08()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 50;
- unsigned int dst_height = 50;
- unsigned int dst_size;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_resize_image(src, src_width, src_height, src_format, dst, &dst_width, NULL);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-
-void utc_mm_util_resize_image_func_09()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 50;
- unsigned int dst_height = 50;
- unsigned int dst_size;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Resize the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_resize_image(src, src_width, src_height, 20, dst, &dst_width, &dst_height);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-
-
-/** @} */
-
-
-
-
+++ /dev/null
-/*
- * libmm-utility
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: YoungHun Kim <yh8004.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/**
-* @ingroup MMF_UTIL_API
-* @addtogroup UTIL
-*/
-
-/**
-* @ingroup UTIL
-* @addtogroup UTS_MMF_UTIL Unit
-*/
-
-/**
-* @ingroup UTS_MMF_UTIL Unit
-* @addtogroup UTS_MMF_UTIL_ROTATE_IMAGE Uts_Mmf_Util_Rotate_Image
-* @{
-*/
-
-/**
-* @file uts_mm_util_rotate_image.c
-* @brief This is a suit of unit test cases to test mm_util_rotate_image API
-* @version Initial Creation Version 0.1
-* @date 2010.06.08
-*/
-
-
-#include "utc_mm_util_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-void *data;
-
-struct tet_testlist tet_testlist[] = {
- {utc_mm_util_rotate_image_func_01 , 1},
- {utc_mm_util_rotate_image_func_02 , 2},
- {utc_mm_util_rotate_image_func_03 , 3},
- {utc_mm_util_rotate_image_func_04 , 4},
- {utc_mm_util_rotate_image_func_05 , 5},
- {utc_mm_util_rotate_image_func_06 , 6},
- {utc_mm_util_rotate_image_func_07 , 7},
- {utc_mm_util_rotate_image_func_08 , 8},
- {utc_mm_util_rotate_image_func_09 , 9},
- {utc_mm_util_rotate_image_func_10 , 10},
- {utc_mm_util_rotate_image_func_11 , 11},
- {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
- tet_infoline("[[ COMMON ]]::Inside startup \n");
-
- tet_infoline("[[ COMMON ]]::Completing startup \n");
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-void utc_mm_util_rotate_image_func_01()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_rotate_image(src, src_width, src_height, src_format, dst, &dst_width, &dst_height, angle);
-
- dts_check_eq(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_rotate_image_func_02()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_rotate_image(NULL, src_width, src_height, src_format, dst, &dst_width, &dst_height, angle);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_rotate_image_func_03()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_rotate_image(src, -1, src_height, src_format, dst, &dst_width, &dst_height, angle);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_rotate_image_func_04()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_rotate_image(src, src_width, -1, src_format, dst, &dst_width, &dst_height, angle);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_rotate_image_func_05()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_rotate_image(src, src_width, src_height, -1, dst, &dst_width, &dst_height, angle);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_rotate_image_func_06()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_rotate_image(src, src_width, src_height, 20, dst, &dst_width, &dst_height, angle);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_rotate_image_func_07()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_rotate_image(src, src_width, src_height, src_format, NULL, &dst_width, &dst_height, angle);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_rotate_image_func_08()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_rotate_image(src, src_width, src_height, src_format, dst, NULL, &dst_height, angle);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_rotate_image_func_09()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_rotate_image(src, src_width, src_height, src_format, dst, &dst_width, NULL, angle);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_rotate_image_func_10()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- //mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_rotate_image(src, src_width, src_height, src_format, dst, &dst_width, &dst_height, -1);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-void utc_mm_util_rotate_image_func_11()
-{
- int ret = 0;
- unsigned char *src;
- unsigned int src_width = 100;
- unsigned int src_height = 100;
- unsigned int src_size;
- mm_util_img_format src_format = MM_UTIL_IMG_FMT_YUV420;
- unsigned char *dst;
- unsigned int dst_width = 100;
- unsigned int dst_height = 100;
- unsigned int dst_size;
- //mm_util_img_rotate_type angle = MM_UTIL_ROTATE_90;
-
- FILE *fp = fopen(YUV_IMAGE_FILE, "rb");
-
- tet_infoline( "[[ TET_MSG ]]:: Rotate the Image" );
-
- /* Get the data of the Image */
- ret = mm_util_get_image_size(src_format, src_width, src_height, &src_size);
- src = malloc(src_size);
- fread(src, 1, src_size, fp);
-
- ret = mm_util_get_image_size(src_format, dst_width, dst_height, &dst_size);
- dst = malloc(dst_size);
-
- ret = mm_util_rotate_image(src, src_width, src_height, src_format, dst, &dst_width, &dst_height, 20);
-
- dts_check_ne(__func__, ret, MM_ERROR_NONE, "err=%x", ret );
-
- free(src);
- free(dst);
- fclose(fp);
- return;
-}
-
-
-
-/** @} */
-
-
-
-
*/
int
-mm_transform_is_completed(MMHandleType MMHandle, bool *is_completed);
+mm_util_transform_is_completed(MMHandleType MMHandle, bool *is_completed);
/**
*
* @param completed_callback [in] Completed_callback
* @param user_param [in] User parameter which is received from user when callback function was set
- * @return This function returns transcode processor result value
+ * @return This function returns transform processor result value
* if the result is 0, then you can use output_Filename pointer(char** value)
* else if the result is -1, then do not execute when the colopsapce converter is not supported
*/
unsigned int dst_width;
unsigned int dst_height;
mm_util_rotation_e dst_rotation;
-
+ unsigned int _MMHandle;
bool hardware_acceleration;
mm_util_cb_s *_util_cb;
bool is_completed;
unsigned int dst_key;
tbm_bo_handle dst_bo_handle;
+ bool set_convert;
+ bool set_crop;
+ bool set_resize;
+ bool set_rotate;
+
/* Src paramters */
guint src_buf_size; /**< for a standard colorspace format */
/* Dst paramters */
guint dst_buf_idx;
/* for multi instance */
- GMutex * instance_lock;
- GMutex *fd_lock;
- GMutex *buf_idx_lock;
+ GCond* thread_cond;
+ GMutex *thread_mutex;
+ GThread* thread;
+ GAsyncQueue *queue;
} mm_util_s;
#ifdef __cplusplus
gboolean _bool = FALSE;
debug_log("Format label: %s",__format_label);
if(strcmp(__format_label, "AYUV") == 0
- || strcmp(__format_label, "I420") == 0 || strcmp(__format_label, "YV12") == 0
- || strcmp(__format_label, "RGB888") == 0 || strcmp(__format_label, "RGB565") == 0 || strcmp(__format_label, "BGR888") == 0 || strcmp(__format_label, "RGBA8888") == 0
+ || strcmp(__format_label, "UYVY") == 0 ||strcmp(__format_label, "Y800") == 0 || strcmp(__format_label, "I420") == 0 || strcmp(__format_label, "YV12") == 0
+ || strcmp(__format_label, "RGB888") == 0 || strcmp(__format_label, "RGB565") == 0 || strcmp(__format_label, "BGR888") == 0 || strcmp(__format_label, "RGBA8888") == 0
|| strcmp(__format_label, "ARGB8888") == 0 ||strcmp(__format_label, "BGRA8888") == 0 ||strcmp(__format_label, "ABGR8888") == 0 ||strcmp(__format_label, "RGBX") == 0
|| strcmp(__format_label, "XRGB") == 0 ||strcmp(__format_label, "BGRX") == 0 ||strcmp(__format_label, "XBGR") == 0 ||strcmp(__format_label, "Y444") == 0
|| strcmp(__format_label, "Y42B") == 0 ||strcmp(__format_label, "YUY2") == 0 ||strcmp(__format_label, "YUYV") == 0 ||strcmp(__format_label, "UYVY") == 0
handle->dst_format_mime = -1;
handle->src_buf_idx = 0;
handle->dst_buf_idx = 0;
+ handle->dst_rotation = MM_UTIL_ROTATION_NONE;
handle->start_x = -1;
handle->start_y = -1;
+ handle->src_width = 0;
+ handle->src_height = 0;
+ handle->dst_width = 0;
+ handle->dst_height = 0;
handle->is_completed = FALSE;
return ret;
return format;
}
-bool
-_mm_transform_completed_cb(media_packet_h *dst, int error, void *user_param)
+
+gpointer
+_mm_util_thread_repeate(gpointer data)
{
- if (!user_param) {
+ mm_util_s* handle = (mm_util_s*) data;
+ int ret = MM_ERROR_NONE;
+
+ if (!handle) {
debug_error("[ERROR] - handle");
- return MM_ERROR_IMAGE_INTERNAL;
+ return NULL;
+ }
+
+ media_packet_h pop_data = (media_packet_h) g_async_queue_pop(handle->queue);
+
+ if(!pop_data) {
+ debug_error("[NULL] Queue data");
+ } else {
+ ret = _mm_util_transform_exec(handle, pop_data); /* Need to block */
+ if(ret == MM_ERROR_NONE) {
+ debug_log("Success - transform_exec");
+ } else{
+ debug_error("Error - transform_exec");
+ }
+ if(handle->_util_cb->completed_cb) {
+ debug_log("completed_cb");
+ handle->_util_cb->completed_cb(&handle->dst_packet, ret, handle->_util_cb->user_data);
+ debug_log("completed_cb %p", &handle->dst);
+ }
+ }
+
+ g_cond_signal(handle->thread_cond);
+ debug_log("===> send completed signal");
+ g_mutex_unlock (handle->thread_mutex);
+ debug_log("exit thread");
+
+ return NULL;
+}
+
+int
+_mm_util_create_thread(mm_util_s *handle)
+{
+ int ret = MM_ERROR_NONE;
+
+ if (!handle) {
+ debug_error("[ERROR] - handle");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
}
- mm_util_s * handle = (mm_util_s *)user_param;
- if(error == MM_ERROR_NONE) {
- handle->is_completed = TRUE;
- debug_log("completed");
+ if(!handle->thread_mutex) {
+ handle->thread_mutex = g_mutex_new();
} else {
- debug_error("[ERROR] complete cb");
+ debug_error("ERROR - thread_mutex is already created");
}
- return TRUE;
+ /*These are a communicator for thread*/
+ if(!handle->queue) {
+ handle->queue = g_async_queue_new();
+ } else {
+ debug_error("ERROR - async queue is already created");
+ }
+
+ if(!handle->thread_cond) {
+ handle->thread_cond = g_cond_new();
+ } else {
+ debug_error("thread cond is already created");
+ }
+
+ /*create threads*/
+ handle->thread = g_thread_new("transform_thread", (GThreadFunc)_mm_util_thread_repeate, (gpointer)handle);
+ if(!handle->thread) {
+ debug_error("ERROR - create thread");
+ return MM_ERROR_IMAGE_INTERNAL;
+ }
+
+ return ret;
}
int _mm_util_processing(mm_util_s *handle)
debug_log("src: %p, dst: %p", handle->src, handle->dst);
if(handle->src_format == handle->dst_format) {
- if((handle->src_width == handle->dst_width) && (handle->src_height == handle->dst_height)) {
- if(handle->dst_rotation !=MM_UTIL_ROTATION_NONE) {
+ if(handle->start_x == -1 && handle->start_y == -1) {
+ if(handle->dst_rotation != MM_UTIL_ROTATION_NONE) {
ret = mm_util_rotate_image(handle->src, handle->src_width, handle->src_height,handle->src_format, handle->dst, &handle->dst_width, &handle->dst_height, handle->dst_rotation);
if (ret != MM_ERROR_NONE) {
IMGP_FREE(handle->src);
return MM_ERROR_IMAGE_INTERNAL;
}
} else {
- IMGP_FREE(handle->src);
- IMGP_FREE(handle->dst);
- debug_error("[Error] rotate info");
- return MM_ERROR_IMAGE_INVALID_VALUE;
+ ret = mm_util_resize_image(handle->src, handle->src_width, handle->src_height,handle->src_format, handle->dst, &handle->dst_width, &handle->dst_height);
+ if (ret != MM_ERROR_NONE) {
+ debug_error("mm_util_resize_image failed");
+ return MM_ERROR_IMAGE_INTERNAL;
+ }
}
} else {
- ret = mm_util_resize_image(handle->src, handle->src_width, handle->src_height,handle->src_format, handle->dst, &handle->dst_width, &handle->dst_height);
+ ret = mm_util_crop_image(handle->src, handle->src_width, handle->src_height, handle->src_format,
+ handle->start_x, handle->start_y, &handle->dst_width, &handle->dst_height, handle->dst);
if (ret != MM_ERROR_NONE) {
- debug_error("mm_util_resize_image failed");
+ IMGP_FREE(handle->src);
+ IMGP_FREE(handle->dst);
+ debug_error("mm_util_crop_image failed");
return MM_ERROR_IMAGE_INTERNAL;
}
}
debug_error("mm_util_convert_colorspace failed");
return MM_ERROR_IMAGE_INTERNAL;
}
- } else {
- ret = mm_util_crop_image(handle->src, handle->src_width, handle->src_height, handle->src_format,
- handle->start_x, handle->start_y, &handle->dst_width, &handle->dst_height, handle->dst);
- if (ret != MM_ERROR_NONE) {
- IMGP_FREE(handle->src);
- IMGP_FREE(handle->dst);
- debug_error("mm_util_convert_colorspace failed");
- return MM_ERROR_IMAGE_INTERNAL;
- }
}
} else {
IMGP_FREE(handle->src);
}
}
- debug_log("End processing");
+ return ret;
+}
+
+int
+_mm_util_transform_exec(mm_util_s * handle, media_packet_h src_packet)
+{
+ int ret = MM_ERROR_NONE;
+ media_format_h src_fmt;
+ media_format_h dst_fmt;
+ media_format_mimetype_e src_mimetype;
+ int src_width, src_height, src_avg_bps, src_max_bps;
+ uint64_t size = 0;
+
+ g_mutex_lock (handle->thread_mutex);
+
+ if(media_packet_get_format(src_packet, &src_fmt) != MM_ERROR_NONE) {
+ debug_error("Imedia_packet_get_format)");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ if(media_format_get_video_info(src_fmt, &src_mimetype, &src_width, &src_height, &src_avg_bps, &src_max_bps) == MEDIA_FORMAT_ERROR_NONE) {
+ debug_log("[Fotmat: %d] W x H : %d x %d", src_mimetype, src_width, src_height);
+ }
+
+ if(_mm_util_check_resolution(src_width, src_height)) {
+ /* src */
+ handle->src_packet = src_packet;
+ debug_log("src_packet: %p handle->src_packet: %p 0x%2x [W X H] %d X %d", src_packet, handle->src_packet, src_fmt, src_width, src_height);
+ if(handle->src_packet) {
+ handle->src_format = _mm_util_mapping_mime_format_to_imgp(src_mimetype);
+ handle->src_width = src_width;
+ handle->src_height = src_height;
+ } else {
+ debug_error("[Error] handle->src");
+ return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
+ }
+
+ if(media_packet_get_buffer_size(handle->src_packet, &size) == MM_ERROR_NONE) {
+ handle->src_buf_size = (guint)size;
+ debug_log("src buffer(%p) %d size: %d", handle->src_packet, handle->src_packet, handle->src_buf_size);
+ } else {
+ debug_error("Error buffer size");
+ }
+
+ if(handle->dst_format == -1) {
+ handle->dst_format = handle->src_format;
+ handle->dst_format_mime = src_mimetype;
+ }
+
+ debug_log("src: %p handle->src_packet: %p (%d),(%d X %d)", src_packet, handle->src_packet, handle->src_packet, handle->src_width, handle->src_height);
+ if(handle->dst_width ==0 && handle->dst_height ==0) {
+ switch(handle->dst_rotation) {
+ case MM_UTIL_ROTATION_90:
+ case MM_UTIL_ROTATION_270:
+ handle->dst_width = handle->src_height;
+ handle->dst_height = handle->src_width;
+ break;
+ case MM_UTIL_ROTATION_NONE:
+ case MM_UTIL_ROTATION_180:
+ case MM_UTIL_ROTATION_FLIP_HORZ:
+ case MM_UTIL_ROTATION_FLIP_VERT:
+ handle->dst_width = handle->src_width;
+ handle->dst_height = handle->src_height;
+ break;
+ }
+ }
+ debug_log("dst (%d X %d)", handle->dst_width, handle->dst_height);
+ if(media_format_make_writable(src_fmt, &dst_fmt) != MEDIA_FORMAT_ERROR_NONE) {
+ media_format_unref(src_fmt);
+ debug_error("[Error] Writable - dst format");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ if(media_format_set_video_mime(dst_fmt, handle->dst_format_mime) != MEDIA_FORMAT_ERROR_NONE) {
+ media_format_unref(src_fmt);
+ media_format_unref(dst_fmt);
+ debug_error("[Error] Set - video mime");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ if(media_format_set_video_width(dst_fmt, handle->dst_width) != MEDIA_FORMAT_ERROR_NONE) {
+ media_format_unref(src_fmt);
+ media_format_unref(dst_fmt);
+ debug_error("[Error] Set - video width");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ if(media_format_set_video_height(dst_fmt, handle->dst_height) != MEDIA_FORMAT_ERROR_NONE) {
+ media_format_unref(src_fmt);
+ media_format_unref(dst_fmt);
+ debug_error("[Error] Set - video height");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ if(media_format_set_video_avg_bps(dst_fmt, src_avg_bps) != MEDIA_FORMAT_ERROR_NONE) {
+ media_format_unref(src_fmt);
+ media_format_unref(dst_fmt);
+ debug_error("[Error] Set - video avg bps");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ if(media_format_set_video_max_bps(dst_fmt, src_max_bps) != MEDIA_FORMAT_ERROR_NONE) {
+ media_format_unref(src_fmt);
+ media_format_unref(dst_fmt);
+ debug_error("[Error] Set - video max bps");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ if(media_packet_create_alloc(dst_fmt, (media_packet_finalize_cb)NULL, NULL, &handle->dst_packet) != MM_ERROR_NONE) {
+ debug_error("Imedia_packet_get_format)");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ } else {
+ debug_log("Success - dst media packet");
+ if(media_packet_get_buffer_size(handle->dst_packet, &size) != MM_ERROR_NONE) {
+ debug_error("Imedia_packet_get_format)");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+ handle->dst_buf_size = (guint)size;
+ debug_log("handle->src_packet: %p [%d] %d X %d (%d) => handle->dst_packet: %p [%d] %d X %d (%d)",
+ handle->src_packet, handle->src_format, handle->src_width, handle->src_height, handle->src_buf_size,
+ handle->dst_packet, handle->dst_format,handle->dst_width, handle->dst_height, handle->dst_buf_size);
+ }
+ }else {
+ debug_error("%d %d", src_width, src_height);
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ ret = _mm_util_processing(handle);
+
+ if(ret != MM_ERROR_NONE) {
+ debug_error("_mm_util_processing failed");
+ IMGP_FREE(handle);
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ media_format_unref(src_fmt);
+ media_format_unref(dst_fmt);
+
return ret;
}
return MM_ERROR_IMAGE_INTERNAL;
}
+ /* g_thread_exit(handle->thread); */
+ if(handle->_MMHandle) {
+ if(handle->thread) {
+ g_thread_join(handle->thread);
+ }
+ }
+
+ if(handle->queue) {
+ g_async_queue_unref(handle->queue);
+ handle->queue = NULL;
+ }
+
+ if(handle->thread_mutex) {
+ g_mutex_free (handle->thread_mutex);
+ handle->thread_mutex = NULL;
+ }
+
+ if(handle->thread_cond) {
+ g_cond_free (handle->thread_cond);
+ handle->thread_cond = NULL;
+ }
+ debug_log("Success - Finalize Handle");
+
return ret;
}
return MM_ERROR_IMAGE_INVALID_VALUE;
}
- mm_util_s *_handle = calloc(1,sizeof(mm_util_s));
- if (!_handle) {
+ mm_util_s *handle = calloc(1,sizeof(mm_util_s));
+ if (!handle) {
debug_error("[ERROR] - _handle");
ret = MM_ERROR_IMAGE_INTERNAL;
}
- ret = _mm_util_handle_init (_handle);
+ ret = _mm_util_handle_init (handle);
if(ret != MM_ERROR_NONE) {
debug_error("_mm_util_handle_init failed");
- IMGP_FREE(_handle);
+ IMGP_FREE(handle);
return MM_ERROR_IMAGE_INVALID_VALUE;
}
- *MMHandle = (MMHandleType)_handle;
+ ret = _mm_util_create_thread(handle);
+ if(ret != MM_ERROR_NONE) {
+ debug_error("ERROR - Create thread");
+ return ret;
+ } else {
+ debug_log("Success -_mm_util_create_thread");
+ }
+ *MMHandle = (MMHandleType)handle;
+
+ handle->_MMHandle = 0;
return ret;
}
{
int ret = MM_ERROR_NONE;
mm_util_s *handle = (mm_util_s *) MMHandle;
- media_format_h src_fmt;
- media_format_h dst_fmt;
- media_format_mimetype_e src_mimetype;
- int src_width, src_height, src_avg_bps, src_max_bps;
- uint64_t size = 0;
if (!handle) {
debug_error("[ERROR] - handle");
debug_error("[ERROR] _util_cb_s");
}
- if(media_packet_get_format(src_packet, &src_fmt) != MM_ERROR_NONE) {
- debug_error("Imedia_packet_get_format)");
- return MM_ERROR_IMAGE_INVALID_VALUE;
- }
+ handle->_MMHandle++;
- if(media_format_get_video_info(src_fmt, &src_mimetype, &src_width, &src_height, &src_avg_bps, &src_max_bps) == MEDIA_FORMAT_ERROR_NONE) {
- debug_log("[Fotmat: %d] W x H : %d x %d", src_mimetype, src_width, src_height);
- }
+ if(handle->queue) {
+ debug_log("g_async_queue_push");
+ g_async_queue_push (handle->queue, GINT_TO_POINTER(src_packet));
- if(_mm_util_check_resolution(src_width, src_height)) {
- /* src */
- handle->src_packet = src_packet;
- debug_log("src_packet: %p handle->src_packet: %p 0x%2x [W X H] %d X %d", src_packet, handle->src_packet, src_fmt, src_width, src_height);
- if(handle->src_packet) {
- handle->src_format = _mm_util_mapping_mime_format_to_imgp(src_mimetype);
- handle->src_width = src_width;
- handle->src_height = src_height;
- } else {
- debug_error("[Error] handle->src");
- return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
- }
-
- if(media_packet_get_buffer_size(handle->src_packet, &size) == MM_ERROR_NONE) {
- handle->src_buf_size = (guint)size;
- debug_log("src buffer(%p) %d size: %d", handle->src_packet, handle->src_packet, handle->src_buf_size);
- } else {
- debug_error("Error buffer size");
- }
-
- if(handle->dst_format == -1) {
- handle->dst_format = handle->src_format;
- handle->dst_format_mime = src_mimetype;
- }
-
- debug_log("src: %p handle->src_packet: %p (%d),(%d X %d)", src_packet, handle->src_packet, handle->src_packet, handle->src_width, handle->src_height);
- if(handle->dst_width ==0 && handle->dst_height ==0) {
- switch(handle->dst_rotation) {
- case MM_UTIL_ROTATION_90:
- case MM_UTIL_ROTATION_270:
- handle->dst_width = handle->src_height;
- handle->dst_height = handle->src_width;
- break;
- case MM_UTIL_ROTATION_NONE:
- case MM_UTIL_ROTATION_180:
- case MM_UTIL_ROTATION_FLIP_HORZ:
- case MM_UTIL_ROTATION_FLIP_VERT:
- handle->dst_width = handle->src_width;
- handle->dst_height = handle->src_height;
- break;
- }
- }
- debug_log("dst (%d X %d)", handle->dst_width, handle->dst_height);
- if(media_format_make_writable(src_fmt, &dst_fmt) != MEDIA_FORMAT_ERROR_NONE) {
- media_format_unref(src_fmt);
- debug_error("[Error] Writable - dst format");
- return MM_ERROR_IMAGE_INVALID_VALUE;
- }
-
- if(media_format_set_video_mime(dst_fmt, handle->dst_format_mime) != MEDIA_FORMAT_ERROR_NONE) {
- media_format_unref(src_fmt);
- media_format_unref(dst_fmt);
- debug_error("[Error] Set - video mime");
- return MM_ERROR_IMAGE_INVALID_VALUE;
- }
-
- if(media_format_set_video_width(dst_fmt, handle->dst_width) != MEDIA_FORMAT_ERROR_NONE) {
- media_format_unref(src_fmt);
- media_format_unref(dst_fmt);
- debug_error("[Error] Set - video width");
- return MM_ERROR_IMAGE_INVALID_VALUE;
- }
-
- if(media_format_set_video_height(dst_fmt, handle->dst_height) != MEDIA_FORMAT_ERROR_NONE) {
- media_format_unref(src_fmt);
- media_format_unref(dst_fmt);
- debug_error("[Error] Set - video height");
- return MM_ERROR_IMAGE_INVALID_VALUE;
- }
-
- if(media_format_set_video_avg_bps(dst_fmt, src_avg_bps) != MEDIA_FORMAT_ERROR_NONE) {
- media_format_unref(src_fmt);
- media_format_unref(dst_fmt);
- debug_error("[Error] Set - video avg bps");
- return MM_ERROR_IMAGE_INVALID_VALUE;
- }
-
- if(media_format_set_video_max_bps(dst_fmt, src_max_bps) != MEDIA_FORMAT_ERROR_NONE) {
- media_format_unref(src_fmt);
- media_format_unref(dst_fmt);
- debug_error("[Error] Set - video max bps");
- return MM_ERROR_IMAGE_INVALID_VALUE;
- }
- if(media_packet_create_alloc(dst_fmt, (media_packet_finalize_cb)NULL, NULL, &handle->dst_packet) != MM_ERROR_NONE) {
- debug_error("Imedia_packet_get_format)");
- return MM_ERROR_IMAGE_INVALID_VALUE;
- } else {
- debug_log("Success - dst media packet");
- if(media_packet_get_buffer_size(handle->dst_packet, &size) != MM_ERROR_NONE) {
- debug_error("Imedia_packet_get_format)");
- return MM_ERROR_IMAGE_INVALID_VALUE;
- }
- handle->dst_buf_size = (guint)size;
- debug_log("handle->src_packet: %p [%d] %d X %d (%d) => handle->dst_packet: %p [%d] %d X %d (%d)",
- handle->src_packet, handle->src_format, handle->src_width, handle->src_height, handle->src_buf_size,
- handle->dst_packet, handle->dst_format,handle->dst_width, handle->dst_height, handle->dst_buf_size);
- }
- }else {
- debug_error("%d %d", src_width, src_height);
- return MM_ERROR_IMAGE_INVALID_VALUE;
- }
-
- ret = _mm_util_processing(handle);
-
- if(ret == MM_ERROR_NONE) {
- if(handle->_util_cb->completed_cb) {
- debug_log("completed_cb");
- handle->_util_cb->completed_cb(&handle->dst_packet, MM_ERROR_NONE, handle->_util_cb->user_data);
- debug_log("completed_cb %p", &handle->dst);
- }
- debug_log("Success - Transform");
- } else {
- debug_error("Error - Transform");
+ g_mutex_lock (handle->thread_mutex);
+ debug_log("waiting...");
+ g_cond_wait(handle->thread_cond, handle->thread_mutex);
+ debug_log("<=== get completed / cancel signal");
+ g_mutex_unlock (handle->thread_mutex);
}
- media_format_unref(src_fmt);
- media_format_unref(dst_fmt);
return ret;
}
int
-mm_transform_is_completed(MMHandleType MMHandle, bool *is_completed)
+mm_util_transform_is_completed(MMHandleType MMHandle, bool *is_completed)
{
int ret = MM_ERROR_NONE;
return MM_ERROR_IMAGE_INVALID_VALUE;
}
+ if( !src_width || !src_height) {
+ debug_error("#ERROR# src_width || src_height valuei is 0 ");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
debug_log("[src] 0x%2x (%d x %d) [dst] 0x%2x", src, src_width, src_height, dst);
imgp_info_s* _imgp_info_s=(imgp_info_s*)g_malloc0(sizeof(imgp_info_s));
return MM_ERROR_IMAGE_INVALID_VALUE;
}
+ if( !src_width || !src_height) {
+ debug_error("#ERROR# src_width || src_height value is 0 ");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
if( (angle < MM_UTIL_ROTATE_0) || (angle > MM_UTIL_ROTATE_NUM) ) {
debug_error("#ERROR# angle vaule");
return MM_ERROR_IMAGE_INVALID_VALUE;
$(DRI2PROTO_CFLAGS) \
$(DRI2_CFLAGS) \
$(TBM_CFLAGS) \
- $(MMLOG_CFLAGS) -DMMF_LOG_OWNER=0x0100 -DMMF_DEBUG_PREFIX=\"MMF-IMAGE\" -D_INTERNAL_SESSION_MANAGER_
+ $(MMLOG_CFLAGS) -DMMF_LOG_OWNER=0x0100 -DMMF_DEBUG_PREFIX=\"MMF-IMAGE\" -D_INTERNAL_SESSION_MANAGER_ -fPIE -pie
############################################
#define ONE_ALL 0
#define IMAGE_FORMAT_LABEL_BUFFER_SIZE 4
MMHandleType MMHandle = 0;
+bool completed = false;
bool
transform_completed_cb(media_packet_h *packet, int error, void *user_param)
media_format_h dst_fmt;
media_format_mimetype_e dst_mimetype;
int dst_width, dst_height, dst_avg_bps, dst_max_bps;
- char *output_fmt = (char*)malloc(sizeof(char) * IMAGE_FORMAT_LABEL_BUFFER_SIZE);
- if(output_fmt) {
- if(media_packet_get_format(*packet, &dst_fmt) != MM_ERROR_NONE) {
- debug_error("Imedia_packet_get_format");
- IMGP_FREE(output_fmt);
- return MM_ERROR_IMAGE_INVALID_VALUE;
+ char *output_fmt = NULL;
+
+ if(error == MM_ERROR_NONE) {
+ debug_log("completed");
+ output_fmt = (char*)malloc(sizeof(char) * IMAGE_FORMAT_LABEL_BUFFER_SIZE);
+ if(output_fmt) {
+ if(media_packet_get_format(*packet, &dst_fmt) != MM_ERROR_NONE) {
+ debug_error("Imedia_packet_get_format");
+ return FALSE;
+ }
+
+ if(media_format_get_video_info(dst_fmt, &dst_mimetype, &dst_width, &dst_height, &dst_avg_bps, &dst_max_bps) ==MEDIA_FORMAT_ERROR_NONE) {
+ memset(output_fmt, 0, IMAGE_FORMAT_LABEL_BUFFER_SIZE);
+ if(dst_mimetype ==MEDIA_FORMAT_YV12 || dst_mimetype == MEDIA_FORMAT_422P ||dst_mimetype == MEDIA_FORMAT_I420
+ || dst_mimetype == MEDIA_FORMAT_NV12 || dst_mimetype == MEDIA_FORMAT_UYVY ||dst_mimetype == MEDIA_FORMAT_YUYV) {
+ strncpy(output_fmt, "yuv", strlen("yuv"));
+ } else {
+ strncpy(output_fmt,"rgb", strlen("rgb"));
+ }
+ debug_log("[mimetype: %d] W x H : %d x %d", dst_mimetype, dst_width, dst_height);
+ snprintf(output_file, 25, "result_%dx%d.%s", dst_width,dst_height, output_fmt);
+ }
}
- if(media_format_get_video_info(dst_fmt, &dst_mimetype, &dst_width, &dst_height, &dst_avg_bps, &dst_max_bps) ==MEDIA_FORMAT_ERROR_NONE) {
- memset(output_fmt, 0, IMAGE_FORMAT_LABEL_BUFFER_SIZE);
- if(dst_mimetype ==MEDIA_FORMAT_YV12 || dst_mimetype == MEDIA_FORMAT_422P ||dst_mimetype == MEDIA_FORMAT_I420
- || dst_mimetype == MEDIA_FORMAT_NV12 || dst_mimetype == MEDIA_FORMAT_UYVY ||dst_mimetype == MEDIA_FORMAT_YUYV) {
- strncpy(output_fmt, "yuv", strlen("yuv"));
- } else {
- strncpy(output_fmt,"rgb", strlen("rgb"));
+ FILE *fpout = fopen(output_file, "w");
+ if(fpout) {
+ media_packet_get_buffer_size(*packet, &size);
+ void *dst = NULL;
+ if(media_packet_get_buffer_data_ptr(*packet, &dst) != MM_ERROR_NONE) {
+ IMGP_FREE(dst);
+ IMGP_FREE(output_fmt);
+ fclose(fpout);
+ debug_error ("[dst] media_packet_get_extra");
+ return FALSE;
}
- debug_log("[mimetype: %d] W x H : %d x %d", dst_mimetype, dst_width, dst_height);
- sprintf(output_file, "result_%dx%d.%s", dst_width,dst_height, output_fmt);
+ debug_log("dst: %p [%d]", dst, size);
+ fwrite(dst, 1, size, fpout);
+ debug_log("FREE");
+ fclose(fpout);
}
- }
- if(error == MM_ERROR_NONE) {
- debug_log("completed");
+ debug_log("write result");
+ debug_log("Free (output_fmt)");
+ IMGP_FREE(output_fmt);
} else {
debug_error("[ERROR] complete cb");
GThread * destroy_thread = g_thread_new(NULL, mm_util_destroy, MMHandle);
+ return_val_if_fail(destroy_thread, FALSE);
g_thread_unref(destroy_thread);
}
- FILE *fpout = fopen(output_file, "w");
- if(fpout) {
- media_packet_get_buffer_size(*packet, &size);
- void *dst = NULL;
- if(media_packet_get_buffer_data_ptr(*packet, &dst) != MM_ERROR_NONE) {
- IMGP_FREE(dst);
- IMGP_FREE(output_fmt);
- fclose(fpout);
- debug_error ("[dst] media_packet_get_extra");
- return MM_ERROR_IMAGE_INVALID_VALUE;
- }
- debug_log("dst: %p [%d]", dst, size);
- fwrite(dst, 1, size, fpout);
- debug_log("FREE");
- fclose(fpout);
- }
-
- debug_log("write result");
- debug_log("Free (output_fmt)");
+ completed = true;
+ debug_log("Destory - dst packet");
media_packet_destroy(*packet);
- IMGP_FREE(output_fmt);
+
return TRUE;
}
if (argc < 1) {
debug_error("[%s][%05d] Usage: ./mm_image_testsuite filename [yuv420 | yuv420p | yuv422 | uyvy | vyuy | nv12 | nv12t | rgb565 | rgb888 | argb | jpeg] width height\n");
- exit (0);
+ return ret;
}
-
/* Create Transform */
ret = mm_util_create (&MMHandle);
if(ret == MM_ERROR_NONE) {
debug_error("media_format_create failed...");
}
- ret = media_packet_create_alloc(fmt, (media_packet_finalize_cb)transform_completed_cb, NULL, &src_packet);
+ ret = media_packet_create_alloc(fmt, (media_packet_finalize_cb)NULL, NULL, &src_packet);
if(ret == MM_ERROR_NONE) {
debug_log("Success - Create Media Packet(%p)", src_packet);
uint64_t size =0;
if (media_packet_get_buffer_size(src_packet, &size) == MEDIA_PACKET_ERROR_NONE) {
ptr = malloc(size);
+ if (ptr == NULL) {
+ debug_log("\tmemory allocation failed\n");
+ return MM_ERROR_IMAGE_INTERNAL;
+ }
if (media_packet_get_buffer_data_ptr(src_packet, &ptr) == MEDIA_PACKET_ERROR_NONE) {
FILE *fp = fopen(argv[1], "r");
+ if (fp == NULL) {
+ debug_log("\tfile open failed %d\n", errno);
+ return MM_ERROR_IMAGE_INTERNAL;
+ }
src = malloc(size);
+ if (src == NULL) {
+ debug_log("\tmemory allocation failed\n");
+ return MM_ERROR_IMAGE_INTERNAL;
+ }
if(fread(src, 1, (int)size, fp)) {
debug_log("#Success# fread");
memcpy(ptr, src, (int)size);
return ret;
}
- ret = mm_util_set_colorspace_convert(MMHandle, MM_UTIL_IMG_FMT_RGB888);
+ ret = mm_util_set_resolution(MMHandle, 176, 144);
if(ret == MM_ERROR_NONE) {
debug_log("Success - Set Convert Info");
} else {
return ret;
}
- ret = mm_util_set_resolution(MMHandle, 320, 240);
- if(ret == MM_ERROR_NONE) {
- debug_log("Success - Set Resize Info");
- } else {
- media_format_unref(fmt);
- debug_log("ERROR - Set Resize Info");
- return ret;
- }
-
/* Transform */
ret = mm_util_transform(MMHandle, src_packet, (mm_util_completed_callback) transform_completed_cb, handle);
if(ret == MM_ERROR_NONE) {
}
debug_log("Wait...");
+ while (false == completed) {} // polling
+
+ ret = mm_util_destroy(MMHandle);
+ if(ret == MM_ERROR_NONE) {
+ debug_log("Success - Destroy");
+ } else {
+ media_format_unref(fmt);
+ debug_error("ERROR - Destroy");
+ return ret;
+ }
- media_packet_destroy(src_packet);
media_format_unref(fmt);
+ debug_log("Destory - src packet");
+ media_packet_destroy(src_packet);
debug_log("destroy");
return ret;
} mm_util_jpeg_yuv_format;
/**
+ * downscale decoding for jpeg
+ */
+typedef enum
+{
+ MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1 = 1, /** 1/1 downscale decode */
+ MM_UTIL_JPEG_DECODE_DOWNSCALE_1_2 = 2, /** 1/2 downscale decode */
+ MM_UTIL_JPEG_DECODE_DOWNSCALE_1_4 = 4, /** 1/4 downscale decode */
+ MM_UTIL_JPEG_DECODE_DOWNSCALE_1_8 = 8, /** 1/8 downscale decode */
+} mm_util_jpeg_decode_downscale;
+
+/**
* YUV data
*/
typedef struct
int
mm_util_decode_from_jpeg_memory (mm_util_jpeg_yuv_data *decoded, void *src, int size, mm_util_jpeg_yuv_format fmt);
+/**
+ * This function extracts yuv data from jpeg file with downscale decode option
+ *
+ * @param decoded [out] pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer.
+ After using it, please free the allocated memory.
+ * @param filename [in] input file name, encoded stream file
+ * @param fmt [in] color format
+ * @param downscale [in] downscale value
+ * @return This function returns zero on success, or negative value with error code.
+ * @remark
+ * @see mm_util_jpeg_yuv_data, mm_util_jpeg_yuv_format
+ * @since R1, 1.0
+ */
+int
+mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded, char *filename, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale);
+
+/**
+ * This function extracts yuv data from jpeg buffer with downscale decode option
+ *
+ * @param decoded [out] pointer of output stream pointer, that is, pointer of encoded jpeg stream pointer.
+ After using it, please free the allocated memory.
+ * @param src [in] input stream pointer(pointer of encoded jpeg stream data)
+ * @param size [in] size of input stream(size of pointer of encoded jpeg stream data)
+ * @param fmt [in] color format
+ * @param downscale [in] downscale value
+ * @return This function returns zero on success, or negative value with error code.
+ * @remark
+ * @see mm_util_jpeg_yuv_data, mm_util_jpeg_yuv_format
+ * @since R1, 1.0
+ */
+int
+mm_util_decode_from_jpeg_memory_with_downscale (mm_util_jpeg_yuv_data *decoded, void *src, int size, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale);
+
+
#ifdef __cplusplus
}
#endif
#define MM_JPEG_ROUND_UP_2(num) (((num)+1)&~1)
#define MM_JPEG_ROUND_UP_4(num) (((num)+3)&~3)
#define MM_JPEG_ROUND_UP_8(num) (((num)+7)&~7)
+#define MM_JPEG_ROUND_DOWN_2(num) ((num)&(~1))
+#define MM_JPEG_ROUND_DOWN_4(num) ((num)&(~3))
#define MM_JPEG_ROUND_DOWN_16(num) ((num)&(~15))
+
+#define ERR_BUF_LENGHT 256
+#define mm_util_stderror(fmt) do { \
+ char buf[ERR_BUF_LENGHT] = {0,}; \
+ strerror_r(errno, buf, ERR_BUF_LENGHT); \
+ debug_error(fmt" : standard error= [%s]", buf); \
+ } while (0)
+
#if LIBJPEG_TURBO
#define PAD(v, p) ((v+(p)-1)&(~((p)-1)))
#define _throwtj() {printf("TurboJPEG ERROR:\n%s\n", tjGetErrorStr());}
{
FILE *file=fopen(filename, "wb");
if(!file || fwrite(jpegBuf, jpegSize, 1, file)!=1) {
- debug_error("ERROR: Could not write to %s \t %s", filename, strerror(errno));
+ debug_error("ERROR: Could not write to %s", filename);
+ mm_util_stderror("ERROR: Could not write");
}
if(file) fclose(file);
void *src = fopen(pFileName, "rb" );
if(src == NULL) {
- debug_error("Error [%s] failed \t %s", pFileName, strerror(errno));
+ debug_error("Error [%s] failed", pFileName);
+ mm_util_stderror("Error file open failed");
return MM_ERROR_IMAGE_FILEOPEN;
}
fseek (src, 0, SEEK_END);
int TD_BU=0;
FILE *fout=fopen(filename, "w+");
if(fout == NULL) {
- debug_error("FILE OPEN FAIL [%s] failed \t %s", filename, strerror(errno));
+ debug_error("FILE OPEN FAIL [%s] failed", filename);
+ mm_util_stderror("FILE OPEN FAIL");
return MM_ERROR_IMAGE_FILEOPEN;
}
debug_log("fmt: %d", fmt);
jpeg_create_compress(&cinfo);
if ((fpWriter = fopen(pFileName, "wb")) == NULL) {
- debug_error("[infile] file open [%s] failed \t %s", pFileName, strerror(errno));
+ debug_error("[infile] file open [%s] failed", pFileName);
+ mm_util_stderror("file open failed");
return MM_ERROR_IMAGE_FILEOPEN;
}
if(large_rect) {
memset(large_rect, 0x10, width);
} else {
+ free(small_rect);
debug_error("large rectangle memory");
return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
}
if(large_rect) {
memset(large_rect, 0x10, width);
} else {
+ free(small_rect);
debug_error("large rectangle memory");
return MM_ERROR_IMAGEHANDLE_NOT_INITIALIZED;
}
}
static int
-mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * decoded_data, char *pFileName, mm_util_jpeg_yuv_format input_fmt)
+mm_image_decode_from_jpeg_file_with_libjpeg(mm_util_jpeg_yuv_data * decoded_data, char *pFileName, mm_util_jpeg_yuv_format input_fmt, mm_util_jpeg_decode_downscale downscale)
{
int iErrorCode = MM_ERROR_NONE;
FILE *infile = NULL;
debug_error("pFileName");
return MM_ERROR_IMAGE_FILEOPEN;
}
+ if(decoded_data == NULL) {
+ debug_error("decoded_data");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
if(decoded_data) {
decoded_data->data = NULL;
}
infile = fopen(pFileName, "rb");
if(infile == NULL) {
- debug_error("[infile] file open [%s] \t %s", pFileName, strerror(errno));
+ debug_error("[infile] file open [%s]", pFileName);
+ mm_util_stderror("file open failed");
return MM_ERROR_IMAGE_FILEOPEN;
}
debug_log("infile");
dinfo.do_fancy_upsampling = FALSE;
dinfo.do_block_smoothing = FALSE;
dinfo.dither_mode = JDITHER_ORDERED;
+ } else if (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1) {
+ dinfo.scale_num = 1;
+ dinfo.scale_denom = (unsigned int)downscale;
+ dinfo.do_fancy_upsampling = FALSE;
+ dinfo.do_block_smoothing = FALSE;
+ dinfo.dither_mode = JDITHER_ORDERED;
}
#endif
dinfo.dct_method = JDCT_FASTEST;
/* Start decompressor*/
jpeg_start_decompress(&dinfo);
+ /* byte-align for YUV format */
+ if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422) {
+ if(dinfo.output_width% 2 != 0) {
+ dinfo.output_width = MM_JPEG_ROUND_DOWN_2(dinfo.output_width);
+ }
+ if(dinfo.output_height% 2 != 0) {
+ dinfo.output_height = MM_JPEG_ROUND_DOWN_2(dinfo.output_height);
+ }
+ }
+
/* JSAMPLEs per row in output buffer */
row_stride = dinfo.output_width * dinfo.output_components;
}
static int
-mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data * decoded_data, void *src, int size, mm_util_jpeg_yuv_format input_fmt)
+mm_image_decode_from_jpeg_memory_with_libjpeg(mm_util_jpeg_yuv_data * decoded_data, void *src, int size, mm_util_jpeg_yuv_format input_fmt, mm_util_jpeg_decode_downscale downscale)
{
int iErrorCode = MM_ERROR_NONE;
struct jpeg_decompress_struct dinfo;
return MM_ERROR_IMAGE_FILEOPEN;
}
debug_log("infile");
+ if(decoded_data == NULL) {
+ debug_error("decoded_data");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
if(decoded_data) {
decoded_data->data = NULL;
}
dinfo.do_fancy_upsampling = FALSE;
dinfo.do_block_smoothing = FALSE;
dinfo.dither_mode = JDITHER_ORDERED;
+ } else if (downscale != MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1) {
+ dinfo.scale_num = 1;
+ dinfo.scale_denom = (unsigned int)downscale;
+ dinfo.do_fancy_upsampling = FALSE;
+ dinfo.do_block_smoothing = FALSE;
+ dinfo.dither_mode = JDITHER_ORDERED;
}
#endif
dinfo.dct_method = JDCT_FASTEST;
jpeg_start_decompress(&dinfo);
debug_log("jpeg_start_decompress");
+ /* byte-align for YUV format */
+ if (input_fmt == MM_UTIL_JPEG_FMT_YUV420 || input_fmt == MM_UTIL_JPEG_FMT_YUV422) {
+ if(dinfo.output_width% 2 != 0) {
+ dinfo.output_width = MM_JPEG_ROUND_DOWN_2(dinfo.output_width);
+ }
+ if(dinfo.output_height% 2 != 0) {
+ dinfo.output_height = MM_JPEG_ROUND_DOWN_2(dinfo.output_height);
+ }
+ }
+
/* JSAMPLEs per row in output buffer */
row_stride = dinfo.output_width * dinfo.output_components;
return MM_ERROR_IMAGE_INVALID_VALUE;
}
- if( (width < 0) || (height < 0)) {
+ if( (width <= 0) || (height <= 0)) {
debug_error("#ERROR# src_width || src_height value ");
return MM_ERROR_IMAGE_INVALID_VALUE;
}
return MM_ERROR_IMAGE_INVALID_VALUE;
}
- if( (quality < 0 ) || (quality>100) ) {
+ if( (quality < 1 ) || (quality>100) ) {
debug_error("#ERROR# quality vaule");
return MM_ERROR_IMAGE_INVALID_VALUE;
}
return MM_ERROR_IMAGE_INVALID_VALUE;
}
- if( (width < 0) || (height < 0)) {
+ if( (width <= 0) || (height <= 0)) {
debug_error("#ERROR# src_width || src_height value ");
return MM_ERROR_IMAGE_INVALID_VALUE;
}
return MM_ERROR_IMAGE_INVALID_VALUE;
}
- if( (quality < 0 ) || (quality>100) ) {
+ if( (quality < 1 ) || (quality>100) ) {
debug_error("#ERROR# quality vaule");
return MM_ERROR_IMAGE_INVALID_VALUE;
}
{
int ret = MM_ERROR_NONE;
+ mm_util_jpeg_decode_downscale downscale = MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1;
+
if( !decoded || !filename) {
debug_error("#ERROR# decoded || filename buffer is NULL");
return MM_ERROR_IMAGE_INVALID_VALUE;
fread((void *)magic, 1, 2, fp);
debug_log("%x %x", magic[0], magic[1]);
fclose(fp);
+ } else {
+ debug_error("[fp] file open [%s] \t %s", filename, strerror(errno));
+ return MM_ERROR_IMAGE_FILEOPEN;
}
+
if(magic[0] == 0xff && magic[1] == 0xd8) {
#if LIBJPEG_TURBO
debug_log("#START# LIBJPEG_TURBO");
debug_log("#End# LIBJPEG_TURBO, Success!! ret: %d", ret);
#else
debug_log("#START# libjpeg");
- ret = mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, fmt);
+ ret = mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, fmt, downscale);
debug_log("decoded->data: %p\t width: %d\t height:%d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
debug_log("#End# libjpeg, Success!! ret: %d", ret);
#endif
{
int ret = MM_ERROR_NONE;
+ mm_util_jpeg_decode_downscale downscale = MM_UTIL_JPEG_DECODE_DOWNSCALE_1_1;
+
+ if( !decoded || !src) {
+ debug_error("#ERROR# decoded || src buffer is NULL");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ if(size < 0) {
+ debug_error("#ERROR# size");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ if( (fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888) ) {
+ debug_error("#ERROR# fmt value");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ #if LIBJPEG_TURBO
+ debug_log("#START# libjpeg");
+ ret = mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(decoded, src, size, fmt);
+
+ debug_log("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+ debug_log("#END# libjpeg, Success!! ret: %d", ret);
+
+ #else
+ debug_log("#START# libjpeg");
+ ret = mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, fmt, downscale);
+
+ debug_log("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+ debug_log("#END# libjpeg, Success!! ret: %d", ret);
+ #endif
+ return ret;
+}
+
+EXPORT_API int
+mm_util_decode_from_jpeg_file_with_downscale(mm_util_jpeg_yuv_data *decoded, char *filename, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale)
+{
+ int ret = MM_ERROR_NONE;
+
+ if( !decoded || !filename) {
+ debug_error("#ERROR# decoded || filename buffer is NULL");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ if( (fmt < MM_UTIL_JPEG_FMT_YUV420) || (fmt > MM_UTIL_JPEG_FMT_ARGB8888) ) {
+ debug_error("#ERROR# fmt value");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ 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)) {
+ debug_error("#ERROR# fmt value");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
+ FILE *fp = fopen(filename, "rb");
+ unsigned char magic[2] = {0};
+ if(fp) {
+ fread((void *)magic, 1, 2, fp);
+ debug_log("%x %x", magic[0], magic[1]);
+ fclose(fp);
+ }
+ if(magic[0] == 0xff && magic[1] == 0xd8) {
+ #if LIBJPEG_TURBO
+ debug_log("#START# LIBJPEG_TURBO");
+ ret = mm_image_decode_from_jpeg_file_with_libjpeg_turbo(decoded, filename, fmt);
+ debug_log("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+ debug_log("#End# LIBJPEG_TURBO, Success!! ret: %d", ret);
+ #else
+ debug_log("#START# libjpeg");
+ ret = mm_image_decode_from_jpeg_file_with_libjpeg(decoded, filename, fmt, downscale);
+ debug_log("decoded->data: %p\t width: %d\t height:%d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
+ debug_log("#End# libjpeg, Success!! ret: %d", ret);
+ #endif
+ } else if(magic[0] == 0x47 && magic[1] == 0x49) {
+ debug_error("Not JPEG IMAGE - GIF");
+ ret = MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
+ } else if(magic[0] == 0x89 && magic[1] == 0x50) {
+ debug_error("Not JPEG IMAGE - PNG");
+ ret = MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
+ } else if(magic[0] == 0x49 && magic[1] == 0x49) {
+ debug_error("Not JPEG IMAGE - TIFF");
+ ret = MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
+ } else {
+ debug_error("Not JPEG IMAGE");
+ ret = MM_ERROR_IMAGE_NOT_SUPPORT_FORMAT;
+ }
+
+ return ret;
+}
+
+EXPORT_API int
+mm_util_decode_from_jpeg_memory_with_downscale(mm_util_jpeg_yuv_data* decoded, void* src, int size, mm_util_jpeg_yuv_format fmt, mm_util_jpeg_decode_downscale downscale)
+{
+ int ret = MM_ERROR_NONE;
+
if( !decoded || !src) {
debug_error("#ERROR# decoded || src buffer is NULL");
return MM_ERROR_IMAGE_INVALID_VALUE;
return MM_ERROR_IMAGE_INVALID_VALUE;
}
+ 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)) {
+ debug_error("#ERROR# fmt value");
+ return MM_ERROR_IMAGE_INVALID_VALUE;
+ }
+
#if LIBJPEG_TURBO
debug_log("#START# libjpeg");
ret = mm_image_decode_from_jpeg_memory_with_libjpeg_turbo(decoded, src, size, fmt);
#else
debug_log("#START# libjpeg");
- ret = mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, fmt);
+ ret = mm_image_decode_from_jpeg_memory_with_libjpeg(decoded, src, size, fmt, downscale);
debug_log("decoded->data: %p\t width: %d\t height: %d\t size: %d\n", decoded->data, decoded->width, decoded->height, decoded->size);
debug_log("#END# libjpeg, Success!! ret: %d", ret);
#endif
+
return ret;
}
mm_util_jpeg_testsuite_CFLAGS = -I$(srcdir)/../include
mm_util_jpeg_testsuite_CFLAGS += $(MMCOMMON_CFLAGS) \
- $(MMLOG_CFLAGS) -DMMF_LOG_OWNER=0x0100 -DMMF_DEBUG_PREFIX=\"MMF-IMAGE\" \
+ $(MMLOG_CFLAGS) -DMMF_LOG_OWNER=0x0100 -DMMF_DEBUG_PREFIX=\"MMF-IMAGE\" -fPIE -pie \
$(TZ_PLATFORM_CONFIG_FLAGS)
fprintf(stderr, "\tTry to open %s to write\n", file_name);
fp = fopen(file_name, "w");
+ if (fp == NULL) {
+ fprintf(stderr, "\tfile open failed %d\n", errno);
+ return FALSE;
+ }
+
fwrite(data, 1, data_size, fp);
fclose(fp);
fp = NULL;
mm_util_jpeg_yuv_data decoded_data = {0,};
mm_util_jpeg_yuv_format fmt; /* = MM_UTIL_JPEG_FMT_RGB888; */
+ mm_util_jpeg_decode_downscale downscale;
if (argc < 2) {
fprintf(stderr, "\t[usage]\n");
fprintf(stderr, "\t\t1. encode : mm_util_jpeg_testsuite encode filepath.yuv width height quality\n");
fprintf(stderr, "\t\t2. decode : mm_util_jpeg_testsuite decode filepath.jpg\n");
+ fprintf(stderr, "\t\t3. decode_ds : mm_util_jpeg_testsuite decode_ds filepath.jpg format downscale\n");
return 0;
}
} else {
ret = MM_ERROR_IMAGE_INTERNAL;
}
+ } else if (!strcmp("decode_ds", argv[1])) {
+ if (_read_file(argv[2], &src, &src_size)) {
+ fmt = atoi(argv[3]);
+ downscale = atoi(argv[4]);
+ ret = mm_util_decode_from_jpeg_memory_with_downscale(&decoded_data, src, src_size, fmt, downscale);
+
+ free(src);
+ src = NULL;
+ } else {
+ ret = MM_ERROR_IMAGE_INTERNAL;
+ }
} else {
fprintf(stderr, "\tunknown command [%s]\n", argv[1]);
return 0;
char filename[BUFFER_SIZE];
memset(filename, 0, BUFFER_SIZE);
if(fmt == MM_UTIL_JPEG_FMT_RGB888 || fmt == MM_UTIL_JPEG_FMT_RGBA8888 || fmt == MM_UTIL_JPEG_FMT_BGRA8888 || fmt == MM_UTIL_JPEG_FMT_ARGB8888) {
- sprintf(filename, "%s%s", DECODE_RESULT_PATH, "rgb");
+ snprintf(filename, BUFFER_SIZE, "%s%s", DECODE_RESULT_PATH, "rgb");
} else if((fmt == MM_UTIL_JPEG_FMT_YUV420) ||
+ (fmt == MM_UTIL_JPEG_FMT_YUV422) ||
(fmt == MM_UTIL_JPEG_FMT_NV12) ||
(fmt == MM_UTIL_JPEG_FMT_NV21) ||
(fmt == MM_UTIL_JPEG_FMT_NV16) ||
(fmt == MM_UTIL_JPEG_FMT_NV61)) {
- sprintf(filename, "%s%s", DECODE_RESULT_PATH, "yuv");
+ snprintf(filename, BUFFER_SIZE, "%s%s", DECODE_RESULT_PATH, "yuv");
}
_write_file(filename, decoded_data.data, decoded_data.size);
Name: libmm-utility
Summary: Multimedia Framework Utility Library
-Version: 0.9
+Version: 0.10
Release: 0
Group: System/Libraries
License: Apache-2.0
bin_PROGRAMS = mm_utility_testsuite
-mm_utility_testsuite_SOURCES = mm_utility_testsuite.c
-
+mm_utility_testsuite_SOURCES = mm_utility_testsuite.c
+
mm_utility_testsuite_CFLAGS = -I$(srcdir)/../include \
- $(MMCOMMON_CFLAGS)
+ $(MMCOMMON_CFLAGS) -fPIE -pie
+
-
mm_utility_testsuite_LDADD = $(MMCOMMON_LIBS)