www.pudn.com > Lab534-VideoMotionDetect.rar > diff_ti_vt.c


/* 
 *  Copyright 2002 by Texas Instruments Incorporated. 
 *  All rights reserved. Property of Texas Instruments Incorporated. 
 *  Restricted rights to use, duplicate or disclose this code are 
 *  granted through contract. 
 *   
 */ 
/* 
 *  ======== diff_ti_vt.c ======== 
 *  Definition of DIFF_TI_IDIFF, the IDIFF function structure the  
 *  defines TI's implementation of the IDIFF interface.  Since IDIFF  
 *  derives from IALG, we also define the symbol DIFF_TI_IALG, TI's  
 *  implementation of the IALG interface. 
 * 
 *  We place these tables in a separate file for two reasons: 
 *     1. We want allow one to replace these tables with 
 *    different definitions.  For example, one may 
 *    want to build a system where the DIFF is activated 
 *    once and never deactivated, moved, or freed. 
 * 
 *     2. Eventually there will be a separate "system build" 
 *    tool that builds these tables automatically  
 *    and if it determines that only one implementation 
 *    of an API exists, "short circuits" the vtable by 
 *    linking calls directly to the algorithm's functions. 
 */ 
 
#include  
 
#include "idiff.h" 
#include "diff_ti.h"  
 
extern Int  DIFF_TI_alloc(const IALG_Params *, struct IALG_Fxns **, 
                            IALG_MemRec *); 
extern Int  DIFF_TI_free(IALG_Handle, IALG_MemRec *); 
extern Int  DIFF_TI_initObj(IALG_Handle, const IALG_MemRec *,  
                              IALG_Handle, const IALG_Params *); 
extern Int  DIFF_TI_numAlloc(Void); 
extern Void DIFF_TI_apply(IDIFF_Handle handle, unsigned char y[],  
                            unsigned char cr[], unsigned char cb[], 
                            unsigned char prevY[], unsigned char prevCr[],  
                     		unsigned char prevCb[], Int lumaSize, Int chromaSize, 
                     		Int yValue, Int crValue, Int cbValue, Int procWidth); 
 
#define IALGFXNS \ 
    &DIFF_TI_IALG,    /* module ID */    \ 
    NULL,               /* activate */     \ 
    DIFF_TI_alloc,    /* algAlloc */     \ 
    NULL,               /* control */      \ 
    NULL,               /* deactivate */   \ 
    DIFF_TI_free,     /* free */         \ 
    DIFF_TI_initObj,  /* init */         \ 
    NULL,               /* moved */        \ 
    DIFF_TI_numAlloc  /* numAlloc */ 
 
/* 
 *  ======== DIFF_TI_IDIFF ======== 
 *  This structure defines TI's implementation of the IDIFF interface 
 *  for the DIFF_TI module. 
 */ 
IDIFF_Fxns DIFF_TI_IDIFF = {   /* module_vendor_interface */ 
    IALGFXNS, 
    DIFF_TI_apply 
}; 
 
/* 
 *  ======== DIFF_TI_IALG ======== 
 *  This structure defines TI's implementation of the IALG interface 
 *  for the DIFF_TI module. 
 */ 
 
asm("_DIFF_TI_IALG .set _DIFF_TI_IDIFF"); 
 
/* 
 *  We could have also duplicate the structure here to allow this code to be  
 *  compiled and run non-DSP platforms at the expense of unnecessary data space 
 *  consumed by the definition below. 
 * 
 *  IALG_Fxns DIFF_TI_IALG = { 
 *      IALGFXNS 
 *  }; 
 */