亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? chan_enc.c

?? 語音壓縮編碼和解碼的標準,其中包含部分源代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*-------------------------------------------------------------------------*/ 
/*                                                                         */
/*                   G.723.1 Channel Encoder Simulation V3.1               */
/*                                                                         */
/*-------------------------------------------------------------------------*/
/*                                                                         */
/*-------------------------------------------------------------------------*/
/* (C) Copyright 1995-1996, Bosch Telecom. All rights reserved.            */
/* Contact: Joerg-Martin Mueller, Bosch Telecom, Email: jmm@bk.bosch.de    */
/*-------------------------------------------------------------------------*/


/*___________________________________________________________________________
 |                                                                           |
 | 	Include-Files                                                        |
 |___________________________________________________________________________|
*/
#include "defines.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

/* G.723.1 Includes */
#include "typedef.h"
#include "basop.h"
#include "cst_lbc.h"
#include "tab_lbc.h"
#include "lbccodec.h"
#include "coder.h"
#include "decod.h"
#include "exc_lbc.h"
#include "util_lbc.h"

#define   tstbit( x, n )    (( x ) &    ( 1 << ( n )))


/*___________________________________________________________________________
 |                                                                           |
 |  	local Functions                                                      |
 |___________________________________________________________________________|
*/
static void  GetChannelBitrates(char *ConfigName);
static void Channel_Pack(Word16 chan_bit[], char ChannelBitStream[], 
                         Word16 SysChannelBitrate, Word16 *NumChannelBytes);
static Word16 GetSpeechFrame (FILE *bit_infile, char InfoBitStream[]);
static void CrcEncoder(Word16 info_bit[], char mode);
static void ChannelEncoder( char InfoBitStream[], char ChannelBitStream[],
                            Word16 ChannelBitrate,  Word16 *NumChannelBytes);
static void bit_allocation( char InfoBitStream[], Word16 info_bit[] );
static void conv_encoder( Word16 bit_class[], Word16 punctur[5][3], 
         Word16 info_bit[], Word16 chan_bit[], char mode);
static void  EndTrellisReorderEnc (Word16 info_bit[], Word16 bit_class[], 
                                   Word16 punctur[5][3], Word16 mode);
static void ChannelCodecInit(Word16 SpeechCodecMode,Word16 ChannelBitrate,
                             Word16 bit_class[],Word16 punctur[5][3]);
static Word16 GetRate (Word16 rbits, Word16 weight, Word16 bit_class, Word16 inv_bit_class, Word16 rnd);
static bitrate_test( Word16 nbit_class[], Word16 punctur[5][3], Word16 last );
static void bitrate_adapt_high (Word16 bit_class[],Word16 punctur[5][3],
                                Word16 cbits, Word16 r[], Word16 last);
static void bitrate_adapt_low (Word16 bit_class[],Word16 punctur[5][3],
                                Word16 cbits, Word16 r[], Word16 last);
static void channel_encoder_adaptation(char InfoBitStream[],char CInfoBitStream[]);
static void Line_Pack_Channel( LINEDEF *Line, char *Vout, Word16 FrType);
static void LSP_Reorder_encoder (LINEDEF *Line);
static void SelectChannelBitrate(Word16 ChannelBitrate,Word16 *SysChannelBitrate,
                                 Word16 *CC_mode, Word16 G723_mode);
static int Strincmp( const char *s, const char *t, size_t max );
static FILE *OpenBinfile( char *name, char *mode );

/*___________________________________________________________________________
 |                                                                           |
 |  Globals                                                                  |
 |___________________________________________________________________________|
*/
/* G.723.1 declarations */
/* -------------------- */
enum  Crate    WrkRate;
Flag  UseHp = True;
Flag  UsePf = True;
Flag  UseVx = True;
Word32  count_clip;

/* Definition of CRC Check Code for error detection (see section 2.4) */
/* ------------------------------------------------------------------ */
#define   CrcLen         5  /* number of parity check bits       */
#define   CrcGen        18  /* generator polynomial              */
#define   CrcWindow53   34  /* number of bits of class 1 for crc */
#define   CrcWindow63   44  /* number of bits of class 1 for crc */
#define   CrcWindowSID  30  /* number of bits of class 1 for crc */

