Sample Usage
3-4
3.1.3
Process Call
After algorithm instance creation and initialization, the test application does the following:
3)
Sets the dynamic parameters (if they change during run-time) by
calling the
control()
function with the
XDM_SETPARAMS
command.
4)
Sets the input and output buffer descriptors required for the
process()
function call. The input and output buffer descriptors are
obtained by calling the
control()
function with the
XDM_GETBUFINFO
command.
5)
Calls the
process()
function to encode/decode a single frame of data.
The behavior of the algorithm can be controlled using various dynamic
parameters (see Section 4.2.1.8). The inputs to the process function
are input and output buffer descriptors, pointer to the
IVIDENC2_InArgs
and
IVIDENC2_OutArgs
structures.
6)
When the
process()
function is called for encoding/decoding a single
frame of data, the software triggers the start of encode/decode. After
triggering the start of the encode/decode frame, the video task can be
placed in SEM-pend state using semaphores. On receipt of interrupt
signal at the end of frame encode/decode, the application releases the
semaphore and resume the video task, which does any book-keeping
operations by the codec and updates the output parameters.
The
control()
and
process()
functions should be called only within the scope of the
algActivate()
and
algDeactivate()
XDAIS functions, which activate and deactivate the
algorithm instance respectively. If the same algorithm is in-use between two process/control
function calls, calling these functions can be avoided. Once an algorithm is activated, there can be
any ordering of
control()
and
process()
functions. The following APIs are called in sequence:
1)
algActivate()
- To activate the algorithm instance.
2)
control()
(optional) - To query the algorithm on status or setting of
dynamic parameters and so on, using the eight control commands.
3)
process()
- To call the Encoder with appropriate input/output buffer
and arguments information.
4)
control()
(optional) - To query the algorithm on status or setting of
dynamic parameters and so on, using the eight available control
commands.
5)
algDeactivate()
- To deactivate the algorithm instance.
The do-while loop encapsulates frame level
process()
call and updates the input buffer pointer
every time before the next call. The do-while loop breaks off either when an error condition occurs
or when the input buffer exhausts.
If the algorithm uses any resources through RMAN, then user must activate the resource after the
algorithm is activated and deactivate the resource before algorithm deactivation.