LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1888|回复: 4

Asterisk SVN-trunk-r38612M之后的729支持。

[复制链接]
发表于 2006-8-23 20:10:40 | 显示全部楼层 |阅读模式
codec_g729.c
[PHP]/*
* G729 codec for Asterisk
*
* Based on sample applications from Intel Performance Primitives (IPP)
* libraries.
*
* For Intel IPP licensing, see http://www.intel.com
*
* For G.729(,A,B) royalty payments, see http://www.sipro.com
*   WARNING: please make sure you are sitting down before looking
*            at their price list.
*
* This source file is Copyright (C) 2004 Ready Technology Limited
* This code is provided for educational purposes and is not warranted
* to be fit for commercial use.  There is no warranty of any kind.
*
* Author: daniel@readytechnology.co.uk
* ailantian at gmail dot com modified for asterisk 1.2.10 and later.
*/

#define _GNU_SOURCE
#include "asterisk.h"

#include <asterisk/lock.h>
#include <asterisk/translate.h>
#include <asterisk/module.h>
#include <asterisk/logger.h>
#include <asterisk/channel.h>
#include "asterisk/options.h"

#include <pthread.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <netinet/in.h>
#include <string.h>
#include <stdio.h>

#include "usc.h"
#include <ippcore.h>
#include <ipps.h>
#include <ippsc.h>
//#include "encoder.h"
//#include "decoder.h"

#include "slin_g729_ex.h"
#include "g729_slin_ex.h"

#define BUFFER_SAMPLES   10000

//AST_MUTEX_DEFINE_STATIC(localuser_lock);

static int localusecnt=0;

//static char *tdesc = "G729/PCM16 (signed linear) Codec Translator, based on IPP";

static USC_Fxns *USC_CODEC_Fxns;

struct g729_translator_pvt {

        struct ast_frame f;

        USC_CodecInfo pInfo;

        USC_Handle codec;        /* the encoder or decoder handle */
        USC_MemBank* pBanks;


        USC_PCMStream pcmStream;        /* Signed linear data */
        USC_Bitstream bitStream;        /* G.729 bits */

        int nbanks;
        int maxbitsize;
          int inFrameSize;
           int outFrameSize;

        short pcm_buf[8000];
//        unsigned char pcm_buf[8000];
        unsigned char bitstream_buf[1000];

        int tail;
};

//#define g729_translator_pvt ast_translator_pvt

