Commit 2593401f authored by Sandrine Avakian's avatar Sandrine Avakian

Adding bv16 .

parents
cmake_minimum_required(VERSION 3.0)
project(BV16
VERSION 2.1
LANGUAGES C
)
set(FBV16_MAJOR_VERSION 2)
set(FBV16_MINOR_VERSION 1)
set(FBV16_VERSION
${FBV16_MAJOR_VERSION}.${FBV16_MINOR_VERSION})
include_directories(${CMAKE_BINARY_DIR} ./bv16)
include_directories(${CMAKE_BINARY_DIR} ./bvcommon)
option(ENABLE_STATIC "Build static library (default is shared library)." OFF)
# add_subdirectory(bv16)
# add_subdirectory(bvcommon)
set( BV16_SOURCE_FILES
./bv16/bitpack.c
./bv16/bv.c
./bv16/coarptch.c
./bv16/decoder.c
./bv16/encoder.c
./bv16/excdec.c
./bv16/excquan.c
./bv16/fineptch.c
./bv16/g192.c
./bv16/gaindec.c
./bv16/gainquan.c
./bv16/levelest.c
./bv16/lspdec.c
./bv16/lspquan.c
./bv16/plc.c
./bv16/postfilt.c
./bv16/ptquan.c
./bv16/tables.c
./bvcommon/a2lsp.c
./bvcommon/allpole.c
./bvcommon/allzero.c
./bvcommon/autocor.c
./bvcommon/cmtables.c
./bvcommon/levdur.c
./bvcommon/lsp2a.c
./bvcommon/ptdec.c
./bvcommon/stblchck.c
./bvcommon/stblzlsp.c
./bvcommon/utility.c
)
add_compile_options(-O -Wall)
add_compile_options(-DWMOPS=0)
add_compile_options(-DG192BITSTREAM=0)
if(MSVC)
list(APPEND BV16_SOURCE_FILES bv16.def)
endif(MSVC)
if(ENABLE_STATIC)
add_library(bv16 STATIC ${BV16_SOURCE_FILES})
add_executable(BroadVoice16 ${BV16_SOURCE_FILES})
else()
add_library(bv16 SHARED ${BV16_SOURCE_FILES})
add_executable(BroadVoice16 ${BV16_SOURCE_FILES})
else()
if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/bv16.pdb
DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
endif()
endif()
if(APPLE)
target_link_libraries(bv16 "-framework Cocoa -lm")
endif()
install(TARGETS bv16
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(TARGETS BroadVoice16
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
file(GLOB BV16_HEADER_FILES "bv16/*.h")
file(GLOB BV16_COMMON_HEADER_FILES "bvcommon/*.h")
install(FILES ${BV16_HEADER_FILES}
DESTINATION include/bv16-floatingpoint/bv16
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install(FILES ${BV16_COMMON_HEADER_FILES}
DESTINATION include/bv16-floatingpoint/bvcommon
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
# install(FILES
# DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/bv16
#)
# # Offer the user the choice of overriding the installation directories
# set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
# set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
# set(INSTALL_INCLUDE_DIR include CACHE PATH
# "Installation directory for header files")
# if(WIN32 AND NOT CYGWIN)
# set(DEF_INSTALL_CMAKE_DIR CMake)
# else()
# set(DEF_INSTALL_CMAKE_DIR lib/CMake/FooBar)
# endif()
# set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH
# "Installation directory for CMake files")
# # Make relative paths absolute (needed later on)
# foreach(p LIB BIN INCLUDE CMAKE)
# set(var INSTALL_${p}_DIR)
# if(NOT IS_ABSOLUTE "${${var}}")
# set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
# endif()
# endforeach()
# # set up include-directories
# include_directories(
# "${PROJECT_SOURCE_DIR}" # to find foo/foo.h
# "${PROJECT_BINARY_DIR}") # to find foo/config.h
# # Add sub-directories
# add_subdirectory(foo)
# add_subdirectory(bar)
# # The interesting stuff goes here
# # ===============================
# # Add all targets to the build-tree export set
# export(TARGETS foo bar
# FILE "${PROJECT_BINARY_DIR}/FooBarTargets.cmake")
# # Export the package for use from the build-tree
# # (this registers the build-tree with a global CMake-registry)
# export(PACKAGE FooBar)
# # Create the FooBarConfig.cmake and FooBarConfigVersion files
# file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}"
# "${INSTALL_INCLUDE_DIR}")
# # ... for the build tree
# set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
# configure_file(FooBarConfig.cmake.in
# "${PROJECT_BINARY_DIR}/FooBarConfig.cmake" @ONLY)
# # ... for the install tree
# set(CONF_INCLUDE_DIRS "\${FBV16_CMAKE_DIR}/${REL_INCLUDE_DIR}")
# configure_file(FooBarConfig.cmake.in
# "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FooBarConfig.cmake" @ONLY)
# # ... for both
# configure_file(FooBarConfigVersion.cmake.in
# "${PROJECT_BINARY_DIR}/FooBarConfigVersion.cmake" @ONLY)
# # Install the FooBarConfig.cmake and FooBarConfigVersion.cmake
# install(FILES
# "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FooBarConfig.cmake"
# "${PROJECT_BINARY_DIR}/FooBarConfigVersion.cmake"
# DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)
# # Install the export set for use with the install-tree
# install(EXPORT FooBarTargets DESTINATION
# "${INSTALL_CMAKE_DIR}" COMPONENT dev)
\ No newline at end of file
# add_library( bv16
# bitpack.c
# bv.c
# coarptch.c
# decoder.c
# encoder.c
# excdec.c
# excquan.c
# fineptch.c
# g192.c
# gaindec.c
# gainquan.c
# levelest.c
# lspdec.c
# lspquan.c
# plc.c
# postfilt.c
# ptquan.c
# tables.c)
# install(TARGETS bv16
# ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
# )
# install(DIRECTORY bv16
# DESTINATION ${CMAKE_INSTALL_PREFIX}/include
# )
/*****************************************************************************/
/* BroadVoice(R)16 (BV16) Floating-Point ANSI-C Source Code */
/* Revision Date: October 5, 2012 */
/* Version 1.2 */
/*****************************************************************************/
/*****************************************************************************/
/* Copyright 2000-2012 Broadcom Corporation */
/* */
/* This software is provided under the GNU Lesser General Public License, */
/* version 2.1, as published by the Free Software Foundation ("LGPL"). */
/* This program is distributed in the hope that it will be useful, but */
/* WITHOUT ANY SUPPORT OR WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LGPL for */
/* more details. A copy of the LGPL is available at */
/* http://www.broadcom.com/licenses/LGPLv2.1.php, */
/* or by writing to the Free Software Foundation, Inc., */
/* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*****************************************************************************/
/*****************************************************************************
bitpack.c: BV16 bit packing routines
$Log$
******************************************************************************/
#include "typedef.h"
#include "bv16cnst.h"
#include "bvcommon.h"
#include "bv16strct.h"
#include "bv16.h"
/****************************************************************************
*
* BV16_BITPACK - BroadVoice16 Encoded Bit Pack Function
*
* PURPOSE:
*
* This function take the encoded bit structure (15 words) and packed it
* into a bit stream (5 words) for sending it across the network.
*
* PROTOTYPE:
* BV16_BitPack ( UINT16 * PackedStream, sBV16bs * BitStruct );
*
* PARAMETERS:
* PackedStream => pointer to the outgoing encoded stream
* BitStruct => pointer to the encoded bit structure
*
* RETURNS:
* Nothing
*
* NOTE:
* The following is the bit table within the bit structure for
* BroadVoice16
*
* Word16 bit_table[] = {
* 7, 7, // LSP
* 7, // Pitch Lag
* 5, // Pitch Gain
* 4, // Excitation Vector Log-Gain
* 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 // Excitation Vector
* };
*
****************************************************************************/
void BV16_BitPack (UWord8 * PackedStream, struct BV16_Bit_Stream * BitStruct )
{
UWord32 temppack;
/* fill the first 16 bit word */
temppack = ( ((UWord32)BitStruct->lspidx[0]) << 25 ); /* 32-7 */
temppack |= ( ((UWord32)BitStruct->lspidx[1]) << 18 ); /* 25-7 */
temppack |= ( ((UWord32)BitStruct->ppidx) << 11 ); /* 18-7 */
/* total=21 */
/* store 1st byte in the payload */
*PackedStream++ = (UWord8)(temppack >> 24);
/* store 2nd byte in the payload */
*PackedStream++ = (UWord8)((temppack << 8) >> 24);
/* clear the upper 16 bits */
temppack = temppack << 16;
temppack |= ( ((UWord32)BitStruct->bqidx) << 22 ); /* 32-(21-16)-5 = 32-10 */
temppack |= ( ((UWord32)BitStruct->gidx) << 18 ); /* 22-4 */
temppack |= ( ((UWord32)BitStruct->qvidx[0]) << 13 ); /* 18-5 */
/* total=19 */
/* store 3rd byte in the payload */
*PackedStream++ = (UWord8)(temppack >> 24);
/* store 4th byte in the payload */
*PackedStream++ = (UWord8)((temppack << 8) >> 24);
/* clear the upper 16 bits */
temppack = temppack << 16;
temppack |= ( ((UWord32)BitStruct->qvidx[1]) << 24 ); /* 32-(19-16)-5 = 32-8 */
temppack |= ( ((UWord32)BitStruct->qvidx[2]) << 19 ); /* 24-5 */
temppack |= ( ((UWord32)BitStruct->qvidx[3]) << 14 ); /* 19-5 */
/* total=18 */
/* store 5th byte in the payload */
*PackedStream++ = (UWord8)(temppack >> 24);
/* store 6th byte in the payload */
*PackedStream++ = (UWord8)((temppack << 8) >> 24);
/* clear the upper 16 bits */
temppack = temppack << 16;
temppack |= ( ((UWord32)BitStruct->qvidx[4]) << 25 ); /* 32-(18-16)-5 = 32-7 */
temppack |= ( ((UWord32)BitStruct->qvidx[5]) << 20 ); /* 25-5 */
temppack |= ( ((UWord32)BitStruct->qvidx[6]) << 15 ); /* 20-5 */
/* total=17 */
/* store 7th byte in the payload */
*PackedStream++ = (UWord8)(temppack >> 24);
/* store 8th byte in the payload */
*PackedStream++ = (UWord8)((temppack << 8) >> 24);
/* clear the upper 16 bits */
temppack = temppack << 16;
temppack |= ( ((UWord32)BitStruct->qvidx[7]) << 26 ); /* 32-(17-16)-5 = 32-6 */
temppack |= ( ((UWord32)BitStruct->qvidx[8]) << 21 ); /* 25-5 */
temppack |= ( ((UWord32)BitStruct->qvidx[9]) << 16 ); /* 20-5 */
/* total=18 */
/* store 9th byte in the payload */
*PackedStream++ = (UWord8)(temppack >> 24);
/* store 10th byte in the payload */
*PackedStream++ = (UWord8)((temppack << 8) >> 24);
return;
}
/****************************************************************************
*
* BV16_BITUNPACK - BroadVoice16 Encoded Bit Unpack Function
*
* PURPOSE:
*
* This function take the encoded bit stream (5 words) and unpack it
* into a bit structure (15 words) for BroadVoice16 decoder.
*
* PROTOTYPE:
* BV16_BitUnPack ( UINT16 * PackedStream, sBV16bs * BitStruct );
*
* PARAMETERS:
* PackedStream => pointer to the incoming encoded bit stream
* BitStruct => pointer to the bit structure for decoder
*
* RETURNS:
* Nothing
*
* NOTE:
* The following is the bit table within the bit structure for
* BroadVoice16
*
* Word16 bit_table[] = {
* 7, 7, // LSP
* 7, // Pitch Lag
* 5, // Pitch Gain
* 4, // Excitation Vector Log-Gain
* 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 // Excitation Vector
* };
*
*
****************************************************************************/
void BV16_BitUnPack (UWord8 * PackedStream, struct BV16_Bit_Stream * BitStruct )
{
UWord32 bitword32;
/* unpack bytes 1 and 2 of bit stream */
bitword32 = (UWord32)*PackedStream++;
bitword32 = (bitword32 << 8) | (UWord32)*PackedStream++;
BitStruct->lspidx[0] = (short)( bitword32 >> 9 );
BitStruct->lspidx[1] = (short)( ( bitword32 & 0x01FF )>> 2 );
/* unpack bytes 3 and 4 of bit stream */
bitword32 = ((bitword32 & 0x0003) << 8) | (UWord32) *PackedStream++;
bitword32 = (bitword32 << 8) | (UWord32)*PackedStream++;
BitStruct->ppidx = (short)( bitword32 >> 11 );
BitStruct->bqidx = (short)( ( bitword32 & 0x07FF ) >> 6 );
BitStruct->gidx = (short)( ( bitword32 & 0x003F ) >> 2 );
/* unpack bytes 5 and 6 of bit stream */
bitword32 = ((bitword32 & 0x0003) << 8) | (UWord32) *PackedStream++;
bitword32 = (bitword32 << 8) | (UWord32)*PackedStream++;
BitStruct->qvidx[0] = (short)( bitword32 >> 13 );
BitStruct->qvidx[1] = (short)( ( bitword32 & 0x1FFF ) >> 8 );
BitStruct->qvidx[2] = (short)( ( bitword32 & 0x00FF ) >> 3 );
/* unpack bytes 7 and 8 of bit stream */
bitword32 = ((bitword32 & 0x0007) << 8) | (UWord32) *PackedStream++;
bitword32 = (bitword32 << 8) | (UWord32)*PackedStream++;
BitStruct->qvidx[3] = (short)( bitword32 >> 14 );
BitStruct->qvidx[4] = (short)( ( bitword32 & 0x3FFF ) >> 9 );
BitStruct->qvidx[5] = (short)( ( bitword32 & 0x01FF ) >> 4 );
/* unpack bytes 9 and 10 of bit stream */
bitword32 = ((bitword32 & 0x000F) << 8) | (UWord32) *PackedStream++;
bitword32 = (bitword32 << 8) | (UWord32)*PackedStream++;
BitStruct->qvidx[6] = (short)( ( bitword32 >> 15 ) );
BitStruct->qvidx[7] = (short)( ( bitword32 & 0x7FFF ) >> 10 );
BitStruct->qvidx[8] = (short)( ( bitword32 & 0x03FF ) >> 5 );
BitStruct->qvidx[9] = (short)( bitword32 & 0x001F );
return;
}
/*****************************************************************************/
/* BroadVoice(R)16 (BV16) Floating-Point ANSI-C Source Code */
/* Revision Date: October 5, 2012 */
/* Version 1.2 */
/*****************************************************************************/
/*****************************************************************************/
/* Copyright 2000-2012 Broadcom Corporation */
/* */
/* This software is provided under the GNU Lesser General Public License, */
/* version 2.1, as published by the Free Software Foundation ("LGPL"). */
/* This program is distributed in the hope that it will be useful, but */
/* WITHOUT ANY SUPPORT OR WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LGPL for */
/* more details. A copy of the LGPL is available at */
/* http://www.broadcom.com/licenses/LGPLv2.1.php, */
/* or by writing to the Free Software Foundation, Inc., */
/* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*****************************************************************************/
/*****************************************************************************
bitpack.h: BV16 bit packing routines
$Log$
******************************************************************************/
#ifndef BITPACK_H
#define BITPACK_H
void BV16_BitPack(UWord8 * PackedStream, struct BV16_Bit_Stream * BitStruct );
void BV16_BitUnPack(UWord8 * PackedStream, struct BV16_Bit_Stream * BitStruct );
#endif
/*****************************************************************************/
/* BroadVoice(R)16 (BV16) Floating-Point ANSI-C Source Code */
/* Revision Date: October 5, 2012 */
/* Version 1.2 */
/*****************************************************************************/
/*****************************************************************************/
/* Copyright 2000-2012 Broadcom Corporation */
/* */
/* This software is provided under the GNU Lesser General Public License, */
/* version 2.1, as published by the Free Software Foundation ("LGPL"). */
/* This program is distributed in the hope that it will be useful, but */
/* WITHOUT ANY SUPPORT OR WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LGPL for */
/* more details. A copy of the LGPL is available at */
/* http://www.broadcom.com/licenses/LGPLv2.1.php, */
/* or by writing to the Free Software Foundation, Inc., */
/* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*****************************************************************************/
/*****************************************************************************
bv.c : BroadVoice16 Codec Entry Interface Program
$Log$
******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "typedef.h"
#include "bv16cnst.h"
#include "bvcommon.h"
#include "bv16strct.h"
#include "bv16.h"
#include "utility.h"
#if G192BITSTREAM
#include "g192.h"
#else
#include "bitpack.h"
#endif
int frame;
short bfi=0;
void usage(char *name)
{
fprintf(stderr,"usage: %s enc|dec input output\n", name);
fprintf(stderr,"\nFormat for speech_file:\n Binary file of 8 kHz sampled 16-bit PCM data.\n");
#if G192BITSTREAM
fprintf(stderr,"\nFormat for bitstream_file per frame: ITU-T G.192 format\n\
One (2-byte) synchronization word [0x6B21],\n\
One (2-byte) size word,\n\
160 words (2-byte) containing 160 bits.\n\n");
#else
fprintf(stderr, "\nFormat for bitstream_file per frame: Packed Bits\n");
#endif
exit(1);
}
int main(int argc, char **argv)
{
FILE *fi, *fo, *fbdi=NULL;
int enc=1;
int nread, i;
short x[FRSZ];
struct BV16_Bit_Stream bs;
struct BV16_Encoder_State cs;
struct BV16_Decoder_State ds;
#if !G192BITSTREAM
UWord8 PackedStream[10];
#endif
int next_bad_frame=-1;
fprintf(stderr,"/***************************************************************************/\n");
fprintf(stderr,"/* BroadVoice(R)16, Copyright (c) 2000-12, Broadcom Corporation. */\n");
fprintf(stderr,"/* All Rights Reserved. */\n");
fprintf(stderr,"/* */\n");
fprintf(stderr,"/* This software is provided under the GNU Lesser General Public License, */\n");
fprintf(stderr,"/* version 2.1, as published by the Free Software Foundation (\"LGPL\"). */\n");
fprintf(stderr,"/* This program is distributed in the hope that it will be useful, but */\n");
fprintf(stderr,"/* WITHOUT ANY SUPPORT OR WARRANTY; without even the implied warranty of */\n");
fprintf(stderr,"/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LGPL for */\n");
fprintf(stderr,"/* more details. A copy of the LGPL is available at */\n");
fprintf(stderr,"/* http://www.broadcom.com/licenses/LGPLv2.1.php, */\n");
fprintf(stderr,"/* or by writing to the Free Software Foundation, Inc., */\n");
fprintf(stderr,"/* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */\n");
fprintf(stderr,"/***************************************************************************/\n");
if ((argc!=4)&&(argc!=5)) usage(argv[0]);
if (!strcmp(argv[1],"enc")) enc=1;
else if (!strcmp(argv[1],"dec")) enc=0;
else usage(argv[0]);
if (!(fi=fopen(argv[2],"rb")))
{
fprintf(stderr,"error: can't read %s\n", argv[2]);
exit(2);
}
if (!(fo=fopen(argv[3],"wb")))
{
fprintf(stderr,"error: can't write to %s\n", argv[3]);
exit(3);
}
if (argc==5)
{
if (!(fbdi=fopen(argv[4],"rb")))
{
fprintf(stderr,"error: can't read %s\n", argv[4]);
exit(3);
}
}
if (!strcmp(argv[1],"enc"))
{
Reset_BV16_Encoder(&cs);
}
else
{
Reset_BV16_Decoder(&ds);
}
if (enc){
#if G192BITSTREAM
fprintf(stderr," BroadVoice16 Floating-Point Encoder V1.2 with ITU-T G.192\n");
#else
fprintf(stderr," BroadVoice16 Floating-Point Encoder V1.2 with packed bit-stream\n");
#endif
fprintf(stderr," Input speech file : %s\n",argv[2]);
fprintf(stderr," Output bit-stream file: %s\n",argv[3]);
}
else{
#if G192BITSTREAM
fprintf(stderr," BroadVoice16 Floating-Point Decoder V1.2 with ITU-T G.192\n");
#else
fprintf(stderr," BroadVoice16 Floating-Point Decoder V1.2 with packed bit-stream\n");
#endif
fprintf(stderr," Input bit-stream file : %s\n",argv[2]);
fprintf(stderr," Output speech file : %s\n",argv[3]);
}
/* START THE MAIN FRAME LOOP */
frame=0;
/* read for the 1st bad frame */
if (fbdi!=NULL)
fscanf(fbdi,"%d", &next_bad_frame);
while (1)
{
/* FRAME COUNTER */
frame++;
/* READ IN ONE SPEECH FRAME */
if (enc==1)
{
nread=fread(x, sizeof(short), FRSZ, fi);
if (nread<=0) goto End;
for (i=nread;i<FRSZ;i++) x[i] = 0;
}
else
{
#if G192BITSTREAM
nread = bv16_fread_g192bitstrm(&bs, fi);
#else
nread = fread( PackedStream, sizeof(UWord8), 10, fi);
BV16_BitUnPack ( PackedStream, &bs );
#endif
if (nread<=0) goto End;
if (frame==next_bad_frame)
{
fscanf(fbdi,"%d", &next_bad_frame);
bfi = 1;
}
}
/* G.BRCM CODING */
if (enc==1)
{
BV16_Encode(&bs, &cs, x);
#if G192BITSTREAM
bv16_fwrite_g192bitstrm(&bs,fo);
#else
BV16_BitPack( PackedStream, &bs );
fwrite(PackedStream, sizeof(UWord8), 10, fo);
#endif
}
else
{
if (!bfi)
BV16_Decode(&bs, &ds, x);
else
{
BV16_PLC(&ds,x);
}
fwrite(x, sizeof(short), FRSZ, fo);
}
if (((frame/100)*100)==frame) fprintf(stderr, "\r %d %d-sample frames processed.", frame, FRSZ);
bfi = 0;
} /* END OF FRAME LOOP */
End: ;
frame--;
fprintf(stderr, "\r %d 40-sample frames processed.\n", frame);
fclose(fi);
fclose(fo);
if (fbdi!=NULL)
fclose(fbdi);
fprintf(stderr, "\n\n");
return 0;
}
/*****************************************************************************/
/* BroadVoice(R)16 (BV16) Floating-Point ANSI-C Source Code */
/* Revision Date: October 5, 2012 */
/* Version 1.2 */
/*****************************************************************************/
/*****************************************************************************/
/* Copyright 2000-2012 Broadcom Corporation */
/* */
/* This software is provided under the GNU Lesser General Public License, */
/* version 2.1, as published by the Free Software Foundation ("LGPL"). */
/* This program is distributed in the hope that it will be useful, but */
/* WITHOUT ANY SUPPORT OR WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LGPL for */
/* more details. A copy of the LGPL is available at */
/* http://www.broadcom.com/licenses/LGPLv2.1.php, */
/* or by writing to the Free Software Foundation, Inc., */
/* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*****************************************************************************/
/*****************************************************************************
bv16.h :
$Log$
******************************************************************************/
extern void Reset_BV16_Encoder(
struct BV16_Encoder_State *cs);
extern void BV16_Encode(
struct BV16_Bit_Stream *bs,
struct BV16_Encoder_State *cs,
short *inx);
extern void Reset_BV16_Decoder(
struct BV16_Decoder_State *ds);
extern void BV16_Decode(
struct BV16_Bit_Stream *bs,
struct BV16_Decoder_State *ds,
short *xq);
extern void BV16_PLC(
struct BV16_Decoder_State *ds,
short *x);
/*****************************************************************************/
/* BroadVoice(R)16 (BV16) Floating-Point ANSI-C Source Code */
/* Revision Date: October 5, 2012 */
/* Version 1.2 */
/*****************************************************************************/
/*****************************************************************************/
/* Copyright 2000-2012 Broadcom Corporation */
/* */
/* This software is provided under the GNU Lesser General Public License, */
/* version 2.1, as published by the Free Software Foundation ("LGPL"). */
/* This program is distributed in the hope that it will be useful, but */