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

📄 tty_enc.c

📁 完整的EVRC压缩解压缩算法源码,通过C-C++编译后可以运行!
💻 C
📖 第 1 页 / 共 2 页
字号:
/* Partner's sole discretion to permit others to reproduce in whole  */
/* or in part such contributions or the resulting Organizational     */
/* Partner's standards publication. The contributor must also be     */
/* willing to grant licenses under such contributor copyrights to    */
/* third parties on reasonable, non-discriminatory terms and         */
/* 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 "const.h"*/
#include "tty.h"


Word16   ditbuf[DITBUF_LEN];


/***********************************************************************
*   init_tty_enc()
************************************************************************/
void init_tty_enc(
    Word16   *tty_char,
    Word16   *counter,
    Word16   *tty_baud_rate)
{
    Word16 i;

    init_get_tty_bit();
    init_dit_to_ascii();

    *tty_char = NON_TTY;
    *counter = NON_TTY;
    *tty_baud_rate = DEFAULT_TTY_BAUD_RATE;

    for( i=0 ; i < DITBUF_LEN ; i++ )
    {
        ditbuf[i] = ERASE;
    }
}



/***********************************************************************
*   tty_enc()
************************************************************************/
Word16 tty_enc(
    Word16   *tty_char,      /* (o): tty character                       */
    Word16   *counter,       /* (o): tty character counter               */
    Word16   *tty_baud_rate, /* (i/o): tty baud rate                     */
    Word16   pcm_buf[],      /* (i): input pcm                           */
    Word16   len             /* (i): length of pcm buffer (FRAMESIZE)    */
)
{
    Word16  i;

    tty_header_in( counter );

    /* Save history dits */
    for( i=0 ; i < DITBUF_LEN-DITS_PER_FRAME ; i++ )
    {
        ditbuf[i] = ditbuf[DITS_PER_FRAME+i];       
    }

    baudot_to_dit( ditbuf+DITBUF_LEN-DITS_PER_FRAME,
                   pcm_buf );


    dit_to_ascii( tty_char, counter, tty_baud_rate, ditbuf);

                
    if( *counter == NON_TTY )
    {

        return(0);
    }

    i = *counter;
    tty_header_out( counter );


    return(i);

}

            


⌨️ 快捷键说明

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