static int lintog729_new(struct ast_trans_pvt *pvt) {
        int i;
//                printf("in lintog729_new\n");
               
        struct g729_translator_pvt *tmp;
//        tmp=pvt->pvt;
//        memset(tmp,0,sizeof(struct g729_translator_pvt));
//        printf("mallocing\n");
        tmp = malloc(sizeof(struct g729_translator_pvt));
        if(tmp==NULL)
                printf("malloc failed\n");
//        printf("1");
        if(tmp) {
                USC_CODEC_Fxns->std.GetInfo((USC_Handle)NULL, &tmp->pInfo);
                ((USC_Option*)tmp->pInfo.params)->modes.truncate = 1;
                  ((USC_Option*)tmp->pInfo.params)->direction = 0;
                  ((USC_Option*)tmp->pInfo.params)->modes.vad = 0;
                USC_CODEC_Fxns->std.NumAlloc(tmp->pInfo.params, &(tmp->nbanks));
                if(!(tmp->pBanks = (USC_MemBank*)ippsMalloc_8u(sizeof(USC_MemBank)*(tmp->nbanks)))) {
                  ast_log(LOG_WARNING, "ippsMalloc_8u failed allocating %d bytes", sizeof(USC_MemBank)*(tmp->nbanks));
                  /* printf("\nLow memory: %d bytes not allocated\n",sizeof(USC_MemBank)*nbanks); */
                  return NULL;
                }
                USC_CODEC_Fxns->std.MemAlloc(tmp->pInfo.params, tmp->pBanks);
                for(i=0; i<tmp->nbanks;i++) {
                        if(!(tmp->pBanks.pMem = ippsMalloc_8u(tmp->pBanks->nbytes))) {
                                ast_log(LOG_WARNING, "ippsMalloc_8u failed allocating %d bytes", sizeof(USC_MemBank)*(tmp->nbanks));
                                /* printf("\nLow memory: %d bytes not allocated\n",tmp->pBanks->nbytes); */
                                return -1;
                        }
                }

                tmp->inFrameSize = getInFrameSize();
                tmp->outFrameSize = getOutFrameSize();

                /* tmp->bitstream_buf = ippsMalloc_8s(tmp->pInfo.maxbitsize); */
printf("2");
                tmp->pcmStream.bitrate = tmp->pInfo.params->modes.bitrate;
                  tmp->maxbitsize = tmp->pInfo.maxbitsize;
                  USC_CODEC_Fxns->std.Init(tmp->pInfo.params, tmp->pBanks, &(tmp->codec));

#ifndef IPPCORE_NO_SSE
                  //ippCoreSetFlushToZero( 1, NULL );
#endif
                  tmp->pcmStream.pcmType.bitPerSample = tmp->pInfo.pcmType->bitPerSample;
                  tmp->pcmStream.pcmType.sample_frequency = tmp->pInfo.pcmType->sample_frequency;
                  tmp->bitStream.nbytes  = tmp->maxbitsize;
                  tmp->bitStream.pBuffer = tmp->bitstream_buf;
printf("3");
                USC_CODEC_Fxns->std.Reinit(&((USC_Option*)tmp->pInfo.params)->modes, tmp->codec);

                tmp->tail = 0;
                localusecnt++;
        }
//        printf("mem copying\n");
//        memcpy(pvt->pvt,tmp,sizeof(struct g729_translator_pvt));
//        free(tmp);
        pvt->pvt=tmp;
        pvt->datalen=0;
        pvt->samples=0;
//        printf("tmp->tail is %d\n",tmp->tail);
//        printf("pvt->pvt->tail is %d\n",pvt->pvt->tail);
//        sleep(10);
        return 0;
}

static int g729tolin_new(struct ast_trans_pvt *pvt) {
        int i;
//         printf("in g729tolin_new\n");
        struct g729_translator_pvt *tmp;
//        printf("size of 729 is %d\n",sizeof(struct g729_translator_pvt));
        tmp = malloc(sizeof(struct g729_translator_pvt));
        if(tmp==NULL)
                printf("malloc failed\n");
//        printf("1\n");
        if(tmp) {
                USC_CODEC_Fxns->std.GetInfo((USC_Handle)NULL, &(tmp->pInfo));       
                ((USC_Option*)tmp->pInfo.params)->modes.bitrate = 0;
                  ((USC_Option*)tmp->pInfo.params)->modes.truncate = 1;
                  ((USC_Option*)tmp->pInfo.params)->direction = 1;

                /* tmp->bitstream_buf = ippsMalloc_8s(size); */
               
                USC_CODEC_Fxns->std.NumAlloc(tmp->pInfo.params, &tmp->nbanks);
                if(!(tmp->pBanks = (USC_MemBank*)ippsMalloc_8u(sizeof(USC_MemBank)*(tmp->nbanks)))) {
                        ast_log(LOG_WARNING, "ippsMalloc_8u failed allocating %d bytes", sizeof(USC_MemBank)*(tmp->nbanks));
                        return -1;
                }
                USC_CODEC_Fxns->std.MemAlloc(tmp->pInfo.params, tmp->pBanks);
                for(i=0; i<tmp->nbanks;i++) {
                        if(!(tmp->pBanks.pMem = ippsMalloc_8u(tmp->pBanks->nbytes))) {
                                ast_log(LOG_WARNING, "ippsMalloc_8u failed allocating %d bytes", sizeof(USC_MemBank)*(tmp->nbanks));
                                /* printf("\nLow memory: %d bytes not allocated\n", tmp->pBanks->nbytes); */
                                return -1;
                        }
                }

                tmp->outFrameSize = getOutFrameSize();

                /* pcm_buf ippsMalloc_8s(getOutFrameSize()); */
//printf("2\n");
                tmp->maxbitsize = tmp->pInfo.maxbitsize;
                USC_CODEC_Fxns->std.Init(tmp->pInfo.params, tmp->pBanks, &(tmp->codec));

#ifndef IPPCORE_NO_SSE
                //ippCoreSetFlushToZero( 1, NULL );
#endif

                tmp->bitStream.nbytes  = tmp->maxbitsize;
                  tmp->bitStream.bitrate = 0;
                tmp->bitStream.frametype = 3;
                tmp->pcmStream.pBuffer = tmp->pcm_buf;
                tmp->pcmStream.pcmType.bitPerSample = 0;
                tmp->pcmStream.pcmType.sample_frequency = 0;
//printf("3\n");
                USC_CODEC_Fxns->std.Reinit(&((USC_Option*)tmp->pInfo.params)->modes, tmp->codec);

                tmp->tail = 0;
                localusecnt++;
        }
//        printf("4\n");
        pvt->pvt=tmp;
        pvt->datalen=0;
        pvt->samples=0;
//        printf("tmp->tail is %d\n",tmp->tail);
//        memcpy(pvt->pvt,tmp,sizeof(struct g729_translator_pvt));
//        free(tmp);
        return 0;
}

