Commit | Line | Data |
---|---|---|
20d3e6e3 JC |
1 | /* |
2 | * | |
38ef2572 | 3 | * Copyright 2012 Samsung Electronics S.LSI Co. LTD |
20d3e6e3 JC |
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) | |
38ef2572 | 24 | * @version 2.0.0 |
20d3e6e3 | 25 | * @history |
38ef2572 | 26 | * 2012.02.20 : Create |
20d3e6e3 JC |
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" | |
37 | #include "ExynosVideoApi.h" | |
38 | ||
d03573a4 SK |
39 | #define MAX_VIDEO_INPUTBUFFER_NUM 5 |
40 | #define MAX_VIDEO_OUTPUTBUFFER_NUM 2 | |
20d3e6e3 | 41 | |
d03573a4 SK |
42 | #define DEFAULT_FRAME_WIDTH 176 |
43 | #define DEFAULT_FRAME_HEIGHT 144 | |
20d3e6e3 JC |
44 | |
45 | #define DEFAULT_VIDEO_INPUT_BUFFER_SIZE (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT) * 2 | |
46 | #define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT * 3) / 2 | |
47 | ||
38ef2572 JC |
48 | #define MFC_INPUT_BUFFER_NUM_MAX 3 |
49 | #define DEFAULT_MFC_INPUT_BUFFER_SIZE 1920 * 1080 * 3 / 2 | |
50 | ||
51 | #define MFC_OUTPUT_BUFFER_NUM_MAX 16 * 2 | |
38ef2572 JC |
52 | #define DEFAULT_MFC_OUTPUT_YBUFFER_SIZE 1920 * 1080 |
53 | #define DEFAULT_MFC_OUTPUT_CBUFFER_SIZE 1920 * 1080 / 2 | |
20d3e6e3 JC |
54 | |
55 | #define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 1 | |
56 | #define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX 4 | |
57 | ||
38ef2572 JC |
58 | #define EXTRA_DPB_NUM 5 |
59 | ||
3e79a27e SK |
60 | #define MFC_INPUT_BUFFER_PLANE 1 |
61 | #define MFC_OUTPUT_BUFFER_PLANE 2 | |
62 | ||
3b1c2e30 | 63 | #define MAX_OUTPUTBUFFER_NUM_DYNAMIC 0 /* Dynamic number of metadata buffer */ |
e8aae8ed SK |
64 | #define PLATFORM_DISPLAY_BUFFER 1 |
65 | ||
20d3e6e3 JC |
66 | typedef struct |
67 | { | |
68 | void *pAddrY; | |
69 | void *pAddrC; | |
38ef2572 | 70 | } CODEC_DEC_ADDR_INFO; |
20d3e6e3 | 71 | |
ef059a02 | 72 | typedef struct _CODEC_DEC_BUFFER |
20d3e6e3 | 73 | { |
ef059a02 SK |
74 | void *pVirAddr[MAX_BUFFER_PLANE]; /* virtual address */ |
75 | int bufferSize[MAX_BUFFER_PLANE]; /* buffer alloc size */ | |
76 | int fd[MAX_BUFFER_PLANE]; /* buffer FD */ | |
77 | int dataSize; /* total data length */ | |
78 | } CODEC_DEC_BUFFER; | |
38ef2572 JC |
79 | |
80 | typedef struct _DECODE_CODEC_EXTRA_BUFFERINFO | |
81 | { | |
82 | /* For Decode Output */ | |
83 | OMX_U32 imageWidth; | |
84 | OMX_U32 imageHeight; | |
85 | OMX_COLOR_FORMATTYPE ColorFormat; | |
3b1c2e30 | 86 | PrivateDataShareBuffer PDSB; |
38ef2572 | 87 | } DECODE_CODEC_EXTRA_BUFFERINFO; |
20d3e6e3 JC |
88 | |
89 | typedef struct _EXYNOS_OMX_VIDEODEC_COMPONENT | |
90 | { | |
91 | OMX_HANDLETYPE hCodecHandle; | |
20d3e6e3 JC |
92 | OMX_BOOL bThumbnailMode; |
93 | OMX_BOOL bFirstFrame; | |
ef059a02 SK |
94 | CODEC_DEC_BUFFER *pMFCDecInputBuffer[MFC_INPUT_BUFFER_NUM_MAX]; |
95 | CODEC_DEC_BUFFER *pMFCDecOutputBuffer[MFC_OUTPUT_BUFFER_NUM_MAX]; | |
20d3e6e3 | 96 | |
38ef2572 JC |
97 | /* Buffer Process */ |
98 | OMX_BOOL bExitBufferProcessThread; | |
99 | OMX_HANDLETYPE hSrcInputThread; | |
100 | OMX_HANDLETYPE hSrcOutputThread; | |
101 | OMX_HANDLETYPE hDstInputThread; | |
102 | OMX_HANDLETYPE hDstOutputThread; | |
103 | ||
104 | /* Shared Memory Handle */ | |
105 | OMX_HANDLETYPE hSharedMemory; | |
106 | ||
107 | /* For DRM Play */ | |
108 | OMX_BOOL bDRMPlayerMode; | |
20d3e6e3 JC |
109 | |
110 | /* CSC handle */ | |
111 | OMX_PTR csc_handle; | |
112 | OMX_U32 csc_set_format; | |
800a8d75 | 113 | |
3b1c2e30 SK |
114 | OMX_HANDLETYPE hRefHandle; |
115 | ||
38ef2572 JC |
116 | OMX_ERRORTYPE (*exynos_codec_srcInputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData); |
117 | OMX_ERRORTYPE (*exynos_codec_srcOutputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData); | |
118 | OMX_ERRORTYPE (*exynos_codec_dstInputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pOutputData); | |
119 | OMX_ERRORTYPE (*exynos_codec_dstOutputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pOutputData); | |
800a8d75 | 120 | |
38ef2572 JC |
121 | OMX_ERRORTYPE (*exynos_codec_start)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); |
122 | OMX_ERRORTYPE (*exynos_codec_stop)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
123 | OMX_ERRORTYPE (*exynos_codec_bufferProcessRun)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
124 | OMX_ERRORTYPE (*exynos_codec_enqueueAllBuffer)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
20d3e6e3 | 125 | |
38ef2572 JC |
126 | int (*exynos_checkInputFrame) (OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag, |
127 | OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame); | |
128 | OMX_ERRORTYPE (*exynos_codec_getCodecInputPrivateData) (OMX_PTR codecBuffer, OMX_PTR addr, OMX_U32 *size); | |
129 | OMX_ERRORTYPE (*exynos_codec_getCodecOutputPrivateData) (OMX_PTR codecBuffer, OMX_PTR addr[], OMX_U32 size[]); | |
130 | } EXYNOS_OMX_VIDEODEC_COMPONENT; | |
20d3e6e3 JC |
131 | |
132 | #ifdef __cplusplus | |
133 | extern "C" { | |
134 | #endif | |
135 | ||
38ef2572 JC |
136 | int calc_plane(int width, int height); |
137 | inline void Exynos_UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent); | |
138 | OMX_BOOL Exynos_Check_BufferProcess_State(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nPortIndex); | |
139 | OMX_ERRORTYPE Exynos_Input_CodecBufferToData(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_PTR codecBuffer, EXYNOS_OMX_DATA *pData); | |
140 | OMX_ERRORTYPE Exynos_Output_CodecBufferToData(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_PTR codecBuffer, EXYNOS_OMX_DATA *pData); | |
141 | ||
142 | OMX_ERRORTYPE Exynos_OMX_SrcInputBufferProcess(OMX_HANDLETYPE hComponent); | |
143 | OMX_ERRORTYPE Exynos_OMX_SrcOutputBufferProcess(OMX_HANDLETYPE hComponent); | |
144 | OMX_ERRORTYPE Exynos_OMX_DstInputBufferProcess(OMX_HANDLETYPE hComponent); | |
145 | OMX_ERRORTYPE Exynos_OMX_DstOutputBufferProcess(OMX_HANDLETYPE hComponent); | |
20d3e6e3 JC |
146 | OMX_ERRORTYPE Exynos_OMX_VideoDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent); |
147 | OMX_ERRORTYPE Exynos_OMX_VideoDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent); | |
20d3e6e3 JC |
148 | |
149 | #ifdef __cplusplus | |
150 | } | |
151 | #endif | |
152 | ||
153 | #endif |