/* Definition of low rate configuration */
/* ------------------------------------ */
#define   NBits5_3       168  /* Info bits with configuration and UB's */
#define   NInfoBits5_3   162  /* Info bits without configuration and UB's */

/* Definition of high rate configuration */
/* ------------------------------------- */
#define   NBits6_3       200  /* Info bits with configuration and UB's */
#define   NInfoBits6_3   193  /* Info bits without configuration and UB's */

/* Definition of SID configuration */
/* ------------------------------- */
#define   NBitsSID        32  /* Info bits with configuration and UB's */
#define   NInfoBitsSID    30  /* Info bits without configuration and UB's */

/* Definition of BCH Code for configuration bits (see section 2.5.4) */
/* ----------------------------------------------------------------- */
#define   BCHLen  13
#define   NumBCHWords  8

/* Channel bitrates (are read from file) */
/* ------------------------------------- */
static Word16   ChannelBitrate_53[2];
static Word16   ChannelBitrate_63[2];
static Word16   ChannelBitrate_SID[2];

/* This flag is only true when exercising a special test sequence */
/* -------------------------------------------------------------- */
Flag TESTSEQUENCE = False;

/*___________________________________________________________________________
 |                                                                           |
 |  	Subroutines                                                          |
 |___________________________________________________________________________|
*/

/*___________________________________________________________________________
 |                                                                           |
 | Generation of channel encoder output format (see section 2.5.4)           |
 |___________________________________________________________________________|
*/
static void Channel_Pack(Word16 chan_bit[], char ChannelBitStream[], 
                         Word16 SysChannelBitrate, Word16 *NumChannelBytes)
{
   Word16 i, pw, pb;
   Word32 L_tmp;

   /* Determine number of bytes to be packed */
   /* -------------------------------------- */

   /* Multiply channel bitrate by 30./8000. */
   /* ------------------------------------- */
   L_tmp = L_mult(SysChannelBitrate,31457);
   *NumChannelBytes = (Word16) L_shr(L_tmp,24);

   /* Multiply channel bitrate by 8000./30. */
   /* ------------------------------------- */
   L_tmp = L_mult(*NumChannelBytes,17067);
   L_tmp = L_shr(L_tmp,7);
   if ((Word16) L_tmp < SysChannelBitrate) *NumChannelBytes = *NumChannelBytes + 1;

   /* Pack channel bits */
   /* ----------------- */
   for (i=0;i<(*NumChannelBytes);i++)  ChannelBitStream[i] = 0;
   pw = 0;
   pb = 0;
   for (i=0;i<*NumChannelBytes*8;i++) {
      ChannelBitStream[pw] = ChannelBitStream[pw] | (chan_bit[i] << pb);
      pb++;
      if (pb == 8) {
         pb = 0;
         pw++;
      }
   }
   return;
}

/*___________________________________________________________________________
 |                                                                           |
 | Quantization of specified channel bitrate to allowed channel bitrate      |
 |               (section 2.5.4)                                             |
 |___________________________________________________________________________|
*/
static void SelectChannelBitrate(Word16 ChannelBitrate,Word16 *SysChannelBitrate,
                                 Word16 *CC_mode, Word16 G723_mode)
{
   Word16   CC_Bitrate[2],i;
 
   /* Set allowed channel bitrates depending on G.723 mode */
   /* ---------------------------------------------------- */
   if (G723_mode == 0) {
      for (i=0;i<2;i++) CC_Bitrate[i] = ChannelBitrate_63[i];
   }
   if (G723_mode == 1) {
      for (i=0;i<2;i++) CC_Bitrate[i] = ChannelBitrate_53[i];
   }
   if (G723_mode == 2) {
      for (i=0;i<2;i++) CC_Bitrate[i] = ChannelBitrate_SID[i];
   }

   /* Quantize requested channel bitrate to next lower allowed channel bitrate */
   /* ------------------------------------------------------------------------ */
   *CC_mode = (-1);
   for (i=1;i>=0;i--) {
      if (ChannelBitrate >= CC_Bitrate[i]){
         *CC_mode = i;
         *SysChannelBitrate = CC_Bitrate[i];
         break;
      }
   }

   if (*CC_mode == (-1)){
      printf (" Requested channel bitrate is too low \n");
      exit(1);
   }      

   return;
}