static struct ast_frame *lintog729_sample(void) {
        static struct ast_frame f;
        f.frametype = AST_FRAME_VOICE;
        f.subclass = AST_FORMAT_SLINEAR;
        f.datalen = sizeof(slin_g729_ex);
        f.samples = sizeof(slin_g729_ex) / 2;
        f.mallocd = 0;
        f.offset = 0;
        f.src = __PRETTY_FUNCTION__;
        f.data = slin_g729_ex;
        return &f;
}

static struct ast_frame *g729tolin_sample(void) {
//        printf("in g729tolin_sample\n");
        static struct ast_frame f;
        f.frametype = AST_FRAME_VOICE;
        f.subclass = AST_FORMAT_G729A;
        f.datalen = sizeof(g729_slin_ex);
        f.samples = 240;
        f.mallocd = 0;
        f.offset = 0;
        f.src = __PRETTY_FUNCTION__;
        f.data = g729_slin_ex;
        return &f;
}

/**
* Retrieve a frame that has already been decompressed
*/
static struct ast_frame *g729tolin_frameout(struct ast_trans_pvt *pvt) {
//        printf("in g729tolin_frameout\n");
        struct g729_translator_pvt *tmp;       
        tmp=pvt->pvt;
//        printf("tmp->tail is %d\n",tmp->tail);
//                printf("pvt->datalen is %d\t pvt->samples is %d\n",pvt->datalen,pvt->samples);
        if(!tmp->tail)
                return NULL;
        tmp->f.frametype = AST_FRAME_VOICE;
        tmp->f.subclass = AST_FORMAT_SLINEAR;
        tmp->f.datalen = tmp->tail * 2;
        tmp->f.samples = tmp->tail;
        tmp->f.mallocd = 0;
        tmp->f.offset = AST_FRIENDLY_OFFSET;
        tmp->f.src = __PRETTY_FUNCTION__;
        tmp->f.data = tmp->pcm_buf;
        tmp->tail = 0;
        pvt->datalen=0;
        pvt->samples=0;
        return &tmp->f;
}
/**
* Accept a frame and decode it at the end of the current buffer
*/
static int g729tolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) {

//        printf("in g729tolin_framein\n");
        int x, i;
        int frameSize = 0;
        struct g729_translator_pvt *tmp;       
        tmp=pvt->pvt;
//        printf("tmp->tail is %d\n",tmp->tail);
/*        if(f->datalen % 10) {
                ast_log(LOG_WARNING, "Received a G.729 frame that was %d bytes from %s\n", f->datalen, f->src);
                return -1;
        } */

        for(x = 0; x < f->datalen; x += frameSize) {
                if((f->datalen - x) == 2)
                        frameSize = 2;   /* VAD frame */
                else
                        frameSize = 10;  /* Regular frame */
                if(tmp->tail + 80 < sizeof(tmp->pcm_buf) / 2) {
                        /* decode the frame */
                        tmp->bitStream.pBuffer = f->data + x;
                        tmp->pcmStream.pBuffer = tmp->pcm_buf + tmp->tail;
                        USC_CODEC_Fxns->std.Decode (tmp->codec, &tmp->bitStream, &tmp->pcmStream);
//                        printf("decoded one\n");

                        tmp->tail += 80;
                        pvt->samples+=80;
                        pvt->datalen+=80*2;
                } else {
                        ast_log(LOG_WARNING, "Out of G.729 buffer space\n");
                        return -1;
                }
        }
        return 0;
}

