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

📄 tty_hdr.c

📁 完整的EVRC压缩解压缩算法源码,通过C-C++编译后可以运行!
💻 C
📖 第 1 页 / 共 2 页
字号:
/* conditions, as appropriate.                                       */
/*                                                                   */
/*-------------------------------------------------------------------*/
/*                                                                   */
/* Notice:                                                           */
/* This contribution has been prepared by the contributor to assist  */
/* 3GPP2 Technical Specifications Group C. This document is offered  */
/* to 3GPP2 Technical Specifications Group C as a basis for          */
/* discussion and should not be construed as a binding proposal on   */
/* Lucent Technologies Inc. or any other company.  Specifically,     */
/* Lucent Technologies Inc. reserves the right to modify, amend, or  */
/* withdraw the statements contained herein.                         */
/*                                                                   */
/* Permission is granted to 3GPP2 Technical Specifications Group C   */
/* participants to copy any portion of this document for legitimate  */
/* purposes of 3GPP2 Technical Specifications Group C. Copying for   */
/* monetary gain or other non-3GPP2 Technical Specifications Group C */
/* purposes is prohibited.                                           */
/*                                                                   */
/*-------------------------------------------------------------------*/
/*                                                                   */
/* Grant of license Motorola Inc. grants a free, irrevocable license */
/* to 3GPP2 and its organizational partners to incorporate Motorola- */
/* supplied text or other copyrightable material contained in the    */
/* contribution and any modifications thereof in the creation of     */ 
/* 3GPP2 publications, to copyright and sell in organizational       */
/* partners name any organizational partners standards publications  */
/* even though it may include portions of the contribution; and at   */
/* the organizational partners sole discretion to permit others      */
/* to reproduce in whole or in part such contributions or the        */
/* resulting organizational partners standards publication. Motorola */
/* is also willing to grant licenses under such Motorola copyrights  */
/* to third parties on reasonable, non-discriminatory terms and      */
/* conditions, as appropriate.                                       */
/*                                                                   */
/* Notice:                                                           */
/* This document has been prepared by Motorola Inc. to assist the    */
/* 3GPP2 standards committee. This document is offered to the        */
/* committee as a basis for discussion and should not be considered  */
/* as a binding proposal on Motorola Inc.  or any other company.     */
/* Specifically, Motorola Inc. reserves the right to modify, amend,  */
/* or withdraw the statement contained herein. Permission is granted */
/* to 3GPP2 and its organizational partners to copy any portion of   */
/* this document for the legitimate purposes of the 3GPP2.  Copying  */
/* this document for monetary gain or other non-3GPP2 purpose is     */
/* prohibited.  Motorola Inc. may hold one or more patents of        */
/* copyrights that cover information contained in this contribution, */
/* and agrees that a license under those rights will be made         */
/* available on reasonable and non-discriminatory terms and          */
/* conditions, subject to receiving a reciprocal license in return.  */
/* Nothing contained herein shall be construed as conferring by      */
/* implication, estoppel, or otherwise any license or right under    */
/* any patent, whether or not the use of information herein          */
/* necessarily employs an invention of any existing or later issued  */
/* patent, or copyright.                                             */
/*                                                                   */
/* Notice                                                            */
/* Permission is granted to 3GPP2 participants to copy any portion of*/
/* this contribution for the legitimate purpose of the 3GPP2.        */
/* Copying this contribution for monetary gain or other non-3GPP2    */
/* purpose is prohibited.                                            */
/*                                                                   */
/*-------------------------------------------------------------------*/


#include <stdio.h>
#include "typedef.h"
#include "tty.h"
#include "basic_op.h"

/***********************************************************************
*   tty_header_in()
*       Takes the header coming into the tty processing and converts
*       it to the internal format.
************************************************************************/

void tty_header_in( Word16 *counter )
{
    Word16   i;
    Word16   j;
    
  
    if( sub(*counter,TTY_SILENCE_HDR) == 0 )
    {
        *counter = TTY_SILENCE;
    }
    else if( sub(*counter,TTY_ONSET_HDR) == 0 )
    {
        *counter = TTY_ONSET;
    }
    else
    {
        j = TTY_CHAR_HDR_START;                     
        for( i=TTY_COUNTER_START ; i <= TTY_COUNTER_STOP ; i = shl(i,1) )
        {
            if( sub(*counter,j) == 0 )
            {
                *counter = i;                       
                break;
            }
            j = add(j,1);
        }
    }

} /* end tty_header_in() */


/***********************************************************************
*   tty_header_in()
*       Takes the internal counter coming out of the tty processing
*       and converts it to the external header format that is sent
*       in the speech packet.
************************************************************************/

void tty_header_out( Word16 *counter)
{
    Word16   i;
    Word16   j;

    if( sub(*counter,NON_TTY) == 0 )
    {
        return;
    }

    if( sub(*counter,TTY_ONSET) == 0 )
    {
        *counter = TTY_ONSET_HDR;                   
        return;
    }

    if( sub(*counter,TTY_SILENCE) == 0 )
    {
        *counter = TTY_SILENCE_HDR;                 
        return;
    }

    j = TTY_CHAR_HDR_START;                     
    for( i=TTY_COUNTER_START ; i <= TTY_COUNTER_STOP ; i = shl(i,1) )
    {
                                                
        if( sub(*counter,i) == 0 )
        {
            *counter = j;                       
            break;
        }
        j = add(j,1);
    }

    return;

} /* end tty_header_out() */


⌨️ 快捷键说明

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