按照xdais标准,DSP端的程序需要实现一些接口,例如video_copy中,在videnc_copy.c中,
#define IALGFXNS \
&VIDENCCOPY_TI_IALG, /* module ID */ \
VIDENCCOPY_TI_activate, /* activate */ \
VIDENCCOPY_TI_alloc, /* alloc */ \
NULL, /* control (NULL => no control ops) */ \
VIDENCCOPY_TI_deactivate, /* deactivate */ \
VIDENCCOPY_TI_free, /* free */ \
VIDENCCOPY_TI_initObj, /* init */ \
NULL, /* moved */ \
NULL /* numAlloc (NULL => IALG_MAXMEMRECS) */
/*
* ======== VIDENCCOPY_TI_IVIDENC ========
* This structure defines TI's implementation of the IVIDENC interface
* for the VIDENCCOPY_TI module.
*/
IVIDENC_Fxns VIDENCCOPY_TI_VIDENCCOPY = { /* module_vendor_interface */
{IALGFXNS},
VIDENCCOPY_TI_process,
VIDENCCOPY_TI_control,
};
定义的结构体VIDENCCOPY_TI_VIDENCCOPY,在VIDENC_COPY.xdc做了注册(用“注册”不知道是否准确)
override readonly config String ialgFxns = "VIDENCCOPY_TI_VIDENCCOPY";
其中VIDENC_COPY是本模块的名字,在package.xdc中指定。
下面是结构体IALGFXNS的定义
00168 /*
00169 * algAlloc() - apps call this to query the algorithm about
00170 * its memory requirements. Must be non-NULL.
00171 * algControl() - algorithm specific control operations. May be
00172 * NULL; NULL => no operations supported.
00173 * algDeactivate() - notification that current instance is about to
00174 * be "deactivated". May be NULL; NULL => do nothing.
00175 * algFree() - query algorithm for memory to free when removing
00176 * an instance. Must be non-NULL.
00177 * algInit() - apps call this to allow the algorithm to
00178 * initialize memory requested via algAlloc(). Must
00180 * algMoved() - apps call this whenever an algorithms object or
00181 * any pointer parameters are moved in real-time.
00182 * May be NULL; NULL => object can not be moved.
00183 * algNumAlloc() - query algorithm for number of memory requests.
00184 * May be NULL; NULL => number of mem recs is less
00185 * then #IALG_DEFMEMRECS.
00187 typedef struct IALG_Fxns {
00192 Void *implementationId;
00243 Void (*algActivate)(IALG_Handle handle);
00317 Int (*algAlloc)(const IALG_Params *params,
00318 struct IALG_Fxns **parentFxns, IALG_MemRec *memTab);
00360 Int (*algControl)(IALG_Handle handle, IALG_Cmd cmd,
00361 IALG_Status *status);
00416 Void (*algDeactivate)(IALG_Handle handle);
00458 Int (*algFree)(IALG_Handle handle, IALG_MemRec *memTab);
00608 Int (*algInit)(IALG_Handle handle, const IALG_MemRec *memTab,
00609 IALG_Handle parent, const IALG_Params *params);
00631 Void (*algMoved)(IALG_Handle handle, const IALG_MemRec *memTab,
00632 IALG_Handle parent, const IALG_Params *params);
00690 Int (*algNumAlloc)(Void);
00691 } IALG_Fxns;
对于DSP算法生命周期的三个阶段,对应的函数为
创建:algNumAlloc algAlloc algInit
执行:algActivate algDeactivate algMoved
删除:algFree
评论