static int lintog729_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) {
//        printf("in lintog729_framein\n");
        struct g729_translator_pvt *tmp;
        tmp=pvt->pvt;
//        printf("tmp->tail is %d\n",tmp->tail);
        if(tmp->tail + f->datalen/2 < sizeof(tmp->pcm_buf) / 2) {
                memcpy((tmp->pcm_buf + tmp->tail), f->data, f->datalen);
                tmp->tail += f->datalen/2;
        } else {
                ast_log(LOG_WARNING, "Out of buffer space\n");
                return -1;
        }
        pvt->samples+=f->samples;
        pvt->datalen+=tmp->tail*2;
        return 0;
}


static struct ast_frame *lintog729_frameout(struct ast_trans_pvt *pvt) {
//printf("in lintog729_frameout\n");
        struct g729_translator_pvt *tmp;
        tmp=pvt->pvt;
//        printf("tmp->tail is %d\n",tmp->tail);
//        printf("pvt->datalen is %d\t pvt->samples is %d\n",pvt->datalen,pvt->samples);

        int x = 0, i;
        if(tmp->tail < 80)
                return NULL;
        tmp->f.frametype = AST_FRAME_VOICE;
        tmp->f.subclass = AST_FORMAT_G729A;
        tmp->f.mallocd = 0;
        tmp->f.offset = AST_FRIENDLY_OFFSET;
        tmp->f.src = __PRETTY_FUNCTION__;
        tmp->f.data = tmp->bitstream_buf;
        while(tmp->tail >= 80) {
                if((x+1) * 10 >= sizeof(tmp->bitstream_buf)) {
                        ast_log(LOG_WARNING, "Out of buffer space\n");
                        break;
                }
                /* Copy the frame to workspace, then encode it */
                tmp->pcmStream.pBuffer = tmp->pcm_buf;
                tmp->bitStream.pBuffer = tmp->bitstream_buf + (x * 10);
                USC_CODEC_Fxns->std.Encode (tmp->codec, &tmp->pcmStream, &tmp->bitStream);

//                printf("encoded one\n");
                tmp->tail -= 80;
                pvt->samples-=80;
                if(tmp->tail)
                        memmove(tmp->pcm_buf, tmp->pcm_buf + 80, tmp->tail * 2);
                x++;
        }
        tmp->f.datalen = x * 10;
        tmp->f.samples = x * 80;
        pvt->datalen=tmp->tail*2;


        return &(tmp->f);
}

static void g729_release(struct ast_trans_pvt *tmp) {
//        printf("in g729_release\n");
        struct g729_translator_pvt *pvt;
        pvt=tmp->pvt;
        int i;
        for(i = 0; i < pvt->nbanks; i++) {
                if(pvt->pBanks.pMem)
                        ippsFree(pvt->pBanks.pMem);       
                pvt->pBanks.pMem=NULL;
        }
        if(pvt->pBanks)
                ippsFree(pvt->pBanks);
        free(pvt);
        localusecnt--;
}