/*_________________________________________________________________________________
 |                                                                                 |
 | Reorder the last protected bits to consider lower BER at the end of the trellis |
 |               (section 2.5.2)                                                   |
 |_________________________________________________________________________________|
*/
static void  EndTrellisReorderEnc (Word16 info_bit[], Word16 bit_class[], 
                                   Word16 punctur[5][3], Word16 mode)
{
   Word16 last,i,ptr_end,tmp,limit;

    if( (mode & 0x3) == 0) limit=CrcWindow63+CrcLen+20;
    if( (mode & 0x3) == 1) limit=CrcWindow53+CrcLen+20;
    if( (mode & 0x3) == 2) limit=CrcWindowSID+CrcLen+20;


   /* Check which class is the last protected one */
   /* ------------------------------------------- */
   last=0;
   for (i=1;i<5;i++){
      if (punctur[i][0] != 0) last=i;
   }

   /* Determine number of protected bits */
   /* ---------------------------------- */
   ptr_end = 0;
   for (i=0;i<=last;i++) ptr_end = ptr_end + bit_class[i];
   ptr_end = ptr_end - 4;  /* remove tail bits */

   /* Do reordering */
   /* ------------- */
   if (ptr_end >= limit) {
      ptr_end--;
      for (i=0;i<10;i++){
         tmp                    = info_bit[ptr_end-i];
         info_bit[ptr_end-i]    = info_bit[ptr_end-19+i];
         info_bit[ptr_end-19+i] = tmp;
      }
   }
   return;
}



/*_________________________________________________________________________________
 |                                                                                 |
 | Determine the parameters of the channel encoder given the channel bitrate       |
 |               (section 2.5.1)                                                   |
 |_________________________________________________________________________________|
*/
static void ChannelCodecInit(Word16 SpeechCodecMode,Word16 ChannelBitrate,
                             Word16 bit_class[],Word16 punctur[5][3])

