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_Venc.h | |
20 | * @brief | |
21 | * @author SeungBeom Kim (sbcrux.kim@samsung.com) | |
22 | * Yunji Kim (yunji.kim@samsung.com) | |
23 | * @version 2.0.0 | |
24 | * @history | |
25 | * 2012.02.20 : Create | |
26 | */ | |
27 | ||
28 | #ifndef EXYNOS_OMX_VIDEO_ENCODE | |
29 | #define EXYNOS_OMX_VIDEO_ENCODE | |
30 | ||
31 | #include "OMX_Component.h" | |
32 | #include "Exynos_OMX_Def.h" | |
33 | #include "Exynos_OSAL_Queue.h" | |
34 | #include "Exynos_OMX_Baseport.h" | |
35 | #include "Exynos_OMX_Basecomponent.h" | |
c6f4bc34 YK |
36 | |
37 | #define MAX_VIDEO_INPUTBUFFER_NUM 5 | |
38 | #define MAX_VIDEO_OUTPUTBUFFER_NUM 4 | |
39 | ||
40 | #define DEFAULT_FRAME_WIDTH 176 | |
41 | #define DEFAULT_FRAME_HEIGHT 144 | |
42 | ||
43 | #define DEFAULT_VIDEO_INPUT_BUFFER_SIZE (ALIGN_TO_16B(DEFAULT_FRAME_WIDTH) * ALIGN_TO_16B(DEFAULT_FRAME_HEIGHT) + \ | |
44 | ALIGN((ALIGN_TO_16B(DEFAULT_FRAME_WIDTH) * ALIGN_TO_16B(DEFAULT_FRAME_HEIGHT))/2,256)) | |
45 | #define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT) * 2 | |
46 | ||
47 | #define MFC_INPUT_BUFFER_NUM_MAX 3 | |
48 | #define MFC_OUTPUT_BUFFER_NUM_MAX 4 | |
49 | ||
50 | #define DEFAULT_MFC_INPUT_YBUFFER_SIZE ALIGN_TO_16B(1920) * ALIGN_TO_16B(1080) | |
51 | #define DEFAULT_MFC_INPUT_CBUFFER_SIZE ALIGN((DEFAULT_MFC_INPUT_YBUFFER_SIZE / 2), 256) | |
52 | #define DEFAULT_MFC_OUTPUT_BUFFER_SIZE 1920 * 1080 * 3 / 2 | |
53 | ||
54 | #define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 5 | |
55 | #define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX 1 | |
56 | ||
57 | #define MFC_INPUT_BUFFER_PLANE 2 | |
58 | #define MFC_OUTPUT_BUFFER_PLANE 1 | |
59 | ||
60 | #define MAX_INPUTBUFFER_NUM_DYNAMIC 0 /* Dynamic number of metadata buffer */ | |
61 | ||
62 | // The largest metadata buffer size advertised | |
63 | // when metadata buffer mode is used for video encoding | |
64 | #define MAX_INPUT_METADATA_BUFFER_SIZE (64) | |
65 | ||
66 | typedef struct | |
67 | { | |
68 | void *pAddrY; | |
69 | void *pAddrC; | |
70 | } CODEC_ENC_ADDR_INFO; | |
71 | ||
72 | typedef struct _CODEC_ENC_BUFFER | |
73 | { | |
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_ENC_BUFFER; | |
79 | ||
80 | typedef struct _EXYNOS_OMX_VIDEOENC_COMPONENT | |
81 | { | |
82 | OMX_HANDLETYPE hCodecHandle; | |
83 | OMX_BOOL bFirstFrame; | |
84 | CODEC_ENC_BUFFER *pMFCEncInputBuffer[MFC_INPUT_BUFFER_NUM_MAX]; | |
85 | CODEC_ENC_BUFFER *pMFCEncOutputBuffer[MFC_OUTPUT_BUFFER_NUM_MAX]; | |
86 | ||
87 | /* Buffer Process */ | |
88 | OMX_BOOL bExitBufferProcessThread; | |
89 | OMX_HANDLETYPE hSrcInputThread; | |
90 | OMX_HANDLETYPE hSrcOutputThread; | |
91 | OMX_HANDLETYPE hDstInputThread; | |
92 | OMX_HANDLETYPE hDstOutputThread; | |
93 | ||
94 | /* Shared Memory Handle */ | |
95 | OMX_HANDLETYPE hSharedMemory; | |
96 | ||
10db72aa SK |
97 | /* For DRM Record */ |
98 | OMX_BOOL bDRMPlayerMode; | |
99 | ||
c6f4bc34 YK |
100 | OMX_BOOL configChange; |
101 | OMX_BOOL IntraRefreshVOP; | |
102 | OMX_VIDEO_CONTROLRATETYPE eControlRate[ALL_PORT_NUM]; | |
103 | OMX_VIDEO_PARAM_QUANTIZATIONTYPE quantization; | |
aa4a2b3e | 104 | OMX_VIDEO_PARAM_INTRAREFRESHTYPE intraRefresh; |
c6f4bc34 YK |
105 | |
106 | OMX_BOOL bFirstInput; | |
107 | OMX_BOOL bFirstOutput; | |
108 | ||
109 | OMX_COLOR_FORMATTYPE ANBColorFormat; | |
110 | ||
111 | /* CSC handle */ | |
112 | OMX_PTR csc_handle; | |
113 | OMX_U32 csc_set_format; | |
114 | ||
115 | OMX_ERRORTYPE (*exynos_codec_srcInputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData); | |
116 | OMX_ERRORTYPE (*exynos_codec_srcOutputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData); | |
117 | OMX_ERRORTYPE (*exynos_codec_dstInputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pOutputData); | |
118 | OMX_ERRORTYPE (*exynos_codec_dstOutputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pOutputData); | |
119 | ||
120 | OMX_ERRORTYPE (*exynos_codec_start)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
121 | OMX_ERRORTYPE (*exynos_codec_stop)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
122 | OMX_ERRORTYPE (*exynos_codec_bufferProcessRun)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
123 | OMX_ERRORTYPE (*exynos_codec_enqueueAllBuffer)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); | |
124 | ||
125 | int (*exynos_checkInputFrame) (OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag, | |
126 | OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame); | |
127 | OMX_ERRORTYPE (*exynos_codec_getCodecInputPrivateData) (OMX_PTR codecBuffer, OMX_PTR addr[], OMX_U32 size[]); | |
128 | OMX_ERRORTYPE (*exynos_codec_getCodecOutputPrivateData) (OMX_PTR codecBuffer, OMX_PTR addr, OMX_U32 *size); | |
129 | } EXYNOS_OMX_VIDEOENC_COMPONENT; | |
130 | ||
131 | #ifdef __cplusplus | |
132 | extern "C" { | |
133 | #endif | |
134 | ||
135 | inline void Exynos_UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent); | |
136 | OMX_BOOL Exynos_Check_BufferProcess_State(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nPortIndex); | |
137 | OMX_ERRORTYPE Exynos_Input_CodecBufferToData(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_PTR codecBuffer, EXYNOS_OMX_DATA *pData); | |
e50b9040 | 138 | OMX_ERRORTYPE Exynos_Output_CodecBufferToData(CODEC_ENC_BUFFER *pCodecBuffer, EXYNOS_OMX_DATA *pData); |
c6f4bc34 YK |
139 | |
140 | ||
141 | OMX_ERRORTYPE Exynos_OMX_SrcInputBufferProcess(OMX_HANDLETYPE hComponent); | |
142 | OMX_ERRORTYPE Exynos_OMX_SrcOutputBufferProcess(OMX_HANDLETYPE hComponent); | |
143 | OMX_ERRORTYPE Exynos_OMX_DstInputBufferProcess(OMX_HANDLETYPE hComponent); | |
144 | OMX_ERRORTYPE Exynos_OMX_DstOutputBufferProcess(OMX_HANDLETYPE hComponent); | |
145 | OMX_ERRORTYPE Exynos_OMX_VideoEncodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent); | |
146 | OMX_ERRORTYPE Exynos_OMX_VideoEncodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent); | |
147 | ||
148 | #ifdef __cplusplus | |
149 | } | |
150 | #endif | |
151 | ||
152 | #endif |