static struct ast_translator g729tolin = {
        .name="g729tolin",
        .srcfmt = AST_FORMAT_G729A,
        .dstfmt = AST_FORMAT_SLINEAR,
        .newpvt = g729tolin_new,
        .framein=g729tolin_framein,
        .frameout=g729tolin_frameout,
        .destroy=g729_release,
        .sample = g729tolin_sample,
        .buffer_samples = BUFFER_SAMPLES,
        .buf_size = BUFFER_SAMPLES * 16,
//        .plc_samples = 160,
       
};
static struct ast_translator lintog729 = {
        .name="lintog729",
        .srcfmt=AST_FORMAT_SLINEAR,
        .dstfmt=AST_FORMAT_G729A,
        .newpvt = lintog729_new,
        .framein=lintog729_framein,
        .frameout=lintog729_frameout,
        .destroy=g729_release,
        .sample=lintog729_sample,
        .buffer_samples=BUFFER_SAMPLES,
        .buf_size=BUFFER_SAMPLES,
       
};

static void parse_config(void)
{
        struct ast_variable *var;
        struct ast_config *cfg = ast_config_load("codecs.conf");
        if (!cfg)
                return;
        for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) {
                if (!strcasecmp(var->name, "genericplc")) {
                        g729tolin.useplc = ast_true(var->value) ? 1 : 0;
                        if (option_verbose > 2)
                                ast_verbose(VERBOSE_PREFIX_3 "codec_g729: %susing generic PLC\n", g729tolin.useplc ? "" : "not ");
                }
        }
        ast_config_destroy(cfg);
}

static int reload(void *mod)
{
        parse_config();
        return 0;
}

int load_module(void* mod) {
//        printf("in load_module g729 \n");
        USC_CODEC_Fxns = USC_GetCodecByName ();

        int res;
        parse_config();       
        res = ast_register_translator(&g729tolin,mod);
        if(!res)
                res = ast_register_translator(&lintog729,mod);
        else
                ast_unregister_translator(&g729tolin);
        return res;
}

int unload_module(void *mod) {
//        printf("in unload_module g729\n");
        int res;
//        ast_mutex_lock(&localuser_lock);
        res = ast_unregister_translator(&lintog729);
//        if(!res)
//                res = ast_unregister_translator(&g729tolin);
//        if(localusecnt)
//                res = -1;
//        ast_mutex_unlock(&localuser_lock);

        res |= ast_unregister_translator(&g729tolin);
        return res;
}

static const char *description(void) {
        //return tdesc;
        return "G729 Coder/Decoder";
}
/*
int usecount(void) {
        int res;
        STANDARD_USECOUNT(res);
        return res;
}
*/
static const char *key() {
        return ASTERISK_GPL_KEY;
}

STD_MOD(MOD_1, reload, NULL, NULL);[/PHP]
 楼主| 发表于 2006-8-23 20:13:35 | 显示全部楼层
Makefile
[PHP]###############################
# DO NOT EDIT BELOW THIS LINE #
###############################

# System Specific
INCLSFX=.h
CPPSFX=.c
OBJSFX=.o
EXESFX=

IPPROOT=/opt/intel/ipp/5.0/ia32/
# Optional, for ICC
#ICCLIBS=-lsvml

# IPP Dependencies
#IPPINCLS=-I$(IPPROOT)/include
IPPLIBS=-L$(IPPROOT)/sharedlib -lippsc -lippsr -lipps -lippcore -L$(IPPROOT)/sharedlib/linux32 -lguide

# Comment the above two and uncomment these
# three lines to build statically linked version
IPPINCLS=-I$(IPPROOT)/include
#IPPLIBS=-L$(IPPROOT)/lib -lippscmerged -lippsrmerged -lippsmerged -lippcore
LDFLAGS=-static
#-libcxa


