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 YK |
67 | |
68 | typedef struct | |
69 | { | |
70 | void *pAddrY; | |
71 | void *pAddrC; | |
72 | } CODEC_DEC_ADDR_INFO; | |
73 | ||
433e798a EC |
74 | typedef struct _BYPASS_BUFFER_INFO |
75 | { | |
76 | OMX_U32 nFlags; | |
77 | OMX_TICKS timeStamp; | |
78 | } BYPASS_BUFFER_INFO; | |
79 | ||
c6f4bc34 YK |
80 | typedef struct _CODEC_DEC_BUFFER |
81 | { | |
82 | void *pVirAddr[MAX_BUFFER_PLANE]; /* virtual address */ | |
83 | int bufferSize[MAX_BUFFER_PLANE]; /* buffer alloc size */ | |
84 | int fd[MAX_BUFFER_PLANE]; /* buffer FD */ | |
85 | int dataSize; /* total data length */ | |
86 | } CODEC_DEC_BUFFER; | |
87 | ||
88 | typedef struct _DECODE_CODEC_EXTRA_BUFFERINFO | |
89 | { | |
90 | /* For Decode Output */ | |
91 | OMX_U32 imageWidth; | |
92 | OMX_U32 imageHeight; | |
93 | OMX_COLOR_FORMATTYPE ColorFormat; | |
94 | } DECODE_CODEC_EXTRA_BUFFERINFO; | |
95 | ||
96 | typedef struct _EXYNOS_OMX_VIDEODEC_COMPONENT | |
97 | { | |
98 | OMX_HANDLETYPE hCodecHandle; | |
99 | OMX_BOOL bThumbnailMode; | |
c70316c7 | 100 | OMX_BOOL bDTSMode; /* true:Decoding Time Stamp, false:Presentation Time Stamp */ |
c6f4bc34 | 101 | OMX_BOOL bFirstFrame; |
433e798a EC |
102 | OMX_BOOL bQosChanged; |
103 | OMX_U32 nQosRatio; | |
c6f4bc34 YK |
104 | CODEC_DEC_BUFFER *pMFCDecInputBuffer[MFC_INPUT_BUFFER_NUM_MAX]; |
105 | CODEC_DEC_BUFFER *pMFCDecOutputBuffer[MFC_OUTPUT_BUFFER_NUM_MAX]; | |
106 | ||
107 | /* Buffer Process */ | |
108 | OMX_BOOL bExitBufferProcessThread; | |
109 | OMX_HANDLETYPE hSrcInputThread; | |
110 | OMX_HANDLETYPE hSrcOutputThread; | |
111 | OMX_HANDLETYPE hDstInputThread; | |
112 | OMX_HANDLETYPE hDstOutputThread; | |
113 | ||
114 | /* Shared Memory Handle */ | |
115 | OMX_HANDLETYPE hSharedMemory; | |
116 | ||
117 | /* For DRM Play */ | |
118 | OMX_BOOL bDRMPlayerMode; | |
119 | ||
405399e5 TK |
120 | /* For Reconfiguration DPB */ |
121 | OMX_BOOL bReconfigDPB; | |
122 | OMX_U32 nSavedDPBCnt; | |
123 | ||
433e798a EC |
124 | /* For Dual DPB */ |
125 | OMX_BOOL bDualDPBMode; | |
126 | ||
c6f4bc34 YK |
127 | /* CSC handle */ |
128 | OMX_PTR csc_handle; | |
129 | OMX_U32 csc_set_format; | |
130 | ||
131 | OMX_ERRORTYPE (*exynos_codec_srcInputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData); | |
132 | OMX_ERRORTYPE (*exynos_codec_srcOutputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData); | |
133 | OMX_ERRORTYPE (*exynos_codec_dstInputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pOutputData); | |
134 | OMX_ERRORTYPE (*exynos_codec_dstOutputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pOutputData); | |
135 | ||
136 | OMX_ERRORTYPE (*exynos_codec_start)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
137 | OMX_ERRORTYPE (*exynos_codec_stop)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
138 | OMX_ERRORTYPE (*exynos_codec_bufferProcessRun)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
139 | OMX_ERRORTYPE (*exynos_codec_enqueueAllBuffer)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
140 | ||
141 | int (*exynos_checkInputFrame) (OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag, | |
142 | OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame); | |
143 | OMX_ERRORTYPE (*exynos_codec_getCodecInputPrivateData) (OMX_PTR codecBuffer, OMX_PTR addr, OMX_U32 *size); | |
144 | OMX_ERRORTYPE (*exynos_codec_getCodecOutputPrivateData) (OMX_PTR codecBuffer, OMX_PTR addr[], OMX_U32 size[]); | |
405399e5 | 145 | OMX_ERRORTYPE (*exynos_codec_reconfigAllBuffers) (OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); |
c6f4bc34 YK |
146 | } EXYNOS_OMX_VIDEODEC_COMPONENT; |
147 | ||
148 | #ifdef __cplusplus | |
149 | extern "C" { | |
150 | #endif | |
151 | ||
c6f4bc34 YK |
152 | inline void Exynos_UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent); |
153 | OMX_BOOL Exynos_Check_BufferProcess_State(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nPortIndex); | |
154 | OMX_ERRORTYPE Exynos_Input_CodecBufferToData(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_PTR codecBuffer, EXYNOS_OMX_DATA *pData); | |
e90eb9e8 | 155 | OMX_ERRORTYPE Exynos_Output_CodecBufferToData(CODEC_DEC_BUFFER *pCodecBuffer, EXYNOS_OMX_DATA *pData); |
c6f4bc34 YK |
156 | |
157 | OMX_ERRORTYPE Exynos_OMX_SrcInputBufferProcess(OMX_HANDLETYPE hComponent); | |
158 | OMX_ERRORTYPE Exynos_OMX_SrcOutputBufferProcess(OMX_HANDLETYPE hComponent); | |
159 | OMX_ERRORTYPE Exynos_OMX_DstInputBufferProcess(OMX_HANDLETYPE hComponent); | |
160 | OMX_ERRORTYPE Exynos_OMX_DstOutputBufferProcess(OMX_HANDLETYPE hComponent); | |
161 | OMX_ERRORTYPE Exynos_OMX_VideoDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent); | |
162 | OMX_ERRORTYPE Exynos_OMX_VideoDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent); | |
163 | ||
cc46393d AS |
164 | OMX_ERRORTYPE Exynos_ResetAllPortConfig(OMX_COMPONENTTYPE *pOMXComponent); |
165 | void Exynos_Free_CodecBuffers(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
166 | ||
c6f4bc34 YK |
167 | #ifdef __cplusplus |
168 | } | |
169 | #endif | |
170 | ||
171 | #endif |