Define new decode_s to use for decoding 96/191096/2
authorhj kim <backto.kim@samsung.com>
Thu, 11 Oct 2018 08:24:40 +0000 (17:24 +0900)
committerhj kim <backto.kim@samsung.com>
Thu, 11 Oct 2018 08:25:49 +0000 (17:25 +0900)
Change-Id: Ic6937b8c350f6e80f20bdd6f305a2ed1464c4174

include/image_util_private.h
src/image_util_decode.c

index d8f7672..4ac3886 100755 (executable)
@@ -167,6 +167,24 @@ typedef struct {
 } decode_encode_s;
 
 typedef struct {
+       image_util_type_e image_type;
+       void **src_buffer;
+       size_t src_size;
+       void **dst_buffer;
+       size_t dst_size;
+       char *path;
+       unsigned long width;
+       unsigned long height;
+       int quality;
+       image_util_colorspace_e colorspace;
+       image_util_scale_e down_scale;
+       decode_cb_s *_decode_cb;
+
+       /* for async */
+       GThread *thread;
+} decode_s;
+
+typedef struct {
        void *frame_h;
 } frame_s;
 
index f409653..c09fa54 100755 (executable)
@@ -111,13 +111,12 @@ int image_util_decode_create(image_util_decode_h * handle)
 
        image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
 
-       decode_encode_s *_handle = (decode_encode_s *) calloc(1, sizeof(decode_encode_s));
+       decode_s *_handle = (decode_s *) calloc(1, sizeof(decode_s));
        image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
 
        _handle->src_buffer = NULL;
        _handle->dst_buffer = NULL;
        _handle->path = NULL;
-       _handle->mode = MODE_DECODE;
        _handle->image_type = _NOT_SUPPORTED_IMAGE_TYPE;
        _handle->colorspace = IMAGE_UTIL_COLORSPACE_RGBA8888;
 
@@ -129,7 +128,7 @@ int image_util_decode_create(image_util_decode_h * handle)
 static int _image_util_decode_create_image_handle(image_util_decode_h handle)
 {
        int err = IMAGE_UTIL_ERROR_NONE;
-       decode_encode_s *_handle = (decode_encode_s *) handle;
+       decode_s *_handle = (decode_s *) handle;
 
        IMAGE_UTIL_DECODE_HANDLE_CHECK(handle);
 
@@ -156,7 +155,7 @@ static int _image_util_decode_create_image_handle(image_util_decode_h handle)
 int image_util_decode_set_input_path(image_util_decode_h handle, const char *path)
 {
        int err = IMAGE_UTIL_ERROR_NONE;
-       decode_encode_s *_handle = (decode_encode_s *) handle;
+       decode_s *_handle = (decode_s *) handle;
        unsigned char *image_header = NULL;
 
        IMAGE_UTIL_DECODE_HANDLE_CHECK(handle);
@@ -189,7 +188,7 @@ int image_util_decode_set_input_path(image_util_decode_h handle, const char *pat
 int image_util_decode_set_input_buffer(image_util_decode_h handle, const unsigned char *src_buffer, unsigned long long src_size)
 {
        int err = IMAGE_UTIL_ERROR_NONE;
-       decode_encode_s *_handle = (decode_encode_s *) handle;
+       decode_s *_handle = (decode_s *) handle;
 
        IMAGE_UTIL_DECODE_HANDLE_CHECK(handle);
        image_util_retvm_if((src_buffer == NULL || src_size == 0), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input buffer");
@@ -215,7 +214,7 @@ int image_util_decode_set_input_buffer(image_util_decode_h handle, const unsigne
 
 int image_util_decode_set_output_buffer(image_util_decode_h handle, unsigned char **dst_buffer)
 {
-       decode_encode_s *_handle = (decode_encode_s *) handle;
+       decode_s *_handle = (decode_s *) handle;
 
        image_util_fenter();
 
@@ -229,7 +228,7 @@ int image_util_decode_set_output_buffer(image_util_decode_h handle, unsigned cha
 
 int image_util_decode_set_colorspace(image_util_encode_h handle, image_util_colorspace_e colorspace)
 {
-       decode_encode_s *_handle = (decode_encode_s *) handle;
+       decode_s *_handle = (decode_s *) handle;
 
        IMAGE_UTIL_DECODE_HANDLE_CHECK(handle);
        IMAGE_UTIL_TYPE_CHECK(_handle->image_type);
@@ -244,7 +243,7 @@ int image_util_decode_set_colorspace(image_util_encode_h handle, image_util_colo
 
 int image_util_decode_set_jpeg_downscale(image_util_encode_h handle, image_util_scale_e down_scale)
 {
-       decode_encode_s *_handle = (decode_encode_s *) handle;
+       decode_s *_handle = (decode_s *) handle;
 
        IMAGE_UTIL_DECODE_HANDLE_CHECK(handle);
        IMAGE_UTIL_SUPPORT_TYPE_CHECK(_handle->image_type, IMAGE_UTIL_JPEG);
@@ -256,7 +255,7 @@ int image_util_decode_set_jpeg_downscale(image_util_encode_h handle, image_util_
        return IMAGE_UTIL_ERROR_NONE;
 }
 
-static int _image_util_decode_internal(decode_encode_s * _handle)
+static int _image_util_decode_internal(decode_s * _handle)
 {
        int err = MM_UTIL_ERROR_NONE;
 
@@ -360,7 +359,7 @@ static int _image_util_decode_internal(decode_encode_s * _handle)
 int image_util_decode_run(image_util_decode_h handle, unsigned long *width, unsigned long *height, unsigned long long *size)
 {
        int err = IMAGE_UTIL_ERROR_NONE;
-       decode_encode_s *_handle = (decode_encode_s *) handle;
+       decode_s *_handle = (decode_s *) handle;
 
        IMAGE_UTIL_DECODE_HANDLE_CHECK(handle);
        image_util_retvm_if((_handle->path == NULL && _handle->src_buffer == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid input");
@@ -381,7 +380,7 @@ int image_util_decode_run(image_util_decode_h handle, unsigned long *width, unsi
 
 gpointer _image_util_decode_thread(gpointer data)
 {
-       decode_encode_s *_handle = (decode_encode_s *) data;
+       decode_s *_handle = (decode_s *) data;
        int err = IMAGE_UTIL_ERROR_NONE;
 
        image_util_fenter();
@@ -406,7 +405,7 @@ gpointer _image_util_decode_thread(gpointer data)
        return NULL;
 }
 
-static int _image_util_decode_create_thread(decode_encode_s * handle)
+static int _image_util_decode_create_thread(decode_s * handle)
 {
        image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
        image_util_retvm_if((handle->thread != NULL), IMAGE_UTIL_ERROR_INVALID_OPERATION, "A thread is alread running");
@@ -424,7 +423,7 @@ static int _image_util_decode_create_thread(decode_encode_s * handle)
 int image_util_decode_run_async(image_util_decode_h handle, image_util_decode_completed_cb completed_cb, void *user_data)
 {
        int err = IMAGE_UTIL_ERROR_NONE;
-       decode_encode_s *_handle = (decode_encode_s *) handle;
+       decode_s *_handle = (decode_s *) handle;
 
        image_util_fenter();
 
@@ -458,7 +457,7 @@ int image_util_decode_run_async(image_util_decode_h handle, image_util_decode_co
 
 int image_util_decode_destroy(image_util_decode_h handle)
 {
-       decode_encode_s *_handle = (decode_encode_s *) handle;
+       decode_s *_handle = (decode_s *) handle;
 
        image_util_fenter();