# Optimizations, choose one set only depending on CPU type (or debug at bottom)
#OPTIMIZE= -O2
#IPPCORE=

# For Pentium I
#OPTIMIZE= -O6 -march=pentium  -mcpu=pentium -ffast-math -fomit-frame-pointer -DIPPCORE_NO_SSE
#IPPCORE=px

# For PII
#OPTIMIZE=-O6 -march=pentium2 -mcpu=pentium2 -ffast-math -fomit-frame-pointer -DIPPCORE_NO_SSE
#IPPCORE=px

# For PIII
#OPTIMIZE= -O6 -mcpu=pentium3 -march=pentium3 -ffast-math -fomit-frame-pointer
#IPPCORE=a6

# For PIII no SSE
#OPTIMIZE= -O6 -mcpu=pentium3 -march=pentium3 -ffast-math -fomit-frame-pointer -mno-sse
#IPPCORE=a6

# For P4
OPTIMIZE= -O6 -march=pentium4 -mcpu=pentium4 -ffast-math -fomit-frame-pointer
# optional

# For P4 no SSE
#OPTIMIZE= -O6 -march=pentium4 -mcpu=pentium4 -ffast-math -fomit-frame-pointer -no-sse
#IPPCORE=w7

# For Athlon (untested)
#OPTIMIZE= -O6 -march=athlon   -mcpu=athlon -ffast-math -fomit-frame-pointer
#IPPCORE=a6

# For debugging
#OPTIMIZE= -O  -g
#IPPCORE=px

# Compiler Specifics
CCOPTS=-c $(OPTIMIZE)
CCDEFS=-D__unix__ -Dlinux -Dlinux32 -DNDEBUG -DLINUX32 -DNO_SCRATCH_MEMORY_USED
CCINCLS=-I./include -I./vm/include $(IPPINCLS)

LNKOUT=-o
LNKOPTS=
LNKLIBS=$(IPPLIBS) -lpthread -lm $(ICCLIBS)

SOLINKOPTS=-shared $(LDFLAGS) -Xlinker -x

build: prepare_directory build_codec build_encoder build_decoder ; @echo "Done"

