Commit | Line | Data |
---|---|---|
c6f4bc34 YK |
1 | /* |
2 | * | |
3 | * Copyright 2012 Samsung Electronics S.LSI Co. LTD | |
4 | * | |
5 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | * you may not use this file except in compliance with the License. | |
7 | * You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | */ | |
17 | ||
18 | /* | |
19 | * @file Exynos_OMX_Vdec.h | |
20 | * @brief | |
21 | * @author SeungBeom Kim (sbcrux.kim@samsung.com) | |
22 | * HyeYeon Chung (hyeon.chung@samsung.com) | |
23 | * Yunji Kim (yunji.kim@samsung.com) | |
24 | * @version 2.0.0 | |
25 | * @history | |
26 | * 2012.02.20 : Create | |
27 | */ | |
28 | ||
29 | #ifndef EXYNOS_OMX_VIDEO_DECODE | |
30 | #define EXYNOS_OMX_VIDEO_DECODE | |
31 | ||
32 | #include "OMX_Component.h" | |
33 | #include "Exynos_OMX_Def.h" | |
34 | #include "Exynos_OSAL_Queue.h" | |
35 | #include "Exynos_OMX_Baseport.h" | |
36 | #include "Exynos_OMX_Basecomponent.h" | |
c6f4bc34 YK |
37 | |
38 | #define MAX_VIDEO_INPUTBUFFER_NUM 5 | |
39 | #define MAX_VIDEO_OUTPUTBUFFER_NUM 2 | |
40 | ||
41 | #define DEFAULT_FRAME_WIDTH 176 | |
42 | #define DEFAULT_FRAME_HEIGHT 144 | |
43 | ||
44 | #define DEFAULT_VIDEO_INPUT_BUFFER_SIZE (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT) * 2 | |
45 | #define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT * 3) / 2 | |
46 | ||
47 | #define MFC_INPUT_BUFFER_NUM_MAX 3 | |
48 | #define DEFAULT_MFC_INPUT_BUFFER_SIZE 1920 * 1080 * 3 / 2 | |
49 | ||
50 | #define MFC_OUTPUT_BUFFER_NUM_MAX 16 * 2 | |
51 | #define DEFAULT_MFC_OUTPUT_YBUFFER_SIZE 1920 * 1080 | |
52 | #define DEFAULT_MFC_OUTPUT_CBUFFER_SIZE 1920 * 1080 / 2 | |
53 | ||
54 | #define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 1 | |
433e798a EC |
55 | #ifdef USE_DUALDPB_MODE |
56 | #define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX 5 | |
57 | #else | |
c6f4bc34 | 58 | #define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX 4 |
433e798a | 59 | #endif |
c6f4bc34 YK |
60 | |
61 | #define EXTRA_DPB_NUM 5 | |
62 | ||
433e798a EC |
63 | #define MFC_DEFAULT_INPUT_BUFFER_PLANE 1 |
64 | #define MFC_DEFAULT_OUTPUT_BUFFER_PLANE 2 | |
65 | ||
66 | #define MAX_INPUTBUFFER_NUM_DYNAMIC 0 /* Dynamic number of metadata buffer */ | |
c6f4bc34 | 67 | |
743cabb0 SK |
68 | #define PLATFORM_DISPLAY_BUFFER 2 |
69 | ||
c6f4bc34 YK |
70 | typedef struct |
71 | { | |
72 | void *pAddrY; | |
73 | void *pAddrC; | |
74 | } CODEC_DEC_ADDR_INFO; | |
75 | ||
433e798a EC |
76 | typedef struct _BYPASS_BUFFER_INFO |
77 | { | |
78 | OMX_U32 nFlags; | |
79 | OMX_TICKS timeStamp; | |
80 | } BYPASS_BUFFER_INFO; | |
81 | ||
c6f4bc34 YK |
82 | typedef struct _CODEC_DEC_BUFFER |
83 | { | |
84 | void *pVirAddr[MAX_BUFFER_PLANE]; /* virtual address */ | |
85 | int bufferSize[MAX_BUFFER_PLANE]; /* buffer alloc size */ | |
86 | int fd[MAX_BUFFER_PLANE]; /* buffer FD */ | |
87 | int dataSize; /* total data length */ | |
88 | } CODEC_DEC_BUFFER; | |
89 | ||
90 | typedef struct _DECODE_CODEC_EXTRA_BUFFERINFO | |
91 | { | |
92 | /* For Decode Output */ | |
93 | OMX_U32 imageWidth; | |
94 | OMX_U32 imageHeight; | |
95 | OMX_COLOR_FORMATTYPE ColorFormat; | |
96 | } DECODE_CODEC_EXTRA_BUFFERINFO; | |
97 | ||
98 | typedef struct _EXYNOS_OMX_VIDEODEC_COMPONENT | |
99 | { | |
100 | OMX_HANDLETYPE hCodecHandle; | |
101 | OMX_BOOL bThumbnailMode; | |
c70316c7 | 102 | OMX_BOOL bDTSMode; /* true:Decoding Time Stamp, false:Presentation Time Stamp */ |
c6f4bc34 | 103 | OMX_BOOL bFirstFrame; |
433e798a EC |
104 | OMX_BOOL bQosChanged; |
105 | OMX_U32 nQosRatio; | |
c6f4bc34 YK |
106 | CODEC_DEC_BUFFER *pMFCDecInputBuffer[MFC_INPUT_BUFFER_NUM_MAX]; |
107 | CODEC_DEC_BUFFER *pMFCDecOutputBuffer[MFC_OUTPUT_BUFFER_NUM_MAX]; | |
108 | ||
109 | /* Buffer Process */ | |
110 | OMX_BOOL bExitBufferProcessThread; | |
111 | OMX_HANDLETYPE hSrcInputThread; | |
112 | OMX_HANDLETYPE hSrcOutputThread; | |
113 | OMX_HANDLETYPE hDstInputThread; | |
114 | OMX_HANDLETYPE hDstOutputThread; | |
115 | ||
116 | /* Shared Memory Handle */ | |
117 | OMX_HANDLETYPE hSharedMemory; | |
118 | ||
119 | /* For DRM Play */ | |
120 | OMX_BOOL bDRMPlayerMode; | |
121 | ||
405399e5 TK |
122 | /* For Reconfiguration DPB */ |
123 | OMX_BOOL bReconfigDPB; | |
124 | OMX_U32 nSavedDPBCnt; | |
125 | ||
433e798a EC |
126 | /* For Dual DPB */ |
127 | OMX_BOOL bDualDPBMode; | |
128 | ||
c6f4bc34 YK |
129 | /* CSC handle */ |
130 | OMX_PTR csc_handle; | |
131 | OMX_U32 csc_set_format; | |
132 | ||
133 | OMX_ERRORTYPE (*exynos_codec_srcInputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData); | |
134 | OMX_ERRORTYPE (*exynos_codec_srcOutputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData); | |
135 | OMX_ERRORTYPE (*exynos_codec_dstInputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pOutputData); | |
136 | OMX_ERRORTYPE (*exynos_codec_dstOutputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pOutputData); | |
137 | ||
138 | OMX_ERRORTYPE (*exynos_codec_start)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
139 | OMX_ERRORTYPE (*exynos_codec_stop)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
140 | OMX_ERRORTYPE (*exynos_codec_bufferProcessRun)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
141 | OMX_ERRORTYPE (*exynos_codec_enqueueAllBuffer)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
142 | ||
143 | int (*exynos_checkInputFrame) (OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag, | |
144 | OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame); | |
145 | OMX_ERRORTYPE (*exynos_codec_getCodecInputPrivateData) (OMX_PTR codecBuffer, OMX_PTR addr, OMX_U32 *size); | |
146 | OMX_ERRORTYPE (*exynos_codec_getCodecOutputPrivateData) (OMX_PTR codecBuffer, OMX_PTR addr[], OMX_U32 size[]); | |
405399e5 | 147 | OMX_ERRORTYPE (*exynos_codec_reconfigAllBuffers) (OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); |
c6f4bc34 YK |
148 | } EXYNOS_OMX_VIDEODEC_COMPONENT; |
149 | ||
150 | #ifdef __cplusplus | |
151 | extern "C" { | |
152 | #endif | |
153 | ||
c6f4bc34 YK |
154 | inline void Exynos_UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent); |
155 | OMX_BOOL Exynos_Check_BufferProcess_State(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nPortIndex); | |
156 | OMX_ERRORTYPE Exynos_Input_CodecBufferToData(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_PTR codecBuffer, EXYNOS_OMX_DATA *pData); | |
e90eb9e8 | 157 | OMX_ERRORTYPE Exynos_Output_CodecBufferToData(CODEC_DEC_BUFFER *pCodecBuffer, EXYNOS_OMX_DATA *pData); |
c6f4bc34 YK |
158 | |
159 | OMX_ERRORTYPE Exynos_OMX_SrcInputBufferProcess(OMX_HANDLETYPE hComponent); | |
160 | OMX_ERRORTYPE Exynos_OMX_SrcOutputBufferProcess(OMX_HANDLETYPE hComponent); | |
161 | OMX_ERRORTYPE Exynos_OMX_DstInputBufferProcess(OMX_HANDLETYPE hComponent); | |
162 | OMX_ERRORTYPE Exynos_OMX_DstOutputBufferProcess(OMX_HANDLETYPE hComponent); | |
163 | OMX_ERRORTYPE Exynos_OMX_VideoDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent); | |
164 | OMX_ERRORTYPE Exynos_OMX_VideoDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent); | |
165 | ||
cc46393d AS |
166 | OMX_ERRORTYPE Exynos_ResetAllPortConfig(OMX_COMPONENTTYPE *pOMXComponent); |
167 | void Exynos_Free_CodecBuffers(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
168 | ||
c6f4bc34 YK |
169 | #ifdef __cplusplus |
170 | } | |
171 | #endif | |
172 | ||
173 | #endif |