4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Vineeth T M <vineeth.tm@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
26 #include <mm_util_bmp.h>
27 #include <tzplatform_config.h>
29 #define DECODE_RESULT_PATH tzplatform_mkpath(TZ_USER_CONTENT, "decode_test.")
30 #define BUFFER_SIZE 128
32 static inline void flush_stdin()
35 while ((ch = getchar()) != EOF && ch != '\n') ;
38 int main(int argc, char *argv[])
41 mm_util_bmp_data decoded;
44 fprintf(stderr, "\t[usage]\n");
45 fprintf(stderr, "\t\t1. decode : mm_util_bmp_testsuite decode filepath.bmp\n");
49 if (!strcmp("decode", argv[1])) {
50 ret = mm_util_decode_from_bmp_file(&decoded, argv[2]);
52 fprintf(stderr, "\tunknown command [%s]\n", argv[1]);
56 if (ret != MM_UTIL_ERROR_NONE) {
57 fprintf(stderr, "\tERROR is occurred %x\n", ret);
59 fprintf(stderr, "\tBMP OPERATION SUCCESS\n");
62 fprintf(stderr, "\t##Decoded data##: %p\t width: %lu\t height:%lu\t size: %llu\n", decoded.data, decoded.width, decoded.height, decoded.size);
63 char filename[BUFFER_SIZE] = { 0, };
64 memset(filename, 0, BUFFER_SIZE);
66 snprintf(filename, BUFFER_SIZE, "%s%s", DECODE_RESULT_PATH, "bmp");
69 ret = mm_util_encode_bmp_to_file(&decoded, filename);
73 fprintf(stderr, "\tDECODED data is NULL\n");