(C)Copyright 2000 NTT Cyber Space Laboratories
TwinVQ Ver. 2.3
2000.10.4
TwinVQ is an audio coding software which converts audio signals into compressed bit streams
TwinVQ has data structure shown in Fig.1. The audio part consists of compressed bit streams, and the header part includes decoding parameters and side information.
TwinVQ encoder program consists of 5 processing modules as shown in Fig.2
Fig. 2 Structure of TwinVQ encoder program
Brief procedure of encoder is shown as follows.
{
< initilize >
while( < read audio data frame by frame >){
< encoding >
< bit stream generation >
}
< termination >
}
This procedure is included in main program. Refer to
main() (encoder.cxx)
Initialization is needed prior to the encoding process. Refer to encoder initialization manual for detail
In sample program, input audio data in 16
bit PCM format is obtained by fread()
every frame.
From "L,R,L,R" signed short data is converted to internal (float) data array by buftofr()
Audio data is compressed into INDEX format
by using TvqEncodeFrame()
From INDEX format data binary bit stream data is generated by TvqWriteBsFrame()
Termination is
TestEnc.exe can be build in TestEnc.dsw workspace of VC++ 6.0. For Linux users, do "make" in "ModEnc/" directory.
Execution is done in DOS prompt environment
TestEnc [option] <inpu data file > <Output bit stream file >
The options are listed below. Possible option
set is described here.
setup parameters | option name | default | remarks |
sampling frequency | -f <#> | 44 | 44 (44.1 kHz) for example |
total bitrate [kbit/s] | -b <#> | 96 | |
channel mode | -c <#> | 1 stereo | monaural :0 |
N_CAN | -n <#> | 16 | either 4, 8, 16, 32 the larger number, the higher quality and the slower. |
file type | -t <string> | "wav" | wav or raw (no header) |
title | -T <string> | "" | |
comment | -C <string> | "" | |
artist | -A <string> | "" | |
copyright information | -R <string> | "" | |
direcoty name for header contents | -h <string> | "header_info" | directory for header information |
Input audio signal is assumed to be signed 16 bit PCM (2Byte per sample). Stereo signal has sample order of L, R, L, and R.
All standard chunk contents in a header information can be specified by command line. Optional chunk contents can be specified by parameter file in the directory of header_info. The SCND subchunk can be specified by parameter files in the directory of header_info\SCNDheader_info can be specified by -h option. Detailed header format is described in TwinVQ data format manual.
There is a minimum version of main program, simple_enc.cxx, in the package. The encoder.cxx file can be replaced by this program.
The encoder DLL functions can be divided into following three categories
Prior to the encoding process for each frame, initialization is needed. Inquiry functions are used for getting various TwinVQ parameters.
Available DLL's are listed below.
category | function name | essential | outline |
Initialization | TvqEncInitialize() |
Yes | TwinVQ encoder initialization |
---|---|---|---|
TvqEncTerminate() |
Yes | TwinVQ encoder termination | |
TvqEncGetVectorInfo() |
Yes | information initialization for TwinVQ bit stream output | |
TvqEncResetFrameCounter() |
reset frame counter | ||
encoding | TvqEncodeFrame() |
Encode | Frame wise encoding process |
TvqEncUpdateVectorInfo() |
Yes | update information for TwinVQ bit stream generation | |
TvqEncSetFrameCounter() |
set frame counter | ||
inquiry | TvqEncCheckVersion() |
Yes | version ID number |
TvqGetVersionID() |
Yes | version ID string | |
TvqEncGetSetupInfo() |
setup information | ||
TvqEncGetConfInfo() |
Yes | configuration parameter for TwinVQ | |
TvqEncGetFrameSize() |
Yes | frame size | |
TvqEncGetNumChannels() |
Yes | Channel number | |
TvqEncGetBitRate() |
bit rate | ||
TvqEncGetSamplingRate() |
sampling rate | ||
TvqEncGetNumFixedBitsPerFrame() |
Yes | number of bits | |
TvqEncGetNumPreCand() |
number of preselection candidates | ||
TvqEncGetNumFrames() |
frame counter | ||
TvqEncGetModuleVersion( ) |
encoder module version |
category | function name | mandatory | outline |
initialization | TvqPutBsHeaderInfo() |
Yes | output bit stream header |
TvqinitBsWriter() |
Yes | initialization output module | |
framewise process | TvqWriteBsFrame() |
Yes | framewise bit stream generation |
TvqCreateHeaderChunk()
buftofr()