3 * Copyright 2012 Samsung Electronics S.LSI Co. LTD
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
21 * @brief color space convertion abstract source
23 * @author Pyoungjae Jung(pjet.jung@samsung.com)
30 #define LOG_TAG "libcsc"
31 #ifndef TIZEN_FEATURE_E3250 /* build env */
32 #include <cutils/log.h>
38 #ifndef TIZEN_FEATURE_E3250 /* build env */
39 #include <utils/Log.h>
40 #include <system/graphics.h>
42 #include "Exynos_OSAL_Log.h"
47 #include "exynos_format.h"
48 #include "swconverter.h"
50 #ifdef TIZEN_FEATURE_E3250 /* build env */
55 #include "Exynos_OMX_Def.h"
57 #include "SEC_OMX_Def.h"
61 #include "hwconverter_wrapper.h"
65 #include "exynos_gscaler.h"
68 #define GSCALER_IMG_ALIGN 16
69 #define CSC_MAX_PLANES 3
70 #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
72 typedef enum _CSC_PLANE {
80 typedef enum _CSC_HW_TYPE {
85 typedef struct _CSC_FORMAT {
88 unsigned int crop_left;
89 unsigned int crop_top;
90 unsigned int crop_width;
91 unsigned int crop_height;
92 unsigned int color_format;
93 unsigned int cacheable;
94 unsigned int mode_drm;
97 typedef struct _CSC_BUFFER {
98 unsigned char *planes[CSC_MAX_PLANES];
102 typedef struct _CSC_HW_PROPERTY {
107 typedef struct _CSC_HANDLE {
108 CSC_FORMAT dst_format;
109 CSC_FORMAT src_format;
110 CSC_BUFFER dst_buffer;
111 CSC_BUFFER src_buffer;
112 CSC_METHOD csc_method;
113 CSC_HW_TYPE csc_hw_type;
115 CSC_HW_PROPERTY hw_property;
118 /* source is RGB888 */
119 static CSC_ERRORCODE conv_sw_src_argb888(
122 CSC_ERRORCODE ret = CSC_ErrorNone;
124 switch (handle->dst_format.color_format) {
125 case HAL_PIXEL_FORMAT_YCbCr_420_P:
126 csc_ARGB8888_to_YUV420P(
127 (unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
128 (unsigned char *)handle->dst_buffer.planes[CSC_U_PLANE],
129 (unsigned char *)handle->dst_buffer.planes[CSC_V_PLANE],
130 (unsigned char *)handle->src_buffer.planes[CSC_RGB_PLANE],
131 handle->src_format.width,
132 handle->src_format.height);
135 case HAL_PIXEL_FORMAT_YCbCr_420_SP:
137 csc_ARGB8888_to_YUV420SP_NEON(
139 csc_ARGB8888_to_YUV420SP(
141 (unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
142 (unsigned char *)handle->dst_buffer.planes[CSC_UV_PLANE],
143 (unsigned char *)handle->src_buffer.planes[CSC_RGB_PLANE],
144 handle->src_format.width,
145 handle->src_format.height);
149 ret = CSC_ErrorUnsupportFormat;
156 /* source is NV12T */
157 static CSC_ERRORCODE conv_sw_src_nv12t(
160 CSC_ERRORCODE ret = CSC_ErrorNone;
162 switch (handle->dst_format.color_format) {
163 case HAL_PIXEL_FORMAT_YCbCr_420_P:
164 ALOGE("dst_format HAL_PIXEL_FORMAT_YCbCr_420_P");
166 csc_tiled_to_linear_y_neon(
168 csc_tiled_to_linear_y(
170 (unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
171 (unsigned char *)handle->src_buffer.planes[CSC_Y_PLANE],
172 handle->src_format.width,
173 handle->src_format.height);
175 csc_tiled_to_linear_uv_deinterleave_neon(
177 csc_tiled_to_linear_uv_deinterleave(
179 (unsigned char *)handle->dst_buffer.planes[CSC_U_PLANE],
180 (unsigned char *)handle->dst_buffer.planes[CSC_V_PLANE],
181 (unsigned char *)handle->src_buffer.planes[CSC_UV_PLANE],
182 handle->src_format.width,
183 handle->src_format.height / 2);
186 case HAL_PIXEL_FORMAT_YCbCr_420_SP:
187 ALOGE("dst_format HAL_PIXEL_FORMAT_YCbCr_420_SP");
189 csc_tiled_to_linear_y_neon(
191 csc_tiled_to_linear_y(
193 (unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
194 (unsigned char *)handle->src_buffer.planes[CSC_Y_PLANE],
195 handle->src_format.width,
196 handle->src_format.height);
198 csc_tiled_to_linear_uv_neon(
200 csc_tiled_to_linear_uv(
202 (unsigned char *)handle->dst_buffer.planes[CSC_UV_PLANE],
203 (unsigned char *)handle->src_buffer.planes[CSC_UV_PLANE],
204 handle->src_format.width,
205 handle->src_format.height / 2);
207 #ifdef OUTPUT_FILE_DUMP
211 static int tmp_cnt=0;
212 int w = handle->dst_buffer.width;
213 int h = handle->dst_buffer.height;
215 memset(filename, 0x00, sizeof(filename));
216 sprintf(filename, "/tmp/dec_dump_%d_%d_%d.yuv", w, h, ++tmp_cnt);
218 pf = fopen(filename, "wb");
220 ALOGE("[file dump] filepoint NULL!");
222 ALOGE("[file dump] fwrite[%d]", tmp_cnt);
223 fwrite(handle->dst_buffer.planes[CSC_Y_PLANE], sizeof(char), w * h, pf);
224 fwrite(handle->dst_buffer.planes[CSC_UV_PLANE], sizeof(char), w * h / 2, pf);
231 ALOGE("dst_format CSC_ErrorUnsupportFormat");
232 ret = CSC_ErrorUnsupportFormat;
239 void csc_interleave_memcpy_neon(
243 unsigned int src_size);
245 /* source is YUV420P */
246 static CSC_ERRORCODE conv_sw_src_yuv420p(
249 CSC_ERRORCODE ret = CSC_ErrorNone;
251 switch (handle->dst_format.color_format) {
252 case HAL_PIXEL_FORMAT_YCbCr_420_P: /* bypass */
253 memcpy((unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
254 (unsigned char *)handle->src_buffer.planes[CSC_Y_PLANE],
255 handle->src_format.width * handle->src_format.height);
256 memcpy((unsigned char *)handle->dst_buffer.planes[CSC_U_PLANE],
257 (unsigned char *)handle->src_buffer.planes[CSC_U_PLANE],
258 (handle->src_format.width * handle->src_format.height) >> 2);
259 memcpy((unsigned char *)handle->dst_buffer.planes[CSC_V_PLANE],
260 (unsigned char *)handle->src_buffer.planes[CSC_V_PLANE],
261 (handle->src_format.width * handle->src_format.height) >> 2);
264 case HAL_PIXEL_FORMAT_YCbCr_420_SP:
265 memcpy((unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
266 (unsigned char *)handle->src_buffer.planes[CSC_Y_PLANE],
267 handle->src_format.width * handle->src_format.height);
269 csc_interleave_memcpy_neon(
271 csc_interleave_memcpy(
273 (unsigned char *)handle->dst_buffer.planes[CSC_UV_PLANE],
274 (unsigned char *)handle->src_buffer.planes[CSC_U_PLANE],
275 (unsigned char *)handle->src_buffer.planes[CSC_V_PLANE],
276 (handle->src_format.width * handle->src_format.height) >> 2);
280 ret = CSC_ErrorUnsupportFormat;
287 /* source is YUV420SP */
288 static CSC_ERRORCODE conv_sw_src_yuv420sp(
291 CSC_ERRORCODE ret = CSC_ErrorNone;
293 switch (handle->dst_format.color_format) {
294 case HAL_PIXEL_FORMAT_YCbCr_420_P:
295 memcpy((unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
296 (unsigned char *)handle->src_buffer.planes[CSC_Y_PLANE],
297 handle->src_format.width * handle->src_format.height);
298 csc_deinterleave_memcpy(
299 (unsigned char *)handle->dst_buffer.planes[CSC_U_PLANE],
300 (unsigned char *)handle->dst_buffer.planes[CSC_V_PLANE],
301 (unsigned char *)handle->src_buffer.planes[CSC_UV_PLANE],
302 handle->src_format.width * handle->src_format.height >> 1);
305 case HAL_PIXEL_FORMAT_YCbCr_420_SP: /* bypass */
306 memcpy((unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
307 (unsigned char *)handle->src_buffer.planes[CSC_Y_PLANE],
308 handle->src_format.width * handle->src_format.height);
309 memcpy((unsigned char *)handle->dst_buffer.planes[CSC_UV_PLANE],
310 (unsigned char *)handle->src_buffer.planes[CSC_UV_PLANE],
311 handle->src_format.width * handle->src_format.height >> 1);
315 ret = CSC_ErrorUnsupportFormat;
322 static CSC_ERRORCODE conv_sw(
325 CSC_ERRORCODE ret = CSC_ErrorNone;
327 ALOGE("%s:: handle->src_format.color_format = %d", __func__, handle->src_format.color_format);
328 switch (handle->src_format.color_format) {
329 case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
330 ALOGE("src_format HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED");
331 ret = conv_sw_src_nv12t(handle);
333 case HAL_PIXEL_FORMAT_YCbCr_420_P:
334 ALOGE("src_format HAL_PIXEL_FORMAT_YCbCr_420_P");
335 ret = conv_sw_src_yuv420p(handle);
337 case HAL_PIXEL_FORMAT_YCbCr_420_SP:
338 ALOGE("src_format HAL_PIXEL_FORMAT_YCbCr_420_SP");
339 ret = conv_sw_src_yuv420sp(handle);
341 case HAL_PIXEL_FORMAT_ARGB888:
342 ALOGE("src_format HAL_PIXEL_FORMAT_ARGB888");
343 ret = conv_sw_src_argb888(handle);
346 ret = CSC_ErrorUnsupportFormat;
353 static CSC_ERRORCODE conv_hw(
356 CSC_ERRORCODE ret = CSC_ErrorNone;
357 switch (handle->csc_hw_type) {
359 case CSC_HW_TYPE_FIMC:
363 OMX_COLOR_FORMATTYPE src_omx_format;
364 OMX_COLOR_FORMATTYPE dst_omx_format;
365 src_addr[0] = handle->src_buffer.planes[CSC_Y_PLANE];
366 src_addr[1] = handle->src_buffer.planes[CSC_UV_PLANE];
367 dst_addr[0] = handle->dst_buffer.planes[CSC_Y_PLANE];
368 dst_addr[1] = handle->dst_buffer.planes[CSC_U_PLANE];
369 dst_addr[2] = handle->dst_buffer.planes[CSC_V_PLANE];
370 src_omx_format = hal_2_omx_pixel_format(handle->src_format.color_format);
371 dst_omx_format = hal_2_omx_pixel_format(handle->dst_format.color_format);
372 csc_hwconverter_convert_nv12t(
373 handle->csc_hw_handle,
376 handle->dst_format.width,
377 handle->dst_format.height,
383 #ifdef ENABLE_GSCALER
384 case CSC_HW_TYPE_GSCALER:
385 if (exynos_gsc_convert(handle->csc_hw_handle) != 0) {
386 ALOGE("%s:: exynos_gsc_convert() fail", __func__);
392 ALOGE("%s:: unsupported csc_hw_type(%d)", __func__, handle->csc_hw_type);
393 ret = CSC_ErrorNotImplemented;
400 static CSC_ERRORCODE csc_init_hw(
403 CSC_HANDLE *csc_handle;
404 CSC_ERRORCODE ret = CSC_ErrorNone;
406 csc_handle = (CSC_HANDLE *)handle;
407 if (csc_handle->csc_method == CSC_METHOD_HW) {
409 csc_handle->csc_hw_type = CSC_HW_TYPE_FIMC;
411 #ifdef ENABLE_GSCALER
412 csc_handle->csc_hw_type = CSC_HW_TYPE_GSCALER;
414 switch (csc_handle->csc_hw_type) {
416 case CSC_HW_TYPE_FIMC:
417 csc_handle->csc_hw_handle = csc_hwconverter_open();
418 ALOGV("%s:: CSC_HW_TYPE_FIMC", __func__);
421 #ifdef ENABLE_GSCALER
422 case CSC_HW_TYPE_GSCALER:
423 if (csc_handle->hw_property.fixed_node >= 0)
424 csc_handle->csc_hw_handle = exynos_gsc_create_exclusive(csc_handle->hw_property.fixed_node, GSC_M2M_MODE, 0);
426 csc_handle->csc_hw_handle = exynos_gsc_create();
427 ALOGV("%s:: CSC_HW_TYPE_GSCALER", __func__);
431 ALOGE("%s:: unsupported csc_hw_type, csc use sw", __func__);
432 csc_handle->csc_hw_handle = NULL;
437 if (csc_handle->csc_method == CSC_METHOD_HW) {
438 if (csc_handle->csc_hw_handle == NULL) {
439 ALOGE("%s:: CSC_METHOD_HW can't open HW", __func__);
442 return CSC_ErrorNotInit;
446 ALOGV("%s:: CSC_METHOD=%d", __func__, csc_handle->csc_method);
451 static CSC_ERRORCODE csc_set_format(
454 CSC_HANDLE *csc_handle;
455 CSC_ERRORCODE ret = CSC_ErrorNone;
458 return CSC_ErrorNotInit;
460 csc_handle = (CSC_HANDLE *)handle;
461 if (csc_handle->csc_method == CSC_METHOD_HW) {
462 switch (csc_handle->csc_hw_type) {
463 case CSC_HW_TYPE_FIMC:
465 #ifdef ENABLE_GSCALER
466 case CSC_HW_TYPE_GSCALER:
467 exynos_gsc_set_src_format(
468 csc_handle->csc_hw_handle,
469 ALIGN(csc_handle->src_format.width, GSCALER_IMG_ALIGN),
470 ALIGN(csc_handle->src_format.height, GSCALER_IMG_ALIGN),
471 csc_handle->src_format.crop_left,
472 csc_handle->src_format.crop_top,
473 csc_handle->src_format.crop_width,
474 csc_handle->src_format.crop_height,
475 HAL_PIXEL_FORMAT_2_V4L2_PIX(csc_handle->src_format.color_format),
476 csc_handle->src_format.cacheable,
477 csc_handle->hw_property.mode_drm);
479 exynos_gsc_set_dst_format(
480 csc_handle->csc_hw_handle,
481 ALIGN(csc_handle->dst_format.width, GSCALER_IMG_ALIGN),
482 ALIGN(csc_handle->dst_format.height, GSCALER_IMG_ALIGN),
483 csc_handle->dst_format.crop_left,
484 csc_handle->dst_format.crop_top,
485 csc_handle->dst_format.crop_width,
486 csc_handle->dst_format.crop_height,
487 HAL_PIXEL_FORMAT_2_V4L2_PIX(csc_handle->dst_format.color_format),
488 csc_handle->dst_format.cacheable,
489 csc_handle->hw_property.mode_drm);
493 ALOGE("%s:: unsupported csc_hw_type", __func__);
501 static CSC_ERRORCODE csc_set_buffer(
504 CSC_HANDLE *csc_handle;
505 CSC_ERRORCODE ret = CSC_ErrorNone;
506 #ifdef ENABLE_GSCALER
507 void *src_addr[3] = {NULL, };
508 void *dst_addr[3] = {NULL, };
512 return CSC_ErrorNotInit;
514 csc_handle = (CSC_HANDLE *)handle;
515 if (csc_handle->csc_method == CSC_METHOD_HW) {
516 #ifdef ENABLE_GSCALER
517 src_addr[0] = csc_handle->src_buffer.planes[CSC_Y_PLANE];
518 src_addr[1] = csc_handle->src_buffer.planes[CSC_U_PLANE];
519 src_addr[2] = csc_handle->src_buffer.planes[CSC_V_PLANE];
520 dst_addr[0] = csc_handle->dst_buffer.planes[CSC_Y_PLANE];
521 dst_addr[1] = csc_handle->dst_buffer.planes[CSC_U_PLANE];
522 dst_addr[2] = csc_handle->dst_buffer.planes[CSC_V_PLANE];
525 switch (csc_handle->csc_hw_type) {
526 case CSC_HW_TYPE_FIMC:
528 #ifdef ENABLE_GSCALER
529 case CSC_HW_TYPE_GSCALER:
530 exynos_gsc_set_src_addr(csc_handle->csc_hw_handle, src_addr);
531 exynos_gsc_set_dst_addr(csc_handle->csc_hw_handle, dst_addr);
535 ALOGE("%s:: unsupported csc_hw_type", __func__);
546 CSC_HANDLE *csc_handle;
547 csc_handle = (CSC_HANDLE *)malloc(sizeof(CSC_HANDLE));
548 if (csc_handle == NULL)
551 memset(csc_handle, 0, sizeof(CSC_HANDLE));
552 csc_handle->hw_property.fixed_node = -1;
553 csc_handle->hw_property.mode_drm = 0;
554 csc_handle->csc_method = method;
556 return (void *)csc_handle;
559 CSC_ERRORCODE csc_deinit(
562 CSC_ERRORCODE ret = CSC_ErrorNone;
563 CSC_HANDLE *csc_handle;
565 csc_handle = (CSC_HANDLE *)handle;
566 if (csc_handle->csc_method == CSC_METHOD_HW) {
567 switch (csc_handle->csc_hw_type) {
569 case CSC_HW_TYPE_FIMC:
570 csc_hwconverter_close(csc_handle->csc_hw_handle);
573 #ifdef ENABLE_GSCALER
574 case CSC_HW_TYPE_GSCALER:
575 exynos_gsc_destroy(csc_handle->csc_hw_handle);
579 ALOGE("%s:: unsupported csc_hw_type", __func__);
584 if (csc_handle != NULL) {
592 CSC_ERRORCODE csc_get_method(
596 CSC_HANDLE *csc_handle;
597 CSC_ERRORCODE ret = CSC_ErrorNone;
600 return CSC_ErrorNotInit;
602 csc_handle = (CSC_HANDLE *)handle;
603 *method = csc_handle->csc_method;
608 CSC_ERRORCODE csc_set_hw_property(
610 CSC_HW_PROPERTY_TYPE property,
613 CSC_HANDLE *csc_handle;
614 CSC_ERRORCODE ret = CSC_ErrorNone;
617 return CSC_ErrorNotInit;
619 csc_handle = (CSC_HANDLE *)handle;
621 case CSC_HW_PROPERTY_FIXED_NODE:
622 csc_handle->hw_property.fixed_node = value;
624 case CSC_HW_PROPERTY_MODE_DRM:
625 csc_handle->hw_property.mode_drm = value;
628 ALOGE("%s:: not supported hw property", __func__);
629 ret = CSC_ErrorUnsupportFormat;
635 CSC_ERRORCODE csc_get_src_format(
638 unsigned int *height,
639 unsigned int *crop_left,
640 unsigned int *crop_top,
641 unsigned int *crop_width,
642 unsigned int *crop_height,
643 unsigned int *color_format,
644 unsigned int *cacheable)
646 CSC_HANDLE *csc_handle;
647 CSC_ERRORCODE ret = CSC_ErrorNone;
650 return CSC_ErrorNotInit;
652 csc_handle = (CSC_HANDLE *)handle;
653 *width = csc_handle->src_format.width;
654 *height = csc_handle->src_format.height;
655 *crop_left = csc_handle->src_format.crop_left;
656 *crop_top = csc_handle->src_format.crop_top;
657 *crop_width = csc_handle->src_format.crop_width;
658 *crop_height = csc_handle->src_format.crop_height;
659 *color_format = csc_handle->src_format.color_format;
660 *cacheable = csc_handle->src_format.cacheable;
665 CSC_ERRORCODE csc_set_src_format(
669 unsigned int crop_left,
670 unsigned int crop_top,
671 unsigned int crop_width,
672 unsigned int crop_height,
673 unsigned int color_format,
674 unsigned int cacheable)
676 CSC_HANDLE *csc_handle;
677 CSC_ERRORCODE ret = CSC_ErrorNone;
680 return CSC_ErrorNotInit;
682 csc_handle = (CSC_HANDLE *)handle;
683 csc_handle->src_format.width = width;
684 csc_handle->src_format.height = height;
685 csc_handle->src_format.crop_left = crop_left;
686 csc_handle->src_format.crop_top = crop_top;
687 csc_handle->src_format.crop_width = crop_width;
688 csc_handle->src_format.crop_height = crop_height;
689 csc_handle->src_format.color_format = color_format;
690 csc_handle->src_format.cacheable = cacheable;
695 CSC_ERRORCODE csc_get_dst_format(
698 unsigned int *height,
699 unsigned int *crop_left,
700 unsigned int *crop_top,
701 unsigned int *crop_width,
702 unsigned int *crop_height,
703 unsigned int *color_format,
704 unsigned int *cacheable)
706 CSC_HANDLE *csc_handle;
707 CSC_ERRORCODE ret = CSC_ErrorNone;
710 return CSC_ErrorNotInit;
712 csc_handle = (CSC_HANDLE *)handle;
713 *width = csc_handle->dst_format.width;
714 *height = csc_handle->dst_format.height;
715 *crop_left = csc_handle->dst_format.crop_left;
716 *crop_top = csc_handle->dst_format.crop_top;
717 *crop_width = csc_handle->dst_format.crop_width;
718 *crop_height = csc_handle->dst_format.crop_height;
719 *color_format = csc_handle->dst_format.color_format;
720 *cacheable = csc_handle->dst_format.cacheable;
725 CSC_ERRORCODE csc_set_dst_format(
729 unsigned int crop_left,
730 unsigned int crop_top,
731 unsigned int crop_width,
732 unsigned int crop_height,
733 unsigned int color_format,
734 unsigned int cacheable)
736 CSC_HANDLE *csc_handle;
737 CSC_ERRORCODE ret = CSC_ErrorNone;
740 return CSC_ErrorNotInit;
742 csc_handle = (CSC_HANDLE *)handle;
743 csc_handle->dst_format.width = width;
744 csc_handle->dst_format.height = height;
745 csc_handle->dst_format.crop_left = crop_left;
746 csc_handle->dst_format.crop_top = crop_top;
747 csc_handle->dst_format.crop_width = crop_width;
748 csc_handle->dst_format.crop_height = crop_height;
749 csc_handle->dst_format.color_format = color_format;
750 csc_handle->dst_format.cacheable = cacheable;
755 CSC_ERRORCODE csc_set_src_buffer(
762 CSC_HANDLE *csc_handle;
763 CSC_ERRORCODE ret = CSC_ErrorNone;
766 return CSC_ErrorNotInit;
768 csc_handle = (CSC_HANDLE *)handle;
769 csc_handle->src_buffer.planes[CSC_Y_PLANE] = y;
770 csc_handle->src_buffer.planes[CSC_U_PLANE] = u;
771 csc_handle->src_buffer.planes[CSC_V_PLANE] = v;
776 CSC_ERRORCODE csc_set_dst_buffer(
783 CSC_HANDLE *csc_handle;
784 CSC_ERRORCODE ret = CSC_ErrorNone;
787 return CSC_ErrorNotInit;
789 csc_handle = (CSC_HANDLE *)handle;
790 csc_handle->dst_buffer.planes[CSC_Y_PLANE] = y;
791 csc_handle->dst_buffer.planes[CSC_U_PLANE] = u;
792 csc_handle->dst_buffer.planes[CSC_V_PLANE] = v;
797 CSC_ERRORCODE csc_convert(
800 CSC_HANDLE *csc_handle = (CSC_HANDLE *)handle;
801 CSC_ERRORCODE ret = CSC_ErrorNone;
803 if (csc_handle == NULL)
804 return CSC_ErrorNotInit;
806 if ((csc_handle->csc_method == CSC_METHOD_HW) &&
807 (csc_handle->csc_hw_handle == NULL))
808 ret = csc_init_hw(handle);
810 if (ret != CSC_ErrorNone)
813 csc_set_format(csc_handle);
814 csc_set_buffer(csc_handle);
816 if (csc_handle->csc_method == CSC_METHOD_HW) {
818 ret = conv_hw(csc_handle);
822 ret = conv_sw(csc_handle);
823 ALOGE("after conv_sw");