##### api object #####
CPPSRC_API=$(wildcard ./api/*$(CPPSFX))
OBJECT_API=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_API))

CPPSRC_VM=$(wildcard ./vm/src/*$(CPPSFX))
OBJECT_VM=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_VM))

############ Asterisk Codec ############
OBJECT_CODEC=./bin/codec_g729.so
CPPSRC_CODEC=$(wildcard ./samples/util_e$(CPPSFX) ./samples/util_d$(CPPSFX) ./samples/codec_g729.c )
OBJSRC_CODEC=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_CODEC))

build_codec:        $(OBJECT_CODEC) ; @echo "done Asterisk codec"

$(OBJECT_CODEC):        $(OBJSRC_CODEC) $(OBJECT_API)
        $(CC)  $(SOLINKOPTS) -o $@ $^ $(LNKLIBS)

##### link encoder example programs #####
OBJECT_ENCODER=./bin/g729fpencoder$(EXESFX)
OBJECT_MY_ENC=./bin/my_enc
CPPSRC_ENCODER=$(wildcard ./samples/encoder$(CPPSFX) ./samples/util_e$(CPPSFX))
CPPSRC_MY_ENC=$(wildcard ./samples/util_e$(CPPSFX) ./samples/my_enc.c)
OBJSRC_ENCODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_ENCODER))
OBJSRC_MY_ENC=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_MY_ENC))

build_encoder: $(OBJECT_ENCODER) $(OBJECT_MY_ENC) ; @echo "done encoder"

$(OBJECT_MY_ENC): $(OBJSRC_MY_ENC) $(OBJECT_API) $(OBJECT_VM)
        $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS)
$(OBJECT_ENCODER): $(OBJSRC_ENCODER) $(OBJECT_API) $(OBJECT_VM)
        $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS)

##### link decoder example programs #####
OBJECT_DECODER=./bin/g729fpdecoder$(EXESFX)
OBJECT_MY_DEC=./bin/my_dec
CPPSRC_DECODER=$(wildcard ./samples/decoder$(CPPSFX) ./samples/util_d$(CPPSFX))
CPPSRC_MY_DEC=$(wildcard ./samples/util_d$(CPPSFX) ./samples/my_dec.c)
OBJSRC_DECODER=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_DECODER))
OBJSRC_MY_DEC=$(patsubst %$(CPPSFX), %$(OBJSFX), $(CPPSRC_MY_DEC))

build_decoder: $(OBJECT_DECODER) $(OBJECT_MY_DEC) ; @echo "done decoder"

$(OBJECT_MY_DEC): $(OBJSRC_MY_DEC) $(OBJECT_API) $(OBJECT_VM)
        $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS)
$(OBJECT_DECODER): $(OBJSRC_DECODER) $(OBJECT_API) $(OBJECT_VM)
        $(CC) -o$@ $(LNKOPTS) $^ $(LNKLIBS)

##### compile encoder & decoder objects all together #####
#OBJECTS=$(OBJECT_API)  $(OBJECT_VM) $(OBJSRC_CODEC)
OBJECTS=$(OBJECT_API) $(OBJECT_VM) $(OBJSRC_CODEC) $(OBJSRC_ENCODER) $(OBJSRC_MY_ENC) $(OBJSRC_DECODER) $(OBJSRC_MY_DEC)
$(OBJECTS): %$(OBJSFX): %$(CPPSFX)
        $(CC) $(CCINCLS) $(CCDEFS) $(CCOPTS) -o$@ $<

prepare_directory: FORCE
        @if test ! -d ./bin; then mkdir ./bin; fi

clean: FORCE
        rm -f $(OBJECTS)

distclean: clean
        rm -f $(OBJECT_ENCODER) $(OBJECT_DECODER)

FORCE:
   
[/PHP]
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-8-23 20:15:04 | 显示全部楼层
vm/include/sys/vm_types_linux32.h
/* /////////////////////////////////////////////////////////////////////////////
//
//                  INTEL CORPORATION PROPRIETARY INFORMATION
//     This software is supplied under the terms of a license agreement or
//     nondisclosure agreement with Intel Corporation and may not be copied
//     or disclosed except in accordance with the terms of that agreement.
//          Copyright(c) 2003-2004 Intel Corporation. All Rights Reserved.
//
//     Cross-architecture support tool.
//     Linux types header.
*/
#ifdef LINUX32

#ifdef __cplusplus
extern "C" {
#endif

typedef unsigned long vm_var32;
typedef unsigned long long vm_var64;
typedef char vm_char;

#define VM_ALIGN_DECL(X,Y) Y __attribute__ ((aligned(X)))

#include <pthread.h>
#include <sys/types.h>
#include <semaphore.h>

/* vm_thread.h */
typedef struct {
        pthread_t handle;
        int is_valid;
} vm_thread;

/* vm_event.h */
typedef struct {
        ast_cond_t cond;
        ast_mutex_t mutex;
        int manual;
        int state;
} vm_event;

/* vm_mmap.h */
typedef struct {
        int    fd;
        void  *address;
        size_t sizet;
} vm_mmap;

/* vm_mutex.h */
typedef struct {
        ast_mutex_t handle;
        int is_valid;
} vm_mutex;

/* vm_semaphore.h */
typedef struct {
    ast_cond_t cond;
    ast_mutex_t mutex;
    int count;
} vm_semaphore;

#ifdef __cplusplus
};
#endif

#endif
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-8-23 20:16:15 | 显示全部楼层
相关其他资源
l_ipp_ia32_p_5.0.043.tgz
ipp-050903.diff
l_ipp-sample-speech-coding_p_4.1.008.tgz
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-8-23 20:17:57 | 显示全部楼层
晕,发错了,谁帮我移动移动。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表