summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libstagefrighthw/Android.mk25
-rw-r--r--libstagefrighthw/SEC_OMX_Plugin.cpp147
-rw-r--r--libstagefrighthw/SEC_OMX_Plugin.h76
-rw-r--r--sec_mm/Android.mk6
-rw-r--r--sec_mm/sec_omx/sec_codecs/Android.mk2
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/Android.mk36
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/color_space_convertor.c1092
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_deinterleave_memcpy.s128
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_interleave_memcpy.s133
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_nv12t_yuv420_uv_neon.s768
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_nv12t_yuv420_y_neon.s680
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_yuv420_nv12t_uv_neon.s573
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_yuv420_nv12t_y_neon.s451
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/Android.mk2
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c185
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/Android.mk2
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c62
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h30
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/color_space_convertor.h176
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h14
-rw-r--r--sec_mm/sec_omx/sec_omx_component/common/Android.mk2
-rw-r--r--sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.c18
-rw-r--r--sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c6
-rw-r--r--sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h8
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c100
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h28
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/Android.mk9
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c497
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.h7
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/library_register.c4
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/library_register.h4
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/Android.mk7
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c448
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.h7
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/library_register.c8
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/library_register.h8
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c122
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h31
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/Android.mk9
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c412
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.h9
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/library_register.c18
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/library_register.h4
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/Android.mk7
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c477
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.h7
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/library_register.c26
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/library_register.h8
-rw-r--r--sec_mm/sec_omx/sec_omx_core/Android.mk2
-rw-r--r--sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Def.h106
-rw-r--r--sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Macros.h26
-rw-r--r--sec_mm/sec_omx/sec_osal/Android.mk18
-rw-r--r--sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.cpp450
-rw-r--r--sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.h64
-rw-r--r--sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h5
-rw-r--r--sec_mm/sec_omx/sec_osal/SEC_OSAL_Semaphore.c2
-rw-r--r--sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.c4
-rw-r--r--sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.h4
58 files changed, 6799 insertions, 761 deletions
diff --git a/libstagefrighthw/Android.mk b/libstagefrighthw/Android.mk
new file mode 100644
index 0000000..c66ea66
--- /dev/null
+++ b/libstagefrighthw/Android.mk
@@ -0,0 +1,25 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ SEC_OMX_Plugin.cpp
+
+LOCAL_CFLAGS += $(PV_CFLAGS_MINUS_VISIBILITY)
+
+LOCAL_C_INCLUDES:= \
+ $(TOP)/frameworks/base/include/media/stagefright/openmax \
+ $(LOCAL_PATH)/../include \
+
+LOCAL_SHARED_LIBRARIES := \
+ libbinder \
+ libutils \
+ libcutils \
+ libui \
+ libdl \
+
+LOCAL_MODULE := libstagefrighthw
+
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_SHARED_LIBRARY)
+
+
diff --git a/libstagefrighthw/SEC_OMX_Plugin.cpp b/libstagefrighthw/SEC_OMX_Plugin.cpp
new file mode 100644
index 0000000..0bb70c5
--- /dev/null
+++ b/libstagefrighthw/SEC_OMX_Plugin.cpp
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#include "SEC_OMX_Plugin.h"
+
+#include <dlfcn.h>
+
+#include <media/stagefright/HardwareAPI.h>
+#include <media/stagefright/MediaDebug.h>
+
+namespace android {
+
+OMXPluginBase *createOMXPlugin() {
+ return new SECOMXPlugin;
+}
+
+SECOMXPlugin::SECOMXPlugin()
+ : mLibHandle(dlopen("libSEC_OMX_Core.aries.so", RTLD_NOW)),
+ mInit(NULL),
+ mDeinit(NULL),
+ mComponentNameEnum(NULL),
+ mGetHandle(NULL),
+ mFreeHandle(NULL),
+ mGetRolesOfComponentHandle(NULL) {
+ if (mLibHandle != NULL) {
+ mInit = (InitFunc)dlsym(mLibHandle, "SEC_OMX_Init");
+ mDeinit = (DeinitFunc)dlsym(mLibHandle, "SEC_OMX_DeInit");
+
+ mComponentNameEnum =
+ (ComponentNameEnumFunc)dlsym(mLibHandle, "SEC_OMX_ComponentNameEnum");
+
+ mGetHandle = (GetHandleFunc)dlsym(mLibHandle, "SEC_OMX_GetHandle");
+ mFreeHandle = (FreeHandleFunc)dlsym(mLibHandle, "SEC_OMX_FreeHandle");
+
+ mGetRolesOfComponentHandle =
+ (GetRolesOfComponentFunc)dlsym(
+ mLibHandle, "SEC_OMX_GetRolesOfComponent");
+
+ (*mInit)();
+
+ }
+}
+
+SECOMXPlugin::~SECOMXPlugin() {
+ if (mLibHandle != NULL) {
+ (*mDeinit)();
+
+ dlclose(mLibHandle);
+ mLibHandle = NULL;
+ }
+}
+
+OMX_ERRORTYPE SECOMXPlugin::makeComponentInstance(
+ const char *name,
+ const OMX_CALLBACKTYPE *callbacks,
+ OMX_PTR appData,
+ OMX_COMPONENTTYPE **component) {
+ if (mLibHandle == NULL) {
+ return OMX_ErrorUndefined;
+ }
+
+ return (*mGetHandle)(
+ reinterpret_cast<OMX_HANDLETYPE *>(component),
+ const_cast<char *>(name),
+ appData, const_cast<OMX_CALLBACKTYPE *>(callbacks));
+}
+
+OMX_ERRORTYPE SECOMXPlugin::destroyComponentInstance(
+ OMX_COMPONENTTYPE *component) {
+ if (mLibHandle == NULL) {
+ return OMX_ErrorUndefined;
+ }
+
+ return (*mFreeHandle)(reinterpret_cast<OMX_HANDLETYPE *>(component));
+}
+
+OMX_ERRORTYPE SECOMXPlugin::enumerateComponents(
+ OMX_STRING name,
+ size_t size,
+ OMX_U32 index) {
+ if (mLibHandle == NULL) {
+ return OMX_ErrorUndefined;
+ }
+
+ return (*mComponentNameEnum)(name, size, index);
+}
+
+OMX_ERRORTYPE SECOMXPlugin::getRolesOfComponent(
+ const char *name,
+ Vector<String8> *roles) {
+ roles->clear();
+
+ if (mLibHandle == NULL) {
+ return OMX_ErrorUndefined;
+ }
+
+ OMX_U32 numRoles;
+ OMX_ERRORTYPE err = (*mGetRolesOfComponentHandle)(
+ const_cast<OMX_STRING>(name), &numRoles, NULL);
+
+ if (err != OMX_ErrorNone) {
+ return err;
+ }
+
+ if (numRoles > 0) {
+ OMX_U8 **array = new OMX_U8 *[numRoles];
+ for (OMX_U32 i = 0; i < numRoles; ++i) {
+ array[i] = new OMX_U8[OMX_MAX_STRINGNAME_SIZE];
+ }
+
+ OMX_U32 numRoles2;
+ err = (*mGetRolesOfComponentHandle)(
+ const_cast<OMX_STRING>(name), &numRoles2, array);
+
+ CHECK_EQ(err, OMX_ErrorNone);
+ CHECK_EQ(numRoles, numRoles2);
+
+ for (OMX_U32 i = 0; i < numRoles; ++i) {
+ String8 s((const char *)array[i]);
+ roles->push(s);
+
+ delete[] array[i];
+ array[i] = NULL;
+ }
+
+ delete[] array;
+ array = NULL;
+ }
+
+ return OMX_ErrorNone;
+}
+
+} // namespace android
+
diff --git a/libstagefrighthw/SEC_OMX_Plugin.h b/libstagefrighthw/SEC_OMX_Plugin.h
new file mode 100644
index 0000000..6df2d31
--- /dev/null
+++ b/libstagefrighthw/SEC_OMX_Plugin.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#ifndef SEC_OMX_PLUGIN
+
+#define SEC_OMX_PLUGIN
+
+#include <media/stagefright/OMXPluginBase.h>
+
+namespace android {
+
+struct SECOMXPlugin : public OMXPluginBase {
+ SECOMXPlugin();
+ virtual ~SECOMXPlugin();
+
+ virtual OMX_ERRORTYPE makeComponentInstance(
+ const char *name,
+ const OMX_CALLBACKTYPE *callbacks,
+ OMX_PTR appData,
+ OMX_COMPONENTTYPE **component);
+
+ virtual OMX_ERRORTYPE destroyComponentInstance(
+ OMX_COMPONENTTYPE *component);
+
+ virtual OMX_ERRORTYPE enumerateComponents(
+ OMX_STRING name,
+ size_t size,
+ OMX_U32 index);
+
+ virtual OMX_ERRORTYPE getRolesOfComponent(
+ const char *name,
+ Vector<String8> *roles);
+
+private:
+ void *mLibHandle;
+
+ typedef OMX_ERRORTYPE (*InitFunc)();
+ typedef OMX_ERRORTYPE (*DeinitFunc)();
+ typedef OMX_ERRORTYPE (*ComponentNameEnumFunc)(
+ OMX_STRING, OMX_U32, OMX_U32);
+
+ typedef OMX_ERRORTYPE (*GetHandleFunc)(
+ OMX_HANDLETYPE *, OMX_STRING, OMX_PTR, OMX_CALLBACKTYPE *);
+
+ typedef OMX_ERRORTYPE (*FreeHandleFunc)(OMX_HANDLETYPE *);
+
+ typedef OMX_ERRORTYPE (*GetRolesOfComponentFunc)(
+ OMX_STRING, OMX_U32 *, OMX_U8 **);
+
+ InitFunc mInit;
+ DeinitFunc mDeinit;
+ ComponentNameEnumFunc mComponentNameEnum;
+ GetHandleFunc mGetHandle;
+ FreeHandleFunc mFreeHandle;
+ GetRolesOfComponentFunc mGetRolesOfComponentHandle;
+
+ SECOMXPlugin(const SECOMXPlugin &);
+ SECOMXPlugin &operator=(const SECOMXPlugin &);
+};
+
+} // namespace android
+
+#endif // SEC_OMX_PLUGIN
diff --git a/sec_mm/Android.mk b/sec_mm/Android.mk
index 6571161..16298da 100644
--- a/sec_mm/Android.mk
+++ b/sec_mm/Android.mk
@@ -1 +1,5 @@
-include $(all-subdir-makefiles)
+WITH_SEC_OMX := true
+
+ifeq ($(WITH_SEC_OMX), true)
+ include $(all-subdir-makefiles)
+endif
diff --git a/sec_mm/sec_omx/sec_codecs/Android.mk b/sec_mm/sec_omx/sec_codecs/Android.mk
index a51a075..3c163a4 100644
--- a/sec_mm/sec_omx/sec_codecs/Android.mk
+++ b/sec_mm/sec_omx/sec_codecs/Android.mk
@@ -4,4 +4,4 @@ include $(CLEAR_VARS)
include $(SEC_CODECS)/video/mfc_c110/dec/Android.mk
include $(SEC_CODECS)/video/mfc_c110/enc/Android.mk
-
+include $(SEC_CODECS)/video/mfc_c110/csc/Android.mk \ No newline at end of file
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/Android.mk b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/Android.mk
new file mode 100644
index 0000000..5c5fd67
--- /dev/null
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/Android.mk
@@ -0,0 +1,36 @@
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+ifeq ($(ARCH_ARM_HAVE_NEON),true)
+LOCAL_SRC_FILES := \
+ csc_yuv420_nv12t_y_neon.s \
+ csc_yuv420_nv12t_uv_neon.s \
+ csc_nv12t_yuv420_y_neon.s \
+ csc_nv12t_yuv420_uv_neon.s \
+ csc_interleave_memcpy.s \
+ csc_deinterleave_memcpy.s
+
+else
+LOCAL_SRC_FILES := \
+ color_space_convertor.c
+
+endif
+
+LOCAL_MODULE := libseccsc.aries
+
+LOCAL_CFLAGS :=
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES :=
+
+LOCAL_SHARED_LIBRARIES := liblog
+
+LOCAL_C_INCLUDES := \
+ $(SEC_CODECS)/video/mfc_c110/include
+
+include $(BUILD_STATIC_LIBRARY)
+
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/color_space_convertor.c b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/color_space_convertor.c
new file mode 100644
index 0000000..c1ac638
--- /dev/null
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/color_space_convertor.c
@@ -0,0 +1,1092 @@
+/*
+ *
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * 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.
+ */
+
+/*
+ * @file color_space_convertor.c
+ * @brief SEC_OMX specific define
+ * @author ShinWon Lee (shinwon.lee@samsung.com)
+ * @version 1.0
+ * @history
+ * 2011.7.01 : Create
+ */
+
+#include "stdlib.h"
+#include "color_space_convertor.h"
+
+#define TILED_SIZE 64*32
+
+/*
+ * De-interleaves src to dest1, dest2
+ *
+ * @param dest1
+ * Address of de-interleaved data[out]
+ *
+ * @param dest2
+ * Address of de-interleaved data[out]
+ *
+ * @param src
+ * Address of interleaved data[in]
+ *
+ * @param src_size
+ * Size of interleaved data[in]
+ */
+void csc_deinterleave_memcpy(char *dest1, char *dest2, char *src, int src_size)
+{
+ int i = 0;
+ for(i=0; i<src_size/2; i++) {
+ dest1[i] = src[i*2];
+ dest2[i] = src[i*2+1];
+ }
+}
+
+/*
+ * Interleaves src1, src2 to dest
+ *
+ * @param dest
+ * Address of interleaved data[out]
+ *
+ * @param src1
+ * Address of de-interleaved data[in]
+ *
+ * @param src2
+ * Address of de-interleaved data[in]
+ *
+ * @param src_size
+ * Size of de-interleaved data[in]
+ */
+void csc_interleave_memcpy(char *dest, char *src1, char *src2, int src_size)
+{
+ int i = 0;
+ for(i=0; i<src_size; i++) {
+ dest[i*2] = src1[i];
+ dest[i*2+1] = src2[i];
+ }
+}
+
+/*
+ * Converts tiled data to linear.
+ * 1. Y of NV12T to Y of YUV420P
+ * 2. Y of NV12T to Y of YUV420S
+ * 3. UV of NV12T to UV of YUV420S
+ *
+ * @param yuv420_dest
+ * Y or UV plane address of YUV420[out]
+ *
+ * @param nv12t_src
+ * Y or UV plane address of NV12T[in]
+ *
+ * @param yuv420_width
+ * Width of YUV420[in]
+ *
+ * @param yuv420_height
+ * Y: Height of YUV420, UV: Height/2 of YUV420[in]
+ */
+void csc_tiled_to_linear(char *yuv420_dest, char *nv12t_src, int yuv420_width, int yuv420_height)
+{
+ unsigned int i, j;
+ unsigned int tiled_x_index = 0, tiled_y_index = 0;
+ unsigned int aligned_x_size = 0;
+ unsigned int tiled_offset = 0, tiled_offset1 = 0, tiled_offset2 = 0, tiled_offset3 = 0;
+ unsigned int temp1 = 0, temp2 = 0;
+
+ if (yuv420_width >= 1024) {
+ for (i=0; i<yuv420_height; i=i+1) {
+ tiled_offset = 0;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+2;
+ tiled_offset = tiled_offset<<11;
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*2;
+ tiled_offset3 = tiled_offset+2048*3;
+ temp2 = 8;
+ } else {
+ temp2 = ((yuv420_height+31)>>5)<<5;
+ /* even fomula: x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ if ((i+32)<temp2) {
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*6;
+ tiled_offset3 = tiled_offset+2048*7;
+ temp2 = 8;
+ } else {
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*2;
+ tiled_offset3 = tiled_offset+2048*3;
+ temp2 = 4;
+ }
+ }
+ temp1 = i&0x1F;
+ memcpy(yuv420_dest+yuv420_width*(i), nv12t_src+tiled_offset+64*(temp1), 64);
+ memcpy(yuv420_dest+yuv420_width*(i)+64*1, nv12t_src+tiled_offset1+64*(temp1), 64);
+ memcpy(yuv420_dest+yuv420_width*(i)+64*2, nv12t_src+tiled_offset2+64*(temp1), 64);
+ memcpy(yuv420_dest+yuv420_width*(i)+64*3, nv12t_src+tiled_offset3+64*(temp1), 64);
+
+ tiled_offset = tiled_offset+temp2*2048;
+ tiled_offset1 = tiled_offset1+temp2*2048;
+ tiled_offset2 = tiled_offset2+temp2*2048;
+ tiled_offset3 = tiled_offset3+temp2*2048;
+ memcpy(yuv420_dest+yuv420_width*(i)+64*4, nv12t_src+tiled_offset+64*(temp1), 64);
+ memcpy(yuv420_dest+yuv420_width*(i)+64*5, nv12t_src+tiled_offset1+64*(temp1), 64);
+ memcpy(yuv420_dest+yuv420_width*(i)+64*6, nv12t_src+tiled_offset2+64*(temp1), 64);
+ memcpy(yuv420_dest+yuv420_width*(i)+64*7, nv12t_src+tiled_offset3+64*(temp1), 64);
+
+ tiled_offset = tiled_offset+temp2*2048;
+ tiled_offset1 = tiled_offset1+temp2*2048;
+ tiled_offset2 = tiled_offset2+temp2*2048;
+ tiled_offset3 = tiled_offset3+temp2*2048;
+ memcpy(yuv420_dest+yuv420_width*(i)+64*8, nv12t_src+tiled_offset+64*(temp1), 64);
+ memcpy(yuv420_dest+yuv420_width*(i)+64*9, nv12t_src+tiled_offset1+64*(temp1), 64);
+ memcpy(yuv420_dest+yuv420_width*(i)+64*10, nv12t_src+tiled_offset2+64*(temp1), 64);
+ memcpy(yuv420_dest+yuv420_width*(i)+64*11, nv12t_src+tiled_offset3+64*(temp1), 64);
+
+ tiled_offset = tiled_offset+temp2*2048;
+ tiled_offset1 = tiled_offset1+temp2*2048;
+ tiled_offset2 = tiled_offset2+temp2*2048;
+ tiled_offset3 = tiled_offset3+temp2*2048;
+ memcpy(yuv420_dest+yuv420_width*(i)+64*12, nv12t_src+tiled_offset+64*(temp1), 64);
+ memcpy(yuv420_dest+yuv420_width*(i)+64*13, nv12t_src+tiled_offset1+64*(temp1), 64);
+ memcpy(yuv420_dest+yuv420_width*(i)+64*14, nv12t_src+tiled_offset2+64*(temp1), 64);
+ memcpy(yuv420_dest+yuv420_width*(i)+64*15, nv12t_src+tiled_offset3+64*(temp1), 64);
+ }
+ aligned_x_size = 1024;
+ }
+
+ if ((yuv420_width-aligned_x_size) >= 512) {
+ for (i=0; i<yuv420_height; i=i+1) {
+ tiled_offset = 0;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+2;
+ temp1 = aligned_x_size>>5;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*2;
+ tiled_offset3 = tiled_offset+2048*3;
+ temp2 = 8;
+ } else {
+ temp2 = ((yuv420_height+31)>>5)<<5;
+ /* even fomula: x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ if ((i+32)<temp2) {
+ temp1 = aligned_x_size>>5;
+ tiled_offset = tiled_offset+(temp1<<11);
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*6;
+ tiled_offset3 = tiled_offset+2048*7;
+ temp2 = 8;
+ } else {
+ temp1 = aligned_x_size>>6;
+ tiled_offset = tiled_offset+(temp1<<11);
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*2;
+ tiled_offset3 = tiled_offset+2048*3;
+ temp2 = 4;
+ }
+ }
+ temp1 = i&0x1F;
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i), nv12t_src+tiled_offset+64*(temp1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i)+64*1, nv12t_src+tiled_offset1+64*(temp1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i)+64*2, nv12t_src+tiled_offset2+64*(temp1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i)+64*3, nv12t_src+tiled_offset3+64*(temp1), 64);
+
+ tiled_offset = tiled_offset+temp2*2048;
+ tiled_offset1 = tiled_offset1+temp2*2048;
+ tiled_offset2 = tiled_offset2+temp2*2048;
+ tiled_offset3 = tiled_offset3+temp2*2048;
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i)+64*4, nv12t_src+tiled_offset+64*(temp1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i)+64*5, nv12t_src+tiled_offset1+64*(temp1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i)+64*6, nv12t_src+tiled_offset2+64*(temp1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i)+64*7, nv12t_src+tiled_offset3+64*(temp1), 64);
+ }
+ aligned_x_size = aligned_x_size+512;
+ }
+
+ if ((yuv420_width-aligned_x_size) >= 256) {
+ for (i=0; i<yuv420_height; i=i+1) {
+ tiled_offset = 0;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+2;
+ temp1 = aligned_x_size>>5;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*2;
+ tiled_offset3 = tiled_offset+2048*3;
+ } else {
+ temp2 = ((yuv420_height+31)>>5)<<5;
+ /* even fomula: x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ if ((i+32)<temp2) {
+ temp1 = aligned_x_size>>5;
+ tiled_offset = tiled_offset+(temp1<<11);
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*6;
+ tiled_offset3 = tiled_offset+2048*7;
+ } else {
+ temp1 = aligned_x_size>>6;
+ tiled_offset = tiled_offset+(temp1<<11);
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*2;
+ tiled_offset3 = tiled_offset+2048*3;
+ }
+ }
+ temp1 = i&0x1F;
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i), nv12t_src+tiled_offset+64*(temp1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i)+64*1, nv12t_src+tiled_offset1+64*(temp1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i)+64*2, nv12t_src+tiled_offset2+64*(temp1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i)+64*3, nv12t_src+tiled_offset3+64*(temp1), 64);
+ }
+ aligned_x_size = aligned_x_size+256;
+ }
+
+ if ((yuv420_width-aligned_x_size) >= 128) {
+ for (i=0; i<yuv420_height; i=i+2) {
+ tiled_offset = 0;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+2;
+ temp1 = aligned_x_size>>5;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ tiled_offset1 = tiled_offset+2048*1;
+ } else {
+ temp2 = ((yuv420_height+31)>>5)<<5;
+ /* even fomula: x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ if ((i+32)<temp2) {
+ temp1 = aligned_x_size>>5;
+ tiled_offset = tiled_offset+(temp1<<11);
+ tiled_offset1 = tiled_offset+2048*1;
+ } else {
+ temp1 = aligned_x_size>>6;
+ tiled_offset = tiled_offset+(temp1<<11);
+ tiled_offset1 = tiled_offset+2048*1;
+ }
+ }
+ temp1 = i&0x1F;
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i), nv12t_src+tiled_offset+64*(temp1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i)+64, nv12t_src+tiled_offset1+64*(temp1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i+1), nv12t_src+tiled_offset+64*(temp1+1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i+1)+64, nv12t_src+tiled_offset1+64*(temp1+1), 64);
+ }
+ aligned_x_size = aligned_x_size+128;
+ }
+
+ if ((yuv420_width-aligned_x_size) >= 64) {
+ for (i=0; i<yuv420_height; i=i+4) {
+ tiled_offset = 0;
+ tiled_x_index = aligned_x_size>>6;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset+2;
+ temp1 = (tiled_x_index>>2)<<2;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ } else {
+ temp2 = ((yuv420_height+31)>>5)<<5;
+ if ((i+32)<temp2) {
+ /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */
+ temp1 = tiled_x_index+2;
+ temp1 = (temp1>>2)<<2;
+ tiled_offset = tiled_x_index+temp1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset+tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ } else {
+ /* even2 fomula: x+x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset<<11;
+ }
+ }
+
+ temp1 = i&0x1F;
+ temp2 = aligned_x_size&0x3F;
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i), nv12t_src+tiled_offset+temp2+64*(temp1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i+1), nv12t_src+tiled_offset+temp2+64*(temp1+1), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i+2), nv12t_src+tiled_offset+temp2+64*(temp1+2), 64);
+ memcpy(yuv420_dest+aligned_x_size+yuv420_width*(i+3), nv12t_src+tiled_offset+temp2+64*(temp1+3), 64);
+ }
+ aligned_x_size = aligned_x_size+64;
+ }
+
+ if (yuv420_width != aligned_x_size) {
+ for (i=0; i<yuv420_height; i=i+4) {
+ for (j=aligned_x_size; j<yuv420_width; j=j+4) {
+ tiled_offset = 0;
+ tiled_x_index = j>>6;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset+2;
+ temp1 = (tiled_x_index>>2)<<2;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ } else {
+ temp2 = ((yuv420_height+31)>>5)<<5;
+ if ((i+32)<temp2) {
+ /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */
+ temp1 = tiled_x_index+2;
+ temp1 = (temp1>>2)<<2;
+ tiled_offset = tiled_x_index+temp1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset+tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ } else {
+ /* even2 fomula: x+x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset<<11;
+ }
+ }
+
+ temp1 = i&0x1F;
+ temp2 = j&0x3F;
+ memcpy(yuv420_dest+j+yuv420_width*(i), nv12t_src+tiled_offset+temp2+64*(temp1), 4);
+ memcpy(yuv420_dest+j+yuv420_width*(i+1), nv12t_src+tiled_offset+temp2+64*(temp1+1), 4);
+ memcpy(yuv420_dest+j+yuv420_width*(i+2), nv12t_src+tiled_offset+temp2+64*(temp1+2), 4);
+ memcpy(yuv420_dest+j+yuv420_width*(i+3), nv12t_src+tiled_offset+temp2+64*(temp1+3), 4);
+ }
+ }
+ }
+}
+
+/*
+ * Converts and Deinterleaves tiled data to linear
+ * 1. UV of NV12T to UV of YUV420P
+ *
+ * @param yuv420_u_dest
+ * U plane address of YUV420P[out]
+ *
+ * @param yuv420_v_dest
+ * V plane address of YUV420P[out]
+ *
+ * @param nv12t_src
+ * UV plane address of NV12T[in]
+ *
+ * @param yuv420_width
+ * Width of YUV420[in]
+ *
+ * @param yuv420_uv_height
+ * Height/2 of YUV420[in]
+ */
+void csc_tiled_to_linear_deinterleave(char *yuv420_u_dest, char *yuv420_v_dest, char *nv12t_uv_src, int yuv420_width, int yuv420_uv_height)
+{
+ unsigned int i, j;
+ unsigned int tiled_x_index = 0, tiled_y_index = 0;
+ unsigned int aligned_x_size = 0;
+ unsigned int tiled_offset = 0, tiled_offset1 = 0, tiled_offset2 = 0, tiled_offset3 = 0;
+ unsigned int temp1 = 0, temp2 = 0;
+
+ if (yuv420_width >= 1024) {
+ for (i=0; i<yuv420_uv_height; i=i+1) {
+ tiled_offset = 0;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+2;
+ tiled_offset = tiled_offset<<11;
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*2;
+ tiled_offset3 = tiled_offset+2048*3;
+ temp2 = 8;
+ } else {
+ temp2 = ((yuv420_uv_height+31)>>5)<<5;
+ /* even fomula: x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ if ((i+32)<temp2) {
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*6;
+ tiled_offset3 = tiled_offset+2048*7;
+ temp2 = 8;
+ } else {
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*2;
+ tiled_offset3 = tiled_offset+2048*3;
+ temp2 = 4;
+ }
+ }
+ temp1 = i&0x1F;
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i), yuv420_v_dest+yuv420_width/2*(i), nv12t_uv_src+tiled_offset+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*1, yuv420_v_dest+yuv420_width/2*(i)+32*1, nv12t_uv_src+tiled_offset1+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*2, yuv420_v_dest+yuv420_width/2*(i)+32*2, nv12t_uv_src+tiled_offset2+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*3, yuv420_v_dest+yuv420_width/2*(i)+32*3, nv12t_uv_src+tiled_offset3+64*(temp1), 64);
+
+ tiled_offset = tiled_offset+temp2*2048;
+ tiled_offset1 = tiled_offset1+temp2*2048;
+ tiled_offset2 = tiled_offset2+temp2*2048;
+ tiled_offset3 = tiled_offset3+temp2*2048;
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*4, yuv420_v_dest+yuv420_width/2*(i)+32*4, nv12t_uv_src+tiled_offset+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*5, yuv420_v_dest+yuv420_width/2*(i)+32*5, nv12t_uv_src+tiled_offset1+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*6, yuv420_v_dest+yuv420_width/2*(i)+32*6, nv12t_uv_src+tiled_offset2+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*7, yuv420_v_dest+yuv420_width/2*(i)+32*7, nv12t_uv_src+tiled_offset3+64*(temp1), 64);
+
+ tiled_offset = tiled_offset+temp2*2048;
+ tiled_offset1 = tiled_offset1+temp2*2048;
+ tiled_offset2 = tiled_offset2+temp2*2048;
+ tiled_offset3 = tiled_offset3+temp2*2048;
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*8, yuv420_v_dest+yuv420_width/2*(i)+32*8, nv12t_uv_src+tiled_offset+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*9, yuv420_v_dest+yuv420_width/2*(i)+32*9, nv12t_uv_src+tiled_offset1+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*10, yuv420_v_dest+yuv420_width/2*(i)+32*10, nv12t_uv_src+tiled_offset2+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*11, yuv420_v_dest+yuv420_width/2*(i)+32*11, nv12t_uv_src+tiled_offset3+64*(temp1), 64);
+
+ tiled_offset = tiled_offset+temp2*2048;
+ tiled_offset1 = tiled_offset1+temp2*2048;
+ tiled_offset2 = tiled_offset2+temp2*2048;
+ tiled_offset3 = tiled_offset3+temp2*2048;
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*12, yuv420_v_dest+yuv420_width/2*(i)+32*12, nv12t_uv_src+tiled_offset+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*13, yuv420_v_dest+yuv420_width/2*(i)+32*13, nv12t_uv_src+tiled_offset1+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*14, yuv420_v_dest+yuv420_width/2*(i)+32*14, nv12t_uv_src+tiled_offset2+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+yuv420_width/2*(i)+32*15, yuv420_v_dest+yuv420_width/2*(i)+32*15, nv12t_uv_src+tiled_offset3+64*(temp1), 64);
+ }
+ aligned_x_size = 1024;
+ }
+
+ if ((yuv420_width-aligned_x_size) >= 512) {
+ for (i=0; i<yuv420_uv_height; i=i+1) {
+ tiled_offset = 0;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+2;
+ temp1 = aligned_x_size>>5;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*2;
+ tiled_offset3 = tiled_offset+2048*3;
+ temp2 = 8;
+ } else {
+ temp2 = ((yuv420_uv_height+31)>>5)<<5;
+ /* even fomula: x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ if ((i+32)<temp2) {
+ temp1 = aligned_x_size>>5;
+ tiled_offset = tiled_offset+(temp1<<11);
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*6;
+ tiled_offset3 = tiled_offset+2048*7;
+ temp2 = 8;
+ } else {
+ temp1 = aligned_x_size>>6;
+ tiled_offset = tiled_offset+(temp1<<11);
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*2;
+ tiled_offset3 = tiled_offset+2048*3;
+ temp2 = 4;
+ }
+ }
+ temp1 = i&0x1F;
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i), yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i), nv12t_uv_src+tiled_offset+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i)+32*1, yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i)+32*1, nv12t_uv_src+tiled_offset1+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i)+32*2, yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i)+32*2, nv12t_uv_src+tiled_offset2+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i)+32*3, yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i)+32*3, nv12t_uv_src+tiled_offset3+64*(temp1), 64);
+
+ tiled_offset = tiled_offset+temp2*2048;
+ tiled_offset1 = tiled_offset1+temp2*2048;
+ tiled_offset2 = tiled_offset2+temp2*2048;
+ tiled_offset3 = tiled_offset3+temp2*2048;
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i)+32*4, yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i)+32*4, nv12t_uv_src+tiled_offset+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i)+32*5, yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i)+32*5, nv12t_uv_src+tiled_offset1+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i)+32*6, yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i)+32*6, nv12t_uv_src+tiled_offset2+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i)+32*7, yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i)+32*7, nv12t_uv_src+tiled_offset3+64*(temp1), 64);
+ }
+ aligned_x_size = aligned_x_size+512;
+ }
+
+ if ((yuv420_width-aligned_x_size) >= 256) {
+ for (i=0; i<yuv420_uv_height; i=i+1) {
+ tiled_offset = 0;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+2;
+ temp1 = aligned_x_size>>5;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*2;
+ tiled_offset3 = tiled_offset+2048*3;
+ } else {
+ temp2 = ((yuv420_uv_height+31)>>5)<<5;
+ /* even fomula: x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ if ((i+32)<temp2) {
+ temp1 = aligned_x_size>>5;
+ tiled_offset = tiled_offset+(temp1<<11);
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*6;
+ tiled_offset3 = tiled_offset+2048*7;
+ } else {
+ temp1 = aligned_x_size>>6;
+ tiled_offset = tiled_offset+(temp1<<11);
+ tiled_offset1 = tiled_offset+2048*1;
+ tiled_offset2 = tiled_offset+2048*2;
+ tiled_offset3 = tiled_offset+2048*3;
+ }
+ }
+ temp1 = i&0x1F;
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i), yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i), nv12t_uv_src+tiled_offset+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i)+32*1, yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i)+32*1, nv12t_uv_src+tiled_offset1+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i)+32*2, yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i)+32*2, nv12t_uv_src+tiled_offset2+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i)+32*3, yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i)+32*3, nv12t_uv_src+tiled_offset3+64*(temp1), 64);
+ }
+ aligned_x_size = aligned_x_size+256;
+ }
+
+ if ((yuv420_width-aligned_x_size) >= 128) {
+ for (i=0; i<yuv420_uv_height; i=i+2) {
+ tiled_offset = 0;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+2;
+ temp1 = aligned_x_size>>5;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ tiled_offset1 = tiled_offset+2048*1;
+ } else {
+ temp2 = ((yuv420_uv_height+31)>>5)<<5;
+ /* even fomula: x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ if ((i+32)<temp2) {
+ temp1 = aligned_x_size>>5;
+ tiled_offset = tiled_offset+(temp1<<11);
+ tiled_offset1 = tiled_offset+2048*1;
+ } else {
+ temp1 = aligned_x_size>>6;
+ tiled_offset = tiled_offset+(temp1<<11);
+ tiled_offset1 = tiled_offset+2048*1;
+ }
+ }
+ temp1 = i&0x1F;
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i), yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i), nv12t_uv_src+tiled_offset+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i)+32*1, yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i)+32*1, nv12t_uv_src+tiled_offset1+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i+1), yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i+1), nv12t_uv_src+tiled_offset+64*(temp1+1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i+1)+32*1, yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i+1)+32*1, nv12t_uv_src+tiled_offset1+64*(temp1+1), 64);
+ }
+ aligned_x_size = aligned_x_size+128;
+ }
+
+ if ((yuv420_width-aligned_x_size) >= 64) {
+ for (i=0; i<yuv420_uv_height; i=i+2) {
+ tiled_offset = 0;
+ tiled_x_index = aligned_x_size>>6;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset+2;
+ temp1 = (tiled_x_index>>2)<<2;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ } else {
+ temp2 = ((yuv420_uv_height+31)>>5)<<5;
+ if ((i+32)<temp2) {
+ /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */
+ temp1 = tiled_x_index+2;
+ temp1 = (temp1>>2)<<2;
+ tiled_offset = tiled_x_index+temp1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset+tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ } else {
+ /* even2 fomula: x+x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset<<11;
+ }
+ }
+ temp1 = i&0x1F;
+ temp2 = aligned_x_size&0x3F;
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i), yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i), nv12t_uv_src+tiled_offset+64*(temp1), 64);
+ csc_deinterleave_memcpy(yuv420_u_dest+aligned_x_size/2+yuv420_width/2*(i+1), yuv420_v_dest+aligned_x_size/2+yuv420_width/2*(i+1), nv12t_uv_src+tiled_offset+64*(temp1+1), 64);
+ }
+ aligned_x_size = aligned_x_size+64;
+ }
+
+ if (yuv420_width != aligned_x_size) {
+ for (i=0; i<yuv420_uv_height; i=i+2) {
+ for (j=aligned_x_size; j<yuv420_width; j=j+4) {
+ tiled_offset = 0;
+ tiled_x_index = j>>6;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset+2;
+ temp1 = (tiled_x_index>>2)<<2;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ } else {
+ temp2 = ((yuv420_uv_height+31)>>5)<<5;
+ if ((i+32)<temp2) {
+ /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */
+ temp1 = tiled_x_index+2;
+ temp1 = (temp1>>2)<<2;
+ tiled_offset = tiled_x_index+temp1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset+tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ } else {
+ /* even2 fomula: x+x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset<<11;
+ }
+ }
+ temp1 = i&0x1F;
+ temp2 = j&0x3F;
+ csc_deinterleave_memcpy(yuv420_u_dest+j/2+yuv420_width/2*(i), yuv420_v_dest+j/2+yuv420_width/2*(i), nv12t_uv_src+tiled_offset+temp2+64*(temp1), 4);
+ csc_deinterleave_memcpy(yuv420_u_dest+j/2+yuv420_width/2*(i+1), yuv420_v_dest+j/2+yuv420_width/2*(i+1), nv12t_uv_src+tiled_offset+temp2+64*(temp1+1), 4);
+ }
+ }
+ }
+}
+
+/*
+ * Converts linear data to tiled.
+ * 1. Y of YUV420P to Y of NV12T
+ * 2. Y of YUV420S to Y of NV12T
+ * 3. UV of YUV420S to UV of NV12T
+ *
+ * @param nv12t_dest
+ * Y or UV plane address of NV12T[out]
+ *
+ * @param yuv420_src
+ * Y or UV plane address of YUV420P(S)[in]
+ *
+ * @param yuv420_width
+ * Width of YUV420[in]
+ *
+ * @param yuv420_height
+ * Y: Height of YUV420, UV: Height/2 of YUV420[in]
+ */
+void csc_linear_to_tiled(char *nv12t_dest, char *yuv420_src, int yuv420_width, int yuv420_height)
+{
+ unsigned int i, j;
+ unsigned int tiled_x_index = 0, tiled_y_index = 0;
+ unsigned int aligned_x_size = 0, aligned_y_size = 0;
+ unsigned int tiled_offset = 0;
+ unsigned int temp1 = 0, temp2 = 0;
+
+ aligned_y_size = (yuv420_height>>5)<<5;
+ aligned_x_size = (yuv420_width>>6)<<6;
+
+ for (i=0; i<aligned_y_size; i=i+32) {
+ for (j=0; j<aligned_x_size; j=j+64) {
+ tiled_offset = 0;
+ tiled_x_index = j>>6;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset+2;
+ temp1 = (tiled_x_index>>2)<<2;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ } else {
+ temp2 = ((yuv420_height+31)>>5)<<5;
+ if ((i+32)<temp2) {
+ /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */
+ temp1 = tiled_x_index+2;
+ temp1 = (temp1>>2)<<2;
+ tiled_offset = tiled_x_index+temp1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset+tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ } else {
+ /* even2 fomula: x+x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset<<11;
+ }
+ }
+
+ memcpy(nv12t_dest+tiled_offset, yuv420_src+j+yuv420_width*(i), 64);
+ memcpy(nv12t_dest+tiled_offset+64*1, yuv420_src+j+yuv420_width*(i+1), 64);
+ memcpy(nv12t_dest+tiled_offset+64*2, yuv420_src+j+yuv420_width*(i+2), 64);
+ memcpy(nv12t_dest+tiled_offset+64*3, yuv420_src+j+yuv420_width*(i+3), 64);
+ memcpy(nv12t_dest+tiled_offset+64*4, yuv420_src+j+yuv420_width*(i+4), 64);
+ memcpy(nv12t_dest+tiled_offset+64*5, yuv420_src+j+yuv420_width*(i+5), 64);
+ memcpy(nv12t_dest+tiled_offset+64*6, yuv420_src+j+yuv420_width*(i+6), 64);
+ memcpy(nv12t_dest+tiled_offset+64*7, yuv420_src+j+yuv420_width*(i+7), 64);
+ memcpy(nv12t_dest+tiled_offset+64*8, yuv420_src+j+yuv420_width*(i+8), 64);
+ memcpy(nv12t_dest+tiled_offset+64*9, yuv420_src+j+yuv420_width*(i+9), 64);
+ memcpy(nv12t_dest+tiled_offset+64*10, yuv420_src+j+yuv420_width*(i+10), 64);
+ memcpy(nv12t_dest+tiled_offset+64*11, yuv420_src+j+yuv420_width*(i+11), 64);
+ memcpy(nv12t_dest+tiled_offset+64*12, yuv420_src+j+yuv420_width*(i+12), 64);
+ memcpy(nv12t_dest+tiled_offset+64*13, yuv420_src+j+yuv420_width*(i+13), 64);
+ memcpy(nv12t_dest+tiled_offset+64*14, yuv420_src+j+yuv420_width*(i+14), 64);
+ memcpy(nv12t_dest+tiled_offset+64*15, yuv420_src+j+yuv420_width*(i+15), 64);
+ memcpy(nv12t_dest+tiled_offset+64*16, yuv420_src+j+yuv420_width*(i+16), 64);
+ memcpy(nv12t_dest+tiled_offset+64*17, yuv420_src+j+yuv420_width*(i+17), 64);
+ memcpy(nv12t_dest+tiled_offset+64*18, yuv420_src+j+yuv420_width*(i+18), 64);
+ memcpy(nv12t_dest+tiled_offset+64*19, yuv420_src+j+yuv420_width*(i+19), 64);
+ memcpy(nv12t_dest+tiled_offset+64*20, yuv420_src+j+yuv420_width*(i+20), 64);
+ memcpy(nv12t_dest+tiled_offset+64*21, yuv420_src+j+yuv420_width*(i+21), 64);
+ memcpy(nv12t_dest+tiled_offset+64*22, yuv420_src+j+yuv420_width*(i+22), 64);
+ memcpy(nv12t_dest+tiled_offset+64*23, yuv420_src+j+yuv420_width*(i+23), 64);
+ memcpy(nv12t_dest+tiled_offset+64*24, yuv420_src+j+yuv420_width*(i+24), 64);
+ memcpy(nv12t_dest+tiled_offset+64*25, yuv420_src+j+yuv420_width*(i+25), 64);
+ memcpy(nv12t_dest+tiled_offset+64*26, yuv420_src+j+yuv420_width*(i+26), 64);
+ memcpy(nv12t_dest+tiled_offset+64*27, yuv420_src+j+yuv420_width*(i+27), 64);
+ memcpy(nv12t_dest+tiled_offset+64*28, yuv420_src+j+yuv420_width*(i+28), 64);
+ memcpy(nv12t_dest+tiled_offset+64*29, yuv420_src+j+yuv420_width*(i+29), 64);
+ memcpy(nv12t_dest+tiled_offset+64*30, yuv420_src+j+yuv420_width*(i+30), 64);
+ memcpy(nv12t_dest+tiled_offset+64*31, yuv420_src+j+yuv420_width*(i+31), 64);
+ }
+ }
+
+ for (i=aligned_y_size; i<yuv420_height; i=i+4) {
+ for (j=0; j<aligned_x_size; j=j+64) {
+ tiled_offset = 0;
+ tiled_x_index = j>>6;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset+2;
+ temp1 = (tiled_x_index>>2)<<2;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ } else {
+ temp2 = ((yuv420_height+31)>>5)<<5;
+ if ((i+32)<temp2) {
+ /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */
+ temp1 = tiled_x_index+2;
+ temp1 = (temp1>>2)<<2;
+ tiled_offset = tiled_x_index+temp1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset+tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ } else {
+ /* even2 fomula: x+x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset<<11;
+ }
+ }
+
+ temp1 = i&0x1F;
+ memcpy(nv12t_dest+tiled_offset+64*(temp1), yuv420_src+j+yuv420_width*(i), 64);
+ memcpy(nv12t_dest+tiled_offset+64*(temp1+1), yuv420_src+j+yuv420_width*(i+1), 64);
+ memcpy(nv12t_dest+tiled_offset+64*(temp1+2), yuv420_src+j+yuv420_width*(i+2), 64);
+ memcpy(nv12t_dest+tiled_offset+64*(temp1+3), yuv420_src+j+yuv420_width*(i+3), 64);
+ }
+ }
+
+ for (i=0; i<yuv420_height; i=i+4) {
+ for (j=aligned_x_size; j<yuv420_width; j=j+4) {
+ tiled_offset = 0;
+ tiled_x_index = j>>6;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset+2;
+ temp1 = (tiled_x_index>>2)<<2;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ } else {
+ temp2 = ((yuv420_height+31)>>5)<<5;
+ if ((i+32)<temp2) {
+ /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */
+ temp1 = tiled_x_index+2;
+ temp1 = (temp1>>2)<<2;
+ tiled_offset = tiled_x_index+temp1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset+tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ } else {
+ /* even2 fomula: x+x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset<<11;
+ }
+ }
+
+ temp1 = i&0x1F;
+ temp2 = j&0x3F;
+ memcpy(nv12t_dest+tiled_offset+temp2+64*(temp1), yuv420_src+j+yuv420_width*(i), 4);
+ memcpy(nv12t_dest+tiled_offset+temp2+64*(temp1+1), yuv420_src+j+yuv420_width*(i+1), 4);
+ memcpy(nv12t_dest+tiled_offset+temp2+64*(temp1+2), yuv420_src+j+yuv420_width*(i+2), 4);
+ memcpy(nv12t_dest+tiled_offset+temp2+64*(temp1+3), yuv420_src+j+yuv420_width*(i+3), 4);
+ }
+ }
+}
+
+/*
+ * Converts and Interleaves linear to tiled
+ * 1. UV of YUV420P to UV of NV12T
+ *
+ * @param nv12t_uv_dest
+ * UV plane address of NV12T[out]
+ *
+ * @param yuv420p_u_src
+ * U plane address of YUV420P[in]
+ *
+ * @param yuv420p_v_src
+ * V plane address of YUV420P[in]
+ *
+ * @param yuv420_width
+ * Width of YUV420[in]
+ *
+ * @param yuv420_uv_height
+ * Height/2 of YUV420[in]
+ */
+void csc_linear_to_tiled_interleave(char *nv12t_uv_dest, char *yuv420p_u_src, char *yuv420p_v_src, int yuv420_width, int yuv420_uv_height)
+{
+ unsigned int i, j;
+ unsigned int tiled_x_index = 0, tiled_y_index = 0;
+ unsigned int aligned_x_size = 0, aligned_y_size = 0;
+ unsigned int tiled_offset = 0;
+ unsigned int temp1 = 0, temp2 = 0;
+
+ aligned_y_size = (yuv420_uv_height>>5)<<5;
+ aligned_x_size = ((yuv420_width)>>6)<<6;
+
+ for (i=0; i<aligned_y_size; i=i+32) {
+ for (j=0; j<aligned_x_size; j=j+64) {
+ tiled_offset = 0;
+ tiled_x_index = j>>6;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset+2;
+ temp1 = (tiled_x_index>>2)<<2;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ } else {
+ temp2 = ((yuv420_uv_height+31)>>5)<<5;
+ if ((i+32)<temp2) {
+ /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */
+ temp1 = tiled_x_index+2;
+ temp1 = (temp1>>2)<<2;
+ tiled_offset = tiled_x_index+temp1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset+tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ } else {
+ /* even2 fomula: x+x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset<<11;
+ }
+ }
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset, yuv420p_u_src+j/2+yuv420_width/2*(i), yuv420p_v_src+j/2+yuv420_width/2*(i), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*1, yuv420p_u_src+j/2+yuv420_width/2*(i+1), yuv420p_v_src+j/2+yuv420_width/2*(i+1), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*2, yuv420p_u_src+j/2+yuv420_width/2*(i+2), yuv420p_v_src+j/2+yuv420_width/2*(i+2), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*3, yuv420p_u_src+j/2+yuv420_width/2*(i+3), yuv420p_v_src+j/2+yuv420_width/2*(i+3), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*4, yuv420p_u_src+j/2+yuv420_width/2*(i+4), yuv420p_v_src+j/2+yuv420_width/2*(i+4), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*5, yuv420p_u_src+j/2+yuv420_width/2*(i+5), yuv420p_v_src+j/2+yuv420_width/2*(i+5), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*6, yuv420p_u_src+j/2+yuv420_width/2*(i+6), yuv420p_v_src+j/2+yuv420_width/2*(i+6), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*7, yuv420p_u_src+j/2+yuv420_width/2*(i+7), yuv420p_v_src+j/2+yuv420_width/2*(i+7), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*8, yuv420p_u_src+j/2+yuv420_width/2*(i+8), yuv420p_v_src+j/2+yuv420_width/2*(i+8), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*9, yuv420p_u_src+j/2+yuv420_width/2*(i+9), yuv420p_v_src+j/2+yuv420_width/2*(i+9), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*10, yuv420p_u_src+j/2+yuv420_width/2*(i+10), yuv420p_v_src+j/2+yuv420_width/2*(i+10), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*11, yuv420p_u_src+j/2+yuv420_width/2*(i+11), yuv420p_v_src+j/2+yuv420_width/2*(i+11), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*12, yuv420p_u_src+j/2+yuv420_width/2*(i+12), yuv420p_v_src+j/2+yuv420_width/2*(i+12), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*13, yuv420p_u_src+j/2+yuv420_width/2*(i+13), yuv420p_v_src+j/2+yuv420_width/2*(i+13), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*14, yuv420p_u_src+j/2+yuv420_width/2*(i+14), yuv420p_v_src+j/2+yuv420_width/2*(i+14), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*15, yuv420p_u_src+j/2+yuv420_width/2*(i+15), yuv420p_v_src+j/2+yuv420_width/2*(i+15), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*16, yuv420p_u_src+j/2+yuv420_width/2*(i+16), yuv420p_v_src+j/2+yuv420_width/2*(i+16), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*17, yuv420p_u_src+j/2+yuv420_width/2*(i+17), yuv420p_v_src+j/2+yuv420_width/2*(i+17), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*18, yuv420p_u_src+j/2+yuv420_width/2*(i+18), yuv420p_v_src+j/2+yuv420_width/2*(i+18), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*19, yuv420p_u_src+j/2+yuv420_width/2*(i+19), yuv420p_v_src+j/2+yuv420_width/2*(i+19), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*20, yuv420p_u_src+j/2+yuv420_width/2*(i+20), yuv420p_v_src+j/2+yuv420_width/2*(i+20), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*21, yuv420p_u_src+j/2+yuv420_width/2*(i+21), yuv420p_v_src+j/2+yuv420_width/2*(i+21), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*22, yuv420p_u_src+j/2+yuv420_width/2*(i+22), yuv420p_v_src+j/2+yuv420_width/2*(i+22), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*23, yuv420p_u_src+j/2+yuv420_width/2*(i+23), yuv420p_v_src+j/2+yuv420_width/2*(i+23), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*24, yuv420p_u_src+j/2+yuv420_width/2*(i+24), yuv420p_v_src+j/2+yuv420_width/2*(i+24), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*25, yuv420p_u_src+j/2+yuv420_width/2*(i+25), yuv420p_v_src+j/2+yuv420_width/2*(i+25), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*26, yuv420p_u_src+j/2+yuv420_width/2*(i+26), yuv420p_v_src+j/2+yuv420_width/2*(i+26), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*27, yuv420p_u_src+j/2+yuv420_width/2*(i+27), yuv420p_v_src+j/2+yuv420_width/2*(i+27), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*28, yuv420p_u_src+j/2+yuv420_width/2*(i+28), yuv420p_v_src+j/2+yuv420_width/2*(i+28), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*29, yuv420p_u_src+j/2+yuv420_width/2*(i+29), yuv420p_v_src+j/2+yuv420_width/2*(i+29), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*30, yuv420p_u_src+j/2+yuv420_width/2*(i+30), yuv420p_v_src+j/2+yuv420_width/2*(i+30), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*31, yuv420p_u_src+j/2+yuv420_width/2*(i+31), yuv420p_v_src+j/2+yuv420_width/2*(i+31), 32);
+ }
+ }
+
+ for (i=aligned_y_size; i<yuv420_uv_height; i=i+4) {
+ for (j=0; j<aligned_x_size; j=j+64) {
+ tiled_offset = 0;
+ tiled_x_index = j>>6;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset+2;
+ temp1 = (tiled_x_index>>2)<<2;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ } else {
+ temp2 = ((yuv420_uv_height+31)>>5)<<5;
+ if ((i+32)<temp2) {
+ /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */
+ temp1 = tiled_x_index+2;
+ temp1 = (temp1>>2)<<2;
+ tiled_offset = tiled_x_index+temp1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset+tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ } else {
+ /* even2 fomula: x+x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset<<11;
+ }
+ }
+ temp1 = i&0x1F;
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*(temp1), yuv420p_u_src+j/2+yuv420_width/2*(i), yuv420p_v_src+j/2+yuv420_width/2*(i), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*(temp1+1), yuv420p_u_src+j/2+yuv420_width/2*(i+1), yuv420p_v_src+j/2+yuv420_width/2*(i+1), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*(temp1+2), yuv420p_u_src+j/2+yuv420_width/2*(i+2), yuv420p_v_src+j/2+yuv420_width/2*(i+2), 32);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*(temp1+3), yuv420p_u_src+j/2+yuv420_width/2*(i+3), yuv420p_v_src+j/2+yuv420_width/2*(i+3), 32);
+ }
+ }
+
+ for (i=0; i<yuv420_uv_height; i=i+4) {
+ for (j=aligned_x_size; j<yuv420_width; j=j+4) {
+ tiled_offset = 0;
+ tiled_x_index = j>>6;
+ tiled_y_index = i>>5;
+ if (tiled_y_index & 0x1) {
+ /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */
+ tiled_offset = tiled_y_index-1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset+2;
+ temp1 = (tiled_x_index>>2)<<2;
+ tiled_offset = tiled_offset+temp1;
+ tiled_offset = tiled_offset<<11;
+ } else {
+ temp2 = ((yuv420_uv_height+31)>>5)<<5;
+ if ((i+32)<temp2) {
+ /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */
+ temp1 = tiled_x_index+2;
+ temp1 = (temp1>>2)<<2;
+ tiled_offset = tiled_x_index+temp1;
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_offset+tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset<<11;
+ } else {
+ /* even2 fomula: x+x_block_num*y */
+ temp1 = ((yuv420_width+127)>>7)<<7;
+ tiled_offset = tiled_y_index*(temp1>>6);
+ tiled_offset = tiled_offset+tiled_x_index;
+ tiled_offset = tiled_offset<<11;
+ }
+ }
+ temp1 = i&0x1F;
+ temp2 = j&0x3F;
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+temp2+64*(temp1), yuv420p_u_src+j/2+yuv420_width/2*(i), yuv420p_v_src+j/2+yuv420_width/2*(i), 2);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+temp2+64*(temp1+1), yuv420p_u_src+j/2+yuv420_width/2*(i+1), yuv420p_v_src+j/2+yuv420_width/2*(i+1), 2);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+temp2+64*(temp1+2), yuv420p_u_src+j/2+yuv420_width/2*(i+2), yuv420p_v_src+j/2+yuv420_width/2*(i+2), 2);
+ csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+temp2+64*(temp1+3), yuv420p_u_src+j/2+yuv420_width/2*(i+3), yuv420p_v_src+j/2+yuv420_width/2*(i+3), 2);
+ }
+ }
+}
+
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_deinterleave_memcpy.s b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_deinterleave_memcpy.s
new file mode 100644
index 0000000..5b55080
--- /dev/null
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_deinterleave_memcpy.s
@@ -0,0 +1,128 @@
+/*
+ *
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * 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.
+ */
+
+/*
+ * @file csc_deinterleave_memcpy.s
+ * @brief SEC_OMX specific define
+ * @author ShinWon Lee (shinwon.lee@samsung.com)
+ * @version 1.0
+ * @history
+ * 2011.7.01 : Create
+ */
+ .arch armv7-a
+ .text
+ .global csc_deinterleave_memcpy
+ .type csc_deinterleave_memcpy, %function
+csc_deinterleave_memcpy:
+ .fnstart
+
+ @r0 dest1
+ @r1 dest2
+ @r2 src
+ @r3 src_size
+ @r4 i
+ @r5 temp1
+ @r6 temp2
+ @r7 temp3
+
+ stmfd sp!, {r4-r12,r14} @ backup registers
+
+ mov r4, #0
+ cmp r3, #256
+ blt LINEAR_SIZE_128
+
+ bic r5, r3, #0xFF
+LINEAR_SIZE_256_LOOP:
+ pld [r2, #64]
+ vld2.8 {q0, q1}, [r2]!
+ pld [r2, #64]
+ vld2.8 {q2, q3}, [r2]!
+ pld [r2, #64]
+ vld2.8 {q4, q5}, [r2]!
+ pld [r2, #64]
+ vld2.8 {q6, q7}, [r2]!
+ pld [r2, #64]
+ vld2.8 {q8, q9}, [r2]!
+ pld [r2, #64]
+ vld2.8 {q10, q11}, [r2]!
+ vld2.8 {q12, q13}, [r2]!
+ vld2.8 {q14, q15}, [r2]!
+
+ vst1.8 {q0}, [r0]!
+ vst1.8 {q2}, [r0]!
+ vst1.8 {q4}, [r0]!
+ vst1.8 {q6}, [r0]!
+ vst1.8 {q8}, [r0]!
+ vst1.8 {q10}, [r0]!
+ vst1.8 {q12}, [r0]!
+ vst1.8 {q14}, [r0]!
+
+ vst1.8 {q1}, [r1]!
+ vst1.8 {q3}, [r1]!
+ vst1.8 {q5}, [r1]!
+ vst1.8 {q7}, [r1]!
+ vst1.8 {q9}, [r1]!
+ vst1.8 {q11}, [r1]!
+ vst1.8 {q13}, [r1]!
+ vst1.8 {q15}, [r1]!
+
+ add r4, #256
+ cmp r4, r5
+ blt LINEAR_SIZE_256_LOOP
+
+LINEAR_SIZE_128:
+ sub r5, r3, r4
+ cmp r5, #64
+ blt LINEAR_SIZE_4
+ pld [r2, #64]
+ vld2.8 {q0, q1}, [r2]!
+ pld [r2, #64]
+ vld2.8 {q2, q3}, [r2]!
+ vld2.8 {q4, q5}, [r2]!
+ vld2.8 {q6, q7}, [r2]!
+
+ vst1.8 {q0}, [r0]!
+ vst1.8 {q4}, [r0]!
+ vst1.8 {q2}, [r0]!
+ vst1.8 {q6}, [r0]!
+
+ vst1.8 {q1}, [r1]!
+ vst1.8 {q3}, [r1]!
+ vst1.8 {q5}, [r1]!
+ vst1.8 {q7}, [r1]!
+
+ add r4, #128
+
+LINEAR_SIZE_4:
+ ldrb r6, [r2], #1
+ ldrb r7, [r2], #1
+ ldrb r8, [r2], #1
+ ldrb r9, [r2], #1
+
+ strb r6, [r0], #1
+ strb r8, [r0], #1
+ strb r7, [r1], #1
+ strb r9, [r1], #1
+
+ add r4, #4
+ cmp r4, r3
+ blt LINEAR_SIZE_4
+
+RESTORE_REG:
+ ldmfd sp!, {r4-r12,r15} @ restore registers
+ .fnend
+
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_interleave_memcpy.s b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_interleave_memcpy.s
new file mode 100644
index 0000000..54f4436
--- /dev/null
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_interleave_memcpy.s
@@ -0,0 +1,133 @@
+/*
+ *
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * 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.
+ */
+
+/*
+ * @file csc_interleave_memcpy.s
+ * @brief SEC_OMX specific define
+ * @author ShinWon Lee (shinwon.lee@samsung.com)
+ * @version 1.0
+ * @history
+ * 2011.7.01 : Create
+ */
+ .arch armv7-a
+ .text
+ .global csc_interleave_memcpy
+ .type csc_interleave_memcpy, %function
+csc_interleave_memcpy:
+ .fnstart
+
+ @r0 dest
+ @r1 src1
+ @r2 src2
+ @r3 src_size
+ @r4 i
+ @r5 temp1
+ @r6 temp2
+ @r7 temp3
+ @r8 temp2
+ @r9 temp3
+
+ stmfd sp!, {r4-r12,r14} @ backup registers
+
+ mov r4, #0
+ cmp r3, #128
+ blt LINEAR_SIZE_64
+
+ bic r5, r3, #0x2F
+LINEAR_SIZE_128_LOOP:
+ pld [r1, #64]
+ vld1.8 {q0}, [r1]!
+ vld1.8 {q2}, [r1]!
+ vld1.8 {q4}, [r1]!
+ vld1.8 {q6}, [r1]!
+ pld [r2]
+ vld1.8 {q8}, [r1]!
+ vld1.8 {q10}, [r1]!
+ vld1.8 {q12}, [r1]!
+ vld1.8 {q14}, [r1]!
+ pld [r2, #64]
+ vld1.8 {q1}, [r2]!
+ vld1.8 {q3}, [r2]!
+ vld1.8 {q5}, [r2]!
+ vld1.8 {q7}, [r2]!
+ vld1.8 {q9}, [r2]!
+ vld1.8 {q11}, [r2]!
+ vld1.8 {q13}, [r2]!
+ vld1.8 {q15}, [r2]!
+
+ vst2.8 {q0, q1}, [r0]!
+ vst2.8 {q2, q3}, [r0]!
+ vst2.8 {q4, q5}, [r0]!
+ vst2.8 {q6, q7}, [r0]!
+ vst2.8 {q8, q9}, [r0]!
+ vst2.8 {q10, q11}, [r0]!
+ pld [r1]
+ vst2.8 {q12, q13}, [r0]!
+ vst2.8 {q14, q15}, [r0]!
+
+ add r4, #128
+ cmp r4, r5
+ blt LINEAR_SIZE_128_LOOP
+
+LINEAR_SIZE_64:
+ sub r5, r3, r4
+ cmp r5, #64
+ blt LINEAR_SIZE_2
+LINEAR_SIZE_64_LOOP:
+ pld [r2]
+ vld1.8 {q0}, [r1]!
+ vld1.8 {q2}, [r1]!
+ vld1.8 {q4}, [r1]!
+ vld1.8 {q6}, [r1]!
+ vld1.8 {q1}, [r2]!
+ vld1.8 {q3}, [r2]!
+ vld1.8 {q5}, [r2]!
+ vld1.8 {q7}, [r2]!
+
+ vst2.8 {q0, q1}, [r0]!
+ vst2.8 {q2, q3}, [r0]!
+ pld [r1]
+ vst2.8 {q4, q5}, [r0]!
+ vst2.8 {q6, q7}, [r0]!
+
+ add r4, #64
+ cmp r4, r3
+ blt LINEAR_SIZE_64_LOOP
+
+LINEAR_SIZE_2:
+ sub r5, r3, r4
+ cmp r5, #2
+ blt RESTORE_REG
+LINEAR_SIZE_2_LOOP:
+ ldrb r6, [r1], #1
+ ldrb r7, [r2], #1
+ ldrb r8, [r1], #1
+ ldrb r9, [r2], #1
+
+ strb r6, [r0], #1
+ strb r7, [r0], #1
+ strb r8, [r0], #1
+ strb r9, [r0], #1
+
+ add r4, #2
+ cmp r4, r3
+ blt LINEAR_SIZE_2_LOOP
+
+RESTORE_REG:
+ ldmfd sp!, {r4-r12,r15} @ restore registers
+ .fnend
+
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_nv12t_yuv420_uv_neon.s b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_nv12t_yuv420_uv_neon.s
new file mode 100644
index 0000000..08e359c
--- /dev/null
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_nv12t_yuv420_uv_neon.s
@@ -0,0 +1,768 @@
+/*
+ *
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * 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.
+ */
+
+/*
+ * @file csc_nv12t_yuv420_uv_neon.s
+ * @brief SEC_OMX specific define
+ * @author ShinWon Lee (shinwon.lee@samsung.com)
+ * @version 1.0
+ * @history
+ * 2011.7.01 : Create
+ */
+
+/*
+ * Converts and Deinterleaves tiled data to linear
+ * 1. UV of NV12T to UV of YUV420P
+ *
+ * @param yuv420_u_dest
+ * U plane address of YUV420P[out]
+ *
+ * @param yuv420_v_dest
+ * V plane address of YUV420P[out]
+ *
+ * @param nv12t_src
+ * UV plane address of NV12T[in]
+ *
+ * @param yuv420_width
+ * Width of YUV420[in]
+ *
+ * @param yuv420_uv_height
+ * Height/2 of YUV420[in]
+ */
+
+ .arch armv7-a
+ .text
+ .global csc_tiled_to_linear_deinterleave
+ .type csc_tiled_to_linear_deinterleave, %function
+csc_tiled_to_linear_deinterleave:
+ .fnstart
+
+ @r0 linear_u_dest
+ @r1 linear_v_dest
+ @r2 tiled_uv_src
+ @r3 linear_x_size
+ @r4 linear_y_size
+ @r5 j
+ @r6 i
+ @r7 tiled_addr
+ @r8 linear_addr
+ @r9 aligned_x_size
+ @r10 temp1
+ @r11 temp2
+ @r12 temp3
+ @r14 temp4
+
+ stmfd sp!, {r4-r12,r14} @ backup registers
+
+ ldr r4, [sp, #40] @ load linear_y_size to r4
+
+ mov r9, #0
+
+LINEAR_X_SIZE_1024:
+ cmp r3, #1024
+ blt LINEAR_X_SIZE_512
+
+ mov r6, #0
+LINEAR_X_SIZE_1024_LOOP:
+ mov r7, #0 @ tiled_offset = 0@
+ mov r5, r6, asr #5 @ tiled_y_index = i>>5@
+ and r10, r5, #0x1
+ cmp r10, #0x1
+ bne LINEAR_X_SIZE_1024_LOOP_EVEN
+LINEAR_X_SIZE_1024_LOOP_ODD:
+ sub r7, r5, #1 @ tiled_offset = tiled_y_index-1@
+ add r10, r3, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_offset*(temp1>>6)@
+ mul r7, r7, r10
+ mov r5, #8
+ mov r5, r5, lsl #11
+ sub r5, r5, #32
+ add r7, r7, #2 @ tiled_offset = tiled_offset+2@
+ mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11@
+ add r11, r7, #2048
+ add r12, r7, #4096
+ add r14, r7, #6144
+ b LINEAR_X_SIZE_1024_LOOP_MEMCPY
+
+LINEAR_X_SIZE_1024_LOOP_EVEN:
+ add r11, r4, #31 @ temp2 = ((linear_y_size+31)>>5)<<5@
+ bic r11, r11, #0x1F
+ add r10, r3, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_y_index*(temp1>>6)@
+ mul r7, r5, r10
+ add r12, r6, #32
+ cmp r12, r11
+ mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11@
+ add r11, r7, #2048
+ movlt r5, #8
+ addlt r12, r7, #12288
+ addlt r14, r7, #14336
+ movge r5, #4
+ addge r12, r7, #2048
+ addge r14, r7, #2048
+ mov r5, r5, lsl #11
+ sub r5, r5, #32
+
+LINEAR_X_SIZE_1024_LOOP_MEMCPY:
+ and r10, r6, #0x1F
+ mov r10, r10, lsl #6
+ add r10, r2, r10
+
+ add r7, r7, r10 @ tiled_addr = tiled_src+64*(temp1)
+ add r11, r11, r10 @ tiled_addr1 = tiled_src+64*(temp1)
+ pld [r11]
+ vld2.8 {q0, q1}, [r7]!
+ pld [r11, #32]
+ add r12, r12, r10 @ tiled_addr2 = tiled_src+64*(temp1)
+ vld2.8 {q2, q3}, [r7], r5
+ pld [r12]
+ vld2.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ add r14, r14, r10 @ tiled_addr3 = tiled_src+64*(temp1)
+ vld2.8 {q6, q7}, [r11], r5
+ pld [r14]
+ vld2.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ mov r10, r3, asr #1
+ vld2.8 {q10, q11}, [r12], r5
+ mul r10, r10, r6
+ vld2.8 {q12, q13}, [r14]!
+ vld2.8 {q14, q15}, [r14], r5
+
+ add r8, r0, r10
+ vst1.8 {q0}, [r8]!
+ vst1.8 {q2}, [r8]!
+ vst1.8 {q4}, [r8]!
+ vst1.8 {q6}, [r8]!
+ vst1.8 {q8}, [r8]!
+ vst1.8 {q10}, [r8]!
+ vst1.8 {q12}, [r8]!
+ vst1.8 {q14}, [r8]!
+
+ add r10, r1, r10
+ vst1.8 {q1}, [r10]!
+ vst1.8 {q3}, [r10]!
+ vst1.8 {q5}, [r10]!
+ vst1.8 {q7}, [r10]!
+ vst1.8 {q9}, [r10]!
+ vst1.8 {q11}, [r10]!
+ pld [r7]
+ vst1.8 {q13}, [r10]!
+ pld [r7, #32]
+ vst1.8 {q15}, [r10]!
+
+ pld [r11]
+ vld2.8 {q0, q1}, [r7]!
+ pld [r11, #32]
+ vld2.8 {q2, q3}, [r7], r5
+ pld [r12]
+ vld2.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ vld2.8 {q6, q7}, [r11], r5
+ pld [r14]
+ vld2.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ vld2.8 {q10, q11}, [r12], r5
+ vld2.8 {q12, q13}, [r14]!
+ vld2.8 {q14, q15}, [r14], r5
+
+ vst1.8 {q0}, [r8]!
+ vst1.8 {q2}, [r8]!
+ vst1.8 {q4}, [r8]!
+ vst1.8 {q6}, [r8]!
+ vst1.8 {q8}, [r8]!
+ vst1.8 {q10}, [r8]!
+ vst1.8 {q12}, [r8]!
+ vst1.8 {q14}, [r8]!
+
+ vst1.8 {q1}, [r10]!
+ vst1.8 {q3}, [r10]!
+ vst1.8 {q5}, [r10]!
+ vst1.8 {q7}, [r10]!
+ vst1.8 {q9}, [r10]!
+ vst1.8 {q11}, [r10]!
+ pld [r7]
+ vst1.8 {q13}, [r10]!
+ pld [r7, #32]
+ vst1.8 {q15}, [r10]!
+
+ pld [r11]
+ vld2.8 {q0, q1}, [r7]!
+ pld [r11, #32]
+ vld2.8 {q2, q3}, [r7], r5
+ pld [r12]
+ vld2.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ vld2.8 {q6, q7}, [r11], r5
+ pld [r14]
+ vld2.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ vld2.8 {q10, q11}, [r12], r5
+ vld2.8 {q12, q13}, [r14]!
+ vld2.8 {q14, q15}, [r14], r5
+
+ vst1.8 {q0}, [r8]!
+ vst1.8 {q2}, [r8]!
+ vst1.8 {q4}, [r8]!
+ vst1.8 {q6}, [r8]!
+ vst1.8 {q8}, [r8]!
+ vst1.8 {q10}, [r8]!
+ vst1.8 {q12}, [r8]!
+ vst1.8 {q14}, [r8]!
+
+ vst1.8 {q1}, [r10]!
+ vst1.8 {q3}, [r10]!
+ vst1.8 {q5}, [r10]!
+ vst1.8 {q7}, [r10]!
+ vst1.8 {q9}, [r10]!
+ vst1.8 {q11}, [r10]!
+ pld [r7]
+ vst1.8 {q13}, [r10]!
+ pld [r7, #32]
+ vst1.8 {q15}, [r10]!
+
+ pld [r11]
+ vld2.8 {q0, q1}, [r7]!
+ pld [r11, #32]
+ vld2.8 {q2, q3}, [r7]
+ pld [r12]
+ vld2.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ vld2.8 {q6, q7}, [r11]
+ pld [r14]
+ vld2.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ vld2.8 {q10, q11}, [r12]
+ vld2.8 {q12, q13}, [r14]!
+ vld2.8 {q14, q15}, [r14]
+
+ vst1.8 {q0}, [r8]!
+ vst1.8 {q2}, [r8]!
+ vst1.8 {q4}, [r8]!
+ vst1.8 {q6}, [r8]!
+ vst1.8 {q8}, [r8]!
+ vst1.8 {q10}, [r8]!
+ vst1.8 {q12}, [r8]!
+ vst1.8 {q14}, [r8]!
+
+ vst1.8 {q1}, [r10]!
+ vst1.8 {q3}, [r10]!
+ vst1.8 {q5}, [r10]!
+ vst1.8 {q7}, [r10]!
+ vst1.8 {q9}, [r10]!
+ vst1.8 {q11}, [r10]!
+ add r6, #1
+ vst1.8 {q13}, [r10]!
+ cmp r6, r4
+ vst1.8 {q15}, [r10]!
+
+ blt LINEAR_X_SIZE_1024_LOOP
+
+ mov r9, #1024
+
+LINEAR_X_SIZE_512:
+ sub r10, r3, r9
+ cmp r10, #512
+ blt LINEAR_X_SIZE_256
+
+ mov r6, #0
+LINEAR_X_SIZE_512_LOOP:
+ mov r7, #0 @ tiled_offset = 0@
+ mov r5, r6, asr #5 @ tiled_y_index = i>>5@
+ and r10, r5, #0x1
+ cmp r10, #0x1
+ bne LINEAR_X_SIZE_512_LOOP_EVEN
+LINEAR_X_SIZE_512_LOOP_ODD:
+ sub r7, r5, #1 @ tiled_offset = tiled_y_index-1@
+ add r10, r3, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_offset*(temp1>>6)@
+ mul r7, r7, r10
+ mov r5, #8
+ mov r5, r5, lsl #11
+ add r7, r7, #2 @ tiled_offset = tiled_offset+2@
+ mov r10, r9, asr #5
+ add r7, r7, r10
+ mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11@
+ add r11, r7, #2048
+ add r12, r7, #4096
+ add r14, r7, #6144
+ sub r5, r5, #32
+ b LINEAR_X_SIZE_512_LOOP_MEMCPY
+
+LINEAR_X_SIZE_512_LOOP_EVEN:
+ add r11, r4, #31 @ temp2 = ((linear_y_size+31)>>5)<<5@
+ bic r11, r11, #0x1F
+ add r10, r3, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_y_index*(temp1>>6)@
+ mul r7, r5, r10
+ add r12, r6, #32
+ cmp r12, r11
+ mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11@
+ movlt r5, #8
+ movlt r10, r9, asr #5
+ movge r10, r9, asr #6
+ add r7, r7, r10, lsl #11
+ add r11, r7, #2048
+ addlt r12, r7, #12288
+ addlt r14, r7, #14336
+ movge r5, #4
+ addge r12, r7, #4096
+ addge r14, r7, #6144
+ mov r5, r5, lsl #11
+ sub r5, r5, #32
+
+LINEAR_X_SIZE_512_LOOP_MEMCPY:
+ and r10, r6, #0x1F
+ mov r10, r10, lsl #6
+ add r10, r2, r10
+
+ add r7, r7, r10 @ tiled_addr = tiled_src+64*(temp1)
+ add r11, r11, r10 @ tiled_addr1 = tiled_src+64*(temp1)
+ pld [r11]
+ vld2.8 {q0, q1}, [r7]!
+ pld [r11, #32]
+ add r12, r12, r10 @ tiled_addr2 = tiled_src+64*(temp1)
+ vld2.8 {q2, q3}, [r7], r5
+ pld [r12]
+ vld2.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ add r14, r14, r10 @ tiled_addr3 = tiled_src+64*(temp1)
+ vld2.8 {q6, q7}, [r11], r5
+ pld [r14]
+ mov r10, r3, asr #1
+ vld2.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ mul r10, r10, r6
+ vld2.8 {q10, q11}, [r12], r5
+ add r8, r0, r10
+ vld2.8 {q12, q13}, [r14]!
+ add r8, r8, r9, asr #1
+ vld2.8 {q14, q15}, [r14], r5
+
+ vst1.8 {q0}, [r8]!
+ vst1.8 {q2}, [r8]!
+ vst1.8 {q4}, [r8]!
+ vst1.8 {q6}, [r8]!
+ vst1.8 {q8}, [r8]!
+ vst1.8 {q10}, [r8]!
+ vst1.8 {q12}, [r8]!
+ add r10, r1, r10
+ vst1.8 {q14}, [r8]!
+
+ add r10, r10, r9, asr #1
+ vst1.8 {q1}, [r10]!
+ vst1.8 {q3}, [r10]!
+ vst1.8 {q5}, [r10]!
+ vst1.8 {q7}, [r10]!
+ vst1.8 {q9}, [r10]!
+ vst1.8 {q11}, [r10]!
+ pld [r7]
+ vst1.8 {q13}, [r10]!
+ pld [r7, #32]
+ vst1.8 {q15}, [r10]!
+
+ pld [r11]
+ vld2.8 {q0, q1}, [r7]!
+ pld [r11, #32]
+ vld2.8 {q2, q3}, [r7]
+ pld [r12]
+ vld2.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ vld2.8 {q6, q7}, [r11]
+ pld [r14]
+ vld2.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ vld2.8 {q10, q11}, [r12]
+ vld2.8 {q12, q13}, [r14]!
+ vld2.8 {q14, q15}, [r14]
+
+ vst1.8 {q0}, [r8]!
+ vst1.8 {q2}, [r8]!
+ vst1.8 {q4}, [r8]!
+ vst1.8 {q6}, [r8]!
+ vst1.8 {q8}, [r8]!
+ vst1.8 {q10}, [r8]!
+ vst1.8 {q12}, [r8]!
+ vst1.8 {q14}, [r8]!
+
+ vst1.8 {q1}, [r10]!
+ vst1.8 {q3}, [r10]!
+ vst1.8 {q5}, [r10]!
+ vst1.8 {q7}, [r10]!
+ vst1.8 {q9}, [r10]!
+ vst1.8 {q11}, [r10]!
+ add r6, #1
+ vst1.8 {q13}, [r10]!
+ cmp r6, r4
+ vst1.8 {q15}, [r10]!
+
+ blt LINEAR_X_SIZE_512_LOOP
+
+ add r9, r9, #512
+
+LINEAR_X_SIZE_256:
+ sub r10, r3, r9
+ cmp r10, #256
+ blt LINEAR_X_SIZE_128
+
+ mov r6, #0
+LINEAR_X_SIZE_256_LOOP:
+ mov r7, #0 @ tiled_offset = 0@
+ mov r5, r6, asr #5 @ tiled_y_index = i>>5@
+ and r10, r5, #0x1
+ cmp r10, #0x1
+ bne LINEAR_X_SIZE_256_LOOP_EVEN
+LINEAR_X_SIZE_256_LOOP_ODD:
+ sub r7, r5, #1 @ tiled_offset = tiled_y_index-1@
+ add r10, r3, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_offset*(temp1>>6)@
+ mul r7, r7, r10
+ add r7, r7, #2 @ tiled_offset = tiled_offset+2@
+ mov r10, r9, asr #5
+ add r7, r7, r10
+ mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11@
+ add r11, r7, #2048
+ add r12, r7, #4096
+ add r14, r7, #6144
+ b LINEAR_X_SIZE_256_LOOP_MEMCPY
+
+LINEAR_X_SIZE_256_LOOP_EVEN:
+ add r11, r4, #31 @ temp2 = ((linear_y_size+31)>>5)<<5@
+ bic r11, r11, #0x1F
+ add r10, r3, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_y_index*(temp1>>6)@
+ mul r7, r5, r10
+ mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11@
+ add r12, r6, #32
+ cmp r12, r11
+ movlt r10, r9, asr #5
+ addlt r7, r7, r10, lsl #11
+ addlt r11, r7, #2048
+ addlt r12, r7, #12288
+ addlt r14, r7, #14336
+ movge r10, r9, asr #6
+ addge r7, r7, r10, lsl #11
+ addge r11, r7, #2048
+ addge r12, r7, #4096
+ addge r14, r7, #6144
+
+LINEAR_X_SIZE_256_LOOP_MEMCPY:
+ and r10, r6, #0x1F
+ mov r10, r10, lsl #6
+ add r10, r2, r10
+
+ add r7, r7, r10 @ tiled_addr = tiled_src+64*(temp1)
+ add r11, r11, r10 @ tiled_addr1 = tiled_src+64*(temp1)
+ pld [r11]
+ vld2.8 {q0, q1}, [r7]!
+ pld [r11, #32]
+ add r12, r12, r10 @ tiled_addr2 = tiled_src+64*(temp1)
+ vld2.8 {q2, q3}, [r7]
+ pld [r12]
+ vld2.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ add r14, r14, r10 @ tiled_addr3 = tiled_src+64*(temp1)
+ vld2.8 {q6, q7}, [r11]
+ pld [r14]
+ vld2.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ mov r10, r3, asr #1
+ vld2.8 {q10, q11}, [r12]
+ mul r10, r10, r6
+ vld2.8 {q12, q13}, [r14]!
+ add r8, r0, r10
+ vld2.8 {q14, q15}, [r14]
+
+ add r8, r8, r9, asr #1
+ vst1.8 {q0}, [r8]!
+ vst1.8 {q2}, [r8]!
+ vst1.8 {q4}, [r8]!
+ vst1.8 {q6}, [r8]!
+ vst1.8 {q8}, [r8]!
+ vst1.8 {q10}, [r8]!
+ vst1.8 {q12}, [r8]!
+ add r10, r1, r10
+ vst1.8 {q14}, [r8]!
+
+ add r10, r10, r9, asr #1
+ vst1.8 {q1}, [r10]!
+ vst1.8 {q3}, [r10]!
+ vst1.8 {q5}, [r10]!
+ vst1.8 {q7}, [r10]!
+ vst1.8 {q9}, [r10]!
+ vst1.8 {q11}, [r10]!
+ add r6, #1
+ vst1.8 {q13}, [r10]!
+ cmp r6, r4
+ vst1.8 {q15}, [r10]!
+ blt LINEAR_X_SIZE_256_LOOP
+
+ add r9, r9, #256
+
+LINEAR_X_SIZE_128:
+ sub r10, r3, r9
+ cmp r10, #128
+ blt LINEAR_X_SIZE_64
+
+ mov r6, #0
+LINEAR_X_SIZE_128_LOOP:
+ mov r7, #0 @ tiled_offset = 0@
+ mov r5, r6, asr #5 @ tiled_y_index = i>>5@
+ and r10, r5, #0x1
+ cmp r10, #0x1
+ bne LINEAR_X_SIZE_128_LOOP_EVEN
+LINEAR_X_SIZE_128_LOOP_ODD:
+ sub r7, r5, #1 @ tiled_offset = tiled_y_index-1@
+ add r10, r3, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_offset*(temp1>>6)@
+ mul r7, r7, r10
+ add r7, r7, #2 @ tiled_offset = tiled_offset+2@
+ mov r10, r9, asr #5
+ add r7, r7, r10
+ mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11@
+ add r11, r7, #2048
+ b LINEAR_X_SIZE_128_LOOP_MEMCPY
+
+LINEAR_X_SIZE_128_LOOP_EVEN:
+ add r11, r4, #31 @ temp2 = ((linear_y_size+31)>>5)<<5@
+ bic r11, r11, #0x1F
+ add r10, r3, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_y_index*(temp1>>6)@
+ mul r7, r5, r10
+ mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11@
+ add r12, r6, #32
+ cmp r12, r11
+ movlt r10, r9, asr #5
+ movge r10, r9, asr #6
+ add r7, r7, r10, lsl #11
+ add r11, r7, #2048
+
+LINEAR_X_SIZE_128_LOOP_MEMCPY:
+ and r10, r6, #0x1F
+ mov r10, r10, lsl #6
+ add r10, r2, r10
+
+ add r7, r7, r10 @ tiled_addr = tiled_src+64*(temp1)
+ add r11, r11, r10 @ tiled_addr1 = tiled_src+64*(temp1)
+ pld [r11]
+ vld2.8 {q0, q1}, [r7]!
+ pld [r11, #32]
+ vld2.8 {q2, q3}, [r7]!
+ pld [r7]
+ vld2.8 {q4, q5}, [r11]!
+ mov r10, r3, asr #1
+ pld [r7, #32]
+ vld2.8 {q6, q7}, [r11]!
+ mul r10, r10, r6
+ pld [r11]
+ vld2.8 {q8, q9}, [r7]!
+ add r10, r10, r9, asr #1
+ pld [r11, #32]
+ vld2.8 {q10, q11}, [r7]!
+ add r8, r0, r10
+ vld2.8 {q12, q13}, [r11]!
+ mov r14, r3, asr #1
+ vld2.8 {q14, q15}, [r11]!
+
+ sub r14, r14, #48
+ vst1.8 {q0}, [r8]!
+ vst1.8 {q2}, [r8]!
+ vst1.8 {q4}, [r8]!
+ vst1.8 {q6}, [r8], r14
+ vst1.8 {q8}, [r8]!
+ vst1.8 {q10}, [r8]!
+ vst1.8 {q12}, [r8]!
+ vst1.8 {q14}, [r8]!
+
+ add r10, r1, r10
+ vst1.8 {q1}, [r10]!
+ vst1.8 {q3}, [r10]!
+ vst1.8 {q5}, [r10]!
+ vst1.8 {q7}, [r10], r14
+ vst1.8 {q9}, [r10]!
+ vst1.8 {q11}, [r10]!
+ add r6, #2
+ vst1.8 {q13}, [r10]!
+ cmp r6, r4
+ vst1.8 {q15}, [r10]!
+
+ blt LINEAR_X_SIZE_128_LOOP
+
+ add r9, r9, #128
+
+LINEAR_X_SIZE_64:
+ sub r10, r3, r9
+ cmp r10, #64
+ blt LINEAR_X_SIZE_4
+
+ mov r5, r9
+ mov r6, #0
+
+LINEAR_X_SIZE_64_LOOP:
+ bl GET_TILED_OFFSET
+
+LINEAR_X_SIZE_64_LOOP_MEMCPY:
+ and r10, r6, #0x1F
+ mov r14, r3, asr #1
+ mov r10, r10, lsl #6
+ sub r14, r14, #16
+ add r10, r2, r10
+
+ add r7, r7, r10 @ tiled_addr = tiled_src+64*(temp1)
+ pld [r7, #64]
+ vld2.8 {q0, q1}, [r7]!
+ mov r10, r3, asr #1
+ pld [r7, #64]
+ vld2.8 {q2, q3}, [r7]!
+ mul r10, r10, r6
+ vld2.8 {q4, q5}, [r7]!
+ add r10, r10, r9, asr #1
+ vld2.8 {q6, q7}, [r7]!
+ add r8, r0, r10
+
+ vst1.8 {q0}, [r8]!
+ vst1.8 {q2}, [r8], r14
+ vst1.8 {q4}, [r8]!
+ vst1.8 {q6}, [r8], r14
+
+ add r10, r1, r10
+ vst1.8 {q1}, [r10]!
+ vst1.8 {q3}, [r10], r14
+ add r6, #2
+ vst1.8 {q5}, [r10]!
+ cmp r6, r4
+ vst1.8 {q7}, [r10], r14
+
+ blt LINEAR_X_SIZE_64_LOOP
+
+ add r9, r9, #64
+
+LINEAR_X_SIZE_4:
+ cmp r9, r3
+ beq RESTORE_REG
+
+ mov r6, #0 @ i = 0
+LINEAR_Y_SIZE_4_LOOP:
+
+ mov r5, r9 @ j = aligned_x_size
+LINEAR_X_SIZE_4_LOOP:
+
+ bl GET_TILED_OFFSET
+
+ mov r11, r3, asr #1 @ temp1 = linear_x_size/2
+ mul r11, r11, r6 @ temp1 = temp1*(i)
+ add r11, r11, r5, asr #1 @ temp1 = temp1+j/2
+ mov r12, r3, asr #1 @ temp2 = linear_x_size/2
+ sub r12, r12, #1 @ temp2 = linear_x_size-1
+
+ add r8, r0, r11 @ linear_addr = linear_dest_u+temp1
+ add r11, r1, r11 @ temp1 = linear_dest_v+temp1
+ add r7, r2, r7 @ tiled_addr = tiled_src+tiled_addr
+ and r14, r6, #0x1F @ temp3 = i&0x1F@
+ mov r14, r14, lsl #6 @ temp3 = temp3*64
+ add r7, r7, r14 @ tiled_addr = tiled_addr+temp3
+ and r14, r5, #0x3F @ temp3 = j&0x3F
+ add r7, r7, r14 @ tiled_addr = tiled_addr+temp3
+
+ ldrh r10, [r7], #2
+ ldrh r14, [r7], #62
+ strb r10, [r8], #1
+ mov r10, r10, asr #8
+ strb r10, [r11], #1
+ strb r14, [r8], r12
+ mov r14, r14, asr #8
+ strb r14, [r11], r12
+
+ ldrh r10, [r7], #2
+ ldrh r14, [r7], #62
+ strb r10, [r8], #1
+ mov r10, r10, asr #8
+ strb r10, [r11], #1
+ strb r14, [r8], r12
+ mov r14, r14, asr #8
+ strb r14, [r11], r12
+
+ add r5, r5, #4 @ j = j+4
+ cmp r5, r3 @ j<linear_x_size
+ blt LINEAR_X_SIZE_4_LOOP
+
+ add r6, r6, #2 @ i = i+4
+ cmp r6, r4 @ i<linear_y_size
+ blt LINEAR_Y_SIZE_4_LOOP
+
+RESTORE_REG:
+ ldmfd sp!, {r4-r12,r15} @ restore registers
+
+GET_TILED_OFFSET:
+ stmfd sp!, {r14}
+
+ mov r12, r6, asr #5 @ temp2 = i>>5
+ mov r11, r5, asr #6 @ temp1 = j>>6
+
+ and r14, r12, #0x1 @ if (temp2 & 0x1)
+ cmp r14, #0x1
+ bne GET_TILED_OFFSET_EVEN_FORMULA_1
+
+GET_TILED_OFFSET_ODD_FORMULA:
+ sub r7, r12, #1 @ tiled_addr = temp2-1
+ add r14, r3, #127 @ temp3 = linear_x_size+127
+ bic r14, r14, #0x7F @ temp3 = (temp3 >>7)<<7
+ mov r14, r14, asr #6 @ temp3 = temp3>>6
+ mul r7, r7, r14 @ tiled_addr = tiled_addr*temp3
+ add r7, r7, r11 @ tiled_addr = tiled_addr+temp1
+ add r7, r7, #2 @ tiled_addr = tiled_addr+2
+ bic r14, r11, #0x3 @ temp3 = (temp1>>2)<<2
+ add r7, r7, r14 @ tiled_addr = tiled_addr+temp3
+ mov r7, r7, lsl #11 @ tiled_addr = tiled_addr<<11
+ b GET_TILED_OFFSET_RETURN
+
+GET_TILED_OFFSET_EVEN_FORMULA_1:
+ add r14, r4, #31 @ temp3 = linear_y_size+31
+ bic r14, r14, #0x1F @ temp3 = (temp3>>5)<<5
+ sub r14, r14, #32 @ temp3 = temp3 - 32
+ cmp r6, r14 @ if (i<(temp3-32)) {
+ bge GET_TILED_OFFSET_EVEN_FORMULA_2
+ add r14, r11, #2 @ temp3 = temp1+2
+ bic r14, r14, #3 @ temp3 = (temp3>>2)<<2
+ add r7, r11, r14 @ tiled_addr = temp1+temp3
+ add r14, r3, #127 @ temp3 = linear_x_size+127
+ bic r14, r14, #0x7F @ temp3 = (temp3>>7)<<7
+ mov r14, r14, asr #6 @ temp3 = temp3>>6
+ mul r12, r12, r14 @ tiled_y_index = tiled_y_index*temp3
+ add r7, r7, r12 @ tiled_addr = tiled_addr+tiled_y_index
+ mov r7, r7, lsl #11 @
+ b GET_TILED_OFFSET_RETURN
+
+GET_TILED_OFFSET_EVEN_FORMULA_2:
+ add r14, r3, #127 @ temp3 = linear_x_size+127
+ bic r14, r14, #0x7F @ temp3 = (temp3>>7)<<7
+ mov r14, r14, asr #6 @ temp3 = temp3>>6
+ mul r7, r12, r14 @ tiled_addr = temp2*temp3
+ add r7, r7, r11 @ tiled_addr = tiled_addr+temp3
+ mov r7, r7, lsl #11 @ tiled_addr = tiled_addr<<11@
+
+GET_TILED_OFFSET_RETURN:
+ ldmfd sp!, {r15} @ restore registers
+ .fnend
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_nv12t_yuv420_y_neon.s b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_nv12t_yuv420_y_neon.s
new file mode 100644
index 0000000..d71ee17
--- /dev/null
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_nv12t_yuv420_y_neon.s
@@ -0,0 +1,680 @@
+/*
+ *
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * 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.
+ */
+
+/*
+ * @file csc_nv12t_yuv420_y_neon.s
+ * @brief SEC_OMX specific define
+ * @author ShinWon Lee (shinwon.lee@samsung.com)
+ * @version 1.0
+ * @history
+ * 2011.7.01 : Create
+ */
+
+/*
+ * Converts tiled data to linear.
+ * 1. Y of NV12T to Y of YUV420P
+ * 2. Y of NV12T to Y of YUV420S
+ * 3. UV of NV12T to UV of YUV420S
+ *
+ * @param yuv420_dest
+ * Y or UV plane address of YUV420[out]
+ *
+ * @param nv12t_src
+ * Y or UV plane address of NV12T[in]
+ *
+ * @param yuv420_width
+ * Width of YUV420[in]
+ *
+ * @param yuv420_height
+ * Y: Height of YUV420, UV: Height/2 of YUV420[in]
+ */
+
+ .arch armv7-a
+ .text
+ .global csc_tiled_to_linear
+ .type csc_tiled_to_linear, %function
+csc_tiled_to_linear:
+ .fnstart
+
+ @r0 linear_dest
+ @r1 tiled_src
+ @r2 linear_x_size
+ @r3 linear_y_size
+ @r4 j
+ @r5 i
+ @r6 tiled_addr
+ @r7 linear_addr
+ @r8 aligned_x_size
+ @r9 aligned_y_size
+ @r10 temp1
+ @r11 temp2
+ @r12 temp3
+ @r14 temp4
+
+ stmfd sp!, {r4-r12,r14} @ backup registers
+
+ mov r8, #0
+ cmp r2, #1024
+ blt LINEAR_X_SIZE_512
+
+LINEAR_X_SIZE_1024:
+
+ mov r5, #0
+LINEAR_X_SIZE_1024_LOOP:
+ mov r6, #0 @ tiled_offset = 0@
+ mov r4, r5, asr #5 @ tiled_y_index = i>>5@
+ and r10, r4, #0x1
+ cmp r10, #0x1
+ bne LINEAR_X_SIZE_1024_LOOP_EVEN
+LINEAR_X_SIZE_1024_LOOP_ODD:
+ sub r6, r4, #1 @ tiled_offset = tiled_y_index-1@
+ add r10, r2, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_offset*(temp1>>6)@
+ mul r6, r6, r10
+ mov r4, #8
+ mov r4, r4, lsl #11
+ sub r4, r4, #32
+ add r6, r6, #2 @ tiled_offset = tiled_offset+2@
+ mov r6, r6, lsl #11 @ tiled_offset = tiled_offset<<11@
+ add r11, r6, #2048
+ add r12, r6, #4096
+ add r14, r6, #6144
+ b LINEAR_X_SIZE_1024_LOOP_MEMCPY
+
+LINEAR_X_SIZE_1024_LOOP_EVEN:
+ add r11, r3, #31 @ temp2 = ((linear_y_size+31)>>5)<<5@
+ bic r11, r11, #0x1F
+ add r10, r2, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_y_index*(temp1>>6)@
+ mul r6, r4, r10
+ add r12, r5, #32
+ cmp r12, r11
+ mov r6, r6, lsl #11 @ tiled_offset = tiled_offset<<11@
+ add r11, r6, #2048
+ movlt r4, #8
+ addlt r12, r6, #12288
+ addlt r14, r6, #14336
+ movge r4, #4
+ addge r12, r6, #4096
+ addge r14, r6, #6144
+ mov r4, r4, lsl #11
+ sub r4, r4, #32
+
+LINEAR_X_SIZE_1024_LOOP_MEMCPY:
+ and r10, r5, #0x1F
+ mov r10, r10, lsl #6
+ add r10, r1, r10
+
+ add r6, r6, r10 @ tiled_addr = tiled_src+64*(temp1)
+ add r11, r11, r10 @ tiled_addr1 = tiled_src+64*(temp1)
+ pld [r11]
+ vld1.8 {q0, q1}, [r6]!
+ pld [r11, #32]
+ add r12, r12, r10 @ tiled_addr2 = tiled_src+64*(temp1)
+ vld1.8 {q2, q3}, [r6], r4
+ pld [r12]
+ vld1.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ add r14, r14, r10 @ tiled_addr3 = tiled_src+64*(temp1)
+ vld1.8 {q6, q7}, [r11], r4
+ pld [r14]
+ vld1.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ mul r7, r2, r5
+ vld1.8 {q10, q11}, [r12], r4
+ add r7, r7, r0
+ vld1.8 {q12, q13}, [r14]!
+ vld1.8 {q14, q15}, [r14], r4
+
+ vst1.8 {q0, q1}, [r7]!
+ vst1.8 {q2, q3}, [r7]!
+ vst1.8 {q4, q5}, [r7]!
+ vst1.8 {q6, q7}, [r7]!
+ vst1.8 {q8, q9}, [r7]!
+ vst1.8 {q10, q11}, [r7]!
+ pld [r6]
+ vst1.8 {q12, q13}, [r7]!
+ pld [r6, #32]
+ vst1.8 {q14, q15}, [r7]!
+
+ pld [r11]
+ vld1.8 {q0, q1}, [r6]!
+ pld [r11, #32]
+ vld1.8 {q2, q3}, [r6], r4
+
+ pld [r12]
+ vld1.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ vld1.8 {q6, q7}, [r11], r4
+ pld [r14]
+ vld1.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ vld1.8 {q10, q11}, [r12], r4
+ vld1.8 {q12, q13}, [r14]!
+ vld1.8 {q14, q15}, [r14], r4
+
+ vst1.8 {q0, q1}, [r7]!
+ vst1.8 {q2, q3}, [r7]!
+ vst1.8 {q4, q5}, [r7]!
+ vst1.8 {q6, q7}, [r7]!
+ vst1.8 {q8, q9}, [r7]!
+ vst1.8 {q10, q11}, [r7]!
+ pld [r6]
+ vst1.8 {q12, q13}, [r7]!
+ pld [r6, #32]
+ vst1.8 {q14, q15}, [r7]!
+
+ pld [r11]
+ vld1.8 {q0, q1}, [r6]!
+ pld [r11, #32]
+ vld1.8 {q2, q3}, [r6], r4
+ pld [r12]
+ vld1.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ vld1.8 {q6, q7}, [r11], r4
+ pld [r14]
+ vld1.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ vld1.8 {q10, q11}, [r12], r4
+ vld1.8 {q12, q13}, [r14]!
+ vld1.8 {q14, q15}, [r14], r4
+
+ vst1.8 {q0, q1}, [r7]!
+ vst1.8 {q2, q3}, [r7]!
+ vst1.8 {q4, q5}, [r7]!
+ vst1.8 {q6, q7}, [r7]!
+ vst1.8 {q8, q9}, [r7]!
+ vst1.8 {q10, q11}, [r7]!
+ pld [r6]
+ vst1.8 {q12, q13}, [r7]!
+ pld [r6, #32]
+ vst1.8 {q14, q15}, [r7]!
+
+ pld [r11]
+ vld1.8 {q0, q1}, [r6]!
+ pld [r11, #32]
+ vld1.8 {q2, q3}, [r6]
+ pld [r12]
+ vld1.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ vld1.8 {q6, q7}, [r11]
+ pld [r14]
+ vld1.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ vld1.8 {q10, q11}, [r12]
+ vld1.8 {q12, q13}, [r14]!
+ vld1.8 {q14, q15}, [r14]
+
+ vst1.8 {q0, q1}, [r7]!
+ vst1.8 {q2, q3}, [r7]!
+ vst1.8 {q4, q5}, [r7]!
+ vst1.8 {q6, q7}, [r7]!
+ vst1.8 {q8, q9}, [r7]!
+ vst1.8 {q10, q11}, [r7]!
+ add r5, #1
+ vst1.8 {q12, q13}, [r7]!
+ cmp r5, r3
+ vst1.8 {q14, q15}, [r7]!
+
+ blt LINEAR_X_SIZE_1024_LOOP
+
+ mov r8, #1024
+
+LINEAR_X_SIZE_512:
+
+ sub r14, r2, r8
+ cmp r14, #512
+ blt LINEAR_X_SIZE_256
+
+ mov r5, #0
+LINEAR_X_SIZE_512_LOOP:
+ mov r6, #0
+ mov r4, r5, asr #5 @ tiled_y_index = i>>5
+ and r10, r4, #0x1
+ cmp r10, #0x1
+ bne LINEAR_X_SIZE_512_LOOP_EVEN
+
+LINEAR_X_SIZE_512_LOOP_ODD:
+ sub r6, r4, #1
+ add r10, r2, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_offset*(temp1>>6)@
+ mul r6, r6, r10
+ mov r4, #8
+ mov r4, r4, lsl #11
+ sub r4, r4, #32
+ add r6, r6, #2 @ tiled_offset = tiled_offset+2@
+ mov r10, r8, asr #5 @ temp1 = aligned_x_size>>5@
+ add r6, r6, r10 @ tiled_offset = tiled_offset+temp1@
+ mov r6, r6, lsl #11
+ add r11, r6, #2048
+ add r12, r6, #4096
+ add r14, r6, #6144
+ b LINEAR_X_SIZE_512_LOOP_MEMCPY
+
+LINEAR_X_SIZE_512_LOOP_EVEN:
+ add r11, r3, #31 @ temp2 = ((linear_y_size+31)>>5)<<5@
+ bic r11, r11, #0x1F
+ add r10, r2, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_y_index*(temp1>>6)@
+ mul r6, r4, r10
+ add r12, r5, #32
+ cmp r12, r11
+ mov r6, r6, lsl #11 @ tiled_offset = tiled_offset<<11@
+ movlt r4, #8
+ movlt r10, r8, asr #5 @ temp1 = aligned_x_size>>5@
+ movge r10, r8, asr #6 @ temp1 = aligned_x_size>>6@
+ add r6, r6, r10, lsl #11 @ tiled_offset = tiled_offset+(temp1<<11)@
+ add r11, r6, #2048
+ addlt r12, r6, #12288
+ addlt r14, r6, #14336
+ movge r4, #4
+ addge r12, r6, #4096
+ addge r14, r6, #6144
+ mov r4, r4, lsl #11
+ sub r4, r4, #32
+
+LINEAR_X_SIZE_512_LOOP_MEMCPY:
+ and r10, r5, #0x1F
+ mov r10, r10, lsl #6
+ add r10, r1, r10
+
+ add r6, r6, r10 @ tiled_addr = tiled_src+64*(temp1)
+ add r11, r11, r10 @ tiled_addr1 = tiled_src+64*(temp1)
+ pld [r11]
+ vld1.8 {q0, q1}, [r6]!
+ pld [r11, #32]
+ add r12, r12, r10 @ tiled_addr2 = tiled_src+64*(temp1)
+ vld1.8 {q2, q3}, [r6], r4
+ pld [r12]
+ vld1.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ add r14, r14, r10 @ tiled_addr3 = tiled_src+64*(temp1)
+ vld1.8 {q6, q7}, [r11], r4
+ pld [r14]
+ vld1.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ mul r7, r2, r5
+ vld1.8 {q10, q11}, [r12], r4
+ add r7, r7, r8
+ vld1.8 {q12, q13}, [r14]!
+ vld1.8 {q14, q15}, [r14], r4
+
+ add r7, r7, r0
+ vst1.8 {q0, q1}, [r7]!
+ vst1.8 {q2, q3}, [r7]!
+ vst1.8 {q4, q5}, [r7]!
+ vst1.8 {q6, q7}, [r7]!
+ vst1.8 {q8, q9}, [r7]!
+ vst1.8 {q10, q11}, [r7]!
+ pld [r6]
+ vst1.8 {q12, q13}, [r7]!
+ pld [r6, #32]
+ vst1.8 {q14, q15}, [r7]!
+
+ pld [r11]
+ vld1.8 {q0, q1}, [r6]!
+ pld [r11, #32]
+ vld1.8 {q2, q3}, [r6], r4
+ pld [r12]
+ vld1.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ vld1.8 {q6, q7}, [r11], r4
+ pld [r14]
+ vld1.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ vld1.8 {q10, q11}, [r12], r4
+ vld1.8 {q12, q13}, [r14]!
+ vld1.8 {q14, q15}, [r14], r4
+
+ vst1.8 {q0, q1}, [r7]!
+ vst1.8 {q2, q3}, [r7]!
+ vst1.8 {q4, q5}, [r7]!
+ vst1.8 {q6, q7}, [r7]!
+ vst1.8 {q8, q9}, [r7]!
+ vst1.8 {q10, q11}, [r7]!
+ add r5, #1
+ vst1.8 {q12, q13}, [r7]!
+ cmp r5, r3
+ vst1.8 {q14, q15}, [r7]!
+
+ blt LINEAR_X_SIZE_512_LOOP
+
+ add r8, r8, #512
+
+LINEAR_X_SIZE_256:
+
+ sub r14, r2, r8
+ cmp r14, #256
+ blt LINEAR_X_SIZE_128
+
+ mov r5, #0
+LINEAR_X_SIZE_256_LOOP:
+ mov r6, #0
+ mov r4, r5, asr #5 @ tiled_y_index = i>>5
+ and r10, r4, #0x1
+ cmp r10, #0x1
+ bne LINEAR_X_SIZE_256_LOOP_EVEN
+
+LINEAR_X_SIZE_256_LOOP_ODD:
+ sub r6, r4, #1
+ add r10, r2, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_offset*(temp1>>6)@
+ mul r6, r6, r10
+ add r6, r6, #2 @ tiled_offset = tiled_offset+2@
+ mov r10, r8, asr #5 @ temp1 = aligned_x_size>>5@
+ add r6, r6, r10 @ tiled_offset = tiled_offset+temp1@
+ mov r6, r6, lsl #11
+ add r11, r6, #2048
+ add r12, r6, #4096
+ add r14, r6, #6144
+ b LINEAR_X_SIZE_256_LOOP_MEMCPY
+
+LINEAR_X_SIZE_256_LOOP_EVEN:
+ add r11, r3, #31 @ temp2 = ((linear_y_size+31)>>5)<<5@
+ bic r11, r11, #0x1F
+ add r10, r2, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_y_index*(temp1>>6)@
+ mul r6, r4, r10
+ mov r6, r6, lsl #11 @ tiled_offset = tiled_offset<<11@
+ add r12, r5, #32
+ cmp r12, r11
+ movlt r10, r8, asr #5 @ temp1 = aligned_x_size>>5@
+ movge r10, r8, asr #6 @ temp1 = aligned_x_size>>6@
+ add r6, r6, r10, lsl #11 @ tiled_offset = tiled_offset+(temp1<<11)@
+ add r11, r6, #2048
+ addlt r12, r6, #12288
+ addlt r14, r6, #14336
+ addge r12, r6, #4096
+ addge r14, r6, #6144
+
+LINEAR_X_SIZE_256_LOOP_MEMCPY:
+ and r10, r5, #0x1F
+ mov r10, r10, lsl #6
+ add r10, r1, r10
+
+ add r6, r6, r10 @ tiled_addr = tiled_src+64*(temp1)
+ add r11, r11, r10 @ tiled_addr1 = tiled_src+64*(temp1)
+ pld [r11]
+ vld1.8 {q0, q1}, [r6]!
+ pld [r11, #32]
+ add r12, r12, r10 @ tiled_addr2 = tiled_src+64*(temp1)
+ vld1.8 {q2, q3}, [r6]
+ pld [r12]
+ vld1.8 {q4, q5}, [r11]!
+ pld [r12, #32]
+ add r14, r14, r10 @ tiled_addr3 = tiled_src+64*(temp1)
+ vld1.8 {q6, q7}, [r11]
+ pld [r14]
+ mul r7, r2, r5
+ vld1.8 {q8, q9}, [r12]!
+ pld [r14, #32]
+ add r7, r7, r8
+ vld1.8 {q10, q11}, [r12]
+ add r7, r7, r0
+ vld1.8 {q12, q13}, [r14]!
+ vld1.8 {q14, q15}, [r14]
+
+ vst1.8 {q0, q1}, [r7]!
+ vst1.8 {q2, q3}, [r7]!
+ vst1.8 {q4, q5}, [r7]!
+ vst1.8 {q6, q7}, [r7]!
+ vst1.8 {q8, q9}, [r7]!
+ vst1.8 {q10, q11}, [r7]!
+ add r5, #1
+ vst1.8 {q12, q13}, [r7]!
+ cmp r5, r3
+ vst1.8 {q14, q15}, [r7]!
+
+ blt LINEAR_X_SIZE_256_LOOP
+
+ add r8, r8, #256
+
+LINEAR_X_SIZE_128:
+
+ sub r14, r2, r8
+ cmp r14, #128
+ blt LINEAR_X_SIZE_64
+
+ mov r5, #0
+LINEAR_X_SIZE_128_LOOP:
+ mov r6, #0
+ mov r4, r5, asr #5 @ tiled_y_index = i>>5
+ and r10, r4, #0x1
+ cmp r10, #0x1
+ bne LINEAR_X_SIZE_128_LOOP_EVEN
+
+LINEAR_X_SIZE_128_LOOP_ODD:
+ sub r6, r4, #1
+ add r10, r2, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_offset*(temp1>>6)@
+ mul r6, r6, r10
+ add r6, r6, #2 @ tiled_offset = tiled_offset+2@
+ mov r10, r8, asr #5 @ temp1 = aligned_x_size>>5@
+ add r6, r6, r10 @ tiled_offset = tiled_offset+temp1@
+ mov r6, r6, lsl #11
+ add r11, r6, #2048
+ b LINEAR_X_SIZE_128_LOOP_MEMCPY
+
+LINEAR_X_SIZE_128_LOOP_EVEN:
+ add r11, r3, #31 @ temp2 = ((linear_y_size+31)>>5)<<5@
+ bic r11, r11, #0x1F
+ add r10, r2, #127 @ temp1 = ((linear_x_size+127)>>7)<<7@
+ bic r10, #0x7F
+ mov r10, r10, asr #6 @ tiled_offset = tiled_y_index*(temp1>>6)@
+ mul r6, r4, r10
+ mov r6, r6, lsl #11 @ tiled_offset = tiled_offset<<11@
+ add r12, r5, #32
+ cmp r12, r11
+ movlt r10, r8, asr #5 @ temp1 = aligned_x_size>>5@
+ movge r10, r8, asr #6 @ temp1 = aligned_x_size>>6@
+ add r6, r6, r10, lsl #11 @ tiled_offset = tiled_offset+(temp1<<11)@
+ add r11, r6, #2048
+
+LINEAR_X_SIZE_128_LOOP_MEMCPY:
+ and r10, r5, #0x1F
+ mov r10, r10, lsl #6
+ add r10, r1, r10
+
+ add r6, r6, r10 @ tiled_addr = tiled_src+64*(temp1)
+ add r11, r11, r10 @ tiled_addr1 = tiled_src+64*(temp1)
+ pld [r6, #64]
+ vld1.8 {q0, q1}, [r6]!
+ pld [r6, #64]
+ vld1.8 {q2, q3}, [r6]!
+ mul r7, r2, r5
+ pld [r11]
+ vld1.8 {q4, q5}, [r6]!
+ add r7, r7, r8
+ pld [r11, #32]
+ vld1.8 {q6, q7}, [r6]
+ add r7, r7, r0
+ pld [r11, #64]
+ vld1.8 {q8, q9}, [r11]!
+ pld [r11, #64]
+ vld1.8 {q10, q11}, [r11]!
+ vld1.8 {q12, q13}, [r11]!
+ vld1.8 {q14, q15}, [r11]
+
+ sub r9, r2, #96
+ vst1.8 {q0, q1}, [r7]!
+ vst1.8 {q2, q3}, [r7]!
+ vst1.8 {q8, q9}, [r7]!
+ vst1.8 {q10, q11}, [r7], r9
+ vst1.8 {q4, q5}, [r7]!
+ vst1.8 {q6, q7}, [r7]!
+ add r5, #2
+ vst1.8 {q12, q13}, [r7]!
+ cmp r5, r3
+ vst1.8 {q14, q15}, [r7]
+
+ blt LINEAR_X_SIZE_128_LOOP
+
+ add r8, r8, #128
+
+LINEAR_X_SIZE_64:
+
+ sub r14, r2, r8
+ cmp r14, #64
+ blt LINEAR_X_SIZE_4
+
+ mov r5, #0
+ mov r4, r8
+
+LINEAR_X_SIZE_64_LOOP:
+
+ bl GET_TILED_OFFSET
+
+ add r6, r1, r6 @ tiled_addr = tiled_src+tiled_addr
+ and r11, r5, #0x1F @ temp2 = i&0x1F
+ mov r11, r11, lsl #6 @ temp2 = 64*temp2
+ add r6, r6, r11 @ tiled_addr = tiled_addr+temp2
+
+ pld [r6, #64]
+ vld1.8 {q0, q1}, [r6]! @ store {tiled_addr}
+ mul r10, r2, r5 @ temp1 = linear_x_size*(i)
+ pld [r6, #64]
+ vld1.8 {q2, q3}, [r6]!
+ pld [r6, #64]
+ vld1.8 {q4, q5}, [r6]! @ store {tiled_addr+64*1}
+ pld [r6, #64]
+ vld1.8 {q6, q7}, [r6]!
+ pld [r6, #64]
+ vld1.8 {q8, q9}, [r6]! @ store {tiled_addr+64*2}
+ pld [r6, #64]
+ vld1.8 {q10, q11}, [r6]!
+ add r7, r0, r4 @ linear_addr = linear_dest+j
+ vld1.8 {q12, q13}, [r6]! @ store {tiled_addr+64*3}
+ add r7, r7, r10 @ linear_addr = linear_addr+temp1
+ vld1.8 {q14, q15}, [r6]!
+ sub r10, r2, #32 @ temp1 = linear_x_size-32
+
+ vst1.8 {q0, q1}, [r7]! @ load {linear_src, 64}
+ vst1.8 {q2, q3}, [r7], r10
+ vst1.8 {q4, q5}, [r7]! @ load {linear_src+linear_x_size*1, 64}
+ vst1.8 {q6, q7}, [r7], r10
+ vst1.8 {q8, q9}, [r7]! @ load {linear_src+linear_x_size*2, 64}
+ vst1.8 {q10, q11}, [r7], r10
+ add r5, #4
+ vst1.8 {q12, q13}, [r7]! @ load {linear_src+linear_x_size*3, 64}
+ cmp r5, r3
+ vst1.8 {q14, q15}, [r7], r10
+
+ blt LINEAR_X_SIZE_64_LOOP
+
+ add r8, r8, #64
+
+LINEAR_X_SIZE_4:
+ cmp r8, r2
+ beq RESTORE_REG
+
+ mov r5, #0 @ i = 0
+LINEAR_Y_SIZE_4_LOOP:
+
+ mov r4, r8 @ j = aligned_x_size
+LINEAR_X_SIZE_4_LOOP:
+
+ bl GET_TILED_OFFSET
+
+ and r10, r5, #0x1F @ temp1 = i&0x1F
+ and r11, r4, #0x3F @ temp2 = j&0x3F
+
+ add r6, r6, r1
+ add r6, r6, r11
+ add r6, r6, r10, lsl #6
+
+ ldr r10, [r6], #64
+ add r7, r0, r4
+ ldr r11, [r6], #64
+ mul r9, r2, r5
+ ldr r12, [r6], #64
+ add r7, r7, r9
+ ldr r14, [r6], #64
+
+ str r10, [r7], r2
+ str r11, [r7], r2
+ str r12, [r7], r2
+ str r14, [r7], r2
+
+ add r4, r4, #4 @ j = j+4
+ cmp r4, r2 @ j<linear_x_size
+ blt LINEAR_X_SIZE_4_LOOP
+
+ add r5, r5, #4 @ i = i+4
+ cmp r5, r3 @ i<linear_y_size
+ blt LINEAR_Y_SIZE_4_LOOP
+
+RESTORE_REG:
+ ldmfd sp!, {r4-r12,r15} @ restore registers
+
+GET_TILED_OFFSET:
+
+ mov r11, r5, asr #5 @ temp2 = i>>5
+ mov r10, r4, asr #6 @ temp1 = j>>6
+
+ and r12, r11, #0x1 @ if (temp2 & 0x1)
+ cmp r12, #0x1
+ bne GET_TILED_OFFSET_EVEN_FORMULA_1
+
+GET_TILED_OFFSET_ODD_FORMULA:
+ sub r6, r11, #1 @ tiled_addr = temp2-1
+ add r12, r2, #127 @ temp3 = linear_x_size+127
+ bic r12, r12, #0x7F @ temp3 = (temp3 >>7)<<7
+ mov r12, r12, asr #6 @ temp3 = temp3>>6
+ mul r6, r6, r12 @ tiled_addr = tiled_addr*temp3
+ add r6, r6, r10 @ tiled_addr = tiled_addr+temp1
+ add r6, r6, #2 @ tiled_addr = tiled_addr+2
+ bic r12, r10, #0x3 @ temp3 = (temp1>>2)<<2
+ add r6, r6, r12 @ tiled_addr = tiled_addr+temp3
+ mov r6, r6, lsl #11 @ tiled_addr = tiled_addr<<11
+ b GET_TILED_OFFSET_RETURN
+
+GET_TILED_OFFSET_EVEN_FORMULA_1:
+ add r12, r3, #31 @ temp3 = linear_y_size+31
+ bic r12, r12, #0x1F @ temp3 = (temp3>>5)<<5
+ sub r12, r12, #32 @ temp3 = temp3 - 32
+ cmp r5, r12 @ if (i<(temp3-32)) {
+ bge GET_TILED_OFFSET_EVEN_FORMULA_2
+ add r12, r10, #2 @ temp3 = temp1+2
+ bic r12, r12, #3 @ temp3 = (temp3>>2)<<2
+ add r6, r10, r12 @ tiled_addr = temp1+temp3
+ add r12, r2, #127 @ temp3 = linear_x_size+127
+ bic r12, r12, #0x7F @ temp3 = (temp3>>7)<<7
+ mov r12, r12, asr #6 @ temp3 = temp3>>6
+ mul r11, r11, r12 @ tiled_y_index = tiled_y_index*temp3
+ add r6, r6, r11 @ tiled_addr = tiled_addr+tiled_y_index
+ mov r6, r6, lsl #11 @
+ b GET_TILED_OFFSET_RETURN
+
+GET_TILED_OFFSET_EVEN_FORMULA_2:
+ add r12, r2, #127 @ temp3 = linear_x_size+127
+ bic r12, r12, #0x7F @ temp3 = (temp3>>7)<<7
+ mov r12, r12, asr #6 @ temp3 = temp3>>6
+ mul r6, r11, r12 @ tiled_addr = temp2*temp3
+ add r6, r6, r10 @ tiled_addr = tiled_addr+temp3
+ mov r6, r6, lsl #11 @ tiled_addr = tiled_addr<<11@
+
+GET_TILED_OFFSET_RETURN:
+ mov pc, lr
+ .fnend
+
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_yuv420_nv12t_uv_neon.s b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_yuv420_nv12t_uv_neon.s
new file mode 100644
index 0000000..dd2c879
--- /dev/null
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_yuv420_nv12t_uv_neon.s
@@ -0,0 +1,573 @@
+/*
+ *
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * 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.
+ */
+
+/*
+ * @file csc_yuv420_nv12t_uv_neon.s
+ * @brief SEC_OMX specific define
+ * @author ShinWon Lee (shinwon.lee@samsung.com)
+ * @version 1.0
+ * @history
+ * 2011.7.01 : Create
+ */
+
+/*
+ * Converts and Interleaves linear to tiled
+ * 1. UV of YUV420P to UV of NV12T
+ *
+ * @param nv12t_uv_dest
+ * UV plane address of NV12T[out]
+ *
+ * @param yuv420p_u_src
+ * U plane address of YUV420P[in]
+ *
+ * @param yuv420p_v_src
+ * V plane address of YUV420P[in]
+ *
+ * @param yuv420_width
+ * Width of YUV420[in]
+ *
+ * @param yuv420_uv_height
+ * Height/2 of YUV420[in]
+ */
+
+ .arch armv7-a
+ .text
+ .global csc_linear_to_tiled_interleave
+ .type csc_linear_to_tiled_interleave, %function
+csc_linear_to_tiled_interleave:
+ .fnstart
+
+ @r0 tiled_dest
+ @r1 linear_src_u
+ @r2 linear_src_v
+ @r3 linear_x_size
+ @r4 linear_y_size
+ @r5 j
+ @r6 i
+ @r7 tiled_addr
+ @r8 linear_addr
+ @r9 aligned_x_size
+ @r10 aligned_y_size
+ @r11 temp1
+ @r12 temp2
+ @r14 temp3
+
+ stmfd sp!, {r4-r12,r14} @ backup registers
+
+ ldr r4, [sp, #40] @ load linear_y_size to r4
+
+ bic r10, r4, #0x1F @ aligned_y_size = (linear_y_size>>5)<<5
+ bic r9, r3, #0x3F @ aligned_x_size = (linear_x_size>>6)<<6
+
+ mov r6, #0 @ i = 0
+LOOP_ALIGNED_Y_SIZE:
+
+ mov r5, #0 @ j = 0
+LOOP_ALIGNED_X_SIZE:
+
+ bl GET_TILED_OFFSET
+
+ mov r11, r3, asr #1 @ temp1 = linear_x_size/2
+ mul r11, r11, r6 @ temp1 = temp1*(i)
+ add r11, r11, r5, asr #1 @ temp1 = temp1+j/2
+ mov r12, r3, asr #1 @ temp2 = linear_x_size/2
+ sub r12, r12, #16 @ temp2 = linear_x_size-16
+
+ add r8, r1, r11 @ linear_addr = linear_src_u+temp1
+ add r11, r2, r11 @ temp1 = linear_src_v+temp1
+ add r7, r0, r7 @ tiled_addr = tiled_dest+tiled_addr
+
+ pld [r8, r3]
+ vld1.8 {q0}, [r8]!
+ vld1.8 {q2}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q1}, [r11]!
+ vld1.8 {q3}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q4}, [r8]!
+ vld1.8 {q6}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q5}, [r11]!
+ vld1.8 {q7}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q8}, [r8]!
+ vld1.8 {q10}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q9}, [r11]!
+ vld1.8 {q11}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q12}, [r8]!
+ vld1.8 {q14}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q13}, [r11]!
+ vld1.8 {q15}, [r11], r12
+
+ vst2.8 {q0, q1}, [r7]!
+ vst2.8 {q2, q3}, [r7]!
+ vst2.8 {q4, q5}, [r7]!
+ vst2.8 {q6, q7}, [r7]!
+ vst2.8 {q8, q9}, [r7]!
+ vst2.8 {q10, q11}, [r7]!
+ vst2.8 {q12, q13}, [r7]!
+ vst2.8 {q14, q15}, [r7]!
+
+ pld [r8, r3]
+ vld1.8 {q0}, [r8]!
+ vld1.8 {q2}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q1}, [r11]!
+ vld1.8 {q3}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q4}, [r8]!
+ vld1.8 {q6}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q5}, [r11]!
+ vld1.8 {q7}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q8}, [r8]!
+ vld1.8 {q10}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q9}, [r11]!
+ vld1.8 {q11}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q12}, [r8]!
+ vld1.8 {q14}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q13}, [r11]!
+ vld1.8 {q15}, [r11], r12
+
+ vst2.8 {q0, q1}, [r7]!
+ vst2.8 {q2, q3}, [r7]!
+ vst2.8 {q4, q5}, [r7]!
+ vst2.8 {q6, q7}, [r7]!
+ vst2.8 {q8, q9}, [r7]!
+ vst2.8 {q10, q11}, [r7]!
+ vst2.8 {q12, q13}, [r7]!
+ vst2.8 {q14, q15}, [r7]!
+
+ pld [r8, r3]
+ vld1.8 {q0}, [r8]!
+ vld1.8 {q2}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q1}, [r11]!
+ vld1.8 {q3}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q4}, [r8]!
+ vld1.8 {q6}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q5}, [r11]!
+ vld1.8 {q7}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q8}, [r8]!
+ vld1.8 {q10}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q9}, [r11]!
+ vld1.8 {q11}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q12}, [r8]!
+ vld1.8 {q14}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q13}, [r11]!
+ vld1.8 {q15}, [r11], r12
+
+ vst2.8 {q0, q1}, [r7]!
+ vst2.8 {q2, q3}, [r7]!
+ vst2.8 {q4, q5}, [r7]!
+ vst2.8 {q6, q7}, [r7]!
+ vst2.8 {q8, q9}, [r7]!
+ vst2.8 {q10, q11}, [r7]!
+ vst2.8 {q12, q13}, [r7]!
+ vst2.8 {q14, q15}, [r7]!
+
+ pld [r8, r3]
+ vld1.8 {q0}, [r8]!
+ vld1.8 {q2}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q1}, [r11]!
+ vld1.8 {q3}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q4}, [r8]!
+ vld1.8 {q6}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q5}, [r11]!
+ vld1.8 {q7}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q8}, [r8]!
+ vld1.8 {q10}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q9}, [r11]!
+ vld1.8 {q11}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q12}, [r8]!
+ vld1.8 {q14}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q13}, [r11]!
+ vld1.8 {q15}, [r11], r12
+
+ vst2.8 {q0, q1}, [r7]!
+ vst2.8 {q2, q3}, [r7]!
+ vst2.8 {q4, q5}, [r7]!
+ vst2.8 {q6, q7}, [r7]!
+ vst2.8 {q8, q9}, [r7]!
+ vst2.8 {q10, q11}, [r7]!
+ vst2.8 {q12, q13}, [r7]!
+ vst2.8 {q14, q15}, [r7]!
+
+ pld [r8, r3]
+ vld1.8 {q0}, [r8]!
+ vld1.8 {q2}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q1}, [r11]!
+ vld1.8 {q3}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q4}, [r8]!
+ vld1.8 {q6}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q5}, [r11]!
+ vld1.8 {q7}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q8}, [r8]!
+ vld1.8 {q10}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q9}, [r11]!
+ vld1.8 {q11}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q12}, [r8]!
+ vld1.8 {q14}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q13}, [r11]!
+ vld1.8 {q15}, [r11], r12
+
+ vst2.8 {q0, q1}, [r7]!
+ vst2.8 {q2, q3}, [r7]!
+ vst2.8 {q4, q5}, [r7]!
+ vst2.8 {q6, q7}, [r7]!
+ vst2.8 {q8, q9}, [r7]!
+ vst2.8 {q10, q11}, [r7]!
+ vst2.8 {q12, q13}, [r7]!
+ vst2.8 {q14, q15}, [r7]!
+
+ pld [r8, r3]
+ vld1.8 {q0}, [r8]!
+ vld1.8 {q2}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q1}, [r11]!
+ vld1.8 {q3}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q4}, [r8]!
+ vld1.8 {q6}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q5}, [r11]!
+ vld1.8 {q7}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q8}, [r8]!
+ vld1.8 {q10}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q9}, [r11]!
+ vld1.8 {q11}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q12}, [r8]!
+ vld1.8 {q14}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q13}, [r11]!
+ vld1.8 {q15}, [r11], r12
+
+ vst2.8 {q0, q1}, [r7]!
+ vst2.8 {q2, q3}, [r7]!
+ vst2.8 {q4, q5}, [r7]!
+ vst2.8 {q6, q7}, [r7]!
+ vst2.8 {q8, q9}, [r7]!
+ vst2.8 {q10, q11}, [r7]!
+ vst2.8 {q12, q13}, [r7]!
+ vst2.8 {q14, q15}, [r7]!
+
+ pld [r8, r3]
+ vld1.8 {q0}, [r8]!
+ vld1.8 {q2}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q1}, [r11]!
+ vld1.8 {q3}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q4}, [r8]!
+ vld1.8 {q6}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q5}, [r11]!
+ vld1.8 {q7}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q8}, [r8]!
+ vld1.8 {q10}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q9}, [r11]!
+ vld1.8 {q11}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q12}, [r8]!
+ vld1.8 {q14}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q13}, [r11]!
+ vld1.8 {q15}, [r11], r12
+
+ vst2.8 {q0, q1}, [r7]!
+ vst2.8 {q2, q3}, [r7]!
+ vst2.8 {q4, q5}, [r7]!
+ vst2.8 {q6, q7}, [r7]!
+ vst2.8 {q8, q9}, [r7]!
+ vst2.8 {q10, q11}, [r7]!
+ vst2.8 {q12, q13}, [r7]!
+ vst2.8 {q14, q15}, [r7]!
+
+ pld [r8, r3]
+ vld1.8 {q0}, [r8]!
+ vld1.8 {q2}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q1}, [r11]!
+ vld1.8 {q3}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q4}, [r8]!
+ vld1.8 {q6}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q5}, [r11]!
+ vld1.8 {q7}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q8}, [r8]!
+ vld1.8 {q10}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q9}, [r11]!
+ vld1.8 {q11}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q12}, [r8]!
+ vld1.8 {q14}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q13}, [r11]!
+ vld1.8 {q15}, [r11], r12
+
+ vst2.8 {q0, q1}, [r7]!
+ vst2.8 {q2, q3}, [r7]!
+ vst2.8 {q4, q5}, [r7]!
+ vst2.8 {q6, q7}, [r7]!
+ vst2.8 {q8, q9}, [r7]!
+ vst2.8 {q10, q11}, [r7]!
+ vst2.8 {q12, q13}, [r7]!
+ vst2.8 {q14, q15}, [r7]!
+
+ add r5, r5, #64 @ j = j+64
+ cmp r5, r9 @ j<aligned_x_size
+ blt LOOP_ALIGNED_X_SIZE
+
+ add r6, r6, #32 @ i = i+32
+ cmp r6, r10 @ i<aligned_y_size
+ blt LOOP_ALIGNED_Y_SIZE
+
+ ldr r4, [sp, #40] @ load linear_y_size to r4
+ cmp r6, r4
+ beq LOOP_LINEAR_Y_SIZE_2_START
+
+LOOP_LINEAR_Y_SIZE_1:
+
+ mov r5, #0 @ j = 0
+LOOP_ALIGNED_X_SIZE_1:
+
+ bl GET_TILED_OFFSET
+
+ mov r11, r3, asr #1 @ temp1 = linear_x_size/2
+ mul r11, r11, r6 @ temp1 = temp1*(i)
+ add r11, r11, r5, asr #1 @ temp1 = temp1+j/2
+ mov r12, r3, asr #1 @ temp2 = linear_x_size/2
+ sub r12, r12, #16 @ temp2 = linear_x_size-16
+
+ add r8, r1, r11 @ linear_addr = linear_src_u+temp1
+ add r11, r2, r11 @ temp1 = linear_src_v+temp1
+ add r7, r0, r7 @ tiled_addr = tiled_dest+tiled_addr
+ and r14, r6, #0x1F @ temp3 = i&0x1F@
+ mov r14, r14, lsl #6 @ temp3 = temp3*64
+ add r7, r7, r14 @ tiled_addr = tiled_addr+temp3
+
+ pld [r8, r3]
+ vld1.8 {q0}, [r8]!
+ vld1.8 {q2}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q1}, [r11]!
+ vld1.8 {q3}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q4}, [r8]!
+ vld1.8 {q6}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q5}, [r11]!
+ vld1.8 {q7}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q8}, [r8]!
+ vld1.8 {q10}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q9}, [r11]!
+ vld1.8 {q11}, [r11], r12
+ pld [r8, r3]
+ vld1.8 {q12}, [r8]!
+ vld1.8 {q14}, [r8], r12
+ pld [r11, r3]
+ vld1.8 {q13}, [r11]!
+ vld1.8 {q15}, [r11], r12
+
+ vst2.8 {q0, q1}, [r7]! @ store {tiled_addr}
+ vst2.8 {q2, q3}, [r7]!
+ vst2.8 {q4, q5}, [r7]! @ store {tiled_addr+64*1}
+ vst2.8 {q6, q7}, [r7]!
+ vst2.8 {q8, q9}, [r7]! @ store {tiled_addr+64*2}
+ vst2.8 {q10, q11}, [r7]!
+ vst2.8 {q12, q13}, [r7]! @ store {tiled_addr+64*3}
+ vst2.8 {q14, q15}, [r7]!
+
+ add r5, r5, #64 @ j = j+64
+ cmp r5, r9 @ j<aligned_x_size
+ blt LOOP_ALIGNED_X_SIZE_1
+
+ add r6, r6, #4 @ i = i+4
+ cmp r6, r4 @ i<linear_y_size
+ blt LOOP_LINEAR_Y_SIZE_1
+
+LOOP_LINEAR_Y_SIZE_2_START:
+ cmp r5, r3
+ beq RESTORE_REG
+
+ mov r6, #0 @ i = 0
+LOOP_LINEAR_Y_SIZE_2:
+
+ mov r5, r9 @ j = aligned_x_size
+LOOP_LINEAR_X_SIZE_2:
+
+ bl GET_TILED_OFFSET
+
+ mov r11, r3, asr #1 @ temp1 = linear_x_size/2
+ mul r11, r11, r6 @ temp1 = temp1*(i)
+ add r11, r11, r5, asr #1 @ temp1 = temp1+j/2
+ mov r12, r3, asr #1 @ temp2 = linear_x_size/2
+ sub r12, r12, #1 @ temp2 = linear_x_size-1
+
+ add r8, r1, r11 @ linear_addr = linear_src_u+temp1
+ add r11, r2, r11 @ temp1 = linear_src_v+temp1
+ add r7, r0, r7 @ tiled_addr = tiled_dest+tiled_addr
+ and r14, r6, #0x1F @ temp3 = i&0x1F@
+ mov r14, r14, lsl #6 @ temp3 = temp3*64
+ add r7, r7, r14 @ tiled_addr = tiled_addr+temp3
+ and r14, r5, #0x3F @ temp3 = j&0x3F
+ add r7, r7, r14 @ tiled_addr = tiled_addr+temp3
+
+ ldrb r10, [r8], #1
+ ldrb r14, [r11], #1
+ mov r14, r14, lsl #8
+ orr r10, r10, r14
+ strh r10, [r7], #2
+ ldrb r10, [r8], r12
+ ldrb r14, [r11], r12
+ mov r14, r14, lsl #8
+ orr r10, r10, r14
+ strh r10, [r7], #62
+
+ ldrb r10, [r8], #1
+ ldrb r14, [r11], #1
+ mov r14, r14, lsl #8
+ orr r10, r10, r14
+ strh r10, [r7], #2
+ ldrb r10, [r8], r12
+ ldrb r14, [r11], r12
+ mov r14, r14, lsl #8
+ orr r10, r10, r14
+ strh r10, [r7], #62
+
+ ldrb r10, [r8], #1
+ ldrb r14, [r11], #1
+ mov r14, r14, lsl #8
+ orr r10, r10, r14
+ strh r10, [r7], #2
+ ldrb r10, [r8], r12
+ ldrb r14, [r11], r12
+ mov r14, r14, lsl #8
+ orr r10, r10, r14
+ strh r10, [r7], #62
+
+ ldrb r10, [r8], #1
+ ldrb r14, [r11], #1
+ mov r14, r14, lsl #8
+ orr r10, r10, r14
+ strh r10, [r7], #2
+ ldrb r10, [r8], r12
+ ldrb r14, [r11], r12
+ mov r14, r14, lsl #8
+ orr r10, r10, r14
+ strh r10, [r7], #62
+
+ add r5, r5, #4 @ j = j+4
+ cmp r5, r3 @ j<linear_x_size
+ blt LOOP_LINEAR_X_SIZE_2
+
+ add r6, r6, #4 @ i = i+4
+ cmp r6, r4 @ i<linear_y_size
+ blt LOOP_LINEAR_Y_SIZE_2
+
+RESTORE_REG:
+ ldmfd sp!, {r4-r12,r15} @ restore registers
+
+GET_TILED_OFFSET:
+ stmfd sp!, {r14}
+
+ mov r12, r6, asr #5 @ temp2 = i>>5
+ mov r11, r5, asr #6 @ temp1 = j>>6
+
+ and r14, r12, #0x1 @ if (temp2 & 0x1)
+ cmp r14, #0x1
+ bne GET_TILED_OFFSET_EVEN_FORMULA_1
+
+GET_TILED_OFFSET_ODD_FORMULA:
+ sub r7, r12, #1 @ tiled_addr = temp2-1
+ add r14, r3, #127 @ temp3 = linear_x_size+127
+ bic r14, r14, #0x7F @ temp3 = (temp3 >>7)<<7
+ mov r14, r14, asr #6 @ temp3 = temp3>>6
+ mul r7, r7, r14 @ tiled_addr = tiled_addr*temp3
+ add r7, r7, r11 @ tiled_addr = tiled_addr+temp1
+ add r7, r7, #2 @ tiled_addr = tiled_addr+2
+ bic r14, r11, #0x3 @ temp3 = (temp1>>2)<<2
+ add r7, r7, r14 @ tiled_addr = tiled_addr+temp3
+ mov r7, r7, lsl #11 @ tiled_addr = tiled_addr<<11
+ b GET_TILED_OFFSET_RETURN
+
+GET_TILED_OFFSET_EVEN_FORMULA_1:
+ add r14, r4, #31 @ temp3 = linear_y_size+31
+ bic r14, r14, #0x1F @ temp3 = (temp3>>5)<<5
+ sub r14, r14, #32 @ temp3 = temp3 - 32
+ cmp r6, r14 @ if (i<(temp3-32)) {
+ bge GET_TILED_OFFSET_EVEN_FORMULA_2
+ add r14, r11, #2 @ temp3 = temp1+2
+ bic r14, r14, #3 @ temp3 = (temp3>>2)<<2
+ add r7, r11, r14 @ tiled_addr = temp1+temp3
+ add r14, r3, #127 @ temp3 = linear_x_size+127
+ bic r14, r14, #0x7F @ temp3 = (temp3>>7)<<7
+ mov r14, r14, asr #6 @ temp3 = temp3>>6
+ mul r12, r12, r14 @ tiled_y_index = tiled_y_index*temp3
+ add r7, r7, r12 @ tiled_addr = tiled_addr+tiled_y_index
+ mov r7, r7, lsl #11 @
+ b GET_TILED_OFFSET_RETURN
+
+GET_TILED_OFFSET_EVEN_FORMULA_2:
+ add r14, r3, #127 @ temp3 = linear_x_size+127
+ bic r14, r14, #0x7F @ temp3 = (temp3>>7)<<7
+ mov r14, r14, asr #6 @ temp3 = temp3>>6
+ mul r7, r12, r14 @ tiled_addr = temp2*temp3
+ add r7, r7, r11 @ tiled_addr = tiled_addr+temp3
+ mov r7, r7, lsl #11 @ tiled_addr = tiled_addr<<11@
+
+GET_TILED_OFFSET_RETURN:
+ ldmfd sp!, {r15} @ restore registers
+ .fnend
+
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_yuv420_nv12t_y_neon.s b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_yuv420_nv12t_y_neon.s
new file mode 100644
index 0000000..3f8932a
--- /dev/null
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/csc/csc_yuv420_nv12t_y_neon.s
@@ -0,0 +1,451 @@
+/*
+ *
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * 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.
+ */
+
+/*
+ * @file csc_yuv420_nv12t_y_neon.s
+ * @brief SEC_OMX specific define
+ * @author ShinWon Lee (shinwon.lee@samsung.com)
+ * @version 1.0
+ * @history
+ * 2011.7.01 : Create
+ */
+
+/*
+ * Converts linear data to tiled.
+ * 1. Y of YUV420P to Y of NV12T
+ * 2. Y of YUV420S to Y of NV12T
+ * 3. UV of YUV420S to UV of NV12T
+ *
+ * @param nv12t_dest
+ * Y or UV plane address of NV12T[out]
+ *
+ * @param yuv420_src
+ * Y or UV plane address of YUV420P(S)[in]
+ *
+ * @param yuv420_width
+ * Width of YUV420[in]
+ *
+ * @param yuv420_height
+ * Y: Height of YUV420, UV: Height/2 of YUV420[in]
+ */
+
+ .arch armv7-a
+ .text
+ .global csc_linear_to_tiled
+ .type csc_linear_to_tiled, %function
+csc_linear_to_tiled:
+ .fnstart
+
+ @r0 tiled_dest
+ @r1 linear_src
+ @r2 linear_x_size
+ @r3 linear_y_size
+ @r4 j
+ @r5 i
+ @r6 nn(tiled_addr)
+ @r7 mm(linear_addr)
+ @r8 aligned_x_size
+ @r9 aligned_y_size
+ @r10 temp1
+ @r11 temp2
+ @r12 temp3
+ @r14 temp4
+
+ stmfd sp!, {r4-r12,r14} @ backup registers
+
+ bic r9, r3, #0x1F @ aligned_y_size = (linear_y_size>>5)<<5
+ bic r8, r2, #0x3F @ aligned_x_size = (linear_x_size>>6)<<6
+
+ mov r5, #0 @ i = 0
+LOOP_ALIGNED_Y_SIZE:
+
+ mov r4, #0 @ j = 0
+LOOP_ALIGNED_X_SIZE:
+
+ bl GET_TILED_OFFSET
+
+ mul r10, r2, r5 @ temp1 = linear_x_size*(i)
+ add r7, r1, r4 @ linear_addr = linear_src+j
+ add r7, r7, r10 @ linear_addr = linear_addr+temp1
+ sub r10, r2, #32
+
+ pld [r7, r2, lsl #1]
+ vld1.8 {q0, q1}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q2, q3}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q4, q5}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q6, q7}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q8, q9}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q10, q11}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q12, q13}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q14, q15}, [r7], r10
+
+ add r6, r0, r6 @ tiled_addr = tiled_dest+tiled_addr
+
+ vst1.8 {q0, q1}, [r6]!
+ vst1.8 {q2, q3}, [r6]!
+ vst1.8 {q4, q5}, [r6]!
+ vst1.8 {q6, q7}, [r6]!
+ vst1.8 {q8, q9}, [r6]!
+ vst1.8 {q10, q11}, [r6]!
+ vst1.8 {q12, q13}, [r6]!
+ vst1.8 {q14, q15}, [r6]!
+
+ pld [r7, r2, lsl #1]
+ vld1.8 {q0, q1}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q2, q3}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q4, q5}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q6, q7}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q8, q9}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q10, q11}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q12, q13}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q14, q15}, [r7], r10
+
+ vst1.8 {q0, q1}, [r6]!
+ vst1.8 {q2, q3}, [r6]!
+ vst1.8 {q4, q5}, [r6]!
+ vst1.8 {q6, q7}, [r6]!
+ vst1.8 {q8, q9}, [r6]!
+ vst1.8 {q10, q11}, [r6]!
+ vst1.8 {q12, q13}, [r6]!
+ vst1.8 {q14, q15}, [r6]!
+
+ pld [r7, r2, lsl #1]
+ vld1.8 {q0, q1}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q2, q3}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q4, q5}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q6, q7}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q8, q9}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q10, q11}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q12, q13}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q14, q15}, [r7], r10
+
+ vst1.8 {q0, q1}, [r6]!
+ vst1.8 {q2, q3}, [r6]!
+ vst1.8 {q4, q5}, [r6]!
+ vst1.8 {q6, q7}, [r6]!
+ vst1.8 {q8, q9}, [r6]!
+ vst1.8 {q10, q11}, [r6]!
+ vst1.8 {q12, q13}, [r6]!
+ vst1.8 {q14, q15}, [r6]!
+
+ pld [r7, r2, lsl #1]
+ vld1.8 {q0, q1}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q2, q3}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q4, q5}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q6, q7}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q8, q9}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q10, q11}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q12, q13}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q14, q15}, [r7], r10
+
+ vst1.8 {q0, q1}, [r6]!
+ vst1.8 {q2, q3}, [r6]!
+ vst1.8 {q4, q5}, [r6]!
+ vst1.8 {q6, q7}, [r6]!
+ vst1.8 {q8, q9}, [r6]!
+ vst1.8 {q10, q11}, [r6]!
+ vst1.8 {q12, q13}, [r6]!
+ vst1.8 {q14, q15}, [r6]!
+
+ pld [r7, r2, lsl #1]
+ vld1.8 {q0, q1}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q2, q3}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q4, q5}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q6, q7}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q8, q9}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q10, q11}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q12, q13}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q14, q15}, [r7], r10
+
+ vst1.8 {q0, q1}, [r6]!
+ vst1.8 {q2, q3}, [r6]!
+ vst1.8 {q4, q5}, [r6]!
+ vst1.8 {q6, q7}, [r6]!
+ vst1.8 {q8, q9}, [r6]!
+ vst1.8 {q10, q11}, [r6]!
+ vst1.8 {q12, q13}, [r6]!
+ vst1.8 {q14, q15}, [r6]!
+
+ pld [r7, r2, lsl #1]
+ vld1.8 {q0, q1}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q2, q3}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q4, q5}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q6, q7}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q8, q9}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q10, q11}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q12, q13}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q14, q15}, [r7], r10
+
+ vst1.8 {q0, q1}, [r6]!
+ vst1.8 {q2, q3}, [r6]!
+ vst1.8 {q4, q5}, [r6]!
+ vst1.8 {q6, q7}, [r6]!
+ vst1.8 {q8, q9}, [r6]!
+ vst1.8 {q10, q11}, [r6]!
+ vst1.8 {q12, q13}, [r6]!
+ vst1.8 {q14, q15}, [r6]!
+
+ pld [r7, r2, lsl #1]
+ vld1.8 {q0, q1}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q2, q3}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q4, q5}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q6, q7}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q8, q9}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q10, q11}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q12, q13}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q14, q15}, [r7], r10
+
+ vst1.8 {q0, q1}, [r6]!
+ vst1.8 {q2, q3}, [r6]!
+ vst1.8 {q4, q5}, [r6]!
+ vst1.8 {q6, q7}, [r6]!
+ vst1.8 {q8, q9}, [r6]!
+ vst1.8 {q10, q11}, [r6]!
+ vst1.8 {q12, q13}, [r6]!
+ vst1.8 {q14, q15}, [r6]!
+
+ pld [r7, r2, lsl #1]
+ vld1.8 {q0, q1}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q2, q3}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q4, q5}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q6, q7}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q8, q9}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q10, q11}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q12, q13}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q14, q15}, [r7], r10
+
+ vst1.8 {q0, q1}, [r6]!
+ vst1.8 {q2, q3}, [r6]!
+ vst1.8 {q4, q5}, [r6]!
+ vst1.8 {q6, q7}, [r6]!
+ vst1.8 {q8, q9}, [r6]!
+ vst1.8 {q10, q11}, [r6]!
+ vst1.8 {q12, q13}, [r6]!
+ vst1.8 {q14, q15}, [r6]!
+
+ add r4, r4, #64 @ j = j+64
+ cmp r4, r8 @ j<aligned_x_size
+ blt LOOP_ALIGNED_X_SIZE
+
+ add r5, r5, #32 @ i = i+32
+ cmp r5, r9 @ i<aligned_y_size
+ blt LOOP_ALIGNED_Y_SIZE
+
+ cmp r5, r3
+ beq LOOP_LINEAR_Y_SIZE_2_START
+
+LOOP_LINEAR_Y_SIZE_1:
+
+ mov r4, #0 @ j = 0
+LOOP_ALIGNED_X_SIZE_1:
+
+ bl GET_TILED_OFFSET
+
+ mul r10, r2, r5 @ temp1 = linear_x_size*(i)
+ add r7, r1, r4 @ linear_addr = linear_src+j
+ add r7, r7, r10 @ linear_addr = linear_addr+temp1
+ sub r10, r2, #32 @ temp1 = linear_x_size-32
+
+ pld [r7, r2, lsl #1]
+ vld1.8 {q0, q1}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q2, q3}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q4, q5}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q6, q7}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q8, q9}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q10, q11}, [r7], r10
+ pld [r7, r2, lsl #1]
+ vld1.8 {q12, q13}, [r7]!
+ pld [r7, r2, lsl #1]
+ vld1.8 {q14, q15}, [r7], r10
+
+ add r6, r0, r6 @ tiled_addr = tiled_dest+tiled_addr
+ and r11, r5, #0x1F @ temp2 = i&0x1F
+ mov r11, r11, lsl #6 @ temp2 = 64*temp2
+ add r6, r6, r11 @ tiled_addr = tiled_addr+temp2
+
+ vst1.8 {q0, q1}, [r6]!
+ vst1.8 {q2, q3}, [r6]!
+ vst1.8 {q4, q5}, [r6]!
+ vst1.8 {q6, q7}, [r6]!
+ vst1.8 {q8, q9}, [r6]!
+ vst1.8 {q10, q11}, [r6]!
+ vst1.8 {q12, q13}, [r6]!
+ vst1.8 {q14, q15}, [r6]!
+
+ add r4, r4, #64 @ j = j+64
+ cmp r4, r8 @ j<aligned_x_size
+ blt LOOP_ALIGNED_X_SIZE_1
+
+ add r5, r5, #4 @ i = i+4
+ cmp r5, r3 @ i<linear_y_size
+ blt LOOP_LINEAR_Y_SIZE_1
+
+LOOP_LINEAR_Y_SIZE_2_START:
+ cmp r4, r2
+ beq RESTORE_REG
+
+ mov r5, #0 @ i = 0
+LOOP_LINEAR_Y_SIZE_2:
+
+ mov r4, r8 @ j = aligned_x_size
+LOOP_LINEAR_X_SIZE_2:
+
+ bl GET_TILED_OFFSET
+
+ mul r10, r2, r5 @ temp1 = linear_x_size*(i)
+ add r7, r1, r4 @ linear_addr = linear_src+j
+ add r7, r7, r10 @ linear_addr = linear_addr+temp1
+
+ add r6, r0, r6 @ tiled_addr = tiled_dest+tiled_addr
+ and r11, r5, #0x1F @ temp2 = i&0x1F
+ mov r11, r11, lsl #6 @ temp2 = 64*temp2
+ add r6, r6, r11 @ tiled_addr = tiled_addr+temp2
+ and r11, r4, #0x3F @ temp2 = j&0x3F
+ add r6, r6, r11 @ tiled_addr = tiled_addr+temp2
+
+ ldr r10, [r7], r2
+ ldr r11, [r7], r2
+ ldr r12, [r7], r2
+ ldr r14, [r7], r2
+ str r10, [r6], #64
+ str r11, [r6], #64
+ str r12, [r6], #64
+ str r14, [r6], #64
+
+ add r4, r4, #4 @ j = j+4
+ cmp r4, r2 @ j<linear_x_size
+ blt LOOP_LINEAR_X_SIZE_2
+
+ add r5, r5, #4 @ i = i+4
+ cmp r5, r3 @ i<linear_y_size
+ blt LOOP_LINEAR_Y_SIZE_2
+
+RESTORE_REG:
+ ldmfd sp!, {r4-r12,r15} @ restore registers
+
+GET_TILED_OFFSET:
+
+ mov r11, r5, asr #5 @ temp2 = i>>5
+ mov r10, r4, asr #6 @ temp1 = j>>6
+
+ and r12, r11, #0x1 @ if (temp2 & 0x1)
+ cmp r12, #0x1
+ bne GET_TILED_OFFSET_EVEN_FORMULA_1
+
+GET_TILED_OFFSET_ODD_FORMULA:
+ sub r6, r11, #1 @ tiled_addr = temp2-1
+ add r12, r2, #127 @ temp3 = linear_x_size+127
+ bic r12, r12, #0x7F @ temp3 = (temp3 >>7)<<7
+ mov r12, r12, asr #6 @ temp3 = temp3>>6
+ mul r6, r6, r12 @ tiled_addr = tiled_addr*temp3
+ add r6, r6, r10 @ tiled_addr = tiled_addr+temp1
+ add r6, r6, #2 @ tiled_addr = tiled_addr+2
+ bic r12, r10, #0x3 @ temp3 = (temp1>>2)<<2
+ add r6, r6, r12 @ tiled_addr = tiled_addr+temp3
+ mov r6, r6, lsl #11 @ tiled_addr = tiled_addr<<11
+ b GET_TILED_OFFSET_RETURN
+
+GET_TILED_OFFSET_EVEN_FORMULA_1:
+ add r12, r3, #31 @ temp3 = linear_y_size+31
+ bic r12, r12, #0x1F @ temp3 = (temp3>>5)<<5
+ sub r12, r12, #32 @ temp3 = temp3 - 32
+ cmp r5, r12 @ if (i<(temp3-32)) {
+ bge GET_TILED_OFFSET_EVEN_FORMULA_2
+ add r12, r10, #2 @ temp3 = temp1+2
+ bic r12, r12, #3 @ temp3 = (temp3>>2)<<2
+ add r6, r10, r12 @ tiled_addr = temp1+temp3
+ add r12, r2, #127 @ temp3 = linear_x_size+127
+ bic r12, r12, #0x7F @ temp3 = (temp3>>7)<<7
+ mov r12, r12, asr #6 @ temp3 = temp3>>6
+ mul r11, r11, r12 @ tiled_y_index = tiled_y_index*temp3
+ add r6, r6, r11 @ tiled_addr = tiled_addr+tiled_y_index
+ mov r6, r6, lsl #11 @
+ b GET_TILED_OFFSET_RETURN
+
+GET_TILED_OFFSET_EVEN_FORMULA_2:
+ add r12, r2, #127 @ temp3 = linear_x_size+127
+ bic r12, r12, #0x7F @ temp3 = (temp3>>7)<<7
+ mov r12, r12, asr #6 @ temp3 = temp3>>6
+ mul r6, r11, r12 @ tiled_addr = temp2*temp3
+ add r6, r6, r10 @ tiled_addr = tiled_addr+temp3
+ mov r6, r6, lsl #11 @ tiled_addr = tiled_addr<<11@
+
+GET_TILED_OFFSET_RETURN:
+ mov pc, lr
+ .fnend
+
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/Android.mk b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/Android.mk
index a694deb..bafc854 100644
--- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/Android.mk
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/Android.mk
@@ -9,7 +9,7 @@ LOCAL_SRC_FILES := \
LOCAL_MODULE := libsecmfcdecapi.aries
-LOCAL_PRELINK_MODULE := false
+
LOCAL_CFLAGS :=
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c
index 508f290..8e47683 100644
--- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/dec/src/SsbSipMfcDecAPI.c
@@ -84,11 +84,13 @@ out:
return MFC_UNPACKED_PB;
}
-void *SsbSipMfcDecOpen(void)
+void *SsbSipMfcDecOpen(void *value)
{
int hMFCOpen;
unsigned int mapped_addr;
_MFCLIB *pCTX;
+ mfc_common_args DecArg;
+ int ret_code;
pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
if (pCTX == NULL) {
@@ -103,6 +105,17 @@ void *SsbSipMfcDecOpen(void)
return NULL;
}
+ if (*(unsigned int *)value == NO_CACHE ||
+ *(unsigned int *)value == CACHE) {
+ DecArg.args.buf_type = *(unsigned int *)value;
+ ret_code = ioctl(hMFCOpen, IOCTL_MFC_BUF_CACHE, &DecArg);
+ if (DecArg.ret_code != MFC_RET_OK) {
+ LOGE("SsbSipMfcDecOpenExt: IOCTL_MFC_BUF_CACHE (%d) failed\n", DecArg.ret_code);
+ }
+ } else {
+ LOGE("SsbSipMfcDecOpenExt: value is invalid, value: %d\n", *(int *)value);
+ }
+
mapped_addr = (unsigned int)mmap(0, MMAP_BUFFER_SIZE_MMAP, PROT_READ | PROT_WRITE, MAP_SHARED, hMFCOpen, 0);
if (!mapped_addr) {
LOGE("SsbSipMfcDecOpen: FIMV5.0 driver address mapping failed\n");
@@ -503,173 +516,3 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
return MFC_RET_OK;
}
-
-int tile_4x2_read(int x_size, int y_size, int x_pos, int y_pos)
-{
- int pixel_x_m1, pixel_y_m1;
- int roundup_x, roundup_y;
- int linear_addr0, linear_addr1, bank_addr ;
- int x_addr;
- int trans_addr;
-
- pixel_x_m1 = x_size -1;
- pixel_y_m1 = y_size -1;
-
- roundup_x = ((pixel_x_m1 >> 7) + 1);
- roundup_y = ((pixel_x_m1 >> 6) + 1);
-
- x_addr = x_pos >> 2;
-
- if ((y_size <= y_pos+32) && ( y_pos < y_size) &&
- (((pixel_y_m1 >> 5) & 0x1) == 0) && (((y_pos >> 5) & 0x1) == 0)) {
- linear_addr0 = (((y_pos & 0x1f) <<4) | (x_addr & 0xf));
- linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x + ((x_addr >> 6) & 0x3f));
-
- if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1))
- bank_addr = ((x_addr >> 4) & 0x1);
- else
- bank_addr = 0x2 | ((x_addr >> 4) & 0x1);
- } else {
- linear_addr0 = (((y_pos & 0x1f) << 4) | (x_addr & 0xf));
- linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x + ((x_addr >> 5) & 0x7f));
-
- if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1))
- bank_addr = ((x_addr >> 4) & 0x1);
- else
- bank_addr = 0x2 | ((x_addr >> 4) & 0x1);
- }
-
- linear_addr0 = linear_addr0 << 2;
- trans_addr = (linear_addr1 <<13) | (bank_addr << 11) | linear_addr0;
-
- return trans_addr;
-}
-
-void Y_tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size)
-{
- int trans_addr;
- unsigned int i, j, k, index;
- unsigned char data8[4];
- unsigned int max_index = x_size * y_size;
-
- for (i = 0; i < y_size; i = i + 16) {
- for (j = 0; j < x_size; j = j + 16) {
- trans_addr = tile_4x2_read(x_size, y_size, j, i);
- for (k = 0; k < 16; k++) {
- /* limit check - prohibit segmentation fault */
- index = (i * x_size) + (x_size * k) + j;
- /* remove equal condition to solve thumbnail bug */
- if (index + 16 > max_index) {
- continue;
- }
-
- data8[0] = p_tiled_addr[trans_addr + 64 * k + 0];
- data8[1] = p_tiled_addr[trans_addr + 64 * k + 1];
- data8[2] = p_tiled_addr[trans_addr + 64 * k + 2];
- data8[3] = p_tiled_addr[trans_addr + 64 * k + 3];
-
- p_linear_addr[index] = data8[0];
- p_linear_addr[index + 1] = data8[1];
- p_linear_addr[index + 2] = data8[2];
- p_linear_addr[index + 3] = data8[3];
-
- data8[0] = p_tiled_addr[trans_addr + 64 * k + 4];
- data8[1] = p_tiled_addr[trans_addr + 64 * k + 5];
- data8[2] = p_tiled_addr[trans_addr + 64 * k + 6];
- data8[3] = p_tiled_addr[trans_addr + 64 * k + 7];
-
- p_linear_addr[index + 4] = data8[0];
- p_linear_addr[index + 5] = data8[1];
- p_linear_addr[index + 6] = data8[2];
- p_linear_addr[index + 7] = data8[3];
-
- data8[0] = p_tiled_addr[trans_addr + 64 * k + 8];
- data8[1] = p_tiled_addr[trans_addr + 64 * k + 9];
- data8[2] = p_tiled_addr[trans_addr + 64 * k + 10];
- data8[3] = p_tiled_addr[trans_addr + 64 * k + 11];
-
- p_linear_addr[index + 8] = data8[0];
- p_linear_addr[index + 9] = data8[1];
- p_linear_addr[index + 10] = data8[2];
- p_linear_addr[index + 11] = data8[3];
-
- data8[0] = p_tiled_addr[trans_addr + 64 * k + 12];
- data8[1] = p_tiled_addr[trans_addr + 64 * k + 13];
- data8[2] = p_tiled_addr[trans_addr + 64 * k + 14];
- data8[3] = p_tiled_addr[trans_addr + 64 * k + 15];
-
- p_linear_addr[index + 12] = data8[0];
- p_linear_addr[index + 13] = data8[1];
- p_linear_addr[index + 14] = data8[2];
- p_linear_addr[index + 15] = data8[3];
- }
- }
- }
-}
-
-void CbCr_tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size)
-{
- int trans_addr;
- unsigned int i, j, k, index;
- unsigned char data8[4];
- unsigned int half_y_size = y_size / 2;
- unsigned int max_index = x_size * half_y_size;
- unsigned char *pUVAddr[2];
-
- pUVAddr[0] = p_linear_addr;
- pUVAddr[1] = p_linear_addr + ((x_size * half_y_size) / 2);
-
- for (i = 0; i < half_y_size; i = i + 16) {
- for (j = 0; j < x_size; j = j + 16) {
- trans_addr = tile_4x2_read(x_size, half_y_size, j, i);
- for (k = 0; k < 16; k++) {
- /* limit check - prohibit segmentation fault */
- index = (i * x_size) + (x_size * k) + j;
- /* remove equal condition to solve thumbnail bug */
- if (index + 16 > max_index) {
- continue;
- }
-
- data8[0] = p_tiled_addr[trans_addr + 64 * k + 0];
- data8[1] = p_tiled_addr[trans_addr + 64 * k + 1];
- data8[2] = p_tiled_addr[trans_addr + 64 * k + 2];
- data8[3] = p_tiled_addr[trans_addr + 64 * k + 3];
-
- pUVAddr[index%2][index/2] = data8[0];
- pUVAddr[(index+1)%2][(index+1)/2] = data8[1];
- pUVAddr[(index+2)%2][(index+2)/2] = data8[2];
- pUVAddr[(index+3)%2][(index+3)/2] = data8[3];
-
- data8[0] = p_tiled_addr[trans_addr + 64 * k + 4];
- data8[1] = p_tiled_addr[trans_addr + 64 * k + 5];
- data8[2] = p_tiled_addr[trans_addr + 64 * k + 6];
- data8[3] = p_tiled_addr[trans_addr + 64 * k + 7];
-
- pUVAddr[(index+4)%2][(index+4)/2] = data8[0];
- pUVAddr[(index+5)%2][(index+5)/2] = data8[1];
- pUVAddr[(index+6)%2][(index+6)/2] = data8[2];
- pUVAddr[(index+7)%2][(index+7)/2] = data8[3];
-
- data8[0] = p_tiled_addr[trans_addr + 64 * k + 8];
- data8[1] = p_tiled_addr[trans_addr + 64 * k + 9];
- data8[2] = p_tiled_addr[trans_addr + 64 * k + 10];
- data8[3] = p_tiled_addr[trans_addr + 64 * k + 11];
-
- pUVAddr[(index+8)%2][(index+8)/2] = data8[0];
- pUVAddr[(index+9)%2][(index+9)/2] = data8[1];
- pUVAddr[(index+10)%2][(index+10)/2] = data8[2];
- pUVAddr[(index+11)%2][(index+11)/2] = data8[3];
-
- data8[0] = p_tiled_addr[trans_addr + 64 * k + 12];
- data8[1] = p_tiled_addr[trans_addr + 64 * k + 13];
- data8[2] = p_tiled_addr[trans_addr + 64 * k + 14];
- data8[3] = p_tiled_addr[trans_addr + 64 * k + 15];
-
- pUVAddr[(index+12)%2][(index+12)/2] = data8[0];
- pUVAddr[(index+13)%2][(index+13)/2] = data8[1];
- pUVAddr[(index+14)%2][(index+14)/2] = data8[2];
- pUVAddr[(index+15)%2][(index+15)/2] = data8[3];
- }
- }
- }
-}
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/Android.mk b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/Android.mk
index e138a99..d364b1c 100644
--- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/Android.mk
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/Android.mk
@@ -9,7 +9,7 @@ LOCAL_SRC_FILES := \
LOCAL_MODULE := libsecmfcencapi.aries
-LOCAL_PRELINK_MODULE := false
+
LOCAL_CFLAGS := -DUSE_FIMC_FRAME_BUFFER
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c
index 2c33c5b..b51a55f 100644
--- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c
@@ -30,11 +30,13 @@
#define _MFCLIB_MAGIC_NUMBER 0x92241001
-void *SsbSipMfcEncOpen(void)
+void *SsbSipMfcEncOpen(void *value)
{
int hMFCOpen;
_MFCLIB *pCTX;
unsigned int mapped_addr;
+ mfc_common_args EncArg;
+ int ret_code;
hMFCOpen = open(S5PC110_MFC_DEV_NAME, O_RDWR | O_NDELAY);
if (hMFCOpen < 0) {
@@ -49,6 +51,17 @@ void *SsbSipMfcEncOpen(void)
return NULL;
}
+ if (*(unsigned int *)value == NO_CACHE ||
+ *(unsigned int *)value == CACHE) {
+ EncArg.args.buf_type = *(unsigned int *)value;
+ ret_code = ioctl(hMFCOpen, IOCTL_MFC_BUF_CACHE, &EncArg);
+ if (EncArg.ret_code != MFC_RET_OK) {
+ LOGE("SsbSipMfcDecOpenExt: IOCTL_MFC_BUF_CACHE (%d) failed\n", EncArg.ret_code);
+ }
+ } else {
+ LOGE("SsbSipMfcDecOpenExt: value is invalid, value: %d\n", *(int *)value);
+ }
+
mapped_addr = (unsigned int)mmap(0, MMAP_BUFFER_SIZE_MMAP, PROT_READ | PROT_WRITE, MAP_SHARED, hMFCOpen, 0);
if (!mapped_addr) {
LOGE("SsbSipMfcEncOpen: FIMV5.0 driver address mapping failed\n");
@@ -167,6 +180,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
EncArg.args.enc_init_mpeg4.in_luma_pad_val = mpeg4_arg->LumaPadVal;
EncArg.args.enc_init_mpeg4.in_cb_pad_val = mpeg4_arg->CbPadVal;
EncArg.args.enc_init_mpeg4.in_cr_pad_val = mpeg4_arg->CrPadVal;
+ EncArg.args.enc_init_mpeg4.in_frame_map = mpeg4_arg->FrameMap;
EncArg.args.enc_init_mpeg4.in_time_increament_res = mpeg4_arg->TimeIncreamentRes;
EncArg.args.enc_init_mpeg4.in_time_vop_time_increament = mpeg4_arg->VopTimeIncreament;
@@ -218,6 +232,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
EncArg.args.enc_init_mpeg4.in_luma_pad_val = h263_arg->LumaPadVal;
EncArg.args.enc_init_mpeg4.in_cb_pad_val = h263_arg->CbPadVal;
EncArg.args.enc_init_mpeg4.in_cr_pad_val = h263_arg->CrPadVal;
+ EncArg.args.enc_init_mpeg4.in_frame_map = mpeg4_arg->FrameMap;
EncArg.args.enc_init_mpeg4.in_RC_framerate = h263_arg->FrameRate;
EncArg.args.enc_init_mpeg4.in_RC_bitrate = h263_arg->Bitrate;
@@ -288,6 +303,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
EncArg.args.enc_init_h264.in_luma_pad_val = h264_arg->LumaPadVal;
EncArg.args.enc_init_h264.in_cb_pad_val = h264_arg->CbPadVal;
EncArg.args.enc_init_h264.in_cr_pad_val = h264_arg->CrPadVal;
+ EncArg.args.enc_init_mpeg4.in_frame_map = mpeg4_arg->FrameMap;
/* rate control*/
EncArg.args.enc_init_h264.in_RC_frm_enable = h264_arg->EnableFRMRateControl;
@@ -371,6 +387,13 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
EncArg.args.enc_exe.in_strm_st = (unsigned int)pCTX->phyStrmBuf;
EncArg.args.enc_exe.in_strm_end = (unsigned int)pCTX->phyStrmBuf + pCTX->sizeStrmBuf;
EncArg.args.enc_exe.in_frametag = pCTX->in_frametag;
+ if (pCTX->encode_cnt == 0) {
+ EncArg.args.enc_exe.in_strm_st = (unsigned int)pCTX->phyStrmBuf;
+ EncArg.args.enc_exe.in_strm_end = (unsigned int)pCTX->phyStrmBuf + pCTX->sizeStrmBuf;
+ } else {
+ EncArg.args.enc_exe.in_strm_st = (unsigned int)pCTX->phyStrmBuf + (MAX_ENCODER_OUTPUT_BUFFER_SIZE/2);
+ EncArg.args.enc_exe.in_strm_end = (unsigned int)pCTX->phyStrmBuf + (MAX_ENCODER_OUTPUT_BUFFER_SIZE/2) + pCTX->sizeStrmBuf;
+ }
ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_ENC_EXE, &EncArg);
if (EncArg.ret_code != MFC_RET_OK) {
@@ -422,6 +445,27 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle)
return MFC_RET_OK;
}
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetSize(void *openHandle, SSBSIP_MFC_CODEC_TYPE codecType, int nWidth, int nHeight)
+{
+ _MFCLIB *pCTX = (_MFCLIB *)openHandle;
+
+ if (pCTX == NULL)
+ return MFC_RET_INVALID_PARAM;
+
+ if (nWidth <= 0 || nHeight <= 0)
+ return MFC_RET_INVALID_PARAM;
+ pCTX->width = nWidth;
+ pCTX->height = nHeight;
+
+ if ((H264_ENC != codecType) &&
+ (MPEG4_ENC != codecType) &&
+ (H263_ENC != codecType))
+ return MFC_RET_INVALID_PARAM;
+ pCTX->codec_type = codecType;
+
+ return MFC_RET_OK;
+}
+
SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info)
{
int ret_code;
@@ -467,6 +511,9 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
input_info->YVirAddr = (void*)pCTX->virFrmBuf.luma;
input_info->CVirAddr = (void*)pCTX->virFrmBuf.chroma;
+ input_info->YSize = aligned_y_size;
+ input_info->CSize = aligned_c_size;
+
return MFC_RET_OK;
}
@@ -507,8 +554,17 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetOutBuf(void *openHandle, SSBSIP_MFC_ENC_OUT
output_info->headerSize = pCTX->encodedHeaderSize;
output_info->dataSize = pCTX->encodedDataSize;
- output_info->StrmPhyAddr = (void *)pCTX->phyStrmBuf;
- output_info->StrmVirAddr = (void *)pCTX->virStrmBuf;
+
+ if (pCTX->encode_cnt == 0) {
+ output_info->StrmPhyAddr = (void *)pCTX->phyStrmBuf;
+ output_info->StrmVirAddr = (void *)pCTX->virStrmBuf;
+ } else {
+ output_info->StrmPhyAddr = (unsigned char *)pCTX->phyStrmBuf + (MAX_ENCODER_OUTPUT_BUFFER_SIZE/2);
+ output_info->StrmVirAddr = (unsigned char *)pCTX->virStrmBuf + (MAX_ENCODER_OUTPUT_BUFFER_SIZE/2);
+ }
+
+ pCTX->encode_cnt ++;
+ pCTX->encode_cnt %= 2;
if (pCTX->encodedframeType == 0)
output_info->frameType = MFC_FRAME_TYPE_NOT_CODED;
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h
index b3e6929..3c10390 100644
--- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h
@@ -23,13 +23,7 @@
#define MAX_DECODER_INPUT_BUFFER_SIZE (1024 * 3072)
#define MAX_ENCODER_OUTPUT_BUFFER_SIZE (1024 * 3072)
-#define SUPPORT_1080P 0
-
-#if SUPPORT_1080P
#define MMAP_BUFFER_SIZE_MMAP (70*1024*1024)
-#else
-#define MMAP_BUFFER_SIZE_MMAP (62*1024*1024)
-#endif
#define S5PC110_MFC_DEV_NAME "/dev/s3c-mfc"
@@ -62,6 +56,16 @@ typedef enum {
} SSBSIP_MFC_FORCE_SET_FRAME_TYPE;
typedef enum {
+ NV12_LINEAR = 0,
+ NV12_TILE
+} SSBSIP_MFC_INSTRM_MODE_TYPE;
+
+typedef enum {
+ NO_CACHE = 0,
+ CACHE = 1
+} SSBIP_MFC_BUFFER_TYPE;
+
+typedef enum {
MFC_DEC_SETCONF_POST_ENABLE = 1,
MFC_DEC_SETCONF_EXTRA_BUFFER_NUM,
MFC_DEC_SETCONF_DISPLAY_DELAY,
@@ -188,6 +192,7 @@ typedef struct {
int LumaPadVal; // [IN] Luma pel value used to fill padding area
int CbPadVal; // [IN] CB pel value used to fill padding area
int CrPadVal; // [IN] CR pel value used to fill padding area
+ int FrameMap; // [IN] Encoding input mode(tile mode or linear mode)
// H.264 specific parameters
int ProfileIDC; // [IN] profile
@@ -230,6 +235,7 @@ typedef struct {
int LumaPadVal; // [IN] Luma pel value used to fill padding area
int CbPadVal; // [IN] CB pel value used to fill padding area
int CrPadVal; // [IN] CR pel value used to fill padding area
+ int FrameMap; // [IN] Encoding input mode(tile mode or linear mode)
// MPEG4 specific parameters
int ProfileIDC; // [IN] profile
@@ -261,6 +267,7 @@ typedef struct {
int LumaPadVal; // [IN] Luma pel value used to fill padding area
int CbPadVal; // [IN] CB pel value used to fill padding area
int CrPadVal; // [IN] CR pel value used to fill padding area
+ int FrameMap; // [IN] Encoding input mode(tile mode or linear mode)
// H.263 specific parameters
int FrameRate; // [IN] rate control parameter(frame rate)
@@ -285,15 +292,9 @@ extern "C" {
#endif
/*--------------------------------------------------------------------------------*/
-/* Format Conversion API */
-/*--------------------------------------------------------------------------------*/
-void Y_tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size);
-void CbCr_tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size);
-
-/*--------------------------------------------------------------------------------*/
/* Decoding APIs */
/*--------------------------------------------------------------------------------*/
-void *SsbSipMfcDecOpen(void);
+void *SsbSipMfcDecOpen(void *value);
SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE codec_type, int Frameleng);
SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill);
SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle);
@@ -309,11 +310,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
/*--------------------------------------------------------------------------------*/
/* Encoding APIs */
/*--------------------------------------------------------------------------------*/
-void *SsbSipMfcEncOpen(void);
+void *SsbSipMfcEncOpen(void *value);
SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param);
SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle);
SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetSize(void *openHandle, SSBSIP_MFC_CODEC_TYPE codecType, int nWidth, int nHeight);
SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info);
SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info);
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/color_space_convertor.h b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/color_space_convertor.h
new file mode 100644
index 0000000..4ad5bda
--- /dev/null
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/color_space_convertor.h
@@ -0,0 +1,176 @@
+/*
+ *
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * 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.
+ */
+
+/*
+ * @file color_space_convertor.h
+ * @brief SEC_OMX specific define.
+ * NV12T(tiled) layout:
+ * Each element is not pixel. It is 64x32 pixel block.
+ * uv pixel block is interleaved as u v u v u v ...
+ * y1 y2 y7 y8 y9 y10 y15 y16
+ * y3 y4 y5 y6 y11 y12 y13 y14
+ * y17 y18 y23 y24 y25 y26 y31 y32
+ * y19 y20 y21 y22 y27 y28 y29 y30
+ * uv1 uv2 uv7 uv8 uv9 uv10 uv15 uv16
+ * uv3 uv4 uv5 uv6 uv11 uv12 uv13 uv14
+ * YUV420Planar(linear) layout:
+ * Each element is not pixel. It is 64x32 pixel block.
+ * y1 y2 y3 y4 y5 y6 y7 y8
+ * y9 y10 y11 y12 y13 y14 y15 y16
+ * y17 y18 y19 y20 y21 y22 y23 y24
+ * y25 y26 y27 y28 y29 y30 y31 y32
+ * u1 u2 u3 u4 u5 u6 u7 u8
+ * v1 v2 v3 v4 v5 v6 v7 v8
+ * YUV420Semiplanar(linear) layout:
+ * Each element is not pixel. It is 64x32 pixel block.
+ * uv pixel block is interleaved as u v u v u v ...
+ * y1 y2 y3 y4 y5 y6 y7 y8
+ * y9 y10 y11 y12 y13 y14 y15 y16
+ * y17 y18 y19 y20 y21 y22 y23 y24
+ * y25 y26 y27 y28 y29 y30 y31 y32
+ * uv1 uv2 uv3 uv4 uv5 uv6 uv7 uv8
+ * uv9 uv10 uv11 uv12 uv13 uv14 uv15 uv16
+ * @author ShinWon Lee (shinwon.lee@samsung.com)
+ * @version 1.0
+ * @history
+ * 2011.7.01 : Create
+ */
+
+#ifndef COLOR_SPACE_CONVERTOR_H_
+#define COLOR_SPACE_CONVERTOR_H_
+
+/*--------------------------------------------------------------------------------*/
+/* Format Conversion API */
+/*--------------------------------------------------------------------------------*/
+/* C Code */
+/*
+ * De-interleaves src to dest1, dest2
+ *
+ * @param dest1
+ * Address of de-interleaved data[out]
+ *
+ * @param dest2
+ * Address of de-interleaved data[out]
+ *
+ * @param src
+ * Address of interleaved data[in]
+ *
+ * @param src_size
+ * Size of interleaved data[in]
+ */
+void csc_deinterleave_memcpy(char *dest1, char *dest2, char *src, int src_size);
+
+/*
+ * Interleaves src1, src2 to dest
+ *
+ * @param dest
+ * Address of interleaved data[out]
+ *
+ * @param src1
+ * Address of de-interleaved data[in]
+ *
+ * @param src2
+ * Address of de-interleaved data[in]
+ *
+ * @param src_size
+ * Size of de-interleaved data[in]
+ */
+void csc_interleave_memcpy(char *dest, char *src1, char *src2, int src_size);
+
+/*
+ * Converts tiled data to linear.
+ * 1. Y of NV12T to Y of YUV420P
+ * 2. Y of NV12T to Y of YUV420S
+ * 3. UV of NV12T to UV of YUV420S
+ *
+ * @param yuv420_dest
+ * Y or UV plane address of YUV420[out]
+ *
+ * @param nv12t_src
+ * Y or UV plane address of NV12T[in]
+ *
+ * @param yuv420_width
+ * Width of YUV420[in]
+ *
+ * @param yuv420_height
+ * Y: Height of YUV420, UV: Height/2 of YUV420[in]
+ */
+void csc_tiled_to_linear(char *yuv420p_y_dest, char *nv12t_y_src, int yuv420p_width, int yuv420p_y_height);
+
+/*
+ * Converts and Deinterleaves tiled data to linear
+ * 1. UV of NV12T to UV of YUV420P
+ *
+ * @param yuv420_u_dest
+ * U plane address of YUV420P[out]
+ *
+ * @param yuv420_v_dest
+ * V plane address of YUV420P[out]
+ *
+ * @param nv12t_src
+ * UV plane address of NV12T[in]
+ *
+ * @param yuv420_width
+ * Width of YUV420[in]
+ *
+ * @param yuv420_uv_height
+ * Height/2 of YUV420[in]
+ */
+void csc_tiled_to_linear_deinterleave(char *yuv420p_u_dest, char *yuv420p_v_dest, char *nv12t_uv_src, int yuv420p_width, int yuv420p_uv_height);
+
+/*
+ * Converts linear data to tiled.
+ * 1. Y of YUV420P to Y of NV12T
+ * 2. Y of YUV420S to Y of NV12T
+ * 3. UV of YUV420S to UV of NV12T
+ *
+ * @param nv12t_dest
+ * Y or UV plane address of NV12T[out]
+ *
+ * @param yuv420_src
+ * Y or UV plane address of YUV420P(S)[in]
+ *
+ * @param yuv420_width
+ * Width of YUV420[in]
+ *
+ * @param yuv420_height
+ * Y: Height of YUV420, UV: Height/2 of YUV420[in]
+ */
+void csc_linear_to_tiled(char *nv12t_dest, char *yuv420p_src, int yuv420p_width, int yuv420p_y_height);
+
+/*
+ * Converts and Interleaves linear to tiled
+ * 1. UV of YUV420P to UV of NV12T
+ *
+ * @param nv12t_uv_dest
+ * UV plane address of NV12T[out]
+ *
+ * @param yuv420p_u_src
+ * U plane address of YUV420P[in]
+ *
+ * @param yuv420p_v_src
+ * V plane address of YUV420P[in]
+ *
+ * @param yuv420_width
+ * Width of YUV420[in]
+ *
+ * @param yuv420_uv_height
+ * Height/2 of YUV420[in]
+ */
+void csc_linear_to_tiled_interleave(char *nv12t_uv_dest, char *yuv420p_u_src, char *yuv420p_v_src, int yuv420p_width, int yuv420p_uv_height);
+
+#endif /*COLOR_SPACE_CONVERTOR_H_*/
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h
index e7e23c3..466860d 100644
--- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h
@@ -31,6 +31,8 @@
#define IOCTL_MFC_SET_CONFIG 0x00800101
#define IOCTL_MFC_GET_CONFIG 0x00800102
+#define IOCTL_MFC_BUF_CACHE 0x00801000
+
/* MFC H/W support maximum 32 extra DPB */
#define MFC_MAX_EXTRA_DPB 5
@@ -117,6 +119,8 @@ typedef struct {
int in_cb_pad_val;
int in_cr_pad_val;
+ int in_frame_map; /* [IN] Encoding input NV12 type linear(0) TILE(1) */
+
unsigned int in_mapped_addr;
mfc_strm_ref_buf_arg_t out_u_addr;
mfc_strm_ref_buf_arg_t out_p_addr;
@@ -158,6 +162,8 @@ typedef struct {
int in_cb_pad_val; /* [IN] CB pel value used to fill padding area */
int in_cr_pad_val; /* [IN] CR pel value used to fill padding area */
+ int in_frame_map; /* [IN] Encoding input NV12 type linear(0) TILE(1) */
+
unsigned int in_mapped_addr;
mfc_strm_ref_buf_arg_t out_u_addr;
mfc_strm_ref_buf_arg_t out_p_addr;
@@ -279,6 +285,11 @@ typedef struct tag_mem_free_arg_t
unsigned int u_addr;
} mfc_mem_free_arg_t;
+typedef enum {
+ MFC_BUFFER_NO_CACHE = 0,
+ MFC_BUFFER_CACHE = 1
+} mfc_buffer_type;
+
typedef union {
mfc_enc_init_mpeg4_arg_t enc_init_mpeg4;
mfc_enc_init_h263_arg_t enc_init_h263;
@@ -294,6 +305,8 @@ typedef union {
mfc_mem_alloc_arg_t mem_alloc;
mfc_mem_free_arg_t mem_free;
mfc_get_phys_addr_arg_t get_phys_addr;
+
+ mfc_buffer_type buf_type;
} mfc_args;
typedef struct tag_mfc_args {
@@ -328,6 +341,7 @@ typedef struct {
int out_frametag_bottom;
unsigned int encoded_Y_paddr;
unsigned int encoded_C_paddr;
+ unsigned int encode_cnt;
} _MFCLIB;
#endif /* _MFC_INTERFACE_H_ */
diff --git a/sec_mm/sec_omx/sec_omx_component/common/Android.mk b/sec_mm/sec_omx/sec_omx_component/common/Android.mk
index 6633682..aa32005 100644
--- a/sec_mm/sec_omx/sec_omx_component/common/Android.mk
+++ b/sec_mm/sec_omx/sec_omx_component/common/Android.mk
@@ -8,7 +8,7 @@ LOCAL_SRC_FILES := \
SEC_OMX_Baseport.c \
SEC_OMX_Resourcemanager.c
-LOCAL_PRELINK_MODULE := false
+
LOCAL_MODULE := libsecbasecomponent.aries
LOCAL_CFLAGS :=
diff --git a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.c b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.c
index d1b224f..89e9aeb 100644
--- a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.c
+++ b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Basecomponent.c
@@ -179,7 +179,7 @@ static OMX_ERRORTYPE SEC_OMX_BufferProcessThread(OMX_PTR threadData)
pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
pSECComponent->sec_BufferProcess(pOMXComponent);
- SEC_OSAL_TheadExit(NULL);
+ SEC_OSAL_ThreadExit(NULL);
EXIT:
FunctionOut();
@@ -329,6 +329,10 @@ OMX_ERRORTYPE SEC_OMX_ComponentStateSet(OMX_COMPONENTTYPE *pOMXComponent, OMX_U3
case OMX_StateLoaded:
for (i = 0; i < pSECComponent->portParam.nPorts; i++) {
pSECPort = (pSECComponent->pSECPort + i);
+ if (pSECPort == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
if (CHECK_PORT_ENABLED(pSECPort)) {
ret = pSECComponent->sec_AllocateTunnelBuffer(pSECPort, i);
@@ -540,7 +544,7 @@ static OMX_ERRORTYPE SEC_OMX_MessageHandlerThread(OMX_PTR threadData)
}
}
- SEC_OSAL_TheadExit(NULL);
+ SEC_OSAL_ThreadExit(NULL);
EXIT:
FunctionOut();
@@ -1094,7 +1098,7 @@ OMX_ERRORTYPE SEC_OMX_SetParameter(
{
OMX_PARAM_BUFFERSUPPLIERTYPE *bufferSupplier = (OMX_PARAM_BUFFERSUPPLIERTYPE *)ComponentParameterStructure;
OMX_U32 portIndex = bufferSupplier->nPortIndex;
- SEC_OMX_BASEPORT *pSECPort;
+ SEC_OMX_BASEPORT *pSECPort = &pSECComponent->pSECPort[portIndex];
if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
if (pSECPort->portDefinition.bEnabled == OMX_TRUE) {
@@ -1112,7 +1116,6 @@ OMX_ERRORTYPE SEC_OMX_SetParameter(
goto EXIT;
}
- pSECPort = &pSECComponent->pSECPort[portIndex];
if (bufferSupplier->eBufferSupplier == OMX_BufferSupplyUnspecified) {
ret = OMX_ErrorNone;
goto EXIT;
@@ -1215,7 +1218,7 @@ OMX_ERRORTYPE SEC_OMX_GetConfig(
ret = OMX_ErrorInvalidState;
goto EXIT;
}
- ret = OMX_ErrorNone;
+ ret = OMX_ErrorUnsupportedIndex;
EXIT:
FunctionOut();
@@ -1258,7 +1261,7 @@ OMX_ERRORTYPE SEC_OMX_SetConfig(
ret = OMX_ErrorInvalidState;
goto EXIT;
}
- ret = OMX_ErrorNone;
+ ret = OMX_ErrorUnsupportedIndex;
EXIT:
FunctionOut();
@@ -1419,7 +1422,6 @@ OMX_ERRORTYPE SEC_OMX_BaseComponent_Constructor(
pOMXComponent->GetComponentVersion = &SEC_OMX_GetComponentVersion;
pOMXComponent->SendCommand = &SEC_OMX_SendCommand;
- pOMXComponent->GetConfig = &SEC_OMX_GetConfig;
pOMXComponent->GetExtensionIndex = &SEC_OMX_GetExtensionIndex;
pOMXComponent->GetState = &SEC_OMX_GetState;
pOMXComponent->SetCallbacks = &SEC_OMX_SetCallbacks;
@@ -1482,5 +1484,3 @@ EXIT:
return ret;
}
-
-
diff --git a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c
index 0e0f7ea..97e00af 100644
--- a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c
+++ b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.c
@@ -832,6 +832,8 @@ OMX_ERRORTYPE SEC_OMX_Port_Constructor(OMX_HANDLETYPE hComponent)
pSECInputPort->portDefinition.nBufferAlignment = 0;
pSECInputPort->markType.hMarkTargetComponent = NULL;
pSECInputPort->markType.pMarkData = NULL;
+ pSECInputPort->bUseAndroidNativeBuffer = OMX_FALSE;
+ pSECInputPort->bStoreMetaDataInBuffer = OMX_FALSE;
/* Output Port */
pSECOutputPort = &pSECPort[OUTPUT_PORT_INDEX];
@@ -940,8 +942,10 @@ OMX_ERRORTYPE SEC_OMX_Port_Constructor(OMX_HANDLETYPE hComponent)
pSECOutputPort->portDefinition.nBufferAlignment = 0;
pSECOutputPort->markType.hMarkTargetComponent = NULL;
pSECOutputPort->markType.pMarkData = NULL;
+ pSECOutputPort->bUseAndroidNativeBuffer = OMX_FALSE;
+ pSECOutputPort->bStoreMetaDataInBuffer = OMX_FALSE;
- pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+ pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
pSECComponent->checkTimeStamp.startTimeStamp = 0;
pSECComponent->checkTimeStamp.nStartFlags = 0x0;
diff --git a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h
index f38226b..147f940 100644
--- a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h
+++ b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h
@@ -62,6 +62,8 @@ typedef struct _SEC_OMX_BASEPORT
OMX_BOOL bIsPortDisabled;
OMX_MARKTYPE markType;
+ OMX_CONFIG_RECTTYPE cropRectangle;
+
/* Tunnel Info */
OMX_HANDLETYPE tunneledComponent;
OMX_U32 tunneledPort;
@@ -70,6 +72,12 @@ typedef struct _SEC_OMX_BASEPORT
OMX_U32 tunnelFlags;
OMX_VIDEO_CONTROLRATETYPE eControlRate;
+
+ /* For Android Native Buffer */
+ OMX_BOOL bUseAndroidNativeBuffer;
+ /* For Android Store Meta Data inBuffer */
+ OMX_BOOL bStoreMetaDataInBuffer;
+ OMX_PTR pIMGGrallocModule;
} SEC_OMX_BASEPORT;
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c b/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c
index 48705c1..30a1acb 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.c
@@ -34,15 +34,13 @@
#include "SEC_OMX_Vdec.h"
#include "SEC_OMX_Basecomponent.h"
#include "SEC_OSAL_Thread.h"
+#include "color_space_convertor.h"
#undef SEC_LOG_TAG
#define SEC_LOG_TAG "SEC_VIDEO_DEC"
#define SEC_LOG_OFF
#include "SEC_OSAL_Log.h"
-#define ONE_FRAME_OUTPUT /* only one frame output for Android */
-#define S5PC110_DECODE_OUT_DATA_BUFFER /* for Android s5pc110 0copy*/
-
inline void SEC_UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent)
{
@@ -68,6 +66,7 @@ inline void SEC_UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent)
switch(secOutputPort->portDefinition.format.video.eColorFormat) {
case OMX_COLOR_FormatYUV420Planar:
case OMX_COLOR_FormatYUV420SemiPlanar:
+ case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
if (width && height)
secOutputPort->portDefinition.nBufferSize = (width * height * 3) / 2;
break;
@@ -161,6 +160,8 @@ OMX_ERRORTYPE SEC_OMX_UseBuffer(
goto EXIT;
}
}
+
+ SEC_OSAL_Free(temp_bufferHeader);
ret = OMX_ErrorInsufficientResources;
EXIT:
@@ -257,6 +258,9 @@ OMX_ERRORTYPE SEC_OMX_AllocateBuffer(
goto EXIT;
}
}
+
+ SEC_OSAL_Free(temp_bufferHeader);
+ SEC_OSAL_Free(temp_buffer);
ret = OMX_ErrorInsufficientResources;
EXIT:
@@ -607,10 +611,9 @@ OMX_ERRORTYPE SEC_OutputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent)
dataBuffer->dataValid =OMX_TRUE;
/* dataBuffer->nFlags = dataBuffer->bufferHeader->nFlags; */
/* dataBuffer->nTimeStamp = dataBuffer->bufferHeader->nTimeStamp; */
-#ifdef S5PC110_DECODE_OUT_DATA_BUFFER
pSECComponent->processData[OUTPUT_PORT_INDEX].dataBuffer = dataBuffer->bufferHeader->pBuffer;
pSECComponent->processData[OUTPUT_PORT_INDEX].allocSize = dataBuffer->bufferHeader->nAllocLen;
-#endif
+
SEC_OSAL_Free(message);
}
SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
@@ -816,13 +819,6 @@ OMX_BOOL SEC_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent)
if (outputData->remainDataLen <= (outputUseBuffer->allocSize - outputUseBuffer->dataLen)) {
copySize = outputData->remainDataLen;
-#ifndef S5PC110_DECODE_OUT_DATA_BUFFER
- if (copySize > 0)
- SEC_OSAL_Memcpy((outputUseBuffer->bufferHeader->pBuffer + outputUseBuffer->dataLen),
- (outputData->dataBuffer + outputData->usedDataLen),
- copySize);
-#endif
-
outputUseBuffer->dataLen += copySize;
outputUseBuffer->remainDataLen += copySize;
outputUseBuffer->nFlags = outputData->nFlags;
@@ -833,28 +829,13 @@ OMX_BOOL SEC_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent)
/* reset outputData */
SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
-#ifdef ONE_FRAME_OUTPUT /* only one frame output for Android */
if ((outputUseBuffer->remainDataLen > 0) ||
(outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS))
SEC_OutputBufferReturn(pOMXComponent);
-#else
- if ((outputUseBuffer->remainDataLen > 0) ||
- ((outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
- SEC_OutputBufferReturn(pOMXComponent);
- } else {
- outputUseBuffer->dataValid = OMX_TRUE;
- }
-#endif
} else {
SEC_OSAL_Log(SEC_LOG_ERROR, "output buffer is smaller than decoded data size Out Length");
copySize = outputUseBuffer->allocSize - outputUseBuffer->dataLen;
-
-#ifndef S5PC110_DECODE_OUT_DATA_BUFFER
- SEC_OSAL_Memcpy((outputUseBuffer->bufferHeader->pBuffer + outputUseBuffer->dataLen),
- (outputData->dataBuffer + outputData->usedDataLen),
- copySize);
-#endif
outputUseBuffer->dataLen += copySize;
outputUseBuffer->remainDataLen += copySize;
outputUseBuffer->nFlags = 0;
@@ -1063,19 +1044,19 @@ OMX_ERRORTYPE SEC_OMX_VideoDecodeGetParameter(
portDefinition = &pSECPort->portDefinition;
switch (index) {
- case supportFormat_1:
+ case supportFormat_0:
portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
- portFormat->eColorFormat = OMX_COLOR_FormatYUV420Planar;
+ portFormat->eColorFormat = OMX_COLOR_FormatYUV420Planar;//OMX_COLOR_FormatYUV420SemiPlanar;
portFormat->xFramerate = portDefinition->format.video.xFramerate;
break;
- case supportFormat_2:
+ case supportFormat_1:
portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
- portFormat->eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
+ portFormat->eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;//OMX_COLOR_FormatYUV420Planar;
portFormat->xFramerate = portDefinition->format.video.xFramerate;
break;
- case supportFormat_3:
+ case supportFormat_2:
portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
- portFormat->eColorFormat = SEC_OMX_COLOR_FormatNV12PhysicalAddress;
+ portFormat->eColorFormat = OMX_SEC_COLOR_FormatNV12TPhysicalAddress;
portFormat->xFramerate = portDefinition->format.video.xFramerate;
break;
}
@@ -1103,6 +1084,20 @@ OMX_ERRORTYPE SEC_OMX_VideoDecodeGetParameter(
ret = OMX_ErrorNone;
}
break;
+#ifdef USE_ANDROID_EXTENSION
+ case OMX_IndexParamGetAndroidNativeBuffer:
+ {
+ if (OMX_ErrorNone != checkVersionANB(ComponentParameterStructure))
+ goto EXIT;
+
+ if (OUTPUT_PORT_INDEX != checkPortIndexANB(ComponentParameterStructure)) {
+ ret = OMX_ErrorBadPortIndex;
+ goto EXIT;
+ }
+ ret = getAndroidNativeBuffer(hComponent, ComponentParameterStructure);
+ }
+ break;
+#endif
default:
{
ret = SEC_OMX_GetParameter(hComponent, nParamIndex, ComponentParameterStructure);
@@ -1201,6 +1196,45 @@ OMX_ERRORTYPE SEC_OMX_VideoDecodeSetParameter(
ret = OMX_ErrorNone;
}
break;
+#ifdef USE_ANDROID_EXTENSION
+ case OMX_IndexParamEnableAndroidBuffers:
+ {
+ if (OMX_ErrorNone != checkVersionANB(ComponentParameterStructure))
+ goto EXIT;
+
+ if (OUTPUT_PORT_INDEX != checkPortIndexANB(ComponentParameterStructure)) {
+ ret = OMX_ErrorBadPortIndex;
+ goto EXIT;
+ }
+
+ ret = enableAndroidNativeBuffer(hComponent, ComponentParameterStructure);
+ if (ret == OMX_ErrorNone) {
+ SEC_OMX_BASECOMPONENT *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ SEC_OMX_BASEPORT *pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+ if (pSECPort->bUseAndroidNativeBuffer) {
+ pSECPort->portDefinition.nBufferCountActual = ANDROID_MAX_VIDEO_OUTPUTBUFFER_NUM;
+ pSECPort->portDefinition.nBufferCountMin = ANDROID_MAX_VIDEO_OUTPUTBUFFER_NUM;
+ } else {
+ pSECPort->portDefinition.nBufferCountActual = MAX_VIDEO_OUTPUTBUFFER_NUM;
+ pSECPort->portDefinition.nBufferCountMin = MAX_VIDEO_OUTPUTBUFFER_NUM;
+ }
+ }
+ }
+ break;
+ case OMX_IndexParamUseAndroidNativeBuffer:
+ {
+ if (OMX_ErrorNone != checkVersionANB(ComponentParameterStructure))
+ goto EXIT;
+
+ if (OUTPUT_PORT_INDEX != checkPortIndexANB(ComponentParameterStructure)) {
+ ret = OMX_ErrorBadPortIndex;
+ goto EXIT;
+ }
+
+ ret = useAndroidNativeBuffer(hComponent, ComponentParameterStructure);
+ }
+ break;
+#endif
default:
{
ret = SEC_OMX_SetParameter(hComponent, nIndex, ComponentParameterStructure);
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h b/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h
index b7f71da..52130f0 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/SEC_OMX_Vdec.h
@@ -40,14 +40,18 @@
#define DEFAULT_FRAME_WIDTH 176
#define DEFAULT_FRAME_HEIGHT 144
-#define DEFAULT_VIDEO_INPUT_BUFFER_SIZE (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT) * 2
-#define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT * 3) / 2
+#define DEFAULT_VIDEO_INPUT_BUFFER_SIZE ((DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT) * 2)
+#define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE ((DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT * 3) / 2)
-#define DEFAULT_MFC_INPUT_BUFFER_SIZE 1024 * 1024 /*DEFAULT_VIDEO_INPUT_BUFFER_SIZE*/
+#define MFC_INPUT_BUFFER_NUM_MAX 2
+#define DEFAULT_MFC_INPUT_BUFFER_SIZE ((1280 * 720 * 3) / 2)
#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 1
#define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX 3
+#ifdef USE_ANDROID_EXTENSION
+#define ANDROID_MAX_VIDEO_OUTPUTBUFFER_NUM 1
+#endif
typedef struct
{
@@ -55,6 +59,24 @@ typedef struct
void *pAddrC;
} MFC_DEC_ADDR_INFO;
+typedef struct _SEC_MFC_NBDEC_THREAD
+{
+ OMX_HANDLETYPE hNBDecodeThread;
+ OMX_HANDLETYPE hDecFrameStart;
+ OMX_HANDLETYPE hDecFrameEnd;
+ OMX_BOOL bExitDecodeThread;
+ OMX_BOOL bDecoderRun;
+
+ OMX_U32 oneFrameSize;
+} SEC_MFC_NBDEC_THREAD;
+
+typedef struct _MFC_DEC_INPUT_BUFFER
+{
+ void *PhyAddr; // physical address
+ void *VirAddr; // virtual address
+ int bufferSize; // input buffer alloc size
+ int dataSize; // Data length
+} MFC_DEC_INPUT_BUFFER;
#ifdef __cplusplus
extern "C" {
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/Android.mk b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/Android.mk
index 2dadf50..6cb3d2d 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/Android.mk
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/Android.mk
@@ -7,22 +7,23 @@ LOCAL_SRC_FILES := \
SEC_OMX_H264dec.c \
library_register.c
-LOCAL_PRELINK_MODULE := false
+
LOCAL_MODULE := libOMX.SEC.AVC.Decoder.aries
LOCAL_CFLAGS :=
LOCAL_ARM_MODE := arm
-LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec.aries libsecosal.aries libsecbasecomponent.aries libsecmfcdecapi.aries
-LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils
+LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec.aries libsecosal.aries libsecbasecomponent.aries \
+ libsecmfcdecapi.aries libseccsc.aries
+LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui libhardware
LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
$(SEC_OMX_INC)/sec \
$(SEC_OMX_TOP)/sec_osal \
$(SEC_OMX_TOP)/sec_omx_core \
$(SEC_OMX_COMPONENT)/common \
- $(SEC_OMX_COMPONENT)/video/dec \
+ $(SEC_OMX_COMPONENT)/video/dec
LOCAL_C_INCLUDES += $(SEC_OMX_TOP)/sec_codecs/video/mfc_c110/include
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c
index 5e73b7f..07e1a89 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.c
@@ -35,6 +35,7 @@
#include "library_register.h"
#include "SEC_OMX_H264dec.h"
#include "SsbSipMfcApi.h"
+#include "color_space_convertor.h"
#undef SEC_LOG_TAG
#define SEC_LOG_TAG "SEC_H264_DEC"
@@ -56,8 +57,6 @@ SEC_OMX_VIDEO_PROFILELEVEL supportedAVCProfileLevels[] ={
{OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel22},
{OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel3},
{OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel31},
- {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel32},
- {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel4},
{OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel1},
{OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel1b},
@@ -69,8 +68,6 @@ SEC_OMX_VIDEO_PROFILELEVEL supportedAVCProfileLevels[] ={
{OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel22},
{OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel3},
{OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel31},
- {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel32},
- {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel4},
{OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel1},
{OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel1b},
@@ -81,9 +78,7 @@ SEC_OMX_VIDEO_PROFILELEVEL supportedAVCProfileLevels[] ={
{OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel21},
{OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel22},
{OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel3},
- {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel31},
- {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel32},
- {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel4}};
+ {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel31}};
static int Check_H264_Frame(OMX_U8 *pInputStream, int buffSize, OMX_U32 flag, OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame)
@@ -242,7 +237,7 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_GetParameter(
goto EXIT;
}
- SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPOMENT_H264_DEC_ROLE);
+ SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_H264_DEC_ROLE);
}
break;
case OMX_IndexParamVideoProfileLevelQuerySupported:
@@ -401,7 +396,7 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_SetParameter(
goto EXIT;
}
- if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPOMENT_H264_DEC_ROLE)) {
+ if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_H264_DEC_ROLE)) {
pSECComponent->pSECPort[INPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
} else {
ret = OMX_ErrorBadParameter;
@@ -453,10 +448,18 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_SetParameter(
pSECOutputPort->portDefinition.format.video.nFrameHeight = pSECPort->portDefinition.format.video.nFrameHeight;
pSECOutputPort->portDefinition.format.video.nStride = width;
pSECOutputPort->portDefinition.format.video.nSliceHeight = height;
- if (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_COLOR_FormatYUV420Planar) {
+
+ switch (pSECOutputPort->portDefinition.format.video.eColorFormat) {
+ case OMX_COLOR_FormatYUV420Planar:
+ case OMX_COLOR_FormatYUV420SemiPlanar:
+ case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+ case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
pSECOutputPort->portDefinition.nBufferSize = (width * height * 3) / 2;
- } else if (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_COLOR_FormatYUV422Planar) {
- pSECOutputPort->portDefinition.nBufferSize = width * height * 2;
+ break;
+ default:
+ SEC_OSAL_Log(SEC_LOG_ERROR, "Color format is not support!! use default YUV size!!");
+ ret = OMX_ErrorUnsupportedSetting;
+ break;
}
}
}
@@ -519,6 +522,84 @@ EXIT:
return ret;
}
+OMX_ERRORTYPE SEC_MFC_H264Dec_GetConfig(
+ OMX_HANDLETYPE hComponent,
+ OMX_INDEXTYPE nIndex,
+ OMX_PTR pComponentConfigStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+ if (ret != OMX_ErrorNone) {
+ goto EXIT;
+ }
+
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+ if (pComponentConfigStructure == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ if (pSECComponent->currentState == OMX_StateInvalid) {
+ ret = OMX_ErrorInvalidState;
+ goto EXIT;
+ }
+
+ switch (nIndex) {
+ case OMX_IndexConfigCommonOutputCrop:
+ {
+ SEC_H264DEC_HANDLE *pH264Dec = NULL;
+ OMX_CONFIG_RECTTYPE *pSrcRectType = NULL;
+ OMX_CONFIG_RECTTYPE *pDstRectType = NULL;
+ pH264Dec = (SEC_H264DEC_HANDLE *)pSECComponent->hCodecHandle;
+
+ if (pH264Dec->hMFCH264Handle.bConfiguredMFC == OMX_FALSE) {
+ ret = OMX_ErrorNotReady;
+ break;
+ }
+
+ pDstRectType = (OMX_CONFIG_RECTTYPE *)pComponentConfigStructure;
+
+ if ((pDstRectType->nPortIndex != INPUT_PORT_INDEX) &&
+ (pDstRectType->nPortIndex != OUTPUT_PORT_INDEX)) {
+ ret = OMX_ErrorBadPortIndex;
+ goto EXIT;
+ }
+
+ SEC_OMX_BASEPORT *pSECPort = &pSECComponent->pSECPort[pDstRectType->nPortIndex];
+
+ pSrcRectType = &(pSECPort->cropRectangle);
+
+ pDstRectType->nTop = pSrcRectType->nTop;
+ pDstRectType->nLeft = pSrcRectType->nLeft;
+ pDstRectType->nHeight = pSrcRectType->nHeight;
+ pDstRectType->nWidth = pSrcRectType->nWidth;
+ }
+ break;
+ default:
+ ret = SEC_OMX_GetConfig(hComponent, nIndex, pComponentConfigStructure);
+ break;
+ }
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
OMX_ERRORTYPE SEC_MFC_H264Dec_SetConfig(
OMX_HANDLETYPE hComponent,
OMX_INDEXTYPE nIndex,
@@ -612,12 +693,21 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_GetExtensionIndex(
goto EXIT;
}
- if (SEC_OSAL_Strcmp(cParameterName, "OMX.SEC.index.ThumbnailMode") == 0) {
+ if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_ENABLE_THUMBNAIL) == 0) {
SEC_H264DEC_HANDLE *pH264Dec = (SEC_H264DEC_HANDLE *)pSECComponent->hCodecHandle;
-
*pIndexType = OMX_IndexVendorThumbnailMode;
-
ret = OMX_ErrorNone;
+#ifdef USE_ANDROID_EXTENSION
+ } else if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_ENABLE_ANB) == 0) {
+ *pIndexType = OMX_IndexParamEnableAndroidBuffers;
+ ret = OMX_ErrorNone;
+ } else if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_GET_ANB) == 0) {
+ *pIndexType = OMX_IndexParamGetAndroidNativeBuffer;
+ ret = OMX_ErrorNone;
+ } else if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_USE_ANB) == 0) {
+ *pIndexType = OMX_IndexParamUseAndroidNativeBuffer;
+ ret = OMX_ErrorNone;
+#endif
} else {
ret = SEC_OMX_GetExtensionIndex(hComponent, cParameterName, pIndexType);
}
@@ -628,7 +718,6 @@ EXIT:
return ret;
}
-
OMX_ERRORTYPE SEC_MFC_H264Dec_ComponentRoleEnum(OMX_HANDLETYPE hComponent, OMX_U8 *cRole, OMX_U32 nIndex)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
@@ -642,7 +731,7 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_ComponentRoleEnum(OMX_HANDLETYPE hComponent, OMX_U
goto EXIT;
}
if (nIndex == (MAX_COMPONENT_ROLE_NUM-1)) {
- SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPOMENT_H264_DEC_ROLE);
+ SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_H264_DEC_ROLE);
ret = OMX_ErrorNone;
} else {
ret = OMX_ErrorNoMore;
@@ -654,6 +743,39 @@ EXIT:
return ret;
}
+OMX_ERRORTYPE SEC_MFC_DecodeThread(OMX_HANDLETYPE hComponent)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_H264DEC_HANDLE *pH264Dec = NULL;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+ pH264Dec = (SEC_H264DEC_HANDLE *)pSECComponent->hCodecHandle;
+
+ while (pH264Dec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
+ SEC_OSAL_SemaphoreWait(pH264Dec->NBDecThread.hDecFrameStart);
+
+ if (pH264Dec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
+ pH264Dec->hMFCH264Handle.returnCodec = SsbSipMfcDecExe(pH264Dec->hMFCH264Handle.hMFCHandle, pH264Dec->NBDecThread.oneFrameSize);
+ SEC_OSAL_SemaphorePost(pH264Dec->NBDecThread.hDecFrameEnd);
+ }
+ }
+
+EXIT:
+ SEC_OSAL_ThreadExit(NULL);
+ FunctionOut();
+
+ return ret;
+}
+
/* MFC Init */
OMX_ERRORTYPE SEC_MFC_H264Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
{
@@ -671,7 +793,8 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
pSECComponent->bSaveFlagEOS = OMX_FALSE;
/* MFC(Multi Function Codec) decoder and CMM(Codec Memory Management) driver open */
- hMFCHandle = (OMX_PTR)SsbSipMfcDecOpen();
+ SSBIP_MFC_BUFFER_TYPE buf_type = CACHE;
+ hMFCHandle = (OMX_PTR)SsbSipMfcDecOpen(&buf_type);
if (hMFCHandle == NULL) {
ret = OMX_ErrorInsufficientResources;
goto EXIT;
@@ -679,15 +802,39 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
pH264Dec->hMFCH264Handle.hMFCHandle = hMFCHandle;
/* Allocate decoder's input buffer */
- pStreamBuffer = SsbSipMfcDecGetInBuf(hMFCHandle, &pStreamPhyBuffer, DEFAULT_MFC_INPUT_BUFFER_SIZE);
+ pStreamBuffer = SsbSipMfcDecGetInBuf(hMFCHandle, &pStreamPhyBuffer, DEFAULT_MFC_INPUT_BUFFER_SIZE * MFC_INPUT_BUFFER_NUM_MAX);
if (pStreamBuffer == NULL) {
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
- pH264Dec->hMFCH264Handle.pMFCStreamBuffer = pStreamBuffer;
- pH264Dec->hMFCH264Handle.pMFCStreamPhyBuffer = pStreamPhyBuffer;
- pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pStreamBuffer;
- pSECComponent->processData[INPUT_PORT_INDEX].allocSize = DEFAULT_MFC_INPUT_BUFFER_SIZE;
+
+ pH264Dec->MFCDecInputBuffer[0].VirAddr = pStreamBuffer;
+ pH264Dec->MFCDecInputBuffer[0].PhyAddr = pStreamPhyBuffer;
+ pH264Dec->MFCDecInputBuffer[0].bufferSize = DEFAULT_MFC_INPUT_BUFFER_SIZE;
+ pH264Dec->MFCDecInputBuffer[0].dataSize = 0;
+ pH264Dec->MFCDecInputBuffer[1].VirAddr = (unsigned char *)pStreamBuffer + pH264Dec->MFCDecInputBuffer[0].bufferSize;
+ pH264Dec->MFCDecInputBuffer[1].PhyAddr = (unsigned char *)pStreamPhyBuffer + pH264Dec->MFCDecInputBuffer[0].bufferSize;
+ pH264Dec->MFCDecInputBuffer[1].bufferSize = DEFAULT_MFC_INPUT_BUFFER_SIZE;
+ pH264Dec->MFCDecInputBuffer[1].dataSize = 0;
+ pH264Dec->indexInputBuffer = 0;
+
+ pH264Dec->bFirstFrame = OMX_TRUE;
+
+ pH264Dec->NBDecThread.bExitDecodeThread = OMX_FALSE;
+ pH264Dec->NBDecThread.bDecoderRun = OMX_FALSE;
+ pH264Dec->NBDecThread.oneFrameSize = 0;
+ SEC_OSAL_SemaphoreCreate(&(pH264Dec->NBDecThread.hDecFrameStart));
+ SEC_OSAL_SemaphoreCreate(&(pH264Dec->NBDecThread.hDecFrameEnd));
+ if (OMX_ErrorNone == SEC_OSAL_ThreadCreate(&pH264Dec->NBDecThread.hNBDecodeThread,
+ SEC_MFC_DecodeThread,
+ pOMXComponent)) {
+ pH264Dec->hMFCH264Handle.returnCodec = MFC_RET_OK;
+ }
+
+ pH264Dec->hMFCH264Handle.pMFCStreamBuffer = pH264Dec->MFCDecInputBuffer[0].VirAddr;
+ pH264Dec->hMFCH264Handle.pMFCStreamPhyBuffer = pH264Dec->MFCDecInputBuffer[0].PhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pH264Dec->MFCDecInputBuffer[0].VirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pH264Dec->MFCDecInputBuffer[0].bufferSize;
SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
@@ -716,6 +863,23 @@ OMX_ERRORTYPE SEC_MFC_H264Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = NULL;
pSECComponent->processData[INPUT_PORT_INDEX].allocSize = 0;
+ if (pH264Dec->NBDecThread.hNBDecodeThread != NULL) {
+ pH264Dec->NBDecThread.bExitDecodeThread = OMX_TRUE;
+ SEC_OSAL_SemaphorePost(pH264Dec->NBDecThread.hDecFrameStart);
+ SEC_OSAL_ThreadTerminate(pH264Dec->NBDecThread.hNBDecodeThread);
+ pH264Dec->NBDecThread.hNBDecodeThread = NULL;
+ }
+
+ if(pH264Dec->NBDecThread.hDecFrameEnd != NULL) {
+ SEC_OSAL_SemaphoreTerminate(pH264Dec->NBDecThread.hDecFrameEnd);
+ pH264Dec->NBDecThread.hDecFrameEnd = NULL;
+ }
+
+ if(pH264Dec->NBDecThread.hDecFrameStart != NULL) {
+ SEC_OSAL_SemaphoreTerminate(pH264Dec->NBDecThread.hDecFrameStart);
+ pH264Dec->NBDecThread.hDecFrameStart = NULL;
+ }
+
if (hMFCHandle != NULL) {
SsbSipMfcDecClose(hMFCHandle);
hMFCHandle = pH264Dec->hMFCH264Handle.hMFCHandle = NULL;
@@ -735,9 +899,9 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
OMX_U32 oneFrameSize = pInputData->dataLen;
SSBSIP_MFC_DEC_OUTPUT_INFO outputInfo;
OMX_S32 setConfVal = 0;
- OMX_S32 returnCodec = 0;
- int bufWidth;
- int bufHeight;
+ int bufWidth = 0;
+ int bufHeight = 0;
+ OMX_BOOL outputDataValid = OMX_FALSE;
FunctionIn();
@@ -751,23 +915,24 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
goto EXIT;
}
- setConfVal = 5;
+ setConfVal = 0;
SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_EXTRA_BUFFER_NUM, &setConfVal);
/* Default number in the driver is optimized */
if (pH264Dec->hMFCH264Handle.bThumbnailMode == OMX_TRUE) {
- setConfVal = 0;
+ setConfVal = 1;
SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &setConfVal);
} else {
setConfVal = 8;
SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &setConfVal);
}
- returnCodec = SsbSipMfcDecInit(pH264Dec->hMFCH264Handle.hMFCHandle, eCodecType, oneFrameSize);
- if (returnCodec == MFC_RET_OK) {
+ pH264Dec->hMFCH264Handle.returnCodec = SsbSipMfcDecInit(pH264Dec->hMFCH264Handle.hMFCHandle, eCodecType, oneFrameSize);
+ if (pH264Dec->hMFCH264Handle.returnCodec == MFC_RET_OK) {
SSBSIP_MFC_IMG_RESOLUTION imgResol;
SSBSIP_MFC_CROP_INFORMATION cropInfo;
SEC_OMX_BASEPORT *secInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+ SEC_OMX_BASEPORT *secOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT, &imgResol);
SEC_OSAL_Log(SEC_LOG_TRACE, "set width height information : %d, %d",
@@ -781,16 +946,38 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
cropInfo.crop_top_offset , cropInfo.crop_bottom_offset ,
cropInfo.crop_left_offset , cropInfo.crop_right_offset);
- int actualWidth = imgResol.width - cropInfo.crop_left_offset - cropInfo.crop_right_offset;
- int actualHeight = imgResol.height - cropInfo.crop_top_offset - cropInfo.crop_bottom_offset;
+ secOutputPort->cropRectangle.nTop = cropInfo.crop_top_offset;
+ secOutputPort->cropRectangle.nLeft = cropInfo.crop_left_offset;
+ secOutputPort->cropRectangle.nWidth = imgResol.width - cropInfo.crop_left_offset - cropInfo.crop_right_offset;
+ secOutputPort->cropRectangle.nHeight = imgResol.height - cropInfo.crop_top_offset - cropInfo.crop_bottom_offset;
+
+ pH264Dec->hMFCH264Handle.bConfiguredMFC = OMX_TRUE;
/** Update Frame Size **/
- if((secInputPort->portDefinition.format.video.nFrameWidth != actualWidth) ||
- (secInputPort->portDefinition.format.video.nFrameHeight != actualHeight)) {
+ if ((cropInfo.crop_left_offset != 0) || (cropInfo.crop_right_offset != 0) ||
+ (cropInfo.crop_top_offset != 0) || (cropInfo.crop_bottom_offset != 0)) {
+ /* change width and height information */
+ secInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+ secInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+ secInputPort->portDefinition.format.video.nStride = ((imgResol.width + 15) & (~15));
+ secInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
+
+ SEC_UpdateFrameSize(pOMXComponent);
+
+ /** Send crop info call back */
+ (*(pSECComponent->pCallbacks->EventHandler))
+ (pOMXComponent,
+ pSECComponent->callbackData,
+ OMX_EventPortSettingsChanged, /* The command was completed */
+ OMX_DirOutput, /* This is the port index */
+ OMX_IndexConfigCommonOutputCrop,
+ NULL);
+ } else if((secInputPort->portDefinition.format.video.nFrameWidth != imgResol.width) ||
+ (secInputPort->portDefinition.format.video.nFrameHeight != imgResol.height)) {
SEC_OSAL_Log(SEC_LOG_TRACE, "change width height information : OMX_EventPortSettingsChanged");
/* change width and height information */
- secInputPort->portDefinition.format.video.nFrameWidth = actualWidth;
- secInputPort->portDefinition.format.video.nFrameHeight = actualHeight;
+ secInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+ secInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
secInputPort->portDefinition.format.video.nStride = ((imgResol.width + 15) & (~15));
secInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
@@ -806,7 +993,6 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
NULL);
}
- pH264Dec->hMFCH264Handle.bConfiguredMFC = OMX_TRUE;
#ifdef ADD_SPS_PPS_I_FRAME
ret = OMX_ErrorInputDataDecodeYet;
#else
@@ -824,68 +1010,59 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
#ifndef FULL_FRAME_SEARCH
if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
- (pSECComponent->bUseFlagEOF == OMX_FALSE)) {
+ (pSECComponent->bUseFlagEOF == OMX_FALSE))
pSECComponent->bUseFlagEOF = OMX_TRUE;
- }
#endif
pSECComponent->timeStamp[pH264Dec->hMFCH264Handle.indexTimestamp] = pInputData->timeStamp;
pSECComponent->nFlags[pH264Dec->hMFCH264Handle.indexTimestamp] = pInputData->nFlags;
- SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pH264Dec->hMFCH264Handle.indexTimestamp));
- pH264Dec->hMFCH264Handle.indexTimestamp++;
- if (pH264Dec->hMFCH264Handle.indexTimestamp >= MAX_TIMESTAMP)
- pH264Dec->hMFCH264Handle.indexTimestamp = 0;
-
- if (Check_H264_StartCode(pInputData->dataBuffer, pInputData->dataLen) == OMX_TRUE) {
- returnCodec = SsbSipMfcDecExe(pH264Dec->hMFCH264Handle.hMFCHandle, oneFrameSize);
- } else {
- pOutputData->timeStamp = pInputData->timeStamp;
- pOutputData->nFlags = pInputData->nFlags;
- returnCodec = MFC_RET_OK;
- goto EXIT;
- }
- if (returnCodec == MFC_RET_OK) {
+ if ((pH264Dec->hMFCH264Handle.returnCodec == MFC_RET_OK) &&
+ (pH264Dec->bFirstFrame == OMX_FALSE)) {
SSBSIP_MFC_DEC_OUTBUF_STATUS status;
OMX_S32 indexTimestamp = 0;
+ /* wait for mfc decode done */
+ if (pH264Dec->NBDecThread.bDecoderRun == OMX_TRUE) {
+ SEC_OSAL_SemaphoreWait(pH264Dec->NBDecThread.hDecFrameEnd);
+ pH264Dec->NBDecThread.bDecoderRun = OMX_FALSE;
+ }
+
status = SsbSipMfcDecGetOutBuf(pH264Dec->hMFCH264Handle.hMFCHandle, &outputInfo);
- bufWidth = (outputInfo.img_width + 15) & (~15);
- bufHeight = (outputInfo.img_height + 15) & (~15);
+ bufWidth = (outputInfo.img_width + 15) & (~15);
+ bufHeight = (outputInfo.img_height + 15) & (~15);
if ((SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
- (((indexTimestamp < 0) || (indexTimestamp > MAX_TIMESTAMP)))) {
+ (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))) {
pOutputData->timeStamp = pInputData->timeStamp;
pOutputData->nFlags = pInputData->nFlags;
} else {
pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
}
+ SEC_OSAL_Log(SEC_LOG_TRACE, "timestamp %lld us (%.2f secs)", pOutputData->timeStamp, pOutputData->timeStamp / 1E6);
if ((status == MFC_GETOUTBUF_DISPLAY_DECODING) ||
(status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
- switch(pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
- case OMX_COLOR_FormatYUV420Planar:
- case OMX_COLOR_FormatYUV420SemiPlanar:
- pOutputData->dataLen = (bufWidth * bufHeight * 3) / 2;
- break;
- default:
- pOutputData->dataLen = bufWidth * bufHeight * 2;
- break;
- }
+ outputDataValid = OMX_TRUE;
}
if (pOutputData->nFlags & OMX_BUFFERFLAG_EOS)
- pOutputData->dataLen = 0;
+ outputDataValid = OMX_FALSE;
if ((status == MFC_GETOUTBUF_DISPLAY_ONLY) ||
- (pSECComponent->getAllDelayBuffer == OMX_TRUE)) {
+ (pSECComponent->getAllDelayBuffer == OMX_TRUE))
ret = OMX_ErrorInputDataDecodeYet;
- }
if(status == MFC_GETOUTBUF_DECODING_ONLY) {
- /* ret = OMX_ErrorInputDataDecodeYet; */
- ret = OMX_ErrorNone;
- goto EXIT;
+ if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+ (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
+ pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+ pSECComponent->getAllDelayBuffer = OMX_TRUE;
+ ret = OMX_ErrorInputDataDecodeYet;
+ } else {
+ ret = OMX_ErrorNone;
+ }
+ outputDataValid = OMX_FALSE;
}
#ifdef FULL_FRAME_SEARCH
@@ -896,7 +1073,6 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
ret = OMX_ErrorInputDataDecodeYet;
} else
#endif
-
if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
pSECComponent->getAllDelayBuffer = OMX_TRUE;
@@ -908,62 +1084,162 @@ OMX_ERRORTYPE SEC_MFC_H264_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
} else {
pOutputData->timeStamp = pInputData->timeStamp;
pOutputData->nFlags = pInputData->nFlags;
- switch(pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
- case OMX_COLOR_FormatYUV420Planar:
- case OMX_COLOR_FormatYUV420SemiPlanar:
- pOutputData->dataLen = (bufWidth * bufHeight * 3) / 2;
- break;
- default:
- pOutputData->dataLen = bufWidth * bufHeight * 2;
- break;
- }
if ((pSECComponent->bSaveFlagEOS == OMX_TRUE) ||
(pSECComponent->getAllDelayBuffer == OMX_TRUE) ||
(pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
pSECComponent->getAllDelayBuffer = OMX_FALSE;
- pOutputData->dataLen = 0;
}
+ if ((pH264Dec->bFirstFrame == OMX_TRUE) &&
+ ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
+ pOutputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+ }
+
+ outputDataValid = OMX_FALSE;
- /* ret = OMX_ErrorUndefined; */ /* ????? */
+ /* ret = OMX_ErrorUndefined; */
ret = OMX_ErrorNone;
- goto EXIT;
}
- /** Fill Output Buffer **/
- if (pOutputData->dataLen > 0)
- {
- int frameSize = bufWidth * bufHeight;
- void *pOutBuf = (void *)pOutputData->dataBuffer;
+ if (ret == OMX_ErrorInputDataDecodeYet) {
+ pH264Dec->MFCDecInputBuffer[pH264Dec->indexInputBuffer].dataSize = oneFrameSize;
+ pH264Dec->indexInputBuffer++;
+ pH264Dec->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+ pH264Dec->hMFCH264Handle.pMFCStreamBuffer = pH264Dec->MFCDecInputBuffer[pH264Dec->indexInputBuffer].VirAddr;
+ pH264Dec->hMFCH264Handle.pMFCStreamPhyBuffer = pH264Dec->MFCDecInputBuffer[pH264Dec->indexInputBuffer].PhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pH264Dec->MFCDecInputBuffer[pH264Dec->indexInputBuffer].VirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pH264Dec->MFCDecInputBuffer[pH264Dec->indexInputBuffer].bufferSize;
+ oneFrameSize = pH264Dec->MFCDecInputBuffer[pH264Dec->indexInputBuffer].dataSize;
+ //pInputData->dataLen = oneFrameSize;
+ //pInputData->remainDataLen = oneFrameSize;
+ }
-#ifdef USE_SAMSUNG_COLORFORMAT
- SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+ if ((Check_H264_StartCode(pInputData->dataBuffer, pInputData->dataLen) == OMX_TRUE) &&
+ ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS)) {
+ SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pH264Dec->hMFCH264Handle.indexTimestamp));
+ pH264Dec->hMFCH264Handle.indexTimestamp++;
+ pH264Dec->hMFCH264Handle.indexTimestamp %= MAX_TIMESTAMP;
+
+ SsbSipMfcDecSetInBuf(pH264Dec->hMFCH264Handle.hMFCHandle,
+ pH264Dec->hMFCH264Handle.pMFCStreamPhyBuffer,
+ pH264Dec->hMFCH264Handle.pMFCStreamBuffer,
+ pSECComponent->processData[INPUT_PORT_INDEX].allocSize);
+
+ pH264Dec->MFCDecInputBuffer[pH264Dec->indexInputBuffer].dataSize = oneFrameSize;
+ pH264Dec->NBDecThread.oneFrameSize = oneFrameSize;
+
+ /* mfc decode start */
+ SEC_OSAL_SemaphorePost(pH264Dec->NBDecThread.hDecFrameStart);
+ pH264Dec->NBDecThread.bDecoderRun = OMX_TRUE;
+ pH264Dec->hMFCH264Handle.returnCodec = MFC_RET_OK;
+
+ pH264Dec->indexInputBuffer++;
+ pH264Dec->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+ pH264Dec->hMFCH264Handle.pMFCStreamBuffer = pH264Dec->MFCDecInputBuffer[pH264Dec->indexInputBuffer].VirAddr;
+ pH264Dec->hMFCH264Handle.pMFCStreamPhyBuffer = pH264Dec->MFCDecInputBuffer[pH264Dec->indexInputBuffer].PhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pH264Dec->MFCDecInputBuffer[pH264Dec->indexInputBuffer].VirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pH264Dec->MFCDecInputBuffer[pH264Dec->indexInputBuffer].bufferSize;
+ if (((pH264Dec->hMFCH264Handle.bThumbnailMode == OMX_TRUE) || (pSECComponent->bSaveFlagEOS == OMX_TRUE)) &&
+ (pH264Dec->bFirstFrame == OMX_TRUE) &&
+ (outputDataValid == OMX_FALSE)) {
+ ret = OMX_ErrorInputDataDecodeYet;
+ }
+ pH264Dec->bFirstFrame = OMX_FALSE;
+ }
- if ((pH264Dec->hMFCH264Handle.bThumbnailMode == OMX_FALSE) &&
- (pSECOutputPort->portDefinition.format.video.eColorFormat == SEC_OMX_COLOR_FormatNV12PhysicalAddress))
+ /** Fill Output Buffer **/
+ if (outputDataValid == OMX_TRUE) {
+ SEC_OMX_BASEPORT *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+ SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+ void *pOutputBuf[3];
-#else
- if (pH264Dec->hMFCH264Handle.bThumbnailMode == OMX_FALSE)
+ int frameSize = bufWidth * bufHeight;
+ int imageSize = outputInfo.img_width * outputInfo.img_height;
+
+ int actualWidth = outputInfo.img_width;
+ int actualHeight = outputInfo.img_height;
+ int actualImageSize = imageSize;
+
+ pOutputBuf[0] = (void *)pOutputData->dataBuffer;
+ pOutputBuf[1] = (void *)pOutputData->dataBuffer + actualImageSize;
+ pOutputBuf[2] = (void *)pOutputData->dataBuffer + ((actualImageSize * 5) / 4);
+
+#ifdef USE_ANDROID_EXTENSION
+ if (pSECOutputPort->bUseAndroidNativeBuffer == OMX_TRUE) {
+ OMX_U32 retANB = 0;
+ void *pVirAddrs[2];
+ actualWidth = (outputInfo.img_width + 15) & (~15);
+ actualImageSize = actualWidth * actualHeight;
+
+ retANB = getVADDRfromANB (pOutputData->dataBuffer,
+ (OMX_U32)pSECInputPort->portDefinition.format.video.nFrameWidth,
+ (OMX_U32)pSECInputPort->portDefinition.format.video.nFrameHeight,
+ pVirAddrs);
+ if (retANB != 0) {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "Error getVADDRfromANB, Error code:%d", retANB);
+ ret = OMX_ErrorOverflow;
+ goto EXIT;
+ }
+ pOutputBuf[0] = pVirAddrs[0];
+ pOutputBuf[1] = pVirAddrs[1];
+ }
#endif
+ if ((pH264Dec->hMFCH264Handle.bThumbnailMode == OMX_FALSE) &&
+ (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress))
{
/* if use Post copy address structure */
- SEC_OSAL_Memcpy(pOutBuf, &frameSize, sizeof(frameSize));
- SEC_OSAL_Memcpy(pOutBuf + sizeof(frameSize), &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
- SEC_OSAL_Memcpy(pOutBuf + sizeof(frameSize) + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
- SEC_OSAL_Memcpy(pOutBuf + sizeof(frameSize) + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
- SEC_OSAL_Memcpy(pOutBuf + sizeof(frameSize) + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
+ SEC_OSAL_Memcpy(pOutputBuf[0], &frameSize, sizeof(frameSize));
+ SEC_OSAL_Memcpy(pOutputBuf[0] + sizeof(frameSize), &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
+ SEC_OSAL_Memcpy(pOutputBuf[0] + sizeof(frameSize) + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
+ SEC_OSAL_Memcpy(pOutputBuf[0] + sizeof(frameSize) + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
+ SEC_OSAL_Memcpy(pOutputBuf[0] + sizeof(frameSize) + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
+ pOutputData->dataLen = (bufWidth * bufHeight * 3) / 2;
} else {
- SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 out for ThumbnailMode");
- Y_tile_to_linear_4x2(
- (unsigned char *)pOutBuf,
+ switch (pSECOutputPort->portDefinition.format.video.eColorFormat) {
+ case OMX_COLOR_FormatYUV420Planar:
+ {
+ SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420P out");
+ csc_tiled_to_linear(
+ (unsigned char *)pOutputBuf[0],
(unsigned char *)outputInfo.YVirAddr,
- bufWidth, bufHeight);
- CbCr_tile_to_linear_4x2(
- ((unsigned char *)pOutBuf) + frameSize,
+ actualWidth,
+ actualHeight);
+ csc_tiled_to_linear_deinterleave(
+ (unsigned char *)pOutputBuf[1],
+ (unsigned char *)pOutputBuf[2],
(unsigned char *)outputInfo.CVirAddr,
- bufWidth, bufHeight);
+ actualWidth,
+ actualHeight >> 1);
+ pOutputData->dataLen = actualImageSize * 3 / 2;
+ }
+ break;
+ case OMX_COLOR_FormatYUV420SemiPlanar:
+ case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+ default:
+ {
+ SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420SP out");
+ csc_tiled_to_linear(
+ (unsigned char *)pOutputBuf[0],
+ (unsigned char *)outputInfo.YVirAddr,
+ actualWidth,
+ actualHeight);
+ csc_tiled_to_linear(
+ (unsigned char *)pOutputBuf[1],
+ (unsigned char *)outputInfo.CVirAddr,
+ actualWidth,
+ actualHeight >> 1);
+ pOutputData->dataLen = actualImageSize * 3 / 2;
+ }
+ break;
+ }
}
+#ifdef USE_ANDROID_EXTENSION
+ if (pSECOutputPort->bUseAndroidNativeBuffer == OMX_TRUE)
+ putVADDRtoANB(pOutputData->dataBuffer);
+#endif
+ } else {
+ pOutputData->dataLen = 0;
}
EXIT:
@@ -1037,7 +1313,7 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, Line:%d", __LINE__);
goto EXIT;
}
- if (SEC_OSAL_Strcmp(SEC_OMX_COMPOMENT_H264_DEC, componentName) != 0) {
+ if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_H264_DEC, componentName) != 0) {
ret = OMX_ErrorBadParameter;
SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, componentName:%s, Line:%d", componentName, __LINE__);
goto EXIT;
@@ -1071,7 +1347,7 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
SEC_OSAL_Memset(pH264Dec, 0, sizeof(SEC_H264DEC_HANDLE));
pSECComponent->hCodecHandle = (OMX_HANDLETYPE)pH264Dec;
- SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPOMENT_H264_DEC);
+ SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_H264_DEC);
/* Set componentVersion */
pSECComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
pSECComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
@@ -1120,7 +1396,7 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
pSECPort->portDefinition.format.video.pNativeRender = 0;
pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
- pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
+ pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
pSECPort->portDefinition.bEnabled = OMX_TRUE;
for(i = 0; i < ALL_PORT_NUM; i++) {
@@ -1132,6 +1408,7 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
pOMXComponent->GetParameter = &SEC_MFC_H264Dec_GetParameter;
pOMXComponent->SetParameter = &SEC_MFC_H264Dec_SetParameter;
+ pOMXComponent->GetConfig = &SEC_MFC_H264Dec_GetConfig;
pOMXComponent->SetConfig = &SEC_MFC_H264Dec_SetConfig;
pOMXComponent->GetExtensionIndex = &SEC_MFC_H264Dec_GetExtensionIndex;
pOMXComponent->ComponentRoleEnum = &SEC_MFC_H264Dec_ComponentRoleEnum;
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.h b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.h
index b1374fb..d3f8ac8 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/SEC_OMX_H264dec.h
@@ -40,6 +40,7 @@ typedef struct _SEC_MFC_H264DEC_HANDLE
OMX_U32 indexTimestamp;
OMX_BOOL bConfiguredMFC;
OMX_BOOL bThumbnailMode;
+ OMX_S32 returnCodec;
} SEC_MFC_H264DEC_HANDLE;
typedef struct _SEC_H264DEC_HANDLE
@@ -50,6 +51,12 @@ typedef struct _SEC_H264DEC_HANDLE
/* SEC MFC Codec specific */
SEC_MFC_H264DEC_HANDLE hMFCH264Handle;
+
+ /* For Non-Block mode */
+ SEC_MFC_NBDEC_THREAD NBDecThread;
+ OMX_BOOL bFirstFrame;
+ MFC_DEC_INPUT_BUFFER MFCDecInputBuffer[MFC_INPUT_BUFFER_NUM_MAX];
+ OMX_U32 indexInputBuffer;
} SEC_H264DEC_HANDLE;
#ifdef __cplusplus
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/library_register.c b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/library_register.c
index f7bcf25..ef3d672 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/library_register.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/library_register.c
@@ -43,8 +43,8 @@ OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType
goto EXIT;
/* component 1 - video decoder H.264 */
- SEC_OSAL_Strcpy(secComponents[0]->componentName, SEC_OMX_COMPOMENT_H264_DEC);
- SEC_OSAL_Strcpy(secComponents[0]->roles[0], SEC_OMX_COMPOMENT_H264_DEC_ROLE);
+ SEC_OSAL_Strcpy(secComponents[0]->componentName, SEC_OMX_COMPONENT_H264_DEC);
+ SEC_OSAL_Strcpy(secComponents[0]->roles[0], SEC_OMX_COMPONENT_H264_DEC_ROLE);
secComponents[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/library_register.h b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/library_register.h
index cdbfaa4..7a6f7a1 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/library_register.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/library_register.h
@@ -37,8 +37,8 @@
#define MAX_COMPONENT_ROLE_NUM 1
/* H.264 */
-#define SEC_OMX_COMPOMENT_H264_DEC "OMX.SEC.AVC.Decoder"
-#define SEC_OMX_COMPOMENT_H264_DEC_ROLE "video_decoder.avc"
+#define SEC_OMX_COMPONENT_H264_DEC "OMX.SEC.AVC.Decoder"
+#define SEC_OMX_COMPONENT_H264_DEC_ROLE "video_decoder.avc"
#ifdef __cplusplus
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/Android.mk b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/Android.mk
index a3a3c0c..42c528f 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/Android.mk
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/Android.mk
@@ -7,15 +7,16 @@ LOCAL_SRC_FILES := \
SEC_OMX_Mpeg4dec.c \
library_register.c
-LOCAL_PRELINK_MODULE := false
+
LOCAL_MODULE := libOMX.SEC.M4V.Decoder.aries
LOCAL_CFLAGS :=
LOCAL_ARM_MODE := arm
-LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec.aries libsecosal.aries libsecbasecomponent.aries libsecmfcdecapi.aries
-LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils
+LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec.aries libsecosal.aries libsecbasecomponent.aries \
+ libsecmfcdecapi.aries libseccsc.aries
+LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui libhardware
LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
$(SEC_OMX_INC)/sec \
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c
index 5074214..052a4c9 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.c
@@ -35,6 +35,7 @@
#include "library_register.h"
#include "SEC_OMX_Mpeg4dec.h"
#include "SsbSipMfcApi.h"
+#include "color_space_convertor.h"
#undef SEC_LOG_TAG
#define SEC_LOG_TAG "SEC_MPEG4_DEC"
@@ -181,6 +182,8 @@ static int Check_H263_Frame(OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag
int len, readStream;
unsigned startCode;
OMX_BOOL bFrameStart = 0;
+ unsigned pTypeMask = 0x03;
+ unsigned pType = 0;
len = 0;
bFrameStart = OMX_FALSE;
@@ -191,9 +194,13 @@ static int Check_H263_Frame(OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag
startCode = 0xFFFFFFFF;
if (bFrameStart == OMX_FALSE) {
/* find PSC(Picture Start Code) : 0000 0000 0000 0000 1000 00 */
- while (((startCode << 8 >> 10) != 0x20)) {
+ while (((startCode << 8 >> 10) != 0x20) || (pType != 0x02)) {
readStream = *(pInputStream + len);
startCode = (startCode << 8) | readStream;
+
+ readStream = *(pInputStream + len + 1);
+ pType = readStream & pTypeMask;
+
len++;
if (len > buffSize)
goto EXIT;
@@ -202,9 +209,14 @@ static int Check_H263_Frame(OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag
/* find next PSC */
startCode = 0xFFFFFFFF;
- while (((startCode << 8 >> 10) != 0x20)) {
+ pType = 0;
+ while (((startCode << 8 >> 10) != 0x20) || (pType != 0x02)) {
readStream = *(pInputStream + len);
startCode = (startCode << 8) | readStream;
+
+ readStream = *(pInputStream + len + 1);
+ pType = readStream & pTypeMask;
+
len++;
if (len > buffSize)
goto EXIT;
@@ -340,9 +352,9 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_GetParameter(
codecType = ((SEC_MPEG4_HANDLE *)(pSECComponent->hCodecHandle))->hMFCMpeg4Handle.codecType;
if (codecType == CODEC_TYPE_MPEG4)
- SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPOMENT_MPEG4_DEC_ROLE);
+ SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_MPEG4_DEC_ROLE);
else
- SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPOMENT_H263_DEC_ROLE);
+ SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_H263_DEC_ROLE);
}
break;
case OMX_IndexParamVideoProfileLevelQuerySupported:
@@ -538,10 +550,10 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_SetParameter(
goto EXIT;
}
- if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPOMENT_MPEG4_DEC_ROLE)) {
+ if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_MPEG4_DEC_ROLE)) {
pSECComponent->pSECPort[INPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4;
//((SEC_MPEG4_HANDLE *)(pSECComponent->hCodecHandle))->hMFCMpeg4Handle.codecType = CODEC_TYPE_MPEG4;
- } else if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPOMENT_H263_DEC_ROLE)) {
+ } else if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_H263_DEC_ROLE)) {
pSECComponent->pSECPort[INPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingH263;
//((SEC_MPEG4_HANDLE *)(pSECComponent->hCodecHandle))->hMFCMpeg4Handle.codecType = CODEC_TYPE_H263;
} else {
@@ -594,10 +606,18 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_SetParameter(
pSECOutputPort->portDefinition.format.video.nFrameHeight = pSECPort->portDefinition.format.video.nFrameHeight;
pSECOutputPort->portDefinition.format.video.nStride = width;
pSECOutputPort->portDefinition.format.video.nSliceHeight = height;
- if (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_COLOR_FormatYUV420Planar) {
+
+ switch (pSECOutputPort->portDefinition.format.video.eColorFormat) {
+ case OMX_COLOR_FormatYUV420Planar:
+ case OMX_COLOR_FormatYUV420SemiPlanar:
+ case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+ case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
pSECOutputPort->portDefinition.nBufferSize = (width * height * 3) / 2;
- } else if (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_COLOR_FormatYUV422Planar) {
- pSECOutputPort->portDefinition.nBufferSize = width * height * 2;
+ break;
+ default:
+ SEC_OSAL_Log(SEC_LOG_ERROR, "Color format is not support!! use default YUV size!!");
+ ret = OMX_ErrorUnsupportedSetting;
+ break;
}
}
}
@@ -611,9 +631,8 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_SetParameter(
OMX_S32 codecType;
ret = SEC_OMX_Check_SizeVersion(pSrcProfileLevel, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
- if (ret != OMX_ErrorNone) {
+ if (ret != OMX_ErrorNone)
goto EXIT;
- }
if (pSrcProfileLevel->nPortIndex >= ALL_PORT_NUM) {
ret = OMX_ErrorBadPortIndex;
@@ -677,6 +696,54 @@ EXIT:
return ret;
}
+OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_GetConfig(
+ OMX_HANDLETYPE hComponent,
+ OMX_INDEXTYPE nIndex,
+ OMX_PTR pComponentConfigStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+ if (ret != OMX_ErrorNone) {
+ goto EXIT;
+ }
+
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+ if (pComponentConfigStructure == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ if (pSECComponent->currentState == OMX_StateInvalid) {
+ ret = OMX_ErrorInvalidState;
+ goto EXIT;
+ }
+
+ switch (nIndex) {
+ default:
+ ret = SEC_OMX_GetConfig(hComponent, nIndex, pComponentConfigStructure);
+ break;
+ }
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_SetConfig(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
@@ -763,12 +830,21 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_GetExtensionIndex(
goto EXIT;
}
- if (SEC_OSAL_Strcmp(cParameterName, "OMX.SEC.index.ThumbnailMode") == 0) {
+ if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_ENABLE_THUMBNAIL) == 0) {
SEC_MPEG4_HANDLE *pMpeg4Dec = (SEC_MPEG4_HANDLE *)pSECComponent->hCodecHandle;
-
*pIndexType = OMX_IndexVendorThumbnailMode;
-
ret = OMX_ErrorNone;
+#ifdef USE_ANDROID_EXTENSION
+ } else if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_ENABLE_ANB) == 0) {
+ *pIndexType = OMX_IndexParamEnableAndroidBuffers;
+ ret = OMX_ErrorNone;
+ } else if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_GET_ANB) == 0) {
+ *pIndexType = OMX_IndexParamGetAndroidNativeBuffer;
+ ret = OMX_ErrorNone;
+ } else if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_USE_ANB) == 0) {
+ *pIndexType = OMX_IndexParamUseAndroidNativeBuffer;
+ ret = OMX_ErrorNone;
+#endif
} else {
ret = SEC_OMX_GetExtensionIndex(hComponent, cParameterName, pIndexType);
}
@@ -817,9 +893,9 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_ComponentRoleEnum(
codecType = ((SEC_MPEG4_HANDLE *)(pSECComponent->hCodecHandle))->hMFCMpeg4Handle.codecType;
if (codecType == CODEC_TYPE_MPEG4)
- SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPOMENT_MPEG4_DEC_ROLE);
+ SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_MPEG4_DEC_ROLE);
else
- SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPOMENT_H263_DEC_ROLE);
+ SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_H263_DEC_ROLE);
EXIT:
FunctionOut();
@@ -827,6 +903,39 @@ EXIT:
return ret;
}
+OMX_ERRORTYPE SEC_MFC_DecodeThread(OMX_HANDLETYPE hComponent)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_MPEG4_HANDLE *pMpeg4Dec = NULL;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+ pMpeg4Dec = (SEC_MPEG4_HANDLE *)pSECComponent->hCodecHandle;
+
+ while (pMpeg4Dec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
+ SEC_OSAL_SemaphoreWait(pMpeg4Dec->NBDecThread.hDecFrameStart);
+
+ if (pMpeg4Dec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
+ pMpeg4Dec->hMFCMpeg4Handle.returnCodec = SsbSipMfcDecExe(pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle, pMpeg4Dec->NBDecThread.oneFrameSize);
+ SEC_OSAL_SemaphorePost(pMpeg4Dec->NBDecThread.hDecFrameEnd);
+ }
+ }
+
+EXIT:
+ SEC_OSAL_ThreadExit(NULL);
+ FunctionOut();
+
+ return ret;
+}
+
/* MFC Init */
OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
{
@@ -845,7 +954,8 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
pSECComponent->bSaveFlagEOS = OMX_FALSE;
/* MFC(Multi Format Codec) decoder and CMM(Codec Memory Management) driver open */
- hMFCHandle = SsbSipMfcDecOpen();
+ SSBIP_MFC_BUFFER_TYPE buf_type = CACHE;
+ hMFCHandle = (OMX_PTR)SsbSipMfcDecOpen(&buf_type);
if (hMFCHandle == NULL) {
ret = OMX_ErrorInsufficientResources;
goto EXIT;
@@ -858,10 +968,34 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
- pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamBuffer = pStreamBuffer;
- pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamPhyBuffer = pStreamPhyBuffer;
- pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pStreamBuffer;
- pSECComponent->processData[INPUT_PORT_INDEX].allocSize = DEFAULT_MFC_INPUT_BUFFER_SIZE;
+
+ pMpeg4Dec->MFCDecInputBuffer[0].VirAddr = pStreamBuffer;
+ pMpeg4Dec->MFCDecInputBuffer[0].PhyAddr = pStreamPhyBuffer;
+ pMpeg4Dec->MFCDecInputBuffer[0].bufferSize = DEFAULT_MFC_INPUT_BUFFER_SIZE;
+ pMpeg4Dec->MFCDecInputBuffer[0].dataSize = 0;
+ pMpeg4Dec->MFCDecInputBuffer[1].VirAddr = (unsigned char *)pStreamBuffer + pMpeg4Dec->MFCDecInputBuffer[0].bufferSize;
+ pMpeg4Dec->MFCDecInputBuffer[1].PhyAddr = (unsigned char *)pStreamPhyBuffer + pMpeg4Dec->MFCDecInputBuffer[0].bufferSize;
+ pMpeg4Dec->MFCDecInputBuffer[1].bufferSize = DEFAULT_MFC_INPUT_BUFFER_SIZE;
+ pMpeg4Dec->MFCDecInputBuffer[1].dataSize = 0;
+ pMpeg4Dec->indexInputBuffer = 0;
+
+ pMpeg4Dec->bFirstFrame = OMX_TRUE;
+
+ pMpeg4Dec->NBDecThread.bExitDecodeThread = OMX_FALSE;
+ pMpeg4Dec->NBDecThread.bDecoderRun = OMX_FALSE;
+ pMpeg4Dec->NBDecThread.oneFrameSize = 0;
+ SEC_OSAL_SemaphoreCreate(&(pMpeg4Dec->NBDecThread.hDecFrameStart));
+ SEC_OSAL_SemaphoreCreate(&(pMpeg4Dec->NBDecThread.hDecFrameEnd));
+ if (OMX_ErrorNone == SEC_OSAL_ThreadCreate(&pMpeg4Dec->NBDecThread.hNBDecodeThread,
+ SEC_MFC_DecodeThread,
+ pOMXComponent)) {
+ pMpeg4Dec->hMFCMpeg4Handle.returnCodec = MFC_RET_OK;
+ }
+
+ pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamBuffer = pMpeg4Dec->MFCDecInputBuffer[0].VirAddr;
+ pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamPhyBuffer = pMpeg4Dec->MFCDecInputBuffer[0].PhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pMpeg4Dec->MFCDecInputBuffer[0].VirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pMpeg4Dec->MFCDecInputBuffer[0].bufferSize;
SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
@@ -892,6 +1026,23 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = NULL;
pSECComponent->processData[INPUT_PORT_INDEX].allocSize = 0;
+ if (pMpeg4Dec->NBDecThread.hNBDecodeThread != NULL) {
+ pMpeg4Dec->NBDecThread.bExitDecodeThread = OMX_TRUE;
+ SEC_OSAL_SemaphorePost(pMpeg4Dec->NBDecThread.hDecFrameStart);
+ SEC_OSAL_ThreadTerminate(pMpeg4Dec->NBDecThread.hNBDecodeThread);
+ pMpeg4Dec->NBDecThread.hNBDecodeThread = NULL;
+ }
+
+ if(pMpeg4Dec->NBDecThread.hDecFrameEnd != NULL) {
+ SEC_OSAL_SemaphoreTerminate(pMpeg4Dec->NBDecThread.hDecFrameEnd);
+ pMpeg4Dec->NBDecThread.hDecFrameEnd = NULL;
+ }
+
+ if(pMpeg4Dec->NBDecThread.hDecFrameStart != NULL) {
+ SEC_OSAL_SemaphoreTerminate(pMpeg4Dec->NBDecThread.hDecFrameStart);
+ pMpeg4Dec->NBDecThread.hDecFrameStart = NULL;
+ }
+
if (hMFCHandle != NULL) {
SsbSipMfcDecClose(hMFCHandle);
pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle = NULL;
@@ -911,10 +1062,10 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
OMX_HANDLETYPE hMFCHandle = pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle;
OMX_U32 oneFrameSize = pInputData->dataLen;
SSBSIP_MFC_DEC_OUTPUT_INFO outputInfo;
- OMX_S32 configValue;
- OMX_S32 returnCodec;
- int bufWidth;
- int bufHeight;
+ OMX_S32 configValue = 0;
+ int bufWidth = 0;
+ int bufHeight = 0;
+ OMX_BOOL outputDataValid = OMX_FALSE;
FunctionIn();
@@ -937,7 +1088,7 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
}
/* Set the number of extra buffer to prevent tearing */
- configValue = 5;
+ configValue = 0;
SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_EXTRA_BUFFER_NUM, &configValue);
/* Set mpeg4 deblocking filter enable */
@@ -945,12 +1096,12 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_POST_ENABLE, &configValue);
if (pMpeg4Dec->hMFCMpeg4Handle.bThumbnailMode == OMX_TRUE) {
- configValue = 0; // the number that you want to delay
+ configValue = 1; // the number that you want to delay
SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &configValue);
}
- returnCodec = SsbSipMfcDecInit(hMFCHandle, MFCCodecType, oneFrameSize);
- if (returnCodec == MFC_RET_OK) {
+ pMpeg4Dec->hMFCMpeg4Handle.returnCodec = SsbSipMfcDecInit(hMFCHandle, MFCCodecType, oneFrameSize);
+ if (pMpeg4Dec->hMFCMpeg4Handle.returnCodec == MFC_RET_OK) {
SSBSIP_MFC_IMG_RESOLUTION imgResol;
SEC_OMX_BASEPORT *pInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
@@ -962,7 +1113,7 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
/** Update Frame Size **/
if ((pInputPort->portDefinition.format.video.nFrameWidth != imgResol.width) ||
- (pInputPort->portDefinition.format.video.nFrameHeight != imgResol.height)) {
+ (pInputPort->portDefinition.format.video.nFrameHeight != imgResol.height)) {
/* change width and height information */
pInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
pInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
@@ -1004,68 +1155,59 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
#ifndef FULL_FRAME_SEARCH
if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
- (pSECComponent->bUseFlagEOF == OMX_FALSE)) {
+ (pSECComponent->bUseFlagEOF == OMX_FALSE))
pSECComponent->bUseFlagEOF = OMX_TRUE;
- }
#endif
pSECComponent->timeStamp[pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp] = pInputData->timeStamp;
pSECComponent->nFlags[pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp] = pInputData->nFlags;
- SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp));
- pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp++;
- if (pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp >= MAX_TIMESTAMP)
- pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp = 0;
-
- if (Check_Stream_PrefixCode(pInputData->dataBuffer, pInputData->dataLen, pMpeg4Dec->hMFCMpeg4Handle.codecType) == OMX_TRUE) {
- returnCodec = SsbSipMfcDecExe(hMFCHandle, oneFrameSize);
- } else {
- pOutputData->timeStamp = pInputData->timeStamp;
- pOutputData->nFlags = pInputData->nFlags;
- returnCodec = MFC_RET_OK;
- goto EXIT;
- }
- if (returnCodec == MFC_RET_OK) {
+ if ((pMpeg4Dec->hMFCMpeg4Handle.returnCodec == MFC_RET_OK) &&
+ (pMpeg4Dec->bFirstFrame == OMX_FALSE)) {
SSBSIP_MFC_DEC_OUTBUF_STATUS status;
OMX_S32 indexTimestamp = 0;
+ /* wait for mfc decode done */
+ if (pMpeg4Dec->NBDecThread.bDecoderRun == OMX_TRUE) {
+ SEC_OSAL_SemaphoreWait(pMpeg4Dec->NBDecThread.hDecFrameEnd);
+ pMpeg4Dec->NBDecThread.bDecoderRun = OMX_FALSE;
+ }
+
status = SsbSipMfcDecGetOutBuf(hMFCHandle, &outputInfo);
bufWidth = (outputInfo.img_width + 15) & (~15);
bufHeight = (outputInfo.img_height + 15) & (~15);
if ((SsbSipMfcDecGetConfig(hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
- (((indexTimestamp < 0) || (indexTimestamp > MAX_TIMESTAMP)))) {
+ (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))) {
pOutputData->timeStamp = pInputData->timeStamp;
pOutputData->nFlags = pInputData->nFlags;
} else {
pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
}
+ SEC_OSAL_Log(SEC_LOG_TRACE, "timestamp %lld us (%.2f secs)", pOutputData->timeStamp, pOutputData->timeStamp / 1E6);
if ((status == MFC_GETOUTBUF_DISPLAY_DECODING) ||
(status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
- switch(pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
- case OMX_COLOR_FormatYUV420Planar:
- case OMX_COLOR_FormatYUV420SemiPlanar:
- pOutputData->dataLen = (bufWidth * bufHeight * 3) /2;
- break;
- default:
- pOutputData->dataLen = bufWidth * bufHeight * 2;
- break;
- }
+ outputDataValid = OMX_TRUE;
}
if (pOutputData->nFlags & OMX_BUFFERFLAG_EOS)
- pOutputData->dataLen = 0;
+ outputDataValid = OMX_FALSE;
if ((status == MFC_GETOUTBUF_DISPLAY_ONLY) ||
- (pSECComponent->getAllDelayBuffer == OMX_TRUE)) {
+ (pSECComponent->getAllDelayBuffer == OMX_TRUE))
ret = OMX_ErrorInputDataDecodeYet;
- }
if (status == MFC_GETOUTBUF_DECODING_ONLY) {
- /* ret = OMX_ErrorInputDataDecodeYet; */
- ret = OMX_ErrorNone;
- goto EXIT;
+ if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+ (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
+ pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+ pSECComponent->getAllDelayBuffer = OMX_TRUE;
+ ret = OMX_ErrorInputDataDecodeYet;
+ } else {
+ ret = OMX_ErrorNone;
+ }
+ outputDataValid = OMX_FALSE;
}
#ifdef FULL_FRAME_SEARCH
@@ -1076,7 +1218,6 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
ret = OMX_ErrorInputDataDecodeYet;
} else
#endif
-
if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
pSECComponent->getAllDelayBuffer = OMX_TRUE;
@@ -1088,62 +1229,162 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
} else {
pOutputData->timeStamp = pInputData->timeStamp;
pOutputData->nFlags = pInputData->nFlags;
- switch(pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
- case OMX_COLOR_FormatYUV420Planar:
- case OMX_COLOR_FormatYUV420SemiPlanar:
- pOutputData->dataLen = (bufWidth * bufHeight * 3) / 2;
- break;
- default:
- pOutputData->dataLen = bufWidth * bufHeight * 2;
- break;
- }
if ((pSECComponent->bSaveFlagEOS == OMX_TRUE) ||
(pSECComponent->getAllDelayBuffer == OMX_TRUE) ||
(pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
pSECComponent->getAllDelayBuffer = OMX_FALSE;
- pOutputData->dataLen = 0;
+ }
+ if ((pMpeg4Dec->bFirstFrame == OMX_TRUE) &&
+ ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
+ pOutputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
}
- /* ret = OMX_ErrorUndefined; */ /* ????? */
+ outputDataValid = OMX_FALSE;
+
+ /* ret = OMX_ErrorUndefined; */
ret = OMX_ErrorNone;
- goto EXIT;
+ }
+
+ if (ret == OMX_ErrorInputDataDecodeYet) {
+ pMpeg4Dec->MFCDecInputBuffer[pMpeg4Dec->indexInputBuffer].dataSize = oneFrameSize;
+ pMpeg4Dec->indexInputBuffer++;
+ pMpeg4Dec->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+ pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamBuffer = pMpeg4Dec->MFCDecInputBuffer[pMpeg4Dec->indexInputBuffer].VirAddr;
+ pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamPhyBuffer = pMpeg4Dec->MFCDecInputBuffer[pMpeg4Dec->indexInputBuffer].PhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pMpeg4Dec->MFCDecInputBuffer[pMpeg4Dec->indexInputBuffer].VirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pMpeg4Dec->MFCDecInputBuffer[pMpeg4Dec->indexInputBuffer].bufferSize;
+ oneFrameSize = pMpeg4Dec->MFCDecInputBuffer[pMpeg4Dec->indexInputBuffer].dataSize;
+ //pInputData->dataLen = oneFrameSize;
+ //pInputData->remainDataLen = oneFrameSize;
+ }
+
+ if ((Check_Stream_PrefixCode(pInputData->dataBuffer, pInputData->dataLen, pMpeg4Dec->hMFCMpeg4Handle.codecType) == OMX_TRUE) &&
+ ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS)) {
+ SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp));
+ pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp++;
+ pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp %= MAX_TIMESTAMP;
+
+ SsbSipMfcDecSetInBuf(pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle,
+ pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamPhyBuffer,
+ pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamBuffer,
+ pSECComponent->processData[INPUT_PORT_INDEX].allocSize);
+
+ pMpeg4Dec->MFCDecInputBuffer[pMpeg4Dec->indexInputBuffer].dataSize = oneFrameSize;
+ pMpeg4Dec->NBDecThread.oneFrameSize = oneFrameSize;
+
+ /* mfc decode start */
+ SEC_OSAL_SemaphorePost(pMpeg4Dec->NBDecThread.hDecFrameStart);
+ pMpeg4Dec->NBDecThread.bDecoderRun = OMX_TRUE;
+ pMpeg4Dec->hMFCMpeg4Handle.returnCodec = MFC_RET_OK;
+
+ pMpeg4Dec->indexInputBuffer++;
+ pMpeg4Dec->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+ pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamBuffer = pMpeg4Dec->MFCDecInputBuffer[pMpeg4Dec->indexInputBuffer].VirAddr;
+ pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamPhyBuffer = pMpeg4Dec->MFCDecInputBuffer[pMpeg4Dec->indexInputBuffer].PhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pMpeg4Dec->MFCDecInputBuffer[pMpeg4Dec->indexInputBuffer].VirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pMpeg4Dec->MFCDecInputBuffer[pMpeg4Dec->indexInputBuffer].bufferSize;
+ if (((pMpeg4Dec->hMFCMpeg4Handle.bThumbnailMode == OMX_TRUE) || (pSECComponent->bSaveFlagEOS == OMX_TRUE)) &&
+ (pMpeg4Dec->bFirstFrame == OMX_TRUE) &&
+ (outputDataValid == OMX_FALSE)) {
+ ret = OMX_ErrorInputDataDecodeYet;
}
+ pMpeg4Dec->bFirstFrame = OMX_FALSE;
+ }
/** Fill Output Buffer **/
- if (pOutputData->dataLen > 0)
- {
- int frameSize = bufWidth * bufHeight;
- void *pOutputBuf = (void *)pOutputData->dataBuffer;
-
-#ifdef USE_SAMSUNG_COLORFORMAT
+ if (outputDataValid == OMX_TRUE) {
+ SEC_OMX_BASEPORT *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+ void *pOutputBuf[3];
- if ((pMpeg4Dec->hMFCMpeg4Handle.bThumbnailMode == OMX_FALSE) &&
- (pSECOutputPort->portDefinition.format.video.eColorFormat == SEC_OMX_COLOR_FormatNV12PhysicalAddress))
-
-#else
- if (pMpeg4Dec->hMFCMpeg4Handle.bThumbnailMode == OMX_FALSE)
+ int frameSize = bufWidth * bufHeight;
+ int imageSize = outputInfo.img_width * outputInfo.img_height;
+
+ int actualWidth = outputInfo.img_width;
+ int actualHeight = outputInfo.img_height;
+ int actualImageSize = imageSize;
+
+ pOutputBuf[0] = (void *)pOutputData->dataBuffer;
+ pOutputBuf[1] = (void *)pOutputData->dataBuffer + actualImageSize;
+ pOutputBuf[2] = (void *)pOutputData->dataBuffer + ((actualImageSize * 5) / 4);
+
+#ifdef USE_ANDROID_EXTENSION
+ if (pSECOutputPort->bUseAndroidNativeBuffer == OMX_TRUE) {
+ OMX_U32 retANB = 0;
+ void *pVirAddrs[2];
+ actualWidth = (outputInfo.img_width + 15) & (~15);
+ actualImageSize = actualWidth * actualHeight;
+
+ retANB = getVADDRfromANB(pOutputData->dataBuffer,
+ (OMX_U32)pSECInputPort->portDefinition.format.video.nFrameWidth,
+ (OMX_U32)pSECInputPort->portDefinition.format.video.nFrameHeight,
+ pVirAddrs);
+ if (retANB != 0) {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "Error getVADDRfromANB, Error code:%d", retANB);
+ ret = OMX_ErrorOverflow;
+ goto EXIT;
+ }
+ pOutputBuf[0] = pVirAddrs[0];
+ pOutputBuf[1] = pVirAddrs[1];
+ }
#endif
+ if ((pMpeg4Dec->hMFCMpeg4Handle.bThumbnailMode == OMX_FALSE) &&
+ (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress))
{
/* if use Post copy address structure */
- SEC_OSAL_Memcpy(pOutputBuf, &frameSize, sizeof(frameSize));
- SEC_OSAL_Memcpy(pOutputBuf + sizeof(frameSize), &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
- SEC_OSAL_Memcpy(pOutputBuf + sizeof(frameSize) + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
- SEC_OSAL_Memcpy(pOutputBuf + sizeof(frameSize) + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
- SEC_OSAL_Memcpy(pOutputBuf + sizeof(frameSize) + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
+ SEC_OSAL_Memcpy(pOutputBuf[0], &frameSize, sizeof(frameSize));
+ SEC_OSAL_Memcpy(pOutputBuf[0] + sizeof(frameSize), &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
+ SEC_OSAL_Memcpy(pOutputBuf[0] + sizeof(frameSize) + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
+ SEC_OSAL_Memcpy(pOutputBuf[0] + sizeof(frameSize) + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
+ SEC_OSAL_Memcpy(pOutputBuf[0] + sizeof(frameSize) + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
+ pOutputData->dataLen = (bufWidth * bufHeight * 3) / 2;
} else {
- SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 out for ThumbnailMode");
- Y_tile_to_linear_4x2(
- (unsigned char *)pOutputBuf,
+ switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
+ case OMX_COLOR_FormatYUV420Planar:
+ {
+ SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420P out");
+ csc_tiled_to_linear(
+ (unsigned char *)pOutputBuf[0],
+ (unsigned char *)outputInfo.YVirAddr,
+ actualWidth,
+ actualHeight);
+ csc_tiled_to_linear_deinterleave(
+ (unsigned char *)pOutputBuf[1],
+ (unsigned char *)pOutputBuf[2],
+ (unsigned char *)outputInfo.CVirAddr,
+ actualWidth,
+ actualHeight >> 1);
+ pOutputData->dataLen = actualImageSize * 3 / 2;
+ }
+ break;
+ case OMX_COLOR_FormatYUV420SemiPlanar:
+ case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+ default:
+ {
+ SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420SP out");
+ csc_tiled_to_linear(
+ (unsigned char *)pOutputBuf[0],
(unsigned char *)outputInfo.YVirAddr,
- bufWidth, bufHeight);
- CbCr_tile_to_linear_4x2(
- ((unsigned char *)pOutputBuf) + frameSize,
+ actualWidth,
+ actualHeight);
+ csc_tiled_to_linear(
+ (unsigned char *)pOutputBuf[1],
(unsigned char *)outputInfo.CVirAddr,
- bufWidth, bufHeight);
+ actualWidth,
+ actualHeight >> 1);
+ pOutputData->dataLen = actualImageSize * 3 / 2;
+ }
+ break;
+ }
}
+#ifdef USE_ANDROID_EXTENSION
+ if (pSECOutputPort->bUseAndroidNativeBuffer == OMX_TRUE)
+ putVADDRtoANB(pOutputData->dataBuffer);
+#endif
+ } else {
+ pOutputData->dataLen = 0;
}
EXIT:
@@ -1218,9 +1459,9 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
SEC_OSAL_Log(SEC_LOG_ERROR, "%s: parameters are null, ret: %X", __FUNCTION__, ret);
goto EXIT;
}
- if (SEC_OSAL_Strcmp(SEC_OMX_COMPOMENT_MPEG4_DEC, componentName) == 0) {
+ if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_MPEG4_DEC, componentName) == 0) {
codecType = CODEC_TYPE_MPEG4;
- } else if (SEC_OSAL_Strcmp(SEC_OMX_COMPOMENT_H263_DEC, componentName) == 0) {
+ } else if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_H263_DEC, componentName) == 0) {
codecType = CODEC_TYPE_H263;
} else {
ret = OMX_ErrorBadParameter;
@@ -1258,9 +1499,9 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
pMpeg4Dec->hMFCMpeg4Handle.codecType = codecType;
if (codecType == CODEC_TYPE_MPEG4)
- SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPOMENT_MPEG4_DEC);
+ SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_MPEG4_DEC);
else
- SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPOMENT_H263_DEC);
+ SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_H263_DEC);
/* Set componentVersion */
pSECComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
@@ -1316,7 +1557,7 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
pSECPort->portDefinition.format.video.pNativeRender = 0;
pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
- pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
+ pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
pSECPort->portDefinition.bEnabled = OMX_TRUE;
if (codecType == CODEC_TYPE_MPEG4) {
@@ -1337,6 +1578,7 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
pOMXComponent->GetParameter = &SEC_MFC_Mpeg4Dec_GetParameter;
pOMXComponent->SetParameter = &SEC_MFC_Mpeg4Dec_SetParameter;
+ pOMXComponent->GetConfig = &SEC_MFC_Mpeg4Dec_GetConfig;
pOMXComponent->SetConfig = &SEC_MFC_Mpeg4Dec_SetConfig;
pOMXComponent->GetExtensionIndex = &SEC_MFC_Mpeg4Dec_GetExtensionIndex;
pOMXComponent->ComponentRoleEnum = &SEC_MFC_Mpeg4Dec_ComponentRoleEnum;
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.h b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.h
index 25170b8..9af04e3 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/SEC_OMX_Mpeg4dec.h
@@ -64,6 +64,7 @@ typedef struct _SEC_MFC_MPEG4_HANDLE
OMX_BOOL bConfiguredMFC;
OMX_BOOL bThumbnailMode;
CODEC_TYPE codecType;
+ OMX_S32 returnCodec;
} SEC_MFC_MPEG4_HANDLE;
typedef struct _SEC_MPEG4_HANDLE
@@ -75,6 +76,12 @@ typedef struct _SEC_MPEG4_HANDLE
/* SEC MFC Codec specific */
SEC_MFC_MPEG4_HANDLE hMFCMpeg4Handle;
+
+ /* For Non-Block mode */
+ SEC_MFC_NBDEC_THREAD NBDecThread;
+ OMX_BOOL bFirstFrame;
+ MFC_DEC_INPUT_BUFFER MFCDecInputBuffer[MFC_INPUT_BUFFER_NUM_MAX];
+ OMX_U32 indexInputBuffer;
} SEC_MPEG4_HANDLE;
#ifdef __cplusplus
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/library_register.c b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/library_register.c
index 89b856d..02d8d39 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/library_register.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/library_register.c
@@ -47,13 +47,13 @@ OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType
goto EXIT;
/* component 1 - video decoder MPEG4 */
- SEC_OSAL_Strcpy(ppSECComponent[0]->componentName, SEC_OMX_COMPOMENT_MPEG4_DEC);
- SEC_OSAL_Strcpy(ppSECComponent[0]->roles[0], SEC_OMX_COMPOMENT_MPEG4_DEC_ROLE);
+ SEC_OSAL_Strcpy(ppSECComponent[0]->componentName, SEC_OMX_COMPONENT_MPEG4_DEC);
+ SEC_OSAL_Strcpy(ppSECComponent[0]->roles[0], SEC_OMX_COMPONENT_MPEG4_DEC_ROLE);
ppSECComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
/* component 2 - video decoder H.263 */
- SEC_OSAL_Strcpy(ppSECComponent[1]->componentName, SEC_OMX_COMPOMENT_H263_DEC);
- SEC_OSAL_Strcpy(ppSECComponent[1]->roles[0], SEC_OMX_COMPOMENT_H263_DEC_ROLE);
+ SEC_OSAL_Strcpy(ppSECComponent[1]->componentName, SEC_OMX_COMPONENT_H263_DEC);
+ SEC_OSAL_Strcpy(ppSECComponent[1]->roles[0], SEC_OMX_COMPONENT_H263_DEC_ROLE);
ppSECComponent[1]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/library_register.h b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/library_register.h
index e9bcfe8..c3e5b9c 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/library_register.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/library_register.h
@@ -37,12 +37,12 @@
#define MAX_COMPONENT_ROLE_NUM 1
/* MPEG4 */
-#define SEC_OMX_COMPOMENT_MPEG4_DEC "OMX.SEC.MPEG4.Decoder"
-#define SEC_OMX_COMPOMENT_MPEG4_DEC_ROLE "video_decoder.mpeg4"
+#define SEC_OMX_COMPONENT_MPEG4_DEC "OMX.SEC.MPEG4.Decoder"
+#define SEC_OMX_COMPONENT_MPEG4_DEC_ROLE "video_decoder.mpeg4"
/* H.263 */
-#define SEC_OMX_COMPOMENT_H263_DEC "OMX.SEC.H263.Decoder"
-#define SEC_OMX_COMPOMENT_H263_DEC_ROLE "video_decoder.h263"
+#define SEC_OMX_COMPONENT_H263_DEC "OMX.SEC.H263.Decoder"
+#define SEC_OMX_COMPONENT_H263_DEC_ROLE "video_decoder.h263"
#ifdef __cplusplus
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c
index eff5dec..19e33de 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c
@@ -33,15 +33,13 @@
#include "SEC_OMX_Venc.h"
#include "SEC_OMX_Basecomponent.h"
#include "SEC_OSAL_Thread.h"
+#include "color_space_convertor.h"
#undef SEC_LOG_TAG
#define SEC_LOG_TAG "SEC_VIDEO_ENC"
#define SEC_LOG_OFF
#include "SEC_OSAL_Log.h"
-#define ONE_FRAME_OUTPUT /* only one frame output for Android */
-#define S5PC110_ENCODE_IN_DATA_BUFFER /* for Android s5pc110 0copy*/
-
inline void SEC_UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent)
{
@@ -160,6 +158,8 @@ OMX_ERRORTYPE SEC_OMX_UseBuffer(
goto EXIT;
}
}
+
+ SEC_OSAL_Free(temp_bufferHeader);
ret = OMX_ErrorInsufficientResources;
EXIT:
@@ -256,6 +256,9 @@ OMX_ERRORTYPE SEC_OMX_AllocateBuffer(
goto EXIT;
}
}
+
+ SEC_OSAL_Free(temp_bufferHeader);
+ SEC_OSAL_Free(temp_buffer);
ret = OMX_ErrorInsufficientResources;
EXIT:
@@ -496,10 +499,9 @@ OMX_ERRORTYPE SEC_InputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent)
dataBuffer->dataValid = OMX_TRUE;
dataBuffer->nFlags = dataBuffer->bufferHeader->nFlags;
dataBuffer->timeStamp = dataBuffer->bufferHeader->nTimeStamp;
-#ifdef S5PC110_ENCODE_IN_DATA_BUFFER
pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = dataBuffer->bufferHeader->pBuffer;
pSECComponent->processData[INPUT_PORT_INDEX].allocSize = dataBuffer->bufferHeader->nAllocLen;
-#endif
+
SEC_OSAL_Free(message);
}
SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
@@ -686,6 +688,14 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
if (pSECComponent->bUseFlagEOF == OMX_TRUE) {
flagEOF = OMX_TRUE;
checkedSize = checkInputStreamLen;
+ if (checkedSize == 0) {
+ SEC_OMX_BASEPORT *pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+ int width = pSECPort->portDefinition.format.video.nFrameWidth;
+ int height = pSECPort->portDefinition.format.video.nFrameHeight;
+ inputUseBuffer->remainDataLen = inputUseBuffer->dataLen = (width * height * 3) / 2;
+ checkedSize = checkInputStreamLen = inputUseBuffer->remainDataLen;
+ inputUseBuffer->nFlags |= OMX_BUFFERFLAG_EOS;
+ }
if (inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) {
flagEOS = OMX_TRUE;
}
@@ -738,12 +748,8 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
if (((inputData->allocSize) - (inputData->dataLen)) >= copySize) {
SEC_OMX_BASEPORT *pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
-#ifndef S5PC110_ENCODE_IN_DATA_BUFFER
- if (copySize > 0) {
- SEC_OSAL_Memcpy(inputData->dataBuffer + inputData->dataLen, checkInputStream, copySize);
- }
-#else
- if (pSECPort->portDefinition.format.video.eColorFormat == OMX_COLOR_FormatYUV420Planar) {
+ if ((pSECPort->portDefinition.format.video.eColorFormat != OMX_SEC_COLOR_FormatNV12TPhysicalAddress) &&
+ (pSECPort->bStoreMetaDataInBuffer == OMX_FALSE)) {
if (flagEOF == OMX_TRUE) {
OMX_U32 width, height;
@@ -756,11 +762,25 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
SEC_OSAL_Log(SEC_LOG_TRACE, "width:%d, height:%d, Ysize:%d", width, height, ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)));
SEC_OSAL_Log(SEC_LOG_TRACE, "width:%d, height:%d, Csize:%d", width, height, ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height / 2)));
- SEC_OSAL_Memcpy(inputData->specificBufferHeader.YVirAddr, checkInputStream, ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)));
- SEC_OSAL_Memcpy(inputData->specificBufferHeader.CVirAddr, checkInputStream + ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)), ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height / 2)));
+ switch (pSECPort->portDefinition.format.video.eColorFormat) {
+ case OMX_COLOR_FormatYUV420Planar:
+ /* Real YUV420P Data */
+ csc_linear_to_tiled(inputData->specificBufferHeader.YVirAddr,
+ checkInputStream, width, height);
+ csc_linear_to_tiled_interleave(inputData->specificBufferHeader.CVirAddr,
+ checkInputStream + (width * height),
+ checkInputStream + (((width * height) * 5) / 4),
+ width, height >> 1);
+ break;
+ case OMX_COLOR_FormatYUV420SemiPlanar:
+ default:
+ SEC_OSAL_Memcpy(inputData->specificBufferHeader.YVirAddr, checkInputStream, (width * height));
+ SEC_OSAL_Memcpy(inputData->specificBufferHeader.CVirAddr, checkInputStream + (width * height), (width * height / 2));
+ break;
+ }
}
}
-#endif
+
inputUseBuffer->dataLen -= copySize;
inputUseBuffer->remainDataLen -= copySize;
inputUseBuffer->usedDataLen += copySize;
@@ -795,10 +815,8 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
}
if (inputUseBuffer->remainDataLen == 0) {
-#ifdef S5PC110_ENCODE_IN_DATA_BUFFER
if(flagEOF == OMX_FALSE)
-#endif
- SEC_InputBufferReturn(pOMXComponent);
+ SEC_InputBufferReturn(pOMXComponent);
} else {
inputUseBuffer->dataValid = OMX_TRUE;
}
@@ -864,18 +882,9 @@ OMX_BOOL SEC_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent)
/* reset outputData */
SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
-#ifdef ONE_FRAME_OUTPUT /* only one frame output for Android */
if ((outputUseBuffer->remainDataLen > 0) ||
(outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS))
SEC_OutputBufferReturn(pOMXComponent);
-#else
- if ((outputUseBuffer->remainDataLen > 0) ||
- ((outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) {
- SEC_OutputBufferReturn(pOMXComponent);
- } else {
- outputUseBuffer->dataValid = OMX_TRUE;
- }
-#endif
} else {
SEC_OSAL_Log(SEC_LOG_ERROR, "output buffer is smaller than encoded data size Out Length");
@@ -969,12 +978,12 @@ OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent)
SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex);
SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
ret = pSECComponent->sec_mfc_bufferProcess(pOMXComponent, inputData, outputData);
-#ifdef S5PC110_ENCODE_IN_DATA_BUFFER
+
if (inputUseBuffer->remainDataLen == 0)
SEC_InputBufferReturn(pOMXComponent);
else
inputUseBuffer->dataValid = OMX_TRUE;
-#endif
+
SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
@@ -1084,21 +1093,28 @@ OMX_ERRORTYPE SEC_OMX_VideoEncodeGetParameter(
portDefinition = &pSECPort->portDefinition;
switch (index) {
+ case supportFormat_0:
+ portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+ portFormat->eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
+ portFormat->xFramerate = portDefinition->format.video.xFramerate;
+ break;
case supportFormat_1:
portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
portFormat->eColorFormat = OMX_COLOR_FormatYUV420Planar;
- portFormat->xFramerate = portDefinition->format.video.xFramerate;
+ portFormat->xFramerate = portDefinition->format.video.xFramerate;
break;
case supportFormat_2:
portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
- portFormat->eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
+ portFormat->eColorFormat = OMX_SEC_COLOR_FormatNV12TPhysicalAddress;
portFormat->xFramerate = portDefinition->format.video.xFramerate;
break;
+#ifdef USE_ANDROID_EXTENSION
case supportFormat_3:
portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
- portFormat->eColorFormat = SEC_OMX_COLOR_FormatNV12PhysicalAddress;
- portFormat->xFramerate = portDefinition->format.video.xFramerate;
+ portFormat->eColorFormat = OMX_COLOR_FormatAndroidOpaque;
+ portFormat->xFramerate = portDefinition->format.video.xFramerate;
break;
+#endif
}
} else if (portIndex == OUTPUT_PORT_INDEX) {
supportFormatNum = OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX - 1;
@@ -1112,7 +1128,7 @@ OMX_ERRORTYPE SEC_OMX_VideoEncodeGetParameter(
portFormat->eCompressionFormat = portDefinition->format.video.eCompressionFormat;
portFormat->eColorFormat = portDefinition->format.video.eColorFormat;
- portFormat->xFramerate = portDefinition->format.video.xFramerate;
+ portFormat->xFramerate = portDefinition->format.video.xFramerate;
}
ret = OMX_ErrorNone;
}
@@ -1137,6 +1153,31 @@ OMX_ERRORTYPE SEC_OMX_VideoEncodeGetParameter(
ret = OMX_ErrorNone;
}
break;
+ case OMX_IndexParamPortDefinition:
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = (OMX_PARAM_PORTDEFINITIONTYPE *)ComponentParameterStructure;
+ OMX_U32 portIndex = portDefinition->nPortIndex;
+ SEC_OMX_BASEPORT *pSECPort;
+
+ if (portIndex >= pSECComponent->portParam.nPorts) {
+ ret = OMX_ErrorBadPortIndex;
+ goto EXIT;
+ }
+ ret = SEC_OMX_Check_SizeVersion(portDefinition, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+ if (ret != OMX_ErrorNone) {
+ goto EXIT;
+ }
+
+ pSECPort = &pSECComponent->pSECPort[portIndex];
+ SEC_OSAL_Memcpy(portDefinition, &pSECPort->portDefinition, portDefinition->nSize);
+
+#ifdef USE_ANDROID_EXTENSION
+ if (portIndex == 0 && pSECPort->bStoreMetaDataInBuffer == OMX_TRUE) {
+ portDefinition->nBufferSize = MAX_INPUT_METADATA_BUFFER_SIZE;
+ }
+#endif
+ }
+ break;
default:
{
ret = SEC_OMX_GetParameter(hComponent, nParamIndex, ComponentParameterStructure);
@@ -1257,6 +1298,21 @@ OMX_ERRORTYPE SEC_OMX_VideoEncodeSetParameter(
}
}
break;
+#ifdef USE_ANDROID_EXTENSION
+ case OMX_IndexParamStoreMetaDataBuffer:
+ {
+ if (OMX_ErrorNone != checkVersionANB(ComponentParameterStructure))
+ goto EXIT;
+
+ if (INPUT_PORT_INDEX != checkPortIndexANB(ComponentParameterStructure)) {
+ ret = OMX_ErrorBadPortIndex;
+ goto EXIT;
+ }
+
+ ret = enableStoreMetaDataInBuffers(hComponent, ComponentParameterStructure);
+ }
+ break;
+#endif
default:
{
ret = SEC_OMX_SetParameter(hComponent, nIndex, ComponentParameterStructure);
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h
index 93d2800..ac24e10 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h
@@ -44,9 +44,20 @@
/* (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT * 3) / 2 */
#define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE DEFAULT_VIDEO_INPUT_BUFFER_SIZE
+#define MFC_INPUT_BUFFER_NUM_MAX 2
+
+#ifdef USE_ANDROID_EXTENSION
+#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 4
+#else
#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 3
+#endif
#define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX 1
+#ifdef USE_ANDROID_EXTENSION
+// The largest metadata buffer size advertised
+// when metadata buffer mode is used for video encoding
+#define MAX_INPUT_METADATA_BUFFER_SIZE (64)
+#endif
typedef struct
{
@@ -54,6 +65,26 @@ typedef struct
void *pAddrC;
} MFC_ENC_ADDR_INFO;
+typedef struct _SEC_MFC_NBENC_THREAD
+{
+ OMX_HANDLETYPE hNBEncodeThread;
+ OMX_HANDLETYPE hEncFrameStart;
+ OMX_HANDLETYPE hEncFrameEnd;
+ OMX_BOOL bExitEncodeThread;
+ OMX_BOOL bEncoderRun;
+} SEC_MFC_NBENC_THREAD;
+
+typedef struct _MFC_ENC_INPUT_BUFFER
+{
+ void *YPhyAddr; // physical address of Y
+ void *CPhyAddr; // physical address of CbCr
+ void *YVirAddr; // virtual address of Y
+ void *CVirAddr; // virtual address of CbCr
+ int YBufferSize; // input buffer alloc size of Y
+ int CBufferSize; // input buffer alloc size of CbCr
+ int YDataSize; // input size of Y data
+ int CDataSize; // input size of CbCr data
+} MFC_ENC_INPUT_BUFFER;
#ifdef __cplusplus
extern "C" {
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/Android.mk b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/Android.mk
index 0a469d4..4157e31 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/Android.mk
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/Android.mk
@@ -7,22 +7,23 @@ LOCAL_SRC_FILES := \
SEC_OMX_H264enc.c \
library_register.c
-LOCAL_PRELINK_MODULE := false
+
LOCAL_MODULE := libOMX.SEC.AVC.Encoder.aries
LOCAL_CFLAGS :=
LOCAL_ARM_MODE := arm
-LOCAL_STATIC_LIBRARIES := libSEC_OMX_Venc.aries libsecosal.aries libsecbasecomponent.aries libsecmfcencapi.aries
-LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils
+LOCAL_STATIC_LIBRARIES := libSEC_OMX_Venc.aries libsecosal.aries libsecbasecomponent.aries \
+ libsecmfcencapi.aries libseccsc.aries
+LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui libhardware
LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
$(SEC_OMX_INC)/sec \
$(SEC_OMX_TOP)/sec_osal \
$(SEC_OMX_TOP)/sec_omx_core \
$(SEC_OMX_COMPONENT)/common \
- $(SEC_OMX_COMPONENT)/video/enc \
+ $(SEC_OMX_COMPONENT)/video/enc
LOCAL_C_INCLUDES += $(SEC_OMX_TOP)/sec_codecs/video/mfc_c110/include
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c
index 239649e..24bbc7a 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c
@@ -35,6 +35,7 @@
#include "library_register.h"
#include "SEC_OMX_H264enc.h"
#include "SsbSipMfcApi.h"
+#include "color_space_convertor.h"
#undef SEC_LOG_TAG
#define SEC_LOG_TAG "SEC_H264_ENC"
@@ -230,18 +231,50 @@ void Set_H264ENC_Param(SSBSIP_MFC_ENC_H264_PARAM *pH264Arg, SEC_OMX_BASECOMPONEN
pH264Arg->StaticDisable = 1;
pH264Arg->ActivityDisable = 1;
+ switch ((SEC_OMX_COLOR_FORMATTYPE)pSECInputPort->portDefinition.format.video.eColorFormat) {
+ case OMX_COLOR_FormatYUV420SemiPlanar:
+ pH264Arg->FrameMap = NV12_LINEAR;
+ break;
+ case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+ default:
+ pH264Arg->FrameMap = NV12_TILE;
+ break;
+ }
+
+#ifdef USE_ANDROID_EXTENSION
+ if (pSECInputPort->bStoreMetaDataInBuffer != OMX_FALSE) {
+ SEC_OMX_DATA *pInputData = &pSECComponent->processData[INPUT_PORT_INDEX];
+ if(isMetadataBufferTypeGrallocSource(pInputData->dataBuffer) == OMX_TRUE)
+ pH264Arg->FrameMap = NV12_LINEAR;
+ else
+ pH264Arg->FrameMap = NV12_TILE;
+ }
+#endif
+
+/*
SEC_OSAL_Log(SEC_LOG_TRACE, "pSECPort->eControlRate: 0x%x", pSECOutputPort->eControlRate);
switch (pSECOutputPort->eControlRate) {
- case OMX_Video_ControlRateDisable:
- /* TBD */
- break;
case OMX_Video_ControlRateVariable:
- /* TBD */
+ SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode VBR");
+ pH264Arg->EnableFRMRateControl = 0; // 0: Disable, 1: Frame level RC
+ pH264Arg->EnableMBRateControl = 0; // 0: Disable, 1:MB level RC
+ pH264Arg->CBRPeriodRf = 100;
break;
- default:
+ case OMX_Video_ControlRateConstant:
+ SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode CBR");
+ pH264Arg->EnableFRMRateControl = 1; // 0: Disable, 1: Frame level RC
+ pH264Arg->EnableMBRateControl = 1; // 0: Disable, 1:MB level RC
+ pH264Arg->CBRPeriodRf = 10;
+ break;
+ case OMX_Video_ControlRateDisable:
+ default: //Android default
+ SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode VBR");
+ pH264Arg->EnableFRMRateControl = 0;
+ pH264Arg->EnableMBRateControl = 0;
+ pH264Arg->CBRPeriodRf = 100;
break;
}
-
+*/
H264PrintParams(*pH264Arg);
}
@@ -307,7 +340,7 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_GetParameter(
goto EXIT;
}
- SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPOMENT_H264_ENC_ROLE);
+ SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_H264_ENC_ROLE);
}
break;
case OMX_IndexParamVideoProfileLevelQuerySupported:
@@ -466,7 +499,7 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_SetParameter(
goto EXIT;
}
- if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPOMENT_H264_ENC_ROLE)) {
+ if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_H264_ENC_ROLE)) {
pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
} else {
ret = OMX_ErrorBadParameter;
@@ -533,6 +566,54 @@ EXIT:
return ret;
}
+OMX_ERRORTYPE SEC_MFC_H264Enc_GetConfig(
+ OMX_HANDLETYPE hComponent,
+ OMX_INDEXTYPE nIndex,
+ OMX_PTR pComponentConfigStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+ if (ret != OMX_ErrorNone) {
+ goto EXIT;
+ }
+
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+ if (pComponentConfigStructure == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ if (pSECComponent->currentState == OMX_StateInvalid) {
+ ret = OMX_ErrorInvalidState;
+ goto EXIT;
+ }
+
+ switch (nIndex) {
+ default:
+ ret = SEC_OMX_GetConfig(hComponent, nIndex, pComponentConfigStructure);
+ break;
+ }
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
OMX_ERRORTYPE SEC_MFC_H264Enc_SetConfig(
OMX_HANDLETYPE hComponent,
OMX_INDEXTYPE nIndex,
@@ -576,6 +657,59 @@ EXIT:
return ret;
}
+OMX_ERRORTYPE SEC_MFC_H264Enc_GetExtensionIndex(
+ OMX_IN OMX_HANDLETYPE hComponent,
+ OMX_IN OMX_STRING cParameterName,
+ OMX_OUT OMX_INDEXTYPE *pIndexType)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+ if (ret != OMX_ErrorNone) {
+ goto EXIT;
+ }
+
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+ if ((cParameterName == NULL) || (pIndexType == NULL)) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ if (pSECComponent->currentState == OMX_StateInvalid) {
+ ret = OMX_ErrorInvalidState;
+ goto EXIT;
+ }
+
+#ifdef USE_ANDROID_EXTENSION
+ if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_STORE_METADATA_BUFFER) == 0) {
+ *pIndexType = OMX_IndexParamStoreMetaDataBuffer;
+ ret = OMX_ErrorNone;
+ } else {
+ ret = SEC_OMX_GetExtensionIndex(hComponent, cParameterName, pIndexType);
+ }
+#else
+ ret = SEC_OMX_GetExtensionIndex(hComponent, cParameterName, pIndexType);
+#endif
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
OMX_ERRORTYPE SEC_MFC_H264Enc_ComponentRoleEnum(OMX_HANDLETYPE hComponent, OMX_U8 *cRole, OMX_U32 nIndex)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
@@ -589,7 +723,7 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_ComponentRoleEnum(OMX_HANDLETYPE hComponent, OMX_U
goto EXIT;
}
if (nIndex == (MAX_COMPONENT_ROLE_NUM-1)) {
- SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPOMENT_H264_ENC_ROLE);
+ SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_H264_ENC_ROLE);
ret = OMX_ErrorNone;
} else {
ret = OMX_ErrorNoMore;
@@ -601,11 +735,46 @@ EXIT:
return ret;
}
+OMX_ERRORTYPE SEC_MFC_EncodeThread(OMX_HANDLETYPE hComponent)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_H264ENC_HANDLE *pH264Enc = NULL;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+ pH264Enc = (SEC_H264ENC_HANDLE *)pSECComponent->hCodecHandle;
+
+ while (pH264Enc->NBEncThread.bExitEncodeThread == OMX_FALSE) {
+ SEC_OSAL_SemaphoreWait(pH264Enc->NBEncThread.hEncFrameStart);
+
+ if (pH264Enc->NBEncThread.bExitEncodeThread == OMX_FALSE) {
+ pH264Enc->hMFCH264Handle.returnCodec = SsbSipMfcEncExe(pH264Enc->hMFCH264Handle.hMFCHandle);
+ SEC_OSAL_SemaphorePost(pH264Enc->NBEncThread.hEncFrameEnd);
+ }
+ }
+
+EXIT:
+ FunctionOut();
+ SEC_OSAL_ThreadExit(NULL);
+
+ return ret;
+}
+
/* MFC Init */
OMX_ERRORTYPE SEC_MFC_H264Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+ SEC_OMX_BASEPORT *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+ SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
SEC_H264ENC_HANDLE *pH264Enc = NULL;
OMX_PTR hMFCHandle = NULL;
OMX_S32 returnCodec = 0;
@@ -618,37 +787,70 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
pSECComponent->bSaveFlagEOS = OMX_FALSE;
/* MFC(Multi Function Codec) encoder and CMM(Codec Memory Management) driver open */
- hMFCHandle = (OMX_PTR)SsbSipMfcEncOpen();
+ SSBIP_MFC_BUFFER_TYPE buf_type = CACHE;
+ hMFCHandle = (OMX_PTR)SsbSipMfcEncOpen(&buf_type);
if (hMFCHandle == NULL) {
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
pH264Enc->hMFCH264Handle.hMFCHandle = hMFCHandle;
- Set_H264ENC_Param(&(pH264Enc->hMFCH264Handle.mfcVideoAvc), pSECComponent);
+ SsbSipMfcEncSetSize(hMFCHandle, H264_ENC,
+ pSECOutputPort->portDefinition.format.video.nFrameWidth,
+ pSECOutputPort->portDefinition.format.video.nFrameHeight);
- returnCodec = SsbSipMfcEncInit(hMFCHandle, &(pH264Enc->hMFCH264Handle.mfcVideoAvc));
+ /* Allocate encoder's input buffer */
+ returnCodec = SsbSipMfcEncGetInBuf(hMFCHandle, &(pH264Enc->hMFCH264Handle.inputInfo));
if (returnCodec != MFC_RET_OK) {
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
+ pH264Enc->MFCEncInputBuffer[0].YPhyAddr = pH264Enc->hMFCH264Handle.inputInfo.YPhyAddr;
+ pH264Enc->MFCEncInputBuffer[0].CPhyAddr = pH264Enc->hMFCH264Handle.inputInfo.CPhyAddr;
+ pH264Enc->MFCEncInputBuffer[0].YVirAddr = pH264Enc->hMFCH264Handle.inputInfo.YVirAddr;
+ pH264Enc->MFCEncInputBuffer[0].CVirAddr = pH264Enc->hMFCH264Handle.inputInfo.CVirAddr;
+ pH264Enc->MFCEncInputBuffer[0].YBufferSize = pH264Enc->hMFCH264Handle.inputInfo.YSize;
+ pH264Enc->MFCEncInputBuffer[0].CBufferSize = pH264Enc->hMFCH264Handle.inputInfo.CSize;
+ pH264Enc->MFCEncInputBuffer[0].YDataSize = 0;
+ pH264Enc->MFCEncInputBuffer[0].CDataSize = 0;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "pH264Enc->hMFCH264Handle.inputInfo.YVirAddr : 0x%x", pH264Enc->hMFCH264Handle.inputInfo.YVirAddr);
+ SEC_OSAL_Log(SEC_LOG_TRACE, "pH264Enc->hMFCH264Handle.inputInfo.CVirAddr : 0x%x", pH264Enc->hMFCH264Handle.inputInfo.CVirAddr);
- /* Allocate encoder's input buffer */
returnCodec = SsbSipMfcEncGetInBuf(hMFCHandle, &(pH264Enc->hMFCH264Handle.inputInfo));
if (returnCodec != MFC_RET_OK) {
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
-
+ pH264Enc->MFCEncInputBuffer[1].YPhyAddr = pH264Enc->hMFCH264Handle.inputInfo.YPhyAddr;
+ pH264Enc->MFCEncInputBuffer[1].CPhyAddr = pH264Enc->hMFCH264Handle.inputInfo.CPhyAddr;
+ pH264Enc->MFCEncInputBuffer[1].YVirAddr = pH264Enc->hMFCH264Handle.inputInfo.YVirAddr;
+ pH264Enc->MFCEncInputBuffer[1].CVirAddr = pH264Enc->hMFCH264Handle.inputInfo.CVirAddr;
+ pH264Enc->MFCEncInputBuffer[1].YBufferSize = pH264Enc->hMFCH264Handle.inputInfo.YSize;
+ pH264Enc->MFCEncInputBuffer[1].CBufferSize = pH264Enc->hMFCH264Handle.inputInfo.CSize;
+ pH264Enc->MFCEncInputBuffer[1].YDataSize = 0;
+ pH264Enc->MFCEncInputBuffer[1].CDataSize = 0;
SEC_OSAL_Log(SEC_LOG_TRACE, "pH264Enc->hMFCH264Handle.inputInfo.YVirAddr : 0x%x", pH264Enc->hMFCH264Handle.inputInfo.YVirAddr);
SEC_OSAL_Log(SEC_LOG_TRACE, "pH264Enc->hMFCH264Handle.inputInfo.CVirAddr : 0x%x", pH264Enc->hMFCH264Handle.inputInfo.CVirAddr);
- pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YPhyAddr = pH264Enc->hMFCH264Handle.inputInfo.YPhyAddr;
- pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CPhyAddr = pH264Enc->hMFCH264Handle.inputInfo.CPhyAddr;
- pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YVirAddr = pH264Enc->hMFCH264Handle.inputInfo.YVirAddr;
- pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CVirAddr = pH264Enc->hMFCH264Handle.inputInfo.CVirAddr;
- pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YSize = pH264Enc->hMFCH264Handle.inputInfo.YSize;
- pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CSize = pH264Enc->hMFCH264Handle.inputInfo.CSize;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YPhyAddr = pH264Enc->MFCEncInputBuffer[0].YPhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CPhyAddr = pH264Enc->MFCEncInputBuffer[0].CPhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YVirAddr = pH264Enc->MFCEncInputBuffer[0].YVirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CVirAddr = pH264Enc->MFCEncInputBuffer[0].CVirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YSize = pH264Enc->MFCEncInputBuffer[0].YBufferSize;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CSize = pH264Enc->MFCEncInputBuffer[0].CBufferSize;
+
+ pH264Enc->indexInputBuffer = 0;
+ pH264Enc->bFirstFrame = OMX_TRUE;
+
+ pH264Enc->NBEncThread.bExitEncodeThread = OMX_FALSE;
+ pH264Enc->NBEncThread.bEncoderRun = OMX_FALSE;
+ SEC_OSAL_SemaphoreCreate(&(pH264Enc->NBEncThread.hEncFrameStart));
+ SEC_OSAL_SemaphoreCreate(&(pH264Enc->NBEncThread.hEncFrameEnd));
+ if (OMX_ErrorNone == SEC_OSAL_ThreadCreate(&pH264Enc->NBEncThread.hNBEncodeThread,
+ SEC_MFC_EncodeThread,
+ pOMXComponent)) {
+ pH264Enc->hMFCH264Handle.returnCodec = MFC_RET_OK;
+ }
SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
@@ -671,8 +873,25 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
FunctionIn();
pH264Enc = (SEC_H264ENC_HANDLE *)pSECComponent->hCodecHandle;
- hMFCHandle = pH264Enc->hMFCH264Handle.hMFCHandle;
+ if (pH264Enc->NBEncThread.hNBEncodeThread != NULL) {
+ pH264Enc->NBEncThread.bExitEncodeThread = OMX_TRUE;
+ SEC_OSAL_SemaphorePost(pH264Enc->NBEncThread.hEncFrameStart);
+ SEC_OSAL_ThreadTerminate(pH264Enc->NBEncThread.hNBEncodeThread);
+ pH264Enc->NBEncThread.hNBEncodeThread = NULL;
+ }
+
+ if(pH264Enc->NBEncThread.hEncFrameEnd != NULL) {
+ SEC_OSAL_SemaphoreTerminate(pH264Enc->NBEncThread.hEncFrameEnd);
+ pH264Enc->NBEncThread.hEncFrameEnd = NULL;
+ }
+
+ if(pH264Enc->NBEncThread.hEncFrameStart != NULL) {
+ SEC_OSAL_SemaphoreTerminate(pH264Enc->NBEncThread.hEncFrameStart);
+ pH264Enc->NBEncThread.hEncFrameStart = NULL;
+ }
+
+ hMFCHandle = pH264Enc->hMFCH264Handle.hMFCHandle;
if (hMFCHandle != NULL) {
SsbSipMfcEncClose(hMFCHandle);
hMFCHandle = pH264Enc->hMFCH264Handle.hMFCHandle = NULL;
@@ -694,13 +913,19 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
SEC_OMX_BASEPORT *pSECPort = NULL;
MFC_ENC_ADDR_INFO addrInfo;
OMX_U32 oneFrameSize = pInputData->dataLen;
- OMX_S32 returnCodec = 0;
FunctionIn();
if (pH264Enc->hMFCH264Handle.bConfiguredMFC == OMX_FALSE) {
- returnCodec = SsbSipMfcEncGetOutBuf(pH264Enc->hMFCH264Handle.hMFCHandle, &outputInfo);
- if (returnCodec != MFC_RET_OK)
+ Set_H264ENC_Param(&(pH264Enc->hMFCH264Handle.mfcVideoAvc), pSECComponent);
+ pH264Enc->hMFCH264Handle.returnCodec = SsbSipMfcEncInit(pH264Enc->hMFCH264Handle.hMFCHandle, &(pH264Enc->hMFCH264Handle.mfcVideoAvc));
+ if (pH264Enc->hMFCH264Handle.returnCodec != MFC_RET_OK) {
+ ret = OMX_ErrorInsufficientResources;
+ goto EXIT;
+ }
+
+ pH264Enc->hMFCH264Handle.returnCodec = SsbSipMfcEncGetOutBuf(pH264Enc->hMFCH264Handle.hMFCHandle, &outputInfo);
+ if (pH264Enc->hMFCH264Handle.returnCodec != MFC_RET_OK)
{
SEC_OSAL_Log(SEC_LOG_TRACE, "%s - SsbSipMfcEncGetOutBuf Failed\n", __func__);
ret = OMX_ErrorUndefined;
@@ -725,13 +950,13 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
pOutputData->dataBuffer = outputInfo.StrmVirAddr;
pOutputData->allocSize = outputInfo.headerSize;
pOutputData->dataLen = outputInfo.headerSize;
- pOutputData->timeStamp = pInputData->timeStamp;
+ pOutputData->timeStamp = 0;
pOutputData->nFlags |= OMX_BUFFERFLAG_CODECCONFIG;
pOutputData->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
pH264Enc->hMFCH264Handle.bConfiguredMFC = OMX_TRUE;
- ret = OMX_ErrorNone;
+ ret = OMX_ErrorInputDataEncodeYet;
goto EXIT;
}
@@ -740,13 +965,6 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
pSECComponent->bUseFlagEOF = OMX_TRUE;
}
- pSECComponent->timeStamp[pH264Enc->hMFCH264Handle.indexTimestamp] = pInputData->timeStamp;
- pSECComponent->nFlags[pH264Enc->hMFCH264Handle.indexTimestamp] = pInputData->nFlags;
- SsbSipMfcEncSetConfig(pH264Enc->hMFCH264Handle.hMFCHandle, MFC_ENC_SETCONF_FRAME_TAG, &(pH264Enc->hMFCH264Handle.indexTimestamp));
- pH264Enc->hMFCH264Handle.indexTimestamp++;
- if (pH264Enc->hMFCH264Handle.indexTimestamp >= MAX_TIMESTAMP)
- pH264Enc->hMFCH264Handle.indexTimestamp = 0;
-
if (oneFrameSize <= 0) {
pOutputData->timeStamp = pInputData->timeStamp;
pOutputData->nFlags = pInputData->nFlags;
@@ -756,37 +974,46 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
}
pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
- if (pSECPort->portDefinition.format.video.eColorFormat == SEC_OMX_COLOR_FormatNV12PhysicalAddress) {
-#define USE_FIMC_FRAME_BUFFER
-#ifdef USE_FIMC_FRAME_BUFFER
+ if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) ||
+ (pSECComponent->getAllDelayBuffer == OMX_TRUE)){
+ /* Dummy input data for get out encoded last frame */
+ pInputInfo->YPhyAddr = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].YPhyAddr;
+ pInputInfo->CPhyAddr = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].CPhyAddr;
+ pInputInfo->YVirAddr = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].YVirAddr;
+ pInputInfo->CVirAddr = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].CVirAddr;
+ } else if (pSECPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress) {
SEC_OSAL_Memcpy(&addrInfo.pAddrY, pInputData->dataBuffer, sizeof(addrInfo.pAddrY));
SEC_OSAL_Memcpy(&addrInfo.pAddrC, pInputData->dataBuffer + sizeof(addrInfo.pAddrY), sizeof(addrInfo.pAddrC));
pInputInfo->YPhyAddr = addrInfo.pAddrY;
pInputInfo->CPhyAddr = addrInfo.pAddrC;
- ret = SsbSipMfcEncSetInBuf(pH264Enc->hMFCH264Handle.hMFCHandle, pInputInfo);
- if (ret != MFC_RET_OK) {
- SEC_OSAL_Log(SEC_LOG_TRACE, "Error : SsbSipMfcEncSetInBuf() \n");
- ret = OMX_ErrorUndefined;
+#ifdef USE_ANDROID_EXTENSION
+ } else if (pSECPort->bStoreMetaDataInBuffer != OMX_FALSE) {
+ ret = preprocessMetaDataInBuffers(pOMXComponent, pInputData->dataBuffer, pInputInfo);
+ if (ret != OMX_ErrorNone)
goto EXIT;
- }
-#else
- OMX_U32 width, height;
-
- width = pSECPort->portDefinition.format.video.nFrameWidth;
- height = pSECPort->portDefinition.format.video.nFrameHeight;
-
- SEC_OSAL_Memcpy(pInputInfo->YVirAddr, pInputData->dataBuffer, ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)));
- SEC_OSAL_Memcpy(pInputInfo->CVirAddr, pInputData->dataBuffer + ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)), ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height / 2)));
#endif
+ } else {
+ /* Real input data */
+ pInputInfo->YPhyAddr = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YPhyAddr;
+ pInputInfo->CPhyAddr = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CPhyAddr;
}
- returnCodec = SsbSipMfcEncExe(pH264Enc->hMFCH264Handle.hMFCHandle);
- if (returnCodec == MFC_RET_OK) {
+ pSECComponent->timeStamp[pH264Enc->hMFCH264Handle.indexTimestamp] = pInputData->timeStamp;
+ pSECComponent->nFlags[pH264Enc->hMFCH264Handle.indexTimestamp] = pInputData->nFlags;
+
+ if ((pH264Enc->hMFCH264Handle.returnCodec == MFC_RET_OK) &&
+ (pH264Enc->bFirstFrame == OMX_FALSE)) {
OMX_S32 indexTimestamp = 0;
- returnCodec = SsbSipMfcEncGetOutBuf(pH264Enc->hMFCH264Handle.hMFCHandle, &outputInfo);
+ /* wait for mfc encode done */
+ if (pH264Enc->NBEncThread.bEncoderRun != OMX_FALSE) {
+ SEC_OSAL_SemaphoreWait(pH264Enc->NBEncThread.hEncFrameEnd);
+ pH264Enc->NBEncThread.bEncoderRun = OMX_FALSE;
+ }
+
+ pH264Enc->hMFCH264Handle.returnCodec = SsbSipMfcEncGetOutBuf(pH264Enc->hMFCH264Handle.hMFCHandle, &outputInfo);
if ((SsbSipMfcEncGetConfig(pH264Enc->hMFCH264Handle.hMFCHandle, MFC_ENC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
- (((indexTimestamp < 0) || (indexTimestamp > MAX_TIMESTAMP)))){
+ (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))){
pOutputData->timeStamp = pInputData->timeStamp;
pOutputData->nFlags = pInputData->nFlags;
} else {
@@ -794,7 +1021,7 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
}
- if (returnCodec == MFC_RET_OK) {
+ if (pH264Enc->hMFCH264Handle.returnCodec == MFC_RET_OK) {
/** Fill Output Buffer **/
pOutputData->dataBuffer = outputInfo.StrmVirAddr;
pOutputData->allocSize = outputInfo.dataSize;
@@ -808,14 +1035,58 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA
SEC_OSAL_Log(SEC_LOG_TRACE, "MFC Encode OK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
ret = OMX_ErrorNone;
+ } else {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncGetOutBuf failed, ret:%d", __FUNCTION__, pH264Enc->hMFCH264Handle.returnCodec);
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
+ }
+
+ if (pSECComponent->getAllDelayBuffer == OMX_TRUE) {
+ ret = OMX_ErrorInputDataEncodeYet;
+ }
+ if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+ pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+ pSECComponent->getAllDelayBuffer = OMX_TRUE;
+ ret = OMX_ErrorInputDataEncodeYet;
+ }
+ if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+ pSECComponent->getAllDelayBuffer = OMX_FALSE;
+ pOutputData->dataLen = 0;
+ pOutputData->usedDataLen = 0;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "OMX_BUFFERFLAG_EOS!!!");
+ ret = OMX_ErrorNone;
}
}
+ if (pH264Enc->hMFCH264Handle.returnCodec != MFC_RET_OK) {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "In %s : SsbSipMfcEncExe Failed!!!\n", __func__);
+ ret = OMX_ErrorUndefined;
+ }
- if (returnCodec != MFC_RET_OK) {
- SEC_OSAL_Log(SEC_LOG_ERROR, "In %s : SsbSipMfcEncExe OR SsbSipMfcEncGetOutBuf Failed!!!\n", __func__);
+ pH264Enc->hMFCH264Handle.returnCodec = SsbSipMfcEncSetInBuf(pH264Enc->hMFCH264Handle.hMFCHandle, pInputInfo);
+ if (pH264Enc->hMFCH264Handle.returnCodec != MFC_RET_OK) {
+ SEC_OSAL_Log(SEC_LOG_TRACE, "Error : SsbSipMfcEncSetInBuf() \n");
ret = OMX_ErrorUndefined;
+ goto EXIT;
+ } else {
+ pH264Enc->indexInputBuffer++;
+ pH264Enc->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YPhyAddr = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].YPhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CPhyAddr = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].CPhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YVirAddr = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].YVirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CVirAddr = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].CVirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YSize = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].YBufferSize;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CSize = pH264Enc->MFCEncInputBuffer[pH264Enc->indexInputBuffer].CBufferSize;
}
+ SsbSipMfcEncSetConfig(pH264Enc->hMFCH264Handle.hMFCHandle, MFC_ENC_SETCONF_FRAME_TAG, &(pH264Enc->hMFCH264Handle.indexTimestamp));
+
+ /* mfc encode start */
+ SEC_OSAL_SemaphorePost(pH264Enc->NBEncThread.hEncFrameStart);
+ pH264Enc->NBEncThread.bEncoderRun = OMX_TRUE;
+ pH264Enc->hMFCH264Handle.indexTimestamp++;
+ pH264Enc->hMFCH264Handle.indexTimestamp %= MAX_TIMESTAMP;
+ pH264Enc->bFirstFrame = OMX_FALSE;
+
EXIT:
FunctionOut();
@@ -847,9 +1118,14 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, SE
ret = SEC_MFC_H264_Encode(pOMXComponent, pInputData, pOutputData);
if (ret != OMX_ErrorNone) {
- pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
- pSECComponent->callbackData,
- OMX_EventError, ret, 0, NULL);
+ if (ret == OMX_ErrorInputDataEncodeYet) {
+ pOutputData->usedDataLen = 0;
+ pOutputData->remainDataLen = pOutputData->dataLen;
+ } else {
+ pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
+ pSECComponent->callbackData,
+ OMX_EventError, ret, 0, NULL);
+ }
} else {
pInputData->usedDataLen += pInputData->dataLen;
pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen;
@@ -882,7 +1158,7 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, Line:%d", __LINE__);
goto EXIT;
}
- if (SEC_OSAL_Strcmp(SEC_OMX_COMPOMENT_H264_ENC, componentName) != 0) {
+ if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_H264_ENC, componentName) != 0) {
ret = OMX_ErrorBadParameter;
SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, componentName:%s, Line:%d", componentName, __LINE__);
goto EXIT;
@@ -916,7 +1192,7 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
SEC_OSAL_Memset(pH264Enc, 0, sizeof(SEC_H264ENC_HANDLE));
pSECComponent->hCodecHandle = (OMX_HANDLETYPE)pH264Enc;
- SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPOMENT_H264_ENC);
+ SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_H264_ENC);
/* Set componentVersion */
pSECComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
pSECComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
@@ -947,7 +1223,7 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
- pSECPort->portDefinition.format.video.eColorFormat = SEC_OMX_COLOR_FormatNV12PhysicalAddress;
+ pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
pSECPort->portDefinition.bEnabled = OMX_TRUE;
/* Output port */
@@ -971,7 +1247,9 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
pOMXComponent->GetParameter = &SEC_MFC_H264Enc_GetParameter;
pOMXComponent->SetParameter = &SEC_MFC_H264Enc_SetParameter;
+ pOMXComponent->GetConfig = &SEC_MFC_H264Enc_GetConfig;
pOMXComponent->SetConfig = &SEC_MFC_H264Enc_SetConfig;
+ pOMXComponent->GetExtensionIndex = &SEC_MFC_H264Enc_GetExtensionIndex;
pOMXComponent->ComponentRoleEnum = &SEC_MFC_H264Enc_ComponentRoleEnum;
pOMXComponent->ComponentDeInit = &SEC_OMX_ComponentDeinit;
@@ -995,7 +1273,7 @@ OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent)
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
- SEC_H264ENC_HANDLE *pH264Dec = NULL;
+ SEC_H264ENC_HANDLE *pH264Enc = NULL;
FunctionIn();
@@ -1009,10 +1287,10 @@ OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent)
SEC_OSAL_Free(pSECComponent->componentName);
pSECComponent->componentName = NULL;
- pH264Dec = (SEC_H264ENC_HANDLE *)pSECComponent->hCodecHandle;
- if (pH264Dec != NULL) {
- SEC_OSAL_Free(pH264Dec);
- pH264Dec = pSECComponent->hCodecHandle = NULL;
+ pH264Enc = (SEC_H264ENC_HANDLE *)pSECComponent->hCodecHandle;
+ if (pH264Enc != NULL) {
+ SEC_OSAL_Free(pH264Enc);
+ pH264Enc = pSECComponent->hCodecHandle = NULL;
}
ret = SEC_OMX_VideoEncodeComponentDeinit(pOMXComponent);
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.h b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.h
index 80f6260..bdd525f 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.h
@@ -47,9 +47,10 @@ typedef struct _SEC_MFC_H264ENC_HANDLE
SSBSIP_MFC_ENC_H264_PARAM mfcVideoAvc;
SSBSIP_MFC_ENC_INPUT_INFO inputInfo;
/* SSBSIP_MFC_ENC_OUTPUT_INFO outputInfo; */
- OMX_U32 indexTimestamp;
+ OMX_U32 indexTimestamp;
OMX_BOOL bConfiguredMFC;
EXTRA_DATA headerData;
+ OMX_S32 returnCodec;
} SEC_MFC_H264ENC_HANDLE;
typedef struct _SEC_H264ENC_HANDLE
@@ -60,6 +61,12 @@ typedef struct _SEC_H264ENC_HANDLE
/* SEC MFC Codec specific */
SEC_MFC_H264ENC_HANDLE hMFCH264Handle;
+
+ /* For Non-Block mode */
+ SEC_MFC_NBENC_THREAD NBEncThread;
+ OMX_BOOL bFirstFrame;
+ MFC_ENC_INPUT_BUFFER MFCEncInputBuffer[MFC_INPUT_BUFFER_NUM_MAX];
+ OMX_U32 indexInputBuffer;
} SEC_H264ENC_HANDLE;
#ifdef __cplusplus
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/library_register.c b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/library_register.c
index ee1ea0a..247b38b 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/library_register.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/library_register.c
@@ -37,19 +37,19 @@
OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **secComponents)
{
- FunctionIn();
+ FunctionIn();
- if (secComponents == NULL)
- goto EXIT;
+ if (secComponents == NULL)
+ goto EXIT;
- /* component 1 - video decoder H.264 */
- SEC_OSAL_Strcpy(secComponents[0]->componentName, SEC_OMX_COMPOMENT_H264_ENC);
- SEC_OSAL_Strcpy(secComponents[0]->roles[0], SEC_OMX_COMPOMENT_H264_ENC_ROLE);
- secComponents[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+ /* component 1 - video decoder H.264 */
+ SEC_OSAL_Strcpy(secComponents[0]->componentName, SEC_OMX_COMPONENT_H264_ENC);
+ SEC_OSAL_Strcpy(secComponents[0]->roles[0], SEC_OMX_COMPONENT_H264_ENC_ROLE);
+ secComponents[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
- FunctionOut();
+ FunctionOut();
- return MAX_COMPONENT_NUM;
+ return MAX_COMPONENT_NUM;
}
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/library_register.h b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/library_register.h
index 71397ef..6a176ad 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/library_register.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/library_register.h
@@ -37,8 +37,8 @@
#define MAX_COMPONENT_ROLE_NUM 1
/* H.264 */
-#define SEC_OMX_COMPOMENT_H264_ENC "OMX.SEC.AVC.Encoder"
-#define SEC_OMX_COMPOMENT_H264_ENC_ROLE "video_encoder.avc"
+#define SEC_OMX_COMPONENT_H264_ENC "OMX.SEC.AVC.Encoder"
+#define SEC_OMX_COMPONENT_H264_ENC_ROLE "video_encoder.avc"
#ifdef __cplusplus
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/Android.mk b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/Android.mk
index 979c34a..e00dd1c 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/Android.mk
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/Android.mk
@@ -7,15 +7,16 @@ LOCAL_SRC_FILES := \
SEC_OMX_Mpeg4enc.c \
library_register.c
-LOCAL_PRELINK_MODULE := false
+
LOCAL_MODULE := libOMX.SEC.M4V.Encoder.aries
LOCAL_CFLAGS :=
LOCAL_ARM_MODE := arm
-LOCAL_STATIC_LIBRARIES := libSEC_OMX_Venc.aries libsecosal.aries libsecbasecomponent.aries libsecmfcencapi.aries
-LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils
+LOCAL_STATIC_LIBRARIES := libSEC_OMX_Venc.aries libsecosal.aries libsecbasecomponent.aries \
+ libsecmfcencapi.aries libseccsc.aries
+LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui libhardware
LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
$(SEC_OMX_INC)/sec \
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c
index 0596c25..5213522 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c
@@ -36,6 +36,7 @@
#include "library_register.h"
#include "SEC_OMX_Mpeg4enc.h"
#include "SsbSipMfcApi.h"
+#include "color_space_convertor.h"
#undef SEC_LOG_TAG
#define SEC_LOG_TAG "SEC_MPEG4_ENC"
@@ -214,18 +215,50 @@ void Set_Mpeg4Enc_Param(SSBSIP_MFC_ENC_MPEG4_PARAM *pMpeg4Param, SEC_OMX_BASECOM
pMpeg4Param->NumberBFrames = 0; /* 0(not used) ~ 2 */
pMpeg4Param->DisableQpelME = 1;
+ switch ((SEC_OMX_COLOR_FORMATTYPE)pSECInputPort->portDefinition.format.video.eColorFormat) {
+ case OMX_COLOR_FormatYUV420SemiPlanar:
+ pMpeg4Param->FrameMap = NV12_LINEAR;
+ break;
+ case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+ default:
+ pMpeg4Param->FrameMap = NV12_TILE;
+ break;
+ }
+
+#ifdef USE_ANDROID_EXTENSION
+ if (pSECInputPort->bStoreMetaDataInBuffer != OMX_FALSE) {
+ SEC_OMX_DATA *pInputData = &pSECComponent->processData[INPUT_PORT_INDEX];
+ if(isMetadataBufferTypeGrallocSource(pInputData->dataBuffer) == OMX_TRUE)
+ pMpeg4Param->FrameMap = NV12_LINEAR;
+ else
+ pMpeg4Param->FrameMap = NV12_TILE;
+ }
+#endif
+
+/*
SEC_OSAL_Log(SEC_LOG_TRACE, "pSECPort->eControlRate: 0x%x", pSECOutputPort->eControlRate);
switch (pSECOutputPort->eControlRate) {
- case OMX_Video_ControlRateDisable:
- /* TBD */
- break;
case OMX_Video_ControlRateVariable:
- /* TBD */
+ SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode VBR");
+ pH264Arg->EnableFRMRateControl = 0; // 0: Disable, 1: Frame level RC
+ pH264Arg->EnableMBRateControl = 0; // 0: Disable, 1:MB level RC
+ pH264Arg->CBRPeriodRf = 100;
break;
- default:
+ case OMX_Video_ControlRateConstant:
+ SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode CBR");
+ pH264Arg->EnableFRMRateControl = 1; // 0: Disable, 1: Frame level RC
+ pH264Arg->EnableMBRateControl = 1; // 0: Disable, 1:MB level RC
+ pH264Arg->CBRPeriodRf = 10;
+ break;
+ case OMX_Video_ControlRateDisable:
+ default: //Android default
+ SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode VBR");
+ pH264Arg->EnableFRMRateControl = 0;
+ pH264Arg->EnableMBRateControl = 0;
+ pH264Arg->CBRPeriodRf = 100;
break;
}
-
+*/
Mpeg4PrintParams(*pMpeg4Param);
}
@@ -259,18 +292,50 @@ void Set_H263Enc_Param(SSBSIP_MFC_ENC_H263_PARAM *pH263Param, SEC_OMX_BASECOMPON
pH263Param->FrameRate = (pSECInputPort->portDefinition.format.video.xFramerate) >> 16;
+ switch ((SEC_OMX_COLOR_FORMATTYPE)pSECInputPort->portDefinition.format.video.eColorFormat) {
+ case OMX_COLOR_FormatYUV420SemiPlanar:
+ pH263Param->FrameMap = NV12_LINEAR;
+ break;
+ case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+ default:
+ pH263Param->FrameMap = NV12_TILE;
+ break;
+ }
+
+#ifdef USE_ANDROID_EXTENSION
+ if (pSECInputPort->bStoreMetaDataInBuffer != OMX_FALSE) {
+ SEC_OMX_DATA *pInputData = &pSECComponent->processData[INPUT_PORT_INDEX];
+ if(isMetadataBufferTypeGrallocSource(pInputData->dataBuffer) == OMX_TRUE)
+ pH263Param->FrameMap = NV12_LINEAR;
+ else
+ pH263Param->FrameMap = NV12_TILE;
+ }
+#endif
+
+/*
SEC_OSAL_Log(SEC_LOG_TRACE, "pSECPort->eControlRate: 0x%x", pSECOutputPort->eControlRate);
switch (pSECOutputPort->eControlRate) {
- case OMX_Video_ControlRateDisable:
- /* TBD */
- break;
case OMX_Video_ControlRateVariable:
- /* TBD */
+ SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode VBR");
+ pH264Arg->EnableFRMRateControl = 0; // 0: Disable, 1: Frame level RC
+ pH264Arg->EnableMBRateControl = 0; // 0: Disable, 1:MB level RC
+ pH264Arg->CBRPeriodRf = 100;
break;
- default:
+ case OMX_Video_ControlRateConstant:
+ SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode CBR");
+ pH264Arg->EnableFRMRateControl = 1; // 0: Disable, 1: Frame level RC
+ pH264Arg->EnableMBRateControl = 1; // 0: Disable, 1:MB level RC
+ pH264Arg->CBRPeriodRf = 10;
+ break;
+ case OMX_Video_ControlRateDisable:
+ default: //Android default
+ SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode VBR");
+ pH264Arg->EnableFRMRateControl = 0;
+ pH264Arg->EnableMBRateControl = 0;
+ pH264Arg->CBRPeriodRf = 100;
break;
}
-
+*/
H263PrintParams(*pH263Param);
}
@@ -362,9 +427,9 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_GetParameter(
codecType = ((SEC_MPEG4ENC_HANDLE *)(pSECComponent->hCodecHandle))->hMFCMpeg4Handle.codecType;
if (codecType == CODEC_TYPE_MPEG4)
- SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPOMENT_MPEG4_ENC_ROLE);
+ SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_MPEG4_ENC_ROLE);
else
- SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPOMENT_H263_ENC_ROLE);
+ SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_H263_ENC_ROLE);
}
break;
case OMX_IndexParamVideoProfileLevelQuerySupported:
@@ -560,10 +625,10 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_SetParameter(
goto EXIT;
}
- if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPOMENT_MPEG4_ENC_ROLE)) {
+ if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_MPEG4_ENC_ROLE)) {
pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4;
//((SEC_MPEG4ENC_HANDLE *)(pSECComponent->hCodecHandle))->hMFCMpeg4Handle.codecType = CODEC_TYPE_MPEG4;
- } else if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPOMENT_H263_ENC_ROLE)) {
+ } else if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_H263_ENC_ROLE)) {
pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingH263;
//((SEC_MPEG4ENC_HANDLE *)(pSECComponent->hCodecHandle))->hMFCMpeg4Handle.codecType = CODEC_TYPE_H263;
} else {
@@ -647,6 +712,54 @@ EXIT:
return ret;
}
+OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_GetConfig(
+ OMX_HANDLETYPE hComponent,
+ OMX_INDEXTYPE nIndex,
+ OMX_PTR pComponentConfigStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+ if (ret != OMX_ErrorNone) {
+ goto EXIT;
+ }
+
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+ if (pComponentConfigStructure == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ if (pSECComponent->currentState == OMX_StateInvalid) {
+ ret = OMX_ErrorInvalidState;
+ goto EXIT;
+ }
+
+ switch (nIndex) {
+ default:
+ ret = SEC_OMX_GetConfig(hComponent, nIndex, pComponentConfigStructure);
+ break;
+ }
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_SetConfig(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
@@ -690,6 +803,59 @@ EXIT:
return ret;
}
+OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_GetExtensionIndex(
+ OMX_IN OMX_HANDLETYPE hComponent,
+ OMX_IN OMX_STRING cParameterName,
+ OMX_OUT OMX_INDEXTYPE *pIndexType)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+ if (ret != OMX_ErrorNone) {
+ goto EXIT;
+ }
+
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+ if ((cParameterName == NULL) || (pIndexType == NULL)) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ if (pSECComponent->currentState == OMX_StateInvalid) {
+ ret = OMX_ErrorInvalidState;
+ goto EXIT;
+ }
+
+#ifdef USE_ANDROID_EXTENSION
+ if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_STORE_METADATA_BUFFER) == 0) {
+ *pIndexType = OMX_IndexParamStoreMetaDataBuffer;
+ ret = OMX_ErrorNone;
+ } else {
+ ret = SEC_OMX_GetExtensionIndex(hComponent, cParameterName, pIndexType);
+ }
+#else
+ ret = SEC_OMX_GetExtensionIndex(hComponent, cParameterName, pIndexType);
+#endif
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_ComponentRoleEnum(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_OUT OMX_U8 *cRole,
@@ -728,12 +894,45 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_ComponentRoleEnum(
codecType = ((SEC_MPEG4ENC_HANDLE *)(pSECComponent->hCodecHandle))->hMFCMpeg4Handle.codecType;
if (codecType == CODEC_TYPE_MPEG4)
- SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPOMENT_MPEG4_ENC_ROLE);
+ SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_MPEG4_ENC_ROLE);
else
- SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPOMENT_H263_ENC_ROLE);
+ SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_H263_ENC_ROLE);
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_EncodeThread(OMX_HANDLETYPE hComponent)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_MPEG4ENC_HANDLE *pMpeg4Enc = NULL;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+ pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)pSECComponent->hCodecHandle;
+
+ while (pMpeg4Enc->NBEncThread.bExitEncodeThread == OMX_FALSE) {
+ SEC_OSAL_SemaphoreWait(pMpeg4Enc->NBEncThread.hEncFrameStart);
+
+ if (pMpeg4Enc->NBEncThread.bExitEncodeThread == OMX_FALSE) {
+ pMpeg4Enc->hMFCMpeg4Handle.returnCodec = SsbSipMfcEncExe(pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle);
+ SEC_OSAL_SemaphorePost(pMpeg4Enc->NBEncThread.hEncFrameEnd);
+ }
+ }
EXIT:
FunctionOut();
+ SEC_OSAL_ThreadExit(NULL);
return ret;
}
@@ -743,6 +942,8 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+ SEC_OMX_BASEPORT *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+ SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
SEC_OMX_BASEPORT *pSECPort = NULL;
SEC_MPEG4ENC_HANDLE *pMpeg4Enc = NULL;
OMX_HANDLETYPE hMFCHandle = NULL;
@@ -756,7 +957,8 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
pSECComponent->bSaveFlagEOS = OMX_FALSE;
/* MFC(Multi Format Codec) encoder and CMM(Codec Memory Management) driver open */
- hMFCHandle = SsbSipMfcEncOpen();
+ SSBIP_MFC_BUFFER_TYPE buf_type = CACHE;
+ hMFCHandle = (OMX_PTR)SsbSipMfcEncOpen(&buf_type);
if (hMFCHandle == NULL) {
ret = OMX_ErrorInsufficientResources;
goto EXIT;
@@ -765,16 +967,31 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
/* set MFC ENC VIDEO PARAM and initialize MFC encoder instance */
if (pMpeg4Enc->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4) {
- Set_Mpeg4Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.mpeg4MFCParam), pSECComponent);
- returnCodec = SsbSipMfcEncInit(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.mpeg4MFCParam));
+ SsbSipMfcEncSetSize(hMFCHandle, MPEG4_ENC,
+ pSECOutputPort->portDefinition.format.video.nFrameWidth,
+ pSECOutputPort->portDefinition.format.video.nFrameHeight);
} else {
- Set_H263Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.h263MFCParam), pSECComponent);
- returnCodec = SsbSipMfcEncInit(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.h263MFCParam));
+ SsbSipMfcEncSetSize(hMFCHandle, H263_ENC,
+ pSECOutputPort->portDefinition.format.video.nFrameWidth,
+ pSECOutputPort->portDefinition.format.video.nFrameHeight);
}
+
+ /* allocate encoder's input buffer */
+ returnCodec = SsbSipMfcEncGetInBuf(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.inputInfo));
if (returnCodec != MFC_RET_OK) {
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
+ pMpeg4Enc->MFCEncInputBuffer[0].YPhyAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YPhyAddr;
+ pMpeg4Enc->MFCEncInputBuffer[0].CPhyAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CPhyAddr;
+ pMpeg4Enc->MFCEncInputBuffer[0].YVirAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YVirAddr;
+ pMpeg4Enc->MFCEncInputBuffer[0].CVirAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CVirAddr;
+ pMpeg4Enc->MFCEncInputBuffer[0].YBufferSize = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YSize;
+ pMpeg4Enc->MFCEncInputBuffer[0].CBufferSize = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CSize;
+ pMpeg4Enc->MFCEncInputBuffer[0].YDataSize = 0;
+ pMpeg4Enc->MFCEncInputBuffer[0].CDataSize = 0;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YVirAddr : 0x%x", pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YVirAddr);
+ SEC_OSAL_Log(SEC_LOG_TRACE, "pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CVirAddr : 0x%x", pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CVirAddr);
/* allocate encoder's input buffer */
returnCodec = SsbSipMfcEncGetInBuf(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.inputInfo));
@@ -782,13 +999,36 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
-
- pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YPhyAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YPhyAddr;
- pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CPhyAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CPhyAddr;
- pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YVirAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YVirAddr;
- pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CVirAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CVirAddr;
- pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YSize = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YSize;
- pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CSize = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CSize;
+ pMpeg4Enc->MFCEncInputBuffer[1].YPhyAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YPhyAddr;
+ pMpeg4Enc->MFCEncInputBuffer[1].CPhyAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CPhyAddr;
+ pMpeg4Enc->MFCEncInputBuffer[1].YVirAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YVirAddr;
+ pMpeg4Enc->MFCEncInputBuffer[1].CVirAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CVirAddr;
+ pMpeg4Enc->MFCEncInputBuffer[1].YBufferSize = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YSize;
+ pMpeg4Enc->MFCEncInputBuffer[1].CBufferSize = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CSize;
+ pMpeg4Enc->MFCEncInputBuffer[1].YDataSize = 0;
+ pMpeg4Enc->MFCEncInputBuffer[1].CDataSize = 0;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YVirAddr : 0x%x", pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YVirAddr);
+ SEC_OSAL_Log(SEC_LOG_TRACE, "pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CVirAddr : 0x%x", pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CVirAddr);
+
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YPhyAddr = pMpeg4Enc->MFCEncInputBuffer[0].YPhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CPhyAddr = pMpeg4Enc->MFCEncInputBuffer[0].CPhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YVirAddr = pMpeg4Enc->MFCEncInputBuffer[0].YVirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CVirAddr = pMpeg4Enc->MFCEncInputBuffer[0].CVirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YSize = pMpeg4Enc->MFCEncInputBuffer[0].YBufferSize;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CSize = pMpeg4Enc->MFCEncInputBuffer[0].CBufferSize;
+
+ pMpeg4Enc->indexInputBuffer = 0;
+ pMpeg4Enc->bFirstFrame = OMX_TRUE;
+
+ pMpeg4Enc->NBEncThread.bExitEncodeThread = OMX_FALSE;
+ pMpeg4Enc->NBEncThread.bEncoderRun = OMX_FALSE;
+ SEC_OSAL_SemaphoreCreate(&(pMpeg4Enc->NBEncThread.hEncFrameStart));
+ SEC_OSAL_SemaphoreCreate(&(pMpeg4Enc->NBEncThread.hEncFrameEnd));
+ if (OMX_ErrorNone == SEC_OSAL_ThreadCreate(&pMpeg4Enc->NBEncThread.hNBEncodeThread,
+ SEC_MFC_EncodeThread,
+ pOMXComponent)) {
+ pMpeg4Enc->hMFCMpeg4Handle.returnCodec = MFC_RET_OK;
+ }
SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
@@ -811,8 +1051,25 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
FunctionIn();
pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)pSECComponent->hCodecHandle;
- hMFCHandle = pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle;
+ if (pMpeg4Enc->NBEncThread.hNBEncodeThread != NULL) {
+ pMpeg4Enc->NBEncThread.bExitEncodeThread = OMX_TRUE;
+ SEC_OSAL_SemaphorePost(pMpeg4Enc->NBEncThread.hEncFrameStart);
+ SEC_OSAL_ThreadTerminate(pMpeg4Enc->NBEncThread.hNBEncodeThread);
+ pMpeg4Enc->NBEncThread.hNBEncodeThread = NULL;
+ }
+
+ if(pMpeg4Enc->NBEncThread.hEncFrameEnd != NULL) {
+ SEC_OSAL_SemaphoreTerminate(pMpeg4Enc->NBEncThread.hEncFrameEnd);
+ pMpeg4Enc->NBEncThread.hEncFrameEnd = NULL;
+ }
+
+ if(pMpeg4Enc->NBEncThread.hEncFrameStart != NULL) {
+ SEC_OSAL_SemaphoreTerminate(pMpeg4Enc->NBEncThread.hEncFrameStart);
+ pMpeg4Enc->NBEncThread.hEncFrameStart = NULL;
+ }
+
+ hMFCHandle = pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle;
if (hMFCHandle != NULL) {
SsbSipMfcEncClose(hMFCHandle);
pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle = NULL;
@@ -835,15 +1092,27 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
SEC_OMX_BASEPORT *pSECPort = NULL;
MFC_ENC_ADDR_INFO addrInfo;
OMX_U32 oneFrameSize = pInputData->dataLen;
- OMX_S32 returnCodec = 0;
FunctionIn();
if (pMpeg4Enc->hMFCMpeg4Handle.bConfiguredMFC == OMX_FALSE) {
- returnCodec = SsbSipMfcEncGetOutBuf(hMFCHandle, &outputInfo);
- if (returnCodec != MFC_RET_OK)
+ /* set MFC ENC VIDEO PARAM and initialize MFC encoder instance */
+ if (pMpeg4Enc->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4) {
+ Set_Mpeg4Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.mpeg4MFCParam), pSECComponent);
+ pMpeg4Enc->hMFCMpeg4Handle.returnCodec = SsbSipMfcEncInit(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.mpeg4MFCParam));
+ } else {
+ Set_H263Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.h263MFCParam), pSECComponent);
+ pMpeg4Enc->hMFCMpeg4Handle.returnCodec = SsbSipMfcEncInit(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.h263MFCParam));
+ }
+ if (pMpeg4Enc->hMFCMpeg4Handle.returnCodec != MFC_RET_OK) {
+ ret = OMX_ErrorInsufficientResources;
+ goto EXIT;
+ }
+
+ pMpeg4Enc->hMFCMpeg4Handle.returnCodec = SsbSipMfcEncGetOutBuf(hMFCHandle, &outputInfo);
+ if (pMpeg4Enc->hMFCMpeg4Handle.returnCodec != MFC_RET_OK)
{
- SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncGetOutBuf failed, ret:%d", __FUNCTION__, returnCodec);
+ SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncGetOutBuf failed, ret:%d", __FUNCTION__, pMpeg4Enc->hMFCMpeg4Handle.returnCodec);
ret = OMX_ErrorUndefined;
goto EXIT;
}
@@ -851,19 +1120,14 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
pOutputData->dataBuffer = outputInfo.StrmVirAddr;
pOutputData->allocSize = outputInfo.headerSize;
pOutputData->dataLen = outputInfo.headerSize;
- pOutputData->timeStamp = pInputData->timeStamp;
+ pOutputData->timeStamp = 0;
pOutputData->nFlags |= OMX_BUFFERFLAG_CODECCONFIG;
pOutputData->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
pMpeg4Enc->hMFCMpeg4Handle.bConfiguredMFC = OMX_TRUE;
- if (pOutputData->dataLen > 0) {
- ret = OMX_ErrorNone;
- goto EXIT;
- } else {
- ret = OMX_ErrorInputDataEncodeYet;
- goto EXIT;
- }
+ ret = OMX_ErrorInputDataEncodeYet;
+ goto EXIT;
}
if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
@@ -871,13 +1135,6 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
pSECComponent->bUseFlagEOF = OMX_TRUE;
}
- pSECComponent->timeStamp[pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp] = pInputData->timeStamp;
- pSECComponent->nFlags[pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp] = pInputData->nFlags;
- SsbSipMfcEncSetConfig(hMFCHandle, MFC_ENC_SETCONF_FRAME_TAG, &(pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp));
- pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp++;
- if (pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp >= MAX_TIMESTAMP)
- pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp = 0;
-
if (oneFrameSize <= 0) {
pOutputData->timeStamp = pInputData->timeStamp;
pOutputData->nFlags = pInputData->nFlags;
@@ -887,39 +1144,46 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
}
pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
- if (pSECPort->portDefinition.format.video.eColorFormat == SEC_OMX_COLOR_FormatNV12PhysicalAddress) {
- /* input data from Real camera */
-#define USE_FIMC_FRAME_BUFFER
-#ifdef USE_FIMC_FRAME_BUFFER
+ if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) ||
+ (pSECComponent->getAllDelayBuffer == OMX_TRUE)){
+ /* Dummy input data for get out encoded last frame */
+ pInputInfo->YPhyAddr = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].YPhyAddr;
+ pInputInfo->CPhyAddr = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].CPhyAddr;
+ pInputInfo->YVirAddr = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].YVirAddr;
+ pInputInfo->CVirAddr = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].CVirAddr;
+ } else if (pSECPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress) {
SEC_OSAL_Memcpy(&addrInfo.pAddrY, pInputData->dataBuffer, sizeof(addrInfo.pAddrY));
SEC_OSAL_Memcpy(&addrInfo.pAddrC, pInputData->dataBuffer + sizeof(addrInfo.pAddrY), sizeof(addrInfo.pAddrC));
pInputInfo->YPhyAddr = addrInfo.pAddrY;
pInputInfo->CPhyAddr = addrInfo.pAddrC;
- returnCodec = SsbSipMfcEncSetInBuf(hMFCHandle, pInputInfo);
- if (returnCodec != MFC_RET_OK) {
- SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncSetInBuf failed, ret:%d", __FUNCTION__, returnCodec);
- ret = OMX_ErrorUndefined;
+#ifdef USE_ANDROID_EXTENSION
+ } else if (pSECPort->bStoreMetaDataInBuffer != OMX_FALSE) {
+ ret = preprocessMetaDataInBuffers(pOMXComponent, pInputData->dataBuffer, pInputInfo);
+ if (ret != OMX_ErrorNone)
goto EXIT;
- }
-#else
- OMX_U32 width, height;
-
- width = pSECPort->portDefinition.format.video.nFrameWidth;
- height = pSECPort->portDefinition.format.video.nFrameHeight;
-
- SEC_OSAL_Memcpy(pInputInfo->YVirAddr, pInputData->dataBuffer, ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)));
- SEC_OSAL_Memcpy(pInputInfo->CVirAddr, pInputData->dataBuffer + ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)), ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height / 2)));
#endif
+ } else {
+ /* Real input data */
+ pInputInfo->YPhyAddr = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YPhyAddr;
+ pInputInfo->CPhyAddr = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CPhyAddr;
}
- returnCodec = SsbSipMfcEncExe(hMFCHandle);
- if (returnCodec == MFC_RET_OK) {
+ pSECComponent->timeStamp[pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp] = pInputData->timeStamp;
+ pSECComponent->nFlags[pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp] = pInputData->nFlags;
+
+ if ((pMpeg4Enc->hMFCMpeg4Handle.returnCodec == MFC_RET_OK) &&
+ (pMpeg4Enc->bFirstFrame == OMX_FALSE)) {
OMX_S32 indexTimestamp = 0;
- returnCodec = SsbSipMfcEncGetOutBuf(hMFCHandle, &outputInfo);
+ /* wait for mfc encode done */
+ if (pMpeg4Enc->NBEncThread.bEncoderRun != OMX_FALSE) {
+ SEC_OSAL_SemaphoreWait(pMpeg4Enc->NBEncThread.hEncFrameEnd);
+ pMpeg4Enc->NBEncThread.bEncoderRun = OMX_FALSE;
+ }
+ pMpeg4Enc->hMFCMpeg4Handle.returnCodec = SsbSipMfcEncGetOutBuf(hMFCHandle, &outputInfo);
if ((SsbSipMfcEncGetConfig(hMFCHandle, MFC_ENC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
- (((indexTimestamp < 0) || (indexTimestamp > MAX_TIMESTAMP)))) {
+ (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))) {
pOutputData->timeStamp = pInputData->timeStamp;
pOutputData->nFlags = pInputData->nFlags;
} else {
@@ -927,25 +1191,70 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT
pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
}
- if (returnCodec == MFC_RET_OK) {
+ if (pMpeg4Enc->hMFCMpeg4Handle.returnCodec == MFC_RET_OK) {
/** Fill Output Buffer **/
pOutputData->dataBuffer = outputInfo.StrmVirAddr;
pOutputData->allocSize = outputInfo.dataSize;
pOutputData->dataLen = outputInfo.dataSize;
+ pOutputData->usedDataLen = 0;
+
pOutputData->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
if (outputInfo.frameType == MFC_FRAME_TYPE_I_FRAME)
pOutputData->nFlags |= OMX_BUFFERFLAG_SYNCFRAME;
ret = OMX_ErrorNone;
} else {
- SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncGetOutBuf failed, ret:%d", __FUNCTION__, returnCodec);
+ SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncGetOutBuf failed, ret:%d", __FUNCTION__, pMpeg4Enc->hMFCMpeg4Handle.returnCodec);
ret = OMX_ErrorUndefined;
+ goto EXIT;
}
- } else {
- SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncExe failed, ret:%d", __FUNCTION__, returnCodec);
+
+ if (pSECComponent->getAllDelayBuffer == OMX_TRUE) {
+ ret = OMX_ErrorInputDataEncodeYet;
+ }
+ if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+ pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+ pSECComponent->getAllDelayBuffer = OMX_TRUE;
+ ret = OMX_ErrorInputDataEncodeYet;
+ }
+ if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+ pSECComponent->getAllDelayBuffer = OMX_FALSE;
+ pOutputData->dataLen = 0;
+ pOutputData->usedDataLen = 0;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "OMX_BUFFERFLAG_EOS!!!");
+ ret = OMX_ErrorNone;
+ }
+ }
+ if (pMpeg4Enc->hMFCMpeg4Handle.returnCodec != MFC_RET_OK) {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncExe failed, ret:%d", __FUNCTION__, pMpeg4Enc->hMFCMpeg4Handle.returnCodec);
+ ret = OMX_ErrorUndefined;
+ }
+
+ pMpeg4Enc->hMFCMpeg4Handle.returnCodec = SsbSipMfcEncSetInBuf(hMFCHandle, pInputInfo);
+ if (pMpeg4Enc->hMFCMpeg4Handle.returnCodec != MFC_RET_OK) {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncSetInBuf failed, ret:%d", __FUNCTION__, pMpeg4Enc->hMFCMpeg4Handle.returnCodec);
ret = OMX_ErrorUndefined;
+ goto EXIT;
+ } else {
+ pMpeg4Enc->indexInputBuffer++;
+ pMpeg4Enc->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YPhyAddr = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].YPhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CPhyAddr = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].CPhyAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YVirAddr = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].YVirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CVirAddr = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].CVirAddr;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YSize = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].YBufferSize;
+ pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CSize = pMpeg4Enc->MFCEncInputBuffer[pMpeg4Enc->indexInputBuffer].CBufferSize;
}
+ SsbSipMfcEncSetConfig(hMFCHandle, MFC_ENC_SETCONF_FRAME_TAG, &(pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp));
+
+ /* mfc encode start */
+ SEC_OSAL_SemaphorePost(pMpeg4Enc->NBEncThread.hEncFrameStart);
+ pMpeg4Enc->NBEncThread.bEncoderRun = OMX_TRUE;
+ pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp++;
+ pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp %= MAX_TIMESTAMP;
+ pMpeg4Enc->bFirstFrame = OMX_FALSE;
+
EXIT:
FunctionOut();
@@ -976,9 +1285,9 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, S
pOutputData->usedDataLen = 0;
pOutputData->remainDataLen = pOutputData->dataLen;
} else {
- pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
- pSECComponent->callbackData,
- OMX_EventError, ret, 0, NULL);
+ pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
+ pSECComponent->callbackData,
+ OMX_EventError, ret, 0, NULL);
}
} else {
pInputData->usedDataLen += pInputData->dataLen;
@@ -1013,9 +1322,9 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
SEC_OSAL_Log(SEC_LOG_ERROR, "%s: parameters are null, ret: %X", __FUNCTION__, ret);
goto EXIT;
}
- if (SEC_OSAL_Strcmp(SEC_OMX_COMPOMENT_MPEG4_ENC, componentName) == 0) {
+ if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_MPEG4_ENC, componentName) == 0) {
codecType = CODEC_TYPE_MPEG4;
- } else if (SEC_OSAL_Strcmp(SEC_OMX_COMPOMENT_H263_ENC, componentName) == 0) {
+ } else if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_H263_ENC, componentName) == 0) {
codecType = CODEC_TYPE_H263;
} else {
ret = OMX_ErrorBadParameter;
@@ -1053,9 +1362,9 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
pMpeg4Enc->hMFCMpeg4Handle.codecType = codecType;
if (codecType == CODEC_TYPE_MPEG4)
- SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPOMENT_MPEG4_ENC);
+ SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_MPEG4_ENC);
else
- SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPOMENT_H263_ENC);
+ SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_H263_ENC);
/* Set componentVersion */
pSECComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
@@ -1089,7 +1398,7 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
- pSECPort->portDefinition.format.video.eColorFormat = SEC_OMX_COLOR_FormatNV12PhysicalAddress;//OMX_COLOR_FormatYUV420SemiPlanar;
+ pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_INPUT_BUFFER_SIZE;
pSECPort->portDefinition.bEnabled = OMX_TRUE;
@@ -1147,7 +1456,9 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
pOMXComponent->GetParameter = &SEC_MFC_Mpeg4Enc_GetParameter;
pOMXComponent->SetParameter = &SEC_MFC_Mpeg4Enc_SetParameter;
+ pOMXComponent->GetConfig = &SEC_MFC_Mpeg4Enc_GetConfig;
pOMXComponent->SetConfig = &SEC_MFC_Mpeg4Enc_SetConfig;
+ pOMXComponent->GetExtensionIndex = &SEC_MFC_Mpeg4Enc_GetExtensionIndex;
pOMXComponent->ComponentRoleEnum = &SEC_MFC_Mpeg4Enc_ComponentRoleEnum;
pOMXComponent->ComponentDeInit = &SEC_OMX_ComponentDeinit;
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.h b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.h
index d4f9038..36e02d8 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.h
@@ -47,6 +47,7 @@ typedef struct _SEC_MFC_MPEG4ENC_HANDLE
OMX_U32 indexTimestamp;
OMX_BOOL bConfiguredMFC;
CODEC_TYPE codecType;
+ OMX_S32 returnCodec;
} SEC_MFC_MPEG4ENC_HANDLE;
typedef struct _SEC_MPEG4ENC_HANDLE
@@ -58,6 +59,12 @@ typedef struct _SEC_MPEG4ENC_HANDLE
/* SEC MFC Codec specific */
SEC_MFC_MPEG4ENC_HANDLE hMFCMpeg4Handle;
+
+ /* For Non-Block mode */
+ SEC_MFC_NBENC_THREAD NBEncThread;
+ OMX_BOOL bFirstFrame;
+ MFC_ENC_INPUT_BUFFER MFCEncInputBuffer[MFC_INPUT_BUFFER_NUM_MAX];
+ OMX_U32 indexInputBuffer;
} SEC_MPEG4ENC_HANDLE;
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/library_register.c b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/library_register.c
index 20e4eb8..467eba2 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/library_register.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/library_register.c
@@ -42,23 +42,23 @@
OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **ppSECComponent)
{
- FunctionIn();
+ FunctionIn();
- if (ppSECComponent == NULL)
- goto EXIT;
+ if (ppSECComponent == NULL)
+ goto EXIT;
- /* component 1 - video encoder MPEG4 */
- SEC_OSAL_Strcpy(ppSECComponent[0]->componentName, SEC_OMX_COMPOMENT_MPEG4_ENC);
- SEC_OSAL_Strcpy(ppSECComponent[0]->roles[0], SEC_OMX_COMPOMENT_MPEG4_ENC_ROLE);
- ppSECComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+ /* component 1 - video encoder MPEG4 */
+ SEC_OSAL_Strcpy(ppSECComponent[0]->componentName, SEC_OMX_COMPONENT_MPEG4_ENC);
+ SEC_OSAL_Strcpy(ppSECComponent[0]->roles[0], SEC_OMX_COMPONENT_MPEG4_ENC_ROLE);
+ ppSECComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
- /* component 2 - video encoder H.263 */
- SEC_OSAL_Strcpy(ppSECComponent[1]->componentName, SEC_OMX_COMPOMENT_H263_ENC);
- SEC_OSAL_Strcpy(ppSECComponent[1]->roles[0], SEC_OMX_COMPOMENT_H263_ENC_ROLE);
- ppSECComponent[1]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+ /* component 2 - video encoder H.263 */
+ SEC_OSAL_Strcpy(ppSECComponent[1]->componentName, SEC_OMX_COMPONENT_H263_ENC);
+ SEC_OSAL_Strcpy(ppSECComponent[1]->roles[0], SEC_OMX_COMPONENT_H263_ENC_ROLE);
+ ppSECComponent[1]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
- FunctionOut();
- return MAX_COMPONENT_NUM;
+ FunctionOut();
+ return MAX_COMPONENT_NUM;
}
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/library_register.h b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/library_register.h
index 3b23011..e172d51 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/library_register.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/library_register.h
@@ -37,12 +37,12 @@
#define MAX_COMPONENT_ROLE_NUM 1
/* MPEG4 */
-#define SEC_OMX_COMPOMENT_MPEG4_ENC "OMX.SEC.MPEG4.Encoder"
-#define SEC_OMX_COMPOMENT_MPEG4_ENC_ROLE "video_encoder.mpeg4"
+#define SEC_OMX_COMPONENT_MPEG4_ENC "OMX.SEC.MPEG4.Encoder"
+#define SEC_OMX_COMPONENT_MPEG4_ENC_ROLE "video_encoder.mpeg4"
/* H.263 */
-#define SEC_OMX_COMPOMENT_H263_ENC "OMX.SEC.H263.Encoder"
-#define SEC_OMX_COMPOMENT_H263_ENC_ROLE "video_encoder.h263"
+#define SEC_OMX_COMPONENT_H263_ENC "OMX.SEC.H263.Encoder"
+#define SEC_OMX_COMPONENT_H263_ENC_ROLE "video_encoder.h263"
#ifdef __cplusplus
diff --git a/sec_mm/sec_omx/sec_omx_core/Android.mk b/sec_mm/sec_omx/sec_omx_core/Android.mk
index cb01274..ddc3c4d 100644
--- a/sec_mm/sec_omx/sec_omx_core/Android.mk
+++ b/sec_mm/sec_omx/sec_omx_core/Android.mk
@@ -6,7 +6,7 @@ LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := SEC_OMX_Component_Register.c \
SEC_OMX_Core.c
-LOCAL_PRELINK_MODULE := false
+
LOCAL_MODULE := libSEC_OMX_Core.aries
LOCAL_CFLAGS :=
diff --git a/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Def.h b/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Def.h
index 10dd94d..10b6144 100644
--- a/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Def.h
+++ b/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Def.h
@@ -16,10 +16,10 @@
*/
/*
- * @file SEC_OMX_Def.h
- * @brief SEC_OMX specific define
- * @author SeungBeom Kim (sbcrux.kim@samsung.com)
- * @version 1.0
+ * @file SEC_OMX_Def.h
+ * @brief SEC_OMX specific define
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
* @history
* 2010.7.15 : Create
*/
@@ -43,83 +43,99 @@
#define MAX_OMX_COMPONENT_LIBNAME_SIZE OMX_MAX_STRINGNAME_SIZE * 2
#define MAX_OMX_MIMETYPE_SIZE OMX_MAX_STRINGNAME_SIZE
-#define MAX_TIMESTAMP 16
-#define MAX_FLAGS 16
+#define MAX_TIMESTAMP 17
+#define MAX_FLAGS 17
+
+#define USE_ANDROID_EXTENSION
typedef enum _SEC_CODEC_TYPE
{
- SW_CODEC,
- HW_VIDEO_CODEC,
- HW_AUDIO_CODEC
+ SW_CODEC,
+ HW_VIDEO_CODEC,
+ HW_AUDIO_CODEC
} SEC_CODEC_TYPE;
typedef struct _SEC_OMX_PRIORITYMGMTTYPE
{
- OMX_U32 nGroupPriority; /* the value 0 represents the highest priority */
- /* for a group of components */
- OMX_U32 nGroupID;
+ OMX_U32 nGroupPriority; /* the value 0 represents the highest priority */
+ /* for a group of components */
+ OMX_U32 nGroupID;
} SEC_OMX_PRIORITYMGMTTYPE;
typedef enum _SEC_OMX_INDEXTYPE
{
- OMX_IndexVendorThumbnailMode = 0x7F000001,
- OMX_COMPONENT_CAPABILITY_TYPE_INDEX = 0xFF7A347 /*for Android*/
+#define SEC_INDEX_PARAM_ENABLE_THUMBNAIL "OMX.SEC.index.ThumbnailMode"
+ OMX_IndexVendorThumbnailMode = 0x7F000001,
+
+ /* for Android Native Window */
+#define SEC_INDEX_PARAM_ENABLE_ANB "OMX.google.android.index.enableAndroidNativeBuffers"
+ OMX_IndexParamEnableAndroidBuffers = 0x7F000011,
+#define SEC_INDEX_PARAM_GET_ANB "OMX.google.android.index.getAndroidNativeBufferUsage"
+ OMX_IndexParamGetAndroidNativeBuffer = 0x7F000012,
+#define SEC_INDEX_PARAM_USE_ANB "OMX.google.android.index.useAndroidNativeBuffer"
+ OMX_IndexParamUseAndroidNativeBuffer = 0x7F000013,
+ /* for Android Store Metadata Inbuffer */
+#define SEC_INDEX_PARAM_STORE_METADATA_BUFFER "OMX.google.android.index.storeMetaDataInBuffers"
+ OMX_IndexParamStoreMetaDataBuffer = 0x7F000014,
+
+ /* for Android PV OpenCore*/
+ OMX_COMPONENT_CAPABILITY_TYPE_INDEX = 0xFF7A347
} SEC_OMX_INDEXTYPE;
typedef enum _SEC_OMX_ERRORTYPE
{
- OMX_ErrorNoEOF = 0x90000001,
- OMX_ErrorInputDataDecodeYet,
- OMX_ErrorInputDataEncodeYet,
- OMX_ErrorMFCInit
+ OMX_ErrorNoEOF = 0x90000001,
+ OMX_ErrorInputDataDecodeYet,
+ OMX_ErrorInputDataEncodeYet,
+ OMX_ErrorMFCInit
} SEC_OMX_ERRORTYPE;
typedef enum _SEC_OMX_COMMANDTYPE
{
- SEC_OMX_CommandComponentDeInit = 0x7F000001,
- SEC_OMX_CommandEmptyBuffer,
- SEC_OMX_CommandFillBuffer
+ SEC_OMX_CommandComponentDeInit = 0x7F000001,
+ SEC_OMX_CommandEmptyBuffer,
+ SEC_OMX_CommandFillBuffer
} SEC_OMX_COMMANDTYPE;
typedef enum _SEC_OMX_TRANS_STATETYPE {
- SEC_OMX_TransStateInvalid,
- SEC_OMX_TransStateLoadedToIdle,
- SEC_OMX_TransStateIdleToExecuting,
- SEC_OMX_TransStateExecutingToIdle,
- SEC_OMX_TransStateIdleToLoaded,
- SEC_OMX_TransStateMax = 0X7FFFFFFF
+ SEC_OMX_TransStateInvalid,
+ SEC_OMX_TransStateLoadedToIdle,
+ SEC_OMX_TransStateIdleToExecuting,
+ SEC_OMX_TransStateExecutingToIdle,
+ SEC_OMX_TransStateIdleToLoaded,
+ SEC_OMX_TransStateMax = 0X7FFFFFFF
} SEC_OMX_TRANS_STATETYPE;
typedef enum _SEC_OMX_COLOR_FORMATTYPE {
-#ifndef USE_SAMSUNG_COLORFORMAT
- SEC_OMX_COLOR_FormatNV12PhysicalAddress = OMX_COLOR_FormatYUV420SemiPlanar
-#else
- SEC_OMX_COLOR_FormatNV12PhysicalAddress = 0x7F000001 /**< Reserved region for introducing Vendor Extensions */
-#endif
+ OMX_SEC_COLOR_FormatNV12TPhysicalAddress = 0x7F000001, /**< Reserved region for introducing Vendor Extensions */
+ /* for Android Native Window */
+ OMX_SEC_COLOR_FormatANBYUV420SemiPlanar = 0x100,
+ /* for Android surface texture encode */
+ OMX_COLOR_FormatAndroidOpaque = 0x7F000789
}SEC_OMX_COLOR_FORMATTYPE;
typedef enum _SEC_OMX_SUPPORTFORMAT_TYPE
{
- supportFormat_1 = 0x00,
- supportFormat_2,
- supportFormat_3,
- supportFormat_4
+ supportFormat_0 = 0x00,
+ supportFormat_1,
+ supportFormat_2,
+ supportFormat_3
} SEC_OMX_SUPPORTFORMAT_TYPE;
/* for Android */
typedef struct _OMXComponentCapabilityFlagsType
{
- /* OMX COMPONENT CAPABILITY RELATED MEMBERS */
- OMX_BOOL iIsOMXComponentMultiThreaded;
- OMX_BOOL iOMXComponentSupportsExternalOutputBufferAlloc;
- OMX_BOOL iOMXComponentSupportsExternalInputBufferAlloc;
- OMX_BOOL iOMXComponentSupportsMovableInputBuffers;
- OMX_BOOL iOMXComponentSupportsPartialFrames;
- OMX_BOOL iOMXComponentUsesNALStartCodes;
- OMX_BOOL iOMXComponentCanHandleIncompleteFrames;
- OMX_BOOL iOMXComponentUsesFullAVCFrames;
+ /* OMX COMPONENT CAPABILITY RELATED MEMBERS */
+ OMX_BOOL iIsOMXComponentMultiThreaded;
+ OMX_BOOL iOMXComponentSupportsExternalOutputBufferAlloc;
+ OMX_BOOL iOMXComponentSupportsExternalInputBufferAlloc;
+ OMX_BOOL iOMXComponentSupportsMovableInputBuffers;
+ OMX_BOOL iOMXComponentSupportsPartialFrames;
+ OMX_BOOL iOMXComponentUsesNALStartCodes;
+ OMX_BOOL iOMXComponentCanHandleIncompleteFrames;
+ OMX_BOOL iOMXComponentUsesFullAVCFrames;
} OMXComponentCapabilityFlagsType;
typedef struct _SEC_OMX_VIDEO_PROFILELEVEL
diff --git a/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Macros.h b/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Macros.h
index b3bfda6..1debc62 100644
--- a/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Macros.h
+++ b/sec_mm/sec_omx/sec_omx_include/sec/SEC_OMX_Macros.h
@@ -16,10 +16,10 @@
*/
/*
- * @file SEC_OMX_Macros.h
- * @brief Macros
- * @author SeungBeom Kim (sbcrux.kim@samsung.com)
- * @version 1.0
+ * @file SEC_OMX_Macros.h
+ * @brief Macros
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
* @history
* 2010.7.15 : Create
*/
@@ -38,15 +38,15 @@
#define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7)
#define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13)
-#define INIT_SET_SIZE_VERSION(_struct_, _structType_) \
- do { \
- SEC_OSAL_Memset((_struct_), 0, sizeof(_structType_)); \
- (_struct_)->nSize = sizeof(_structType_); \
- (_struct_)->nVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; \
- (_struct_)->nVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; \
- (_struct_)->nVersion.s.nRevision = REVISION_NUMBER; \
- (_struct_)->nVersion.s.nStep = STEP_NUMBER; \
- } while (0)
+#define INIT_SET_SIZE_VERSION(_struct_, _structType_) \
+ do { \
+ SEC_OSAL_Memset((_struct_), 0, sizeof(_structType_)); \
+ (_struct_)->nSize = sizeof(_structType_); \
+ (_struct_)->nVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; \
+ (_struct_)->nVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; \
+ (_struct_)->nVersion.s.nRevision = REVISION_NUMBER; \
+ (_struct_)->nVersion.s.nStep = STEP_NUMBER; \
+ } while (0)
/*
* Port Specific
diff --git a/sec_mm/sec_omx/sec_osal/Android.mk b/sec_mm/sec_omx/sec_osal/Android.mk
index b474876..dfd3d82 100644
--- a/sec_mm/sec_omx/sec_osal/Android.mk
+++ b/sec_mm/sec_omx/sec_osal/Android.mk
@@ -12,18 +12,28 @@ LOCAL_SRC_FILES := \
SEC_OSAL_Memory.c \
SEC_OSAL_Semaphore.c \
SEC_OSAL_Library.c \
- SEC_OSAL_Log.c
+ SEC_OSAL_Log.c \
+ SEC_OSAL_Buffer.cpp
+
-LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libsecosal.aries
LOCAL_CFLAGS :=
LOCAL_STATIC_LIBRARIES :=
-LOCAL_SHARED_LIBRARIES := libcutils libutils
+
+LOCAL_SHARED_LIBRARIES := libcutils libutils \
+ libui \
+ libhardware \
+ libandroid_runtime \
+ libsurfaceflinger_client \
+ libbinder \
+ libmedia
LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
$(SEC_OMX_INC)/sec \
- $(SEC_OMX_TOP)/sec_osal
+ $(SEC_OMX_TOP)/sec_osal \
+ $(SEC_OMX_COMPONENT)/common \
+ $(SEC_OMX_TOP)/../../include
include $(BUILD_STATIC_LIBRARY)
diff --git a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.cpp b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.cpp
new file mode 100644
index 0000000..949fc19
--- /dev/null
+++ b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.cpp
@@ -0,0 +1,450 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * 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.
+ */
+
+/*
+ * @file SEC_OSAL_Buffer.c
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * Jinsung Yang (jsgood.yang@samsung.com)
+ * @version 1.0.2
+ * @history
+ * 2011.5.15 : Create
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OMX_Def.h"
+#include "SEC_OMX_Macros.h"
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_Buffer.h"
+#include "SEC_OMX_Basecomponent.h"
+
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <ui/android_native_buffer.h>
+#include <ui/GraphicBuffer.h>
+#include <ui/GraphicBufferMapper.h>
+#include <ui/Rect.h>
+#include <media/stagefright/HardwareAPI.h>
+#include <hardware/hardware.h>
+#include <media/stagefright/MetadataBufferType.h>
+#include "hal_public.h"
+
+#define HAL_PIXEL_FORMAT_C110_NV12 0x100
+
+using namespace android;
+
+
+struct AndroidNativeBuffersParams {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+};
+
+#ifdef USE_ANDROID_EXTENSION
+OMX_ERRORTYPE checkVersionANB(OMX_PTR ComponentParameterStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_VERSIONTYPE* version = NULL;
+
+
+ AndroidNativeBuffersParams *pANBP;
+ pANBP = (AndroidNativeBuffersParams *)ComponentParameterStructure;
+
+ version = (OMX_VERSIONTYPE*)((char*)pANBP + sizeof(OMX_U32));
+ if (*((OMX_U32*)pANBP) <= sizeof(AndroidNativeBuffersParams)) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ if (version->s.nVersionMajor != VERSIONMAJOR_NUMBER ||
+ version->s.nVersionMinor != VERSIONMINOR_NUMBER) {
+ ret = OMX_ErrorVersionMismatch;
+ goto EXIT;
+ }
+
+ ret = OMX_ErrorNone;
+
+EXIT:
+ return ret;
+}
+
+OMX_U32 checkPortIndexANB(OMX_PTR ComponentParameterStructure)
+{
+ AndroidNativeBuffersParams *pANBP;
+ pANBP = (AndroidNativeBuffersParams *)ComponentParameterStructure;
+
+ return pANBP->nPortIndex;
+}
+
+OMX_U32 getMetadataBufferType(const uint8_t *ptr)
+{
+ OMX_U32 type = *(OMX_U32 *) ptr;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "getMetadataBufferType: %ld", type);
+ return type;
+}
+
+OMX_U32 getVADDRfromANB(OMX_PTR pUnreadableBuffer, OMX_U32 Width, OMX_U32 Height, void *pVirAddrs[])
+{
+ OMX_U32 ret = 0;
+ android_native_buffer_t *buf;
+ void *readableBuffer;
+ GraphicBufferMapper &mapper = GraphicBufferMapper::get();
+ Rect bounds(Width, Height);
+
+ FunctionIn();
+
+ buf = (android_native_buffer_t *)pUnreadableBuffer;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "pUnreadableBuffer:0x%x, buf:0x%x, buf->handle:0x%x",
+ pUnreadableBuffer, buf, buf->handle);
+
+ ret = mapper.lock(buf->handle, GRALLOC_USAGE_SW_WRITE_OFTEN, bounds, pVirAddrs);
+ if (ret != 0) {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "mapper.lock Error, Error code:%d", ret);
+ }
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_U32 putVADDRtoANB(OMX_PTR pUnreadableBuffer)
+{
+ android_native_buffer_t *buf;
+ void *readableBuffer;
+ int ret = 0;
+ GraphicBufferMapper &mapper = GraphicBufferMapper::get();
+
+ FunctionIn();
+
+ buf = (android_native_buffer_t *)pUnreadableBuffer;
+
+ FunctionOut();
+
+ return mapper.unlock(buf->handle);
+}
+
+OMX_ERRORTYPE enableAndroidNativeBuffer(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_OMX_BASEPORT *pSECPort = NULL;
+
+ EnableAndroidNativeBuffersParams *peanbp;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+ peanbp = (EnableAndroidNativeBuffersParams *)ComponentParameterStructure;
+ pSECPort = &pSECComponent->pSECPort[peanbp->nPortIndex];
+
+ if (peanbp->enable == OMX_FALSE) {
+ SEC_OSAL_Log(SEC_LOG_TRACE, "disable AndroidNativeBuffer");
+ pSECPort->bUseAndroidNativeBuffer = OMX_FALSE;
+ } else {
+ SEC_OSAL_Log(SEC_LOG_TRACE, "enable AndroidNativeBuffer");
+ pSECPort->bUseAndroidNativeBuffer = OMX_TRUE;
+ pSECPort->portDefinition.format.video.eColorFormat = (OMX_COLOR_FORMATTYPE)OMX_SEC_COLOR_FormatANBYUV420SemiPlanar;
+ }
+
+ ret = OMX_ErrorNone;
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_ERRORTYPE getAndroidNativeBuffer(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_OMX_BASEPORT *pSECPort = NULL;
+
+ GetAndroidNativeBufferUsageParams *pganbp;
+
+ FunctionIn();
+
+ pganbp = (GetAndroidNativeBufferUsageParams *)ComponentParameterStructure;
+
+ pganbp->nUsage = GRALLOC_USAGE_SW_WRITE_OFTEN;
+
+ ret = OMX_ErrorNone;
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_ERRORTYPE UseBufferANB(
+ OMX_IN OMX_HANDLETYPE hComponent,
+ OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr,
+ OMX_IN OMX_U32 nPortIndex,
+ OMX_IN OMX_PTR pAppPrivate,
+ OMX_IN OMX_U32 nSizeBytes,
+ OMX_IN OMX_U8 *pBuffer)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_OMX_BASEPORT *pSECPort = NULL;
+ OMX_BUFFERHEADERTYPE *temp_bufferHeader = NULL;
+ int i = 0;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+ pSECPort = &pSECComponent->pSECPort[nPortIndex];
+ if (nPortIndex >= pSECComponent->portParam.nPorts) {
+ ret = OMX_ErrorBadPortIndex;
+ goto EXIT;
+ }
+ if (pSECPort->portState != OMX_StateIdle) {
+ ret = OMX_ErrorIncorrectStateOperation;
+ goto EXIT;
+ }
+
+ if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+ ret = OMX_ErrorBadPortIndex;
+ goto EXIT;
+ }
+
+ temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)SEC_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE));
+ if (temp_bufferHeader == NULL) {
+ ret = OMX_ErrorInsufficientResources;
+ goto EXIT;
+ }
+ SEC_OSAL_Memset(temp_bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE));
+
+ for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+ if (pSECPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) {
+ pSECPort->bufferHeader[i] = temp_bufferHeader;
+ pSECPort->bufferStateAllocate[i] = (BUFFER_STATE_ASSIGNED | HEADER_STATE_ALLOCATED);
+ INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE);
+ temp_bufferHeader->pBuffer = pBuffer;
+ temp_bufferHeader->nAllocLen = nSizeBytes;
+ temp_bufferHeader->pAppPrivate = pAppPrivate;
+ if (nPortIndex == INPUT_PORT_INDEX)
+ temp_bufferHeader->nInputPortIndex = INPUT_PORT_INDEX;
+ else
+ temp_bufferHeader->nOutputPortIndex = OUTPUT_PORT_INDEX;
+
+ pSECPort->assignedBufferNum++;
+ if (pSECPort->assignedBufferNum == pSECPort->portDefinition.nBufferCountActual) {
+ pSECPort->portDefinition.bPopulated = OMX_TRUE;
+ /* SEC_OSAL_MutexLock(pSECComponent->compMutex); */
+ SEC_OSAL_SemaphorePost(pSECPort->loadedResource);
+ /* SEC_OSAL_MutexUnlock(pSECComponent->compMutex); */
+ }
+ *ppBufferHdr = temp_bufferHeader;
+ ret = OMX_ErrorNone;
+ goto EXIT;
+ }
+ }
+
+ SEC_OSAL_Free(temp_bufferHeader);
+ ret = OMX_ErrorInsufficientResources;
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_ERRORTYPE useAndroidNativeBuffer(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_OMX_BASEPORT *pSECPort = NULL;
+ OMX_U32 frameSize = 0;
+ OMX_U32 bufWidth, bufHeight;
+ UseAndroidNativeBufferParams *puanbp;
+
+ FunctionIn();
+
+ puanbp = (UseAndroidNativeBufferParams *)ComponentParameterStructure;
+
+ OMX_PTR buffer = (void *)puanbp->nativeBuffer.get();
+ android_native_buffer_t *buf = (android_native_buffer_t *)buffer;
+ bufWidth = ((buf->width + 15) / 16) * 16;
+ bufHeight = ((buf->height + 15) / 16) * 16;
+ frameSize = (bufWidth * bufHeight * 3) / 2;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "buffer:0x%x, buf:0x%x, buf->handle:0x%x", buffer, buf, buf->handle);
+
+ ret = UseBufferANB(hComponent, puanbp->bufferHeader, puanbp->nPortIndex,
+ puanbp->pAppPrivate, frameSize, (OMX_U8 *)buffer);
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_ERRORTYPE enableStoreMetaDataInBuffers(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_OMX_BASEPORT *pSECPort = NULL;
+
+ StoreMetaDataInBuffersParams *pStoreMetaData;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+ pStoreMetaData = (StoreMetaDataInBuffersParams*)ComponentParameterStructure;
+ pSECPort = &pSECComponent->pSECPort[pStoreMetaData->nPortIndex];
+
+ if (pStoreMetaData->bStoreMetaData == OMX_FALSE) {
+ SEC_OSAL_Log(SEC_LOG_TRACE, "disable StoreMetaDataInBuffers");
+ pSECPort->bStoreMetaDataInBuffer = OMX_FALSE;
+ } else {
+ SEC_OSAL_Log(SEC_LOG_TRACE, "enable StoreMetaDataInBuffers");
+ pSECPort->bStoreMetaDataInBuffer = OMX_TRUE;
+ }
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_BOOL isMetadataBufferTypeGrallocSource(OMX_BYTE pInputDataBuffer)
+{
+ OMX_U32 type = getMetadataBufferType(pInputDataBuffer);
+
+ if (type == kMetadataBufferTypeGrallocSource)
+ return OMX_TRUE;
+ else
+ return OMX_FALSE;
+}
+
+OMX_ERRORTYPE preprocessMetaDataInBuffers(OMX_HANDLETYPE hComponent, OMX_BYTE pInputDataBuffer, BUFFER_ADDRESS_INFO *pInputInfo)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_OMX_BASEPORT *pSECPort = NULL;
+ OMX_U32 type = 0;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+ pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+
+ type = getMetadataBufferType(pInputDataBuffer);
+ if (type == kMetadataBufferTypeCameraSource) {
+ SEC_OSAL_Memcpy(&pInputInfo->YPhyAddr, pInputDataBuffer + 4, sizeof(void *));
+ SEC_OSAL_Memcpy(&pInputInfo->CPhyAddr, pInputDataBuffer + 4 + sizeof(void *), sizeof(void *));
+ } else if (type == kMetadataBufferTypeGrallocSource){
+ IMG_gralloc_module_public_t *module = (IMG_gralloc_module_public_t *)pSECPort->pIMGGrallocModule;
+ OMX_PTR pUnreadableBuffer = NULL;
+ OMX_PTR pReadableBuffer = NULL;
+ OMX_PTR pVirAddrs[3];
+ int err = 0;
+
+ pVirAddrs[0] = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YVirAddr;
+ pVirAddrs[1] = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CVirAddr;
+ pVirAddrs[2] = NULL;
+
+ if (module == NULL) {
+ err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **)&module);
+ if(err) {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "hw_get_module failed (err=%d)\n", err);
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
+ }
+ pSECPort->pIMGGrallocModule = (OMX_PTR)module;
+ }
+
+ /**************************************/
+ /* IMG CSC RGB to NV12 */
+ /**************************************/
+ buffer_handle_t buf = *((buffer_handle_t *) (pInputDataBuffer + 4));
+ SEC_OSAL_Log(SEC_LOG_TRACE, "buffer handle %p)\n", buf);
+ err = module->Blit(module, buf, pVirAddrs, HAL_PIXEL_FORMAT_C110_NV12);
+ if(err) {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "module->Blit() failed (err=%d)\n", err);
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
+ }
+
+ pInputInfo->YPhyAddr = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YPhyAddr;
+ pInputInfo->CPhyAddr = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CPhyAddr;
+ } else {
+ ret = OMX_ErrorNotImplemented;
+ goto EXIT;
+ }
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+#endif
diff --git a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.h b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.h
new file mode 100644
index 0000000..da7e8f3
--- /dev/null
+++ b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.h
@@ -0,0 +1,64 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * 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.
+ */
+
+/*
+ * @file SEC_OSAL_Buffer.h
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * Jinsung Yang (jsgood.yang@samsung.com)
+ * @version 1.0.2
+ * @history
+ * 2011.5.15 : Create
+ */
+
+#ifndef SEC_OSAL_BUFFER
+#define SEC_OSAL_BUFFER
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "OMX_Types.h"
+
+typedef struct {
+ void *YPhyAddr; // [IN/OUT] physical address of Y
+ void *CPhyAddr; // [IN/OUT] physical address of CbCr
+ void *YVirAddr; // [IN/OUT] virtual address of Y
+ void *CVirAddr; // [IN/OUT] virtual address of CbCr
+ int YSize; // [IN/OUT] input size of Y data
+ int CSize; // [IN/OUT] input size of CbCr data
+} BUFFER_ADDRESS_INFO;
+
+
+OMX_ERRORTYPE checkVersionANB(OMX_PTR ComponentParameterStructure);
+OMX_U32 checkPortIndexANB(OMX_PTR ComponentParameterStructure);
+OMX_U32 getMetadataBufferType(const uint8_t *ptr);
+OMX_ERRORTYPE enableAndroidNativeBuffer(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure);
+OMX_ERRORTYPE getAndroidNativeBuffer(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure);
+OMX_ERRORTYPE useAndroidNativeBuffer(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure);
+OMX_U32 getVADDRfromANB(OMX_PTR pUnreadableBuffer, OMX_U32 Width, OMX_U32 Height, void *vaddress[]);
+OMX_U32 putVADDRtoANB(OMX_PTR pUnreadableBuffer);
+OMX_ERRORTYPE enableStoreMetaDataInBuffers(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure);
+OMX_BOOL isMetadataBufferTypeGrallocSource(OMX_BYTE pInputDataBuffer);
+OMX_ERRORTYPE preprocessMetaDataInBuffers(OMX_HANDLETYPE hComponent, OMX_BYTE pInputDataBuffer, BUFFER_ADDRESS_INFO *pInputInfo);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h
index 68910cc..3f0938f 100644
--- a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h
+++ b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h
@@ -33,11 +33,10 @@
#define MAX_QUEUE_ELEMENTS 10
-struct SEC_QElem;
typedef struct _SEC_QElem
{
- void *data;
- struct SEC_QElem *qNext;
+ void *data;
+ struct _SEC_QElem *qNext;
} SEC_QElem;
typedef struct _SEC_QUEUE
diff --git a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Semaphore.c b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Semaphore.c
index 17a29a0..94bc9c8 100644
--- a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Semaphore.c
+++ b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Semaphore.c
@@ -43,7 +43,7 @@ OMX_ERRORTYPE SEC_OSAL_SemaphoreCreate(OMX_HANDLETYPE *semaphoreHandle)
{
sem_t *sema;
- sema = (sem_t *)SEC_OSAL_Malloc(sizeof(sema));
+ sema = (sem_t *)SEC_OSAL_Malloc(sizeof(sem_t));
if (!sema)
return OMX_ErrorInsufficientResources;
diff --git a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.c b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.c
index d488885..3b69d30 100644
--- a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.c
+++ b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.c
@@ -125,7 +125,7 @@ EXIT:
}
-OMX_ERRORTYPE SEC_OSAL_ThreadCancle(OMX_HANDLETYPE threadHandle)
+OMX_ERRORTYPE SEC_OSAL_ThreadCancel(OMX_HANDLETYPE threadHandle)
{
SEC_THREAD_HANDLE_TYPE *thread = (SEC_THREAD_HANDLE_TYPE *)threadHandle;
@@ -140,7 +140,7 @@ OMX_ERRORTYPE SEC_OSAL_ThreadCancle(OMX_HANDLETYPE threadHandle)
return OMX_ErrorNone;
}
-void SEC_OSAL_TheadExit(void *value_ptr)
+void SEC_OSAL_ThreadExit(void *value_ptr)
{
pthread_exit(value_ptr);
return;
diff --git a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.h b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.h
index b932aef..ccd2609 100644
--- a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.h
+++ b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.h
@@ -37,8 +37,8 @@ extern "C" {
OMX_ERRORTYPE SEC_OSAL_ThreadCreate(OMX_HANDLETYPE *threadHandle, OMX_PTR function_name, OMX_PTR argument);
OMX_ERRORTYPE SEC_OSAL_ThreadTerminate(OMX_HANDLETYPE threadHandle);
-OMX_ERRORTYPE SEC_OSAL_ThreadCancle(OMX_HANDLETYPE threadHandle);
-void SEC_OSAL_TheadExit(void *value_ptr);
+OMX_ERRORTYPE SEC_OSAL_ThreadCancel(OMX_HANDLETYPE threadHandle);
+void SEC_OSAL_ThreadExit(void *value_ptr);
void SEC_OSAL_SleepMillisec(OMX_U32 ms);
#ifdef __cplusplus