{
/* Definition of puncturing matrix for convolutional code (see Table C4) */
/* --------------------------------------------------------------------- */
   static const Word16 PuncturTable[25][3] = {{0x000,0x000,0x000},
                                            {0xd6f,0x690,0x000},
                                            {0xd7f,0x690,0x000},
                                            {0xd7f,0x691,0x000},
                                            {0xd7f,0x695,0x000},
                                            {0xdff,0x695,0x000},
                                            {0xfff,0x695,0x000},
                                            {0xfff,0x69d,0x000},
                                            {0xfff,0x6dd,0x000},
                                            {0xfff,0x6df,0x000},
                                            {0xfff,0x7df,0x000},
                                            {0xfff,0x7ff,0x000},
                                            {0xfff,0xfff,0x000},
                                            {0xfff,0xfff,0x001},
                                            {0xfff,0xfff,0x009},
                                            {0xfff,0xfff,0x109},
                                            {0xfff,0xfff,0x309},
                                            {0xfff,0xfff,0x329},
                                            {0xfff,0xfff,0x729},
                                            {0xfff,0xfff,0x72d},
                                            {0xfff,0xfff,0x72f},
                                            {0xfff,0xfff,0x7af},
                                            {0xfff,0xfff,0x7bf},
                                            {0xfff,0xfff,0x7ff},
                                            {0xfff,0xfff,0xfff}};

/* Definition of low rate configuration (see Table C5a)         */
/* Note that the weight is in 16 bit representation and negated */
/* ------------------------------------------------------------ */
   static const Word16   BitClass53[5]    = { 34+CrcLen, 40, 40, 40+4, 8 };
   static const Word16   Weight53[5]      = { -7864, -10158, -7864, -6882, 0}; 

   static const Word16   InvBitClass53[4] = {26887, 26214, 26214, 26214}; /* 2^20/BitClass53[i]) */
   static const Word16   inv_b0p4_53      = 24386;                        /* 2^20/(BitClass53[0]+4)*/

/* Definition of high rate configuration (see Table C5a)        */
/* Note that the weight is in 16 bit representation and negated */
/* ------------------------------------------------------------ */
   static const Word16   BitClass63[5]    = { 44+CrcLen, 44, 46, 47+4, 12 };
   static const Word16   Weight63[5]      = { -8520, -9502, -7864, -6882, 0};

   static const Word16   InvBitClass63[4] = {21400, 23831, 22795, 22310};
   static const Word16   inv_b0p4_63      = 19785;

/* Definition of SID configuration (see Table C5b)              */
/* Note that the weight is in 16 bit representation and negated */
/* ------------------------------------------------------------ */
   static const Word16   BitClassSID[5] = { 30+CrcLen+4, 0, 0, 0, 0 };
   static const Word16   WeightSID[5]   = { -32768, 0, 0, 0, 0};

   static const Word16   inv_b0p4_SID   = 26887;

   Word16   i,j,rbits,r[5],abits,last,cbits,limit,NInfoBits;
   Word16   weight[5],inv_b0p4,inv_bit_class[4];
   Word32   L_tmp;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区成人| 国产精品综合久久| 色久优优欧美色久优优| 亚洲欧美国产77777| 99国产精品视频免费观看| 国产精品系列在线| 99vv1com这只有精品| 亚洲精品国产精华液| 欧美在线999| 国产真实精品久久二三区| 国产日产欧美精品一区二区三区| 国产宾馆实践打屁股91| 亚洲欧美日韩国产中文在线| 欧美不卡一区二区三区四区| 中文字幕电影一区| 精品影视av免费| 精品剧情在线观看| 成人永久免费视频| 亚洲在线观看免费| 日韩欧美在线123| 在线观看亚洲精品| 成人午夜激情视频| 色综合久久九月婷婷色综合| 美女视频黄免费的久久 | 久久久精品国产免大香伊| 国产福利一区二区三区在线视频| 国产亚洲美州欧州综合国| 免费看日韩a级影片| 国产欧美视频在线观看| 欧美少妇bbb| 成人免费观看男女羞羞视频| 午夜久久福利影院| 亚洲六月丁香色婷婷综合久久 | 91在线国产福利| 成人高清伦理免费影院在线观看| 国产一区激情在线| 婷婷开心激情综合| 青青草伊人久久| 日韩电影免费在线看| 一区二区三区在线免费播放 | 色94色欧美sute亚洲线路一ni | av综合在线播放| 欧美三日本三级三级在线播放| 91一区二区三区在线观看| 东方aⅴ免费观看久久av| 成人一区二区三区中文字幕| 国产黄人亚洲片| 99久久精品免费看国产免费软件| 91久久精品一区二区三| 欧美午夜精品久久久久久孕妇| 欧美精品一二三区| 精品国产区一区| 中文字幕免费不卡| 午夜日韩在线电影| 国产成人小视频| 91麻豆精品国产自产在线观看一区 | 91国内精品野花午夜精品| 国产无一区二区| 亚洲三级电影全部在线观看高清| 综合分类小说区另类春色亚洲小说欧美| 天堂va蜜桃一区二区三区漫画版| 国产成人免费视频精品含羞草妖精| 一本久久综合亚洲鲁鲁五月天| 欧美日本一道本在线视频| xfplay精品久久| 日韩在线播放一区二区| 91免费视频网址| 国产精品日韩精品欧美在线| 精品亚洲欧美一区| 日韩欧美精品三级| 午夜精品福利视频网站| 91成人在线免费观看| 国产三级精品在线| 日本伊人色综合网| 欧美日韩一区视频| 韩国精品主播一区二区在线观看 | 不卡电影一区二区三区| 国产精品久久久久影院亚瑟| 国产一区不卡视频| 精品免费视频一区二区| 国产精品一区二区男女羞羞无遮挡| 欧美精品乱码久久久久久按摩 | 亚洲精品中文在线影院| 在线观看日韩精品| 男人的天堂亚洲一区| 欧美卡1卡2卡| 午夜亚洲福利老司机| 56国语精品自产拍在线观看| 日本一不卡视频| 91精品国产乱码| 久久99精品视频| 欧美一区二区三区视频免费| 久久99在线观看| 精品国产亚洲在线| 成人黄动漫网站免费app| 日韩美女视频一区| 欧美日韩中文国产| 久久精品99久久久| 国产三区在线成人av| 成人av免费在线观看| 一区二区久久久| www亚洲一区| 欧美亚州韩日在线看免费版国语版| 蜜臀久久99精品久久久久宅男| 中文字幕乱码日本亚洲一区二区| 久久久久久久一区| 91小宝寻花一区二区三区| 中文字幕一区二区在线播放| 在线一区二区三区做爰视频网站| 午夜精品影院在线观看| 国产欧美日本一区视频| 91精品久久久久久久99蜜桃| 成人av电影观看| 经典三级视频一区| 日韩成人av影视| 日韩高清不卡一区二区| 亚洲午夜激情网站| 亚洲欧美激情插| 一区精品在线播放| 国产精品国产三级国产a| 欧美大片免费久久精品三p| 色婷婷综合久久久中文一区二区| 狠狠色综合日日| 精品一区二区三区欧美| 亚洲二区视频在线| 亚洲欧美一区二区久久| 亚洲欧美欧美一区二区三区| 中文幕一区二区三区久久蜜桃| 久久午夜老司机| 久久久午夜精品| 国产欧美日韩中文久久| 国产亚洲自拍一区| 欧美国产精品一区二区三区| 精品国产麻豆免费人成网站| 欧美一级片在线看| 日韩一区二区三区视频在线观看| 欧美日韩成人在线| 日韩久久久精品| 欧美激情一区二区三区蜜桃视频| 日韩视频一区在线观看| 精品美女在线播放| 中文字幕日韩一区| 亚洲国产美国国产综合一区二区 | 亚洲一区二区三区爽爽爽爽爽 | 7777精品伊人久久久大香线蕉完整版| 久久久久国产精品麻豆| 亚洲精品一二三四区| 日韩高清不卡在线| 懂色中文一区二区在线播放| 欧美欧美欧美欧美| 日韩美女视频一区| 国产成人精品影视| 久久丝袜美腿综合| 奇米精品一区二区三区在线观看| 北条麻妃一区二区三区| 欧美变态tickling挠脚心| 午夜视频在线观看一区二区| 91麻豆.com| 一区二区三区国产| 菠萝蜜视频在线观看一区| 国产亚洲污的网站| 国产一区三区三区| 精品久久久久久久久久久久久久久久久| 欧美激情一区二区三区在线| 老司机免费视频一区二区三区| 欧美精品在线一区二区| 亚洲高清在线精品| 欧美色倩网站大全免费| 亚洲成人av免费| 精品福利视频一区二区三区| 老司机精品视频在线| 欧美精品一区二区三区一线天视频 | 午夜视频久久久久久| 欧美夫妻性生活| 免费成人在线观看视频| 国产精品久久久久国产精品日日 | 久久99日本精品| 久久久噜噜噜久久中文字幕色伊伊 | 日韩亚洲欧美高清| 成人sese在线| 精品一区二区三区在线观看 | 欧美日韩午夜精品| 麻豆精品视频在线| 亚洲激情自拍偷拍| 久久精品亚洲麻豆av一区二区 | 久久精品99久久久| 日韩avvvv在线播放| 久久久99精品免费观看不卡| 一本久久综合亚洲鲁鲁五月天| 玖玖九九国产精品| 亚洲成av人**亚洲成av**| 久久久久97国产精华液好用吗| 欧美午夜一区二区三区| 色婷婷久久久久swag精品| 国产成人免费在线观看不卡| 免费人成黄页网站在线一区二区| 一区二区三区成人| 欧美肥胖老妇做爰| 国产不卡视频一区二区三区| 久久99精品久久久久久动态图|