-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
278 lines (231 loc) · 12 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
****************************** LIBDCE README ******************************
The LIBDCE component provides an interface for applications running on the
MPU (HLOS) to invoke the Codec Engine APIs on the remote core (IPU). It
enables the Video Encode/Decode Usecases. Apart from the exposed CE APIs,
it provides a memplugin utility to allocate memory that can be read/written
from the remote IPU core.
******************************* API DETAILS *******************************
######################### Codec Engine APIs #########################
/*==================================================================*/
/** Engine_open : Codec Engine Exposed API to open
* Codec Engine.
* @ param name [in] : Name of Encoder or Decoder codec.
* @ param attrs [in] : Pointer to Engine Attributes structure.
NULL is valid.
* @ param ec [out] : Pointer to Engine Error structure for Codec
* to write error code. NULL is valid.
* @ return : Codec Engine Handle is returned to be used
* to create codec.
* In case of error, NULL is returned.
*/
Engine_Handle Engine_open(String name, Engine_Attrs *attrs, Engine_Error *ec)
######################### VIDDEC3 APIs #########################
/*==================================================================*/
/** VIDDEC3_create : Create Decoder codec.
*
* @ param engine [in] : Engine Handle obtained in Engine_open() call.
* @ param name [in] : Name of Decoder codec.
* @ param params [in] : Pointer to Static parameters structure of codec
* allocated using dce_alloc() API.
* @ return : Codec Handle is returned to be used for
* future CE calls.
* In case of error, NULL is returned.
*/
VIDDEC3_Handle VIDDEC3_create(Engine_Handle engine, String name,
VIDDEC3_Params *params)
/*==================================================================*/
/** VIDDEC3_control : Codec control call.
*
* @ param codec [in] : Codec Handle obtained in VIDDEC3_create() call.
* @ param id [in] : Command id for XDM control operation.
* @ param dynParams [in] : Pointer to dynamic parameters structure
* of codec allocated using dce_alloc() API.
* @ param status [out] : Pointer to status parameters structure
* of codec allocated using dce_alloc() API.
* If 'id' is XDM_GETVERSION, then
* status->data.buf should have a pointer to a
* buffer allocated through dce_alloc() API.
* @ return : DCE error status of control call is returned.
* #DCE_EOK [0] : Success.
* #DCE_EXDM_FAIL [-1] : XDM Failure.
* #DCE_EXDM_UNSUPPORTED [-3] : Unsupported XDM request.
* #DCE_EIPC_CALL_FAIL [-5] : MmRpc Call failed.
* #DCE_EINVALID_INPUT [-6] : Invalid Inputs.
*/
XDAS_Int32 VIDDEC3_control(VIDDEC3_Handle codec, VIDDEC3_Cmd id,
VIDDEC3_DynamicParams *dynParams, VIDDEC3_Status *status)
/*==================================================================*/
/** VIDDEC3_process : Decode process call.
*
* @ param codec [in] : Codec Handle obtained in VIDDEC3_create() call.
* @ param inBufs [in] : Pointer to Input Buffer Descriptor structure
* of codec allocated using dce_alloc() API.
* inBufs->descs[0].buf it should have a DMA Buf FD
* to the Input Buffer.
* @ param outBufs [in] : Pointer to Output Buffer Descriptor structure
* of codec allocated using dce_alloc() API.
* outBufs->descs[0].buf and outBufs->descs[1].buf
* should have virtual pointers to the Output
* These fields should have
* DMA Buf FDs to the Output Buffers. In Android
* these fields should have the memheader pointer,
* and the memheader->offset should have the offset
* for the actual data with in the outbuffer.
* @ param inArgs [in] : Pointer to Input Arguments structure
* of codec allocated using dce_alloc() API.
* @ param outArgs [out] : Pointer to Output Arguments structure
* of codec allocated using dce_alloc() API.
* @ return : DCE error status of process call is returned.
* #DCE_EOK [0] : Success.
* #DCE_EXDM_FAIL [-1] : XDM Failure.
* #DCE_EXDM_UNSUPPORTED [-3] : Unsupported XDM request.
* #DCE_EIPC_CALL_FAIL [-5] : MmRpc Call failed.
* #DCE_EINVALID_INPUT [-6] : Invalid Inputs.
*/
XDAS_Int32 VIDDEC3_process(VIDDEC3_Handle codec,
XDM2_BufDesc *inBufs, XDM2_BufDesc *outBufs,
VIDDEC3_InArgs *inArgs, VIDDEC3_OutArgs *outArgs)
/*===============================================================*/
/** VIDDEC3_delete : Delete Decode codec instance.
*
* @ param codec [in] : Codec Handle obtained in VIDDEC3_create() call.
* @ return : NIL.
*/
Void VIDDEC3_delete(VIDDEC3_Handle codec)
######################### VIDDENC2 APIs #########################
/*==================================================================*/
/** VIDENC2_create : Create Encoder codec.
*
* @ param engine [in] : Engine Handle obtained in Engine_open() call.
* @ param name [in] : Name of Encoder codec.
* @ param params [in] : Pointer to Static parameters structure of codec
* allocated using dce_alloc() API.
* @ return : Codec Handle is returned to be used for
* future CE calls.
* In case of error, NULL is returned.
*/
VIDENC2_Handle VIDENC2_create(Engine_Handle engine, String name,
VIDENC2_Params *params)
/*==================================================================*/
/** VIDENC2_control : Codec control call.
*
* @ param codec [in] : Codec Handle obtained in VIDENC2_create() call.
* @ param id [in] : Command id for XDM control operation.
* @ param dynParams [in] : Pointer to dynamic parameters structure
* of codec allocated using dce_alloc() API.
* @ param status [out] : Pointer to status parameters structure
* of codec allocated using dce_alloc() API.
* If 'id' is XDM_GETVERSION, then
* status->data.buf should have a pointer to a
* buffer allocated through dce_alloc() API.
* @ return : DCE error status of control call is returned.
* #DCE_EOK [0] : Success.
* #DCE_EXDM_FAIL [-1] : XDM Failure.
* #DCE_EXDM_UNSUPPORTED [-3] : Unsupported XDM request.
* #DCE_EIPC_CALL_FAIL [-5] : MmRpc Call failed.
* #DCE_EINVALID_INPUT [-6] : Invalid Inputs.
*/
XDAS_Int32 VIDENC2_control(VIDENC2_Handle codec, VIDENC2_Cmd id,
VIDENC2_DynamicParams *dynParams, VIDENC2_Status *status)
/*==================================================================*/
/** VIDENC2_process : Encode process call.
*
* @ param codec [in] : Codec Handle obtained in VIDENC2_create() call.
* @ param inBufs [in] : Pointer to Input Buffer Descriptor structure
* of codec allocated using dce_alloc() API.
* inBufs->planeDesc[0].buf and inBufs->planeDesc[1].buf
* should have virtual pointers to the Output
* These fields should have
* DMA Buf FDs to the Output Buffers.
* @ param outBufs [in] : Pointer to Output Buffer Descriptor structure
* of codec allocated using dce_alloc() API.
* OutBufs->descs[0].buf it
* should have a DMA Buf FD to the Input Buffer.
* @ param inArgs [in] : Pointer to Input Arguments structure
* of codec allocated using dce_alloc() API.
* @ param outArgs [out] : Pointer to Output Arguments structure
* of codec allocated using dce_alloc() API.
* @ return : DCE error status of process call is returned.
* #DCE_EOK [0] : Success.
* #DCE_EXDM_FAIL [-1] : XDM Failure.
* #DCE_EXDM_UNSUPPORTED [-3] : Unsupported XDM request.
* #DCE_EIPC_CALL_FAIL [-5] : MmRpc Call failed.
* #DCE_EINVALID_INPUT [-6] : Invalid Inputs.
*/
XDAS_Int32 VIDENC2_process(VIDENC2_Handle codec,
IVIDEO2_BufDesc *inBufs, XDM2_BufDesc *outBufs,
VIDENC2_InArgs *inArgs, VIDENC2_OutArgs *outArgs)
/*===============================================================*/
/** VIDENC2_delete : Delete Encode codec instance.
*
* @ param codec [in] : Codec Handle obtained in VIDENC2_create() call.
* @ return : NIL.
*/
Void VIDENC2_delete(VIDENC2_Handle codec)
/*==================================================================*/
/** Engine_close : Codec Engine Exposed API to Close Engine.
*
* @ param engine [in] : Engine Handle obtained in Engine_open() call.
*/
Void Engine_close(Engine_Handle engine)
############################ libDCE APIs ############################
See libdce.h
******************************* API call flow ******************************
// For example of a Decoder Application - using CE video3 interfaces to IPU (IVA-HD)
If (BUILDOS_LINUX) {
dev = dce_init()
}
engine = Engine_open(String name, Engine_Attrs *attrs, Engine_Error *ec)
params = *dce_alloc(int sz)
Fill params
codec = VIDDEC3_create(Engine_Handle engine, String name,
VIDDEC3_Params *params)
dynParams = *dce_alloc(int sz)
Fill dynParams
status = *dce_alloc(int sz)
XDAS_Int32 VIDDEC3_control(VIDDEC3_Handle codec, VIDDEC3_Cmd id,
VIDDEC3_DynamicParams *dynParams, VIDDEC3_Status *status)
inBufs = *dce_alloc(int sz)
Fill inBufs
outBufs = *dce_alloc(int sz)
Fill outBufs
inArgs = *dce_alloc(int sz)
Fill inArgs
outArgs = *dce_alloc(int sz)
Fill outArgs
while(end of stream) {
if (BUILDOS_LINUX) {
inBufs->descs[0].buf = DMA Buf FD of Input Buffer
if( Output Buffer == MultiPlanar ) {
outBufs->descs[0].buf = DMA Buf FD of Output Luma Buffer
outBufs->descs[1].buf = DMA Buf FD of Output Chroma Buffer
} else { // Output Buffer is Single Planar
outBufs->descs[0].buf = DMA Buf FD of Output Luma Buffer
outBufs->descs[1].buf = DMA Buf FD of Output Luma Buffer +
Offset of Chroma Buffer
}
}
if (BUILDOS_LINUX) {
handle <- (inArgs.inputID).DMA_Buf_FD of Luma [and/or] chroma
dce_buf_lock(int num, size_t *handle)
}
XDAS_Int32 VIDDEC3_process(VIDDEC3_Handle codec,
XDM2_BufDesc *inBufs, XDM2_BufDesc *outBufs,
VIDDEC3_InArgs *inArgs, VIDDEC3_OutArgs *outArgs)
if (BUILDOS_LINUX) {
handle <- (outArgs.freeBufID).DMA_Buf_FD of Luma [and/or] chroma
dce_buf_unlock(int num, size_t *handle)
}
}
Void VIDDEC3_delete(VIDDEC3_Handle codec)
Void Engine_close(Engine_Handle engine)
If (BUILDOS_LINUX) {
dce_deinit(dev)
}
dce_free(params)
dce_free(dynParams)
dce_free(status)
dce_free(inBufs)
dce_free(outBufs)
dce_free(inArgs)
dce_free(outArgs)