www.pudn.com > T-REC-G.722.1-200505-I!!SOFT-ZST-E.zip > encode.c
/*************************************************************************************
**
** ITU-T 7/14kHz Audio Coder Candidate (G.722.1 Annex C) Source Code
**
** © 2004 Polycom, Inc.
**
** All rights reserved.
**
*************************************************************************************/
/*************************************************************************************
Filename: encode.c
Description: Contains the main function for the G.722.1 Annex C encoder
Design Notes:
WMOPS: 7kHz | 24kbit | 32kbit
-------|--------------|----------------
AVG | 2.32 | 2.43
-------|--------------|----------------
MAX | 2.59 | 2.67
-------|--------------|----------------
14kHz | 24kbit | 32kbit | 48kbit
-------|--------------|----------------|----------------
AVG | 4.45 | 4.78 | 5.07
-------|--------------|----------------|----------------
MAX | 5.07 | 5.37 | 5.59
-------|--------------|----------------|----------------
*************************************************************************************/
/************************************************************************************
Include files
*************************************************************************************/
#include "defs.h"
#include "count.h"
/************************************************************************************
Local type declarations
*************************************************************************************/
/* This object is used to control the command line input */
typedef struct
{
Word16 syntax;
Word32 bit_rate;
Word16 bandwidth;
Word16 number_of_bits_per_frame;
Word16 number_of_regions;
Word16 frame_size;
FILE *fpin;
FILE *fp_bitstream;
} ENCODER_CONTROL;
/************************************************************************************
Constant definitions
*************************************************************************************/
#define MAX_SAMPLE_RATE 32000
#define MAX_FRAMESIZE (MAX_SAMPLE_RATE/50)
#define MEASURE_WMOPS 1
#define WMOPS 1
/***************************************************************************
Local function declarations
***************************************************************************/
void parse_command_line(char *argv[],ENCODER_CONTROL *control);
void write_ITU_format(Word16 *out_words,
Word16 number_of_bits_per_frame,
Word16 number_of_16bit_words_per_frame,
FILE *fp_bitstream);
/************************************************************************************
Function: G.722.1 Annex C main encoder function
Syntax: encode