first of all , I want to say thanks for your attention. the fllowing qustion has puzzled me for a long time. it may be help for you too if you finish the reading.
I have some problems when migrate xdais alg to xdm stanard, such as :
Q1、you should no longer use the control function defined in ialg interface because the xdm's control function replace it ;
Q2、don't try to extend the IALG_Obj interface ,because you cann't use it in the xdm's process function
Q3、 instead of extending the IALG_Params you should better turn to extend the params defined in xdm , suche as inarg outarg dynamciParam and so on
take the fir alg in RF5 for RF5\src\fir_ti for example:
typedef struct FIR_TI_Obj {
IALG_Obj alg; /* MUST be first field of all FIR objs */
Short *workBuf; /* on-chip scratch history */
Short *history; /* off chip presistant history */
Short *coeff; /* on-chip persistant coeff */
Int filterLenM1; /* length of coefficient array - 1 */
Int frameLen; /* length of input (output) buffer */
} FIR_TI_Obj;
typedef struct IFIR_Params {
Int size; /* must be first field of all params structures */
Short *coeffPtr;
Int filterLen;
Int frameLen;
} IFIR_Params;
In RF5 these extended parameter was used in FIR_TI_alloc , FIR_TI_initObj and FIR_TI_control functions , because the calling process was made by ourselves , we can pass these extend parameters in these functions with type casting. and a process function is defined like this:
Void FIR_TI_filter(IFIR_Handle handle, Short in[], Short out[]) //you can think this function is just the process function in VISA interface.
noticed that : we can get the IFIR handle in process function. so we can use the extended parameters in the process likely function.
Q4:when use codecEngine , can we still extend these struct like that? how to use it ? because we cann't get the handle of them in xdm 's process and control function.
Q5: difference about IALG_Params ,IALG_Status , IVIDENC_DynamicParams , IVIDENC_Status
in ialg interface we can get and set alg's parameter through IALG_Status ,so can we say that the IALG_Status is a subset of IALG_Params ? if you want the user to set some params you should put it in IALG_Status。 for some secret parameter you can put it in *_TI_Obj and it usually defined in a file named *_ti_priv.h. did i said right?
in xdm interface ,the IVIDENC_Status is just used for get the status of algs such as buffer info. and IVIDENC_DynamicParams is used for users to modify the parameter . while where should i put the secret params? if do it like in FIR_TI_Obj, I would not get the handle of it in xdm's process function.
Q6: Byte alignment
in the ti wiki, I have ever saw an article which said that "Both the base data structure and the extended structure have to be 32-bit aligned for remote algorithm execution support". but I found that some extended structs in Ti's example aren't 32 bit aligned. for example:
1、ISPHENC1_Params in file isphenc1.h:
typedef struct ISPHENC1_Params {
XDAS_Int16 size; /**< @sizeField */
XDAS_Int16 frameSize; /**< Input frame size in bytes
* for sample based codecs.
*/
XDAS_Int16 compandingLaw; /**< Optional, codec-specific companding law.
* See your codec-specific interface
* documentation options.
*
* @sa ISPEECH1_PCM_CompandingLaw
* @sa ISPEECH1_G726_CompandingLaw
*/
XDAS_Int16 packingType; /**< Optional, codec-specific packing type.
* See your codec-specific interface
* documentation options.
*
* @sa ISPEECH1_AMR_PackingType
* @sa ISPEECH1_G726_PackingType
* @sa ISPEECH1_WBAMR_PackingType
*/
XDAS_Int16 vadSelection; /**< Optional, codec-specific voice activity
* detection selection. See your
* codec-specific interface documentation
* options.
*
* @sa ISPEECH1_AMR_VADSelect
* @sa ISPEECH1_SMV_VADSelect
*/
XDAS_Int16 codecSelection; /**< Optional, codec-specific codec selection.
* See your codec-specific interface
* documentation options.
*
* @sa ISPEECH1_AMR_CodecSelect
* @sa ISPHENC1_Params.codecSelection
*/
XDAS_Int16 bitRate; /**< Optional, codec-specific bit rate.
* See your codec-specific interface
* documentation options.
*
* @sa ISPEECH1_AMR_BitRate
* @sa ISPEECH1_G723_BitRate
* @sa ISPEECH1_G726_BitRate
* @sa ISPEECH1_WBAMR_BitRate
*/
XDAS_Int16 reserved; /**< Reserved - serves to pad this structure. */
XDAS_Int8 **tablesPtr; /**< Optional pointer to the codec's
* initialization tables.
*
* @remarks This parameter specifies a
* pointer to the array of the
* codec's table block pointers.
* If the application requires
* the codec to select the
* default table address array
* pointer, it should set this
* to @c NULL.
*/
} ISPHENC1_Params;
2、IH264VENC_DynamicParams in file ih264venc.h :
typedef struct IH264VENC_DynamicParams
{
/*!
* Mandatory fields of the DynamicParams structure - Base class
*/
IVIDENC1_DynamicParams videncDynamicParams;
/*!
* Additional elements specific to H.264 Encoder - Extensions to base class
*/
XDAS_Int32 OutBufSize; /*!< Size of the Output Buffer */
XDAS_UInt8 QPISlice; /*!< Quant. param for I Slices (0-51) */
XDAS_UInt8 QPSlice; /*!< Quant. Param for non - I Slices */
XDAS_UInt8 RateCtrlQpMax; /*!< Maximum QP to be used Range[0,51] */
XDAS_UInt8 RateCtrlQpMin; /*!< Minimum QP to be used Range[0,51] */
XDAS_UInt8 NumRowsInSlice; /*!< Number of rows in a Slice */
XDAS_UInt8 LfDisableIdc; /*!< Loop Filter enable/disable control */
XDAS_Int8 LFAlphaC0Offset; /* Alpha & C0 offset div. 2, */
XDAS_Int8 LFBetaOffset; /* Beta offset div. 2, */
XDAS_Int8 ChromaQPOffset; /*!< Chroma QP offset (-12..12) */
XDAS_Int8 SecChromaQPOffset;/*!<Secondary chroma Qp offset */
} IH264VENC_DynamicParams;
Does they are 32 byte aligned?