⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trsapi.h

📁 微软的基于HMM的人脸识别原代码, 非常经典的说
💻 H
📖 第 1 页 / 共 2 页
字号:
/*M*
//               NSL PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license agreement or
//  nondisclosure agreement with NSL and may not be copied
//  or disclosed except in accordance with the terms of that agreement.
//        Copyright (c) 1997 NSL. All Rights Reserved.
//
//  RCS:
//      $Source: trsapi.h $
//      $Revision: 1.5 $
//      $Date: 1997/27/01 $
//
//  Author: Smirnov I.E.
//  Purpose: Test System Implementor's Program Interface
//
*M*/

#if !defined _TRSAPI_H
#define _TRSAPI_H

#include <stdio.h>
/* =========================================================================*/
#ifdef __cplusplus
extern "C"{
#endif

#ifndef WIN32
    #define __cdecl
#endif

#if !defined(TRS_W32DLL) || !defined(WIN32)
# define   TRSAPI(type,func,arg)              extern type __cdecl func arg
#elif defined __BORLANDC__
# define TRSAPI(type,func,arg)               type _export __cdecl func arg
#else
# define TRSAPI(type,func,arg) __declspec(dllexport) type __cdecl func arg
#endif


typedef struct _trsProcessorInfo
{
    int     family;
    int     frequency;  /* MHz */
    double  time_scale; /* 1e-6/frequency */
} trsProcessorInfo;


/* === Get internal testsystem info ========================================*/

TRSAPI(void *,trsGet,(int item));

/* === Test registration and starting ======================================*/

typedef int (*TRSProc_t)        (void);     /* Test's body() ptr            */
typedef int (*TRSProcArg_t)     (void*);    /* Test's body(arg) ptr         */
typedef int (*TRSProcTerm_t)    (int);      /* Termination procedure        */

TRSAPI(int,trsReg,(char     *FuncName,      /* Lib Function name            */
                   char     *TestName,      /* Brief test explanation       */
                   char     *TestClass,     /* Name of test class           */
                   TRSProc_t TestProc));    /* Function test body           */

TRSAPI(int,trsRegArg,(
                   char     *FuncName,      /* Lib Function name            */
                   char     *TestName,      /* Brief test explanation       */
                   char     *TestClass,     /* Name of test class           */
                   TRSProc_t TestProc,      /* Function test body           */
                   void     *TestArg));     /* Pointer to any needed data   */

#define TG_REG_FUNCNAME        1            /* "FuncName"                   */
#define TG_REG_TESTNAME        2            /* "TestName"                   */
#define TG_REG_TESTCLASS       3            /* "TestClass"                  */
#define TG_REG_TESTRPOC        4            /* "TestProc"                   */
#define TG_REG_FILE            5            /* __FILE__                     */
#define TG_REG_TESTPROC        6            /* TestProc                     */
#define TG_REG_TESTARG         7            /* TestArg                      */
#define TG_REG_LINE            8            /* __LINE__                     */

/* Test classes:                                                            */
/*   Algorithm   - does the function do what we need ?                      */
/*   SideEffects - does the function do what we don't need ?                */
/*   BadArgs     - attempts to break the function                           */
/*   Timing      - how long we are waiting the function's results           */
/*   Relative    - mutual check with another lib functios                   */
/*   Application - the function usage examples                              */
/*   Tuning      - optimize internal parameters for best performance        */
/*   Any other...                                                           */

/* --- Test Result Status --------------------------------------------------*/
/* This value should be set by the test according to results of test.       */

#define TRS_OK                 TRUE     /* Test is OK, ->.sum file: "OK"    */
#define TRS_FAIL              FALSE     /* Test failed,->.sum file: "FAIL"  */
#define TRS_UNDEF                -1     /* Result undefine, no write to .sum*/


TRSAPI(int,trsResult,(int result, const char *format,...));

/* if trsResult(TRS_FAIL,"Accuracy is %e", 1.24); then in .sum:             */
/*                                                                          */
/* <r>esult: Accuracy is 1.24                                         FAIL  */  

/* --- Terminating function ------------------------------------------------*/

TRSAPI(TRSProcTerm_t, trsRegTerm,(TRSProcTerm_t Term));

/*  Term can free memory, tables, do some completion work, will
    invoked after test ends and get "result" equal to return value
    of test.

    If no any trsRegTerm(Term) - then as usual.

  int Term(int result) {

      switch (result) {
        case TRS_UNDEF:    ...; break;
        case TRS_OK:       ...; break;
        case TRS_FAIL:     ...; break;
        case MyErrorCode1: ...; return TRS_FAIL;
        case MyErrorCode2: ...; return TRS_UNDEF;
        case MyErrorCode3: ...; return TRS_OK;
        default:           ...; break;
      }
      return result;
   }

      if in test                          will be called in trsRun, 

    if (error1) return TRS_FAIL;         trsResult=Term(TRS_FAIL);    
    if (error2) return TRS_UNDEF;        trsResult=Term(TRS_UNDEF);
    if (case1)  return MyErrorCode1;     trsResult=Term(MyErrorCode1);
    if (case2)  return MyErrorCode2;     trsResult=Term(MyErrorCode2);
    if (case3)  return MyErrorCode3;     trsResult=Term(MyErrorCode3);
    return TRS_OK;                       trsResult=Term(TRS_OK);      

   MyErrorCode may be any if out of range [-16..15]
*/
/* -------------------------------------------------------------------------*/

TRSAPI(int,trsRun,(int  argC, char *argV[]));   /* Start test system        */

#define TG_RUN_ARGC            9
#define TG_RUN_ARGV           10

/* --- Test write ----------------------------------------------------------*/

TRSAPI(int, trsWrite,(int twflag,const char *format,...));
                                         /*    When Write?                  */
#define TW_RUN     0x8000                /* in batch mode                   */
#define TW_RERUN   0x4000                /* at restart when error or "-r"   */
#define TW_DEBUG   0x2000                /* in debug mode            "-d"   */
#define TW_EMPTY   0x0000                /* to comment out trsWrite         */

                                         /*    Where Write?                 */
#define TW_CON     0x0800                /* To console                      */
#define TW_LST     0x0400                /* To .lst file             "-l"   */
#define TW_SUM     0x0200                /* To .sum file             "-s"   */

#define TO_CON     TW_RUN | TW_CON
#define TO_LST     TW_RUN | TW_LST
#define TO_SUM     TW_RUN | TW_SUM

/* --- Benchmark functions -------------------------------------------------*/

#define TRS_MAX_TIMER 9                 /* Timers [0..TRS_MAX_TIMER]        */
                                        /* High Priority Timers:            */
                                        /*     0..TRS_MAX_TIMER/2           */

TRSAPI(void,  trsTimerStart,   (int TimerNo)); /* Start counting ticks fr 0 */
TRSAPI(void,  trsTimerStop,    (int TimerNo)); /* Stop counting ticks       */
TRSAPI(void,  trsTimerContinue,(int TimerNo)); /* Continue counting ticks   */

TRSAPI(double,trsTimerClock,   (int TimerNo)); /* Interval in CLOCKS_PER_SEC*/
TRSAPI(double,trsTimerSec,     (int TimerNo)); /* Timer interval in seconds */
                                               /* Getting is available also */
                                               /* on fly (when timer run)   */
TRSAPI(double,trsClocksPerSec,(void));         /* Clock frequency           */

/* --- Loops organization functions ----------------------------------------*/

#define TRS_STEP_ADD 0                          /* Additive step type       */
#define TRS_STEP_MPY 1                          /* Mult step type           */
#define TRS_STEP_DIV 2                          /* Div step type            */

typedef struct _TRSScale_t {
  int start;
  int end;
  int step;
  int steptype;                                 /*TRS_STEP_ADD or TRS_STEP_MPY*/
  int current;                                  /* current point            */
  int init;                                     /* 0 - init, 1 - run        */
} TRSScale_t;

TRSAPI(int, trsScaleInit,(int start,int end,int step,int steptype,TRSScale_t *scale));
/* returns:
     0 - error in parameters
     1 - init OK
*/

TRSAPI(int, trsScaleNextPoint,(TRSScale_t *scale, int *next));
/* returns:
     0 - if no more points (out of range)
     1 - next point value was returned to (*next)
*/

/* --- Guarded memory manage functions -------------------------------------*/
/* This functions may be used in test class "SideEffects".                  */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -