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__);
445 ALOGV("%s:: CSC_METHOD=%d", __func__, csc_handle->csc_method);
450 static CSC_ERRORCODE csc_set_format(
453 CSC_HANDLE *csc_handle;
454 CSC_ERRORCODE ret = CSC_ErrorNone;
457 return CSC_ErrorNotInit;
459 csc_handle = (CSC_HANDLE *)handle;
460 if (csc_handle->csc_method == CSC_METHOD_HW) {
461 switch (csc_handle->csc_hw_type) {
462 case CSC_HW_TYPE_FIMC:
464 #ifdef ENABLE_GSCALER
465 case CSC_HW_TYPE_GSCALER:
466 exynos_gsc_set_src_format(
467 csc_handle->csc_hw_handle,
468 ALIGN(csc_handle->src_format.width, GSCALER_IMG_ALIGN),
469 ALIGN(csc_handle->src_format.height, GSCALER_IMG_ALIGN),
470 csc_handle->src_format.crop_left,
471 csc_handle->src_format.crop_top,
472 csc_handle->src_format.crop_width,
473 csc_handle->src_format.crop_height,
474 HAL_PIXEL_FORMAT_2_V4L2_PIX(csc_handle->src_format.color_format),
475 csc_handle->src_format.cacheable,
476 csc_handle->hw_property.mode_drm);
478 exynos_gsc_set_dst_format(
479 csc_handle->csc_hw_handle,
480 ALIGN(csc_handle->dst_format.width, GSCALER_IMG_ALIGN),
481 ALIGN(csc_handle->dst_format.height, GSCALER_IMG_ALIGN),
482 csc_handle->dst_format.crop_left,
483 csc_handle->dst_format.crop_top,
484 csc_handle->dst_format.crop_width,
485 csc_handle->dst_format.crop_height,
486 HAL_PIXEL_FORMAT_2_V4L2_PIX(csc_handle->dst_format.color_format),
487 csc_handle->dst_format.cacheable,
488 csc_handle->hw_property.mode_drm);
492 ALOGE("%s:: unsupported csc_hw_type", __func__);
500 static CSC_ERRORCODE csc_set_buffer(
503 CSC_HANDLE *csc_handle;
504 CSC_ERRORCODE ret = CSC_ErrorNone;
505 #ifdef ENABLE_GSCALER
506 void *src_addr[3] = {NULL, };
507 void *dst_addr[3] = {NULL, };
511 return CSC_ErrorNotInit;
513 csc_handle = (CSC_HANDLE *)handle;
514 if (csc_handle->csc_method == CSC_METHOD_HW) {
515 #ifdef ENABLE_GSCALER
516 src_addr[0] = csc_handle->src_buffer.planes[CSC_Y_PLANE];
517 src_addr[1] = csc_handle->src_buffer.planes[CSC_U_PLANE];
518 src_addr[2] = csc_handle->src_buffer.planes[CSC_V_PLANE];
519 dst_addr[0] = csc_handle->dst_buffer.planes[CSC_Y_PLANE];
520 dst_addr[1] = csc_handle->dst_buffer.planes[CSC_U_PLANE];
521 dst_addr[2] = csc_handle->dst_buffer.planes[CSC_V_PLANE];
524 switch (csc_handle->csc_hw_type) {
525 case CSC_HW_TYPE_FIMC:
527 #ifdef ENABLE_GSCALER
528 case CSC_HW_TYPE_GSCALER:
529 exynos_gsc_set_src_addr(csc_handle->csc_hw_handle, src_addr);
530 exynos_gsc_set_dst_addr(csc_handle->csc_hw_handle, dst_addr);
534 ALOGE("%s:: unsupported csc_hw_type", __func__);
545 CSC_HANDLE *csc_handle;
546 csc_handle = (CSC_HANDLE *)malloc(sizeof(CSC_HANDLE));
547 if (csc_handle == NULL)
550 memset(csc_handle, 0, sizeof(CSC_HANDLE));
551 csc_handle->hw_property.fixed_node = -1;
552 csc_handle->hw_property.mode_drm = 0;
553 csc_handle->csc_method = method;
555 return (void *)csc_handle;
558 CSC_ERRORCODE csc_deinit(
561 CSC_ERRORCODE ret = CSC_ErrorNone;
562 CSC_HANDLE *csc_handle;
564 csc_handle = (CSC_HANDLE *)handle;
565 if (csc_handle->csc_method == CSC_METHOD_HW) {
566 switch (csc_handle->csc_hw_type) {
568 case CSC_HW_TYPE_FIMC:
569 csc_hwconverter_close(csc_handle->csc_hw_handle);
572 #ifdef ENABLE_GSCALER
573 case CSC_HW_TYPE_GSCALER:
574 exynos_gsc_destroy(csc_handle->csc_hw_handle);
578 ALOGE("%s:: unsupported csc_hw_type", __func__);
583 if (csc_handle != NULL) {
591 CSC_ERRORCODE csc_get_method(
595 CSC_HANDLE *csc_handle;
596 CSC_ERRORCODE ret = CSC_ErrorNone;
599 return CSC_ErrorNotInit;
601 csc_handle = (CSC_HANDLE *)handle;
602 *method = csc_handle->csc_method;
607 CSC_ERRORCODE csc_set_hw_property(
609 CSC_HW_PROPERTY_TYPE property,
612 CSC_HANDLE *csc_handle;
613 CSC_ERRORCODE ret = CSC_ErrorNone;
616 return CSC_ErrorNotInit;
618 csc_handle = (CSC_HANDLE *)handle;
620 case CSC_HW_PROPERTY_FIXED_NODE:
621 csc_handle->hw_property.fixed_node = value;
623 case CSC_HW_PROPERTY_MODE_DRM:
624 csc_handle->hw_property.mode_drm = value;
627 ALOGE("%s:: not supported hw property", __func__);
628 ret = CSC_ErrorUnsupportFormat;
634 CSC_ERRORCODE csc_get_src_format(
637 unsigned int *height,
638 unsigned int *crop_left,
639 unsigned int *crop_top,
640 unsigned int *crop_width,
641 unsigned int *crop_height,
642 unsigned int *color_format,
643 unsigned int *cacheable)
645 CSC_HANDLE *csc_handle;
646 CSC_ERRORCODE ret = CSC_ErrorNone;
649 return CSC_ErrorNotInit;
651 csc_handle = (CSC_HANDLE *)handle;
652 *width = csc_handle->src_format.width;
653 *height = csc_handle->src_format.height;
654 *crop_left = csc_handle->src_format.crop_left;
655 *crop_top = csc_handle->src_format.crop_top;
656 *crop_width = csc_handle->src_format.crop_width;
657 *crop_height = csc_handle->src_format.crop_height;
658 *color_format = csc_handle->src_format.color_format;
659 *cacheable = csc_handle->src_format.cacheable;
664 CSC_ERRORCODE csc_set_src_format(
668 unsigned int crop_left,
669 unsigned int crop_top,
670 unsigned int crop_width,
671 unsigned int crop_height,
672 unsigned int color_format,
673 unsigned int cacheable)
675 CSC_HANDLE *csc_handle;
676 CSC_ERRORCODE ret = CSC_ErrorNone;
679 return CSC_ErrorNotInit;
681 csc_handle = (CSC_HANDLE *)handle;
682 csc_handle->src_format.width = width;
683 csc_handle->src_format.height = height;
684 csc_handle->src_format.crop_left = crop_left;
685 csc_handle->src_format.crop_top = crop_top;
686 csc_handle->src_format.crop_width = crop_width;
687 csc_handle->src_format.crop_height = crop_height;
688 csc_handle->src_format.color_format = color_format;
689 csc_handle->src_format.cacheable = cacheable;
694 CSC_ERRORCODE csc_get_dst_format(
697 unsigned int *height,
698 unsigned int *crop_left,
699 unsigned int *crop_top,
700 unsigned int *crop_width,
701 unsigned int *crop_height,
702 unsigned int *color_format,
703 unsigned int *cacheable)
705 CSC_HANDLE *csc_handle;
706 CSC_ERRORCODE ret = CSC_ErrorNone;
709 return CSC_ErrorNotInit;
711 csc_handle = (CSC_HANDLE *)handle;
712 *width = csc_handle->dst_format.width;
713 *height = csc_handle->dst_format.height;
714 *crop_left = csc_handle->dst_format.crop_left;
715 *crop_top = csc_handle->dst_format.crop_top;
716 *crop_width = csc_handle->dst_format.crop_width;
717 *crop_height = csc_handle->dst_format.crop_height;
718 *color_format = csc_handle->dst_format.color_format;
719 *cacheable = csc_handle->dst_format.cacheable;
724 CSC_ERRORCODE csc_set_dst_format(
728 unsigned int crop_left,
729 unsigned int crop_top,
730 unsigned int crop_width,
731 unsigned int crop_height,
732 unsigned int color_format,
733 unsigned int cacheable)
735 CSC_HANDLE *csc_handle;
736 CSC_ERRORCODE ret = CSC_ErrorNone;
739 return CSC_ErrorNotInit;
741 csc_handle = (CSC_HANDLE *)handle;
742 csc_handle->dst_format.width = width;
743 csc_handle->dst_format.height = height;
744 csc_handle->dst_format.crop_left = crop_left;
745 csc_handle->dst_format.crop_top = crop_top;
746 csc_handle->dst_format.crop_width = crop_width;
747 csc_handle->dst_format.crop_height = crop_height;
748 csc_handle->dst_format.color_format = color_format;
749 csc_handle->dst_format.cacheable = cacheable;
754 CSC_ERRORCODE csc_set_src_buffer(
761 CSC_HANDLE *csc_handle;
762 CSC_ERRORCODE ret = CSC_ErrorNone;
765 return CSC_ErrorNotInit;
767 csc_handle = (CSC_HANDLE *)handle;
768 csc_handle->src_buffer.planes[CSC_Y_PLANE] = y;
769 csc_handle->src_buffer.planes[CSC_U_PLANE] = u;
770 csc_handle->src_buffer.planes[CSC_V_PLANE] = v;
775 CSC_ERRORCODE csc_set_dst_buffer(
782 CSC_HANDLE *csc_handle;
783 CSC_ERRORCODE ret = CSC_ErrorNone;
786 return CSC_ErrorNotInit;
788 csc_handle = (CSC_HANDLE *)handle;
789 csc_handle->dst_buffer.planes[CSC_Y_PLANE] = y;
790 csc_handle->dst_buffer.planes[CSC_U_PLANE] = u;
791 csc_handle->dst_buffer.planes[CSC_V_PLANE] = v;
796 CSC_ERRORCODE csc_convert(
799 CSC_HANDLE *csc_handle = (CSC_HANDLE *)handle;
800 CSC_ERRORCODE ret = CSC_ErrorNone;
802 if (csc_handle == NULL)
803 return CSC_ErrorNotInit;
805 if ((csc_handle->csc_method == CSC_METHOD_HW) &&
806 (csc_handle->csc_hw_handle == NULL))
809 csc_set_format(csc_handle);
810 csc_set_buffer(csc_handle);
812 if (csc_handle->csc_method == CSC_METHOD_HW) {
814 ret = conv_hw(csc_handle);
818 ret = conv_sw(csc_handle);
819 ALOGE("after conv_sw");