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

📄 vqdesign.3

📁 speech signal process tools
💻 3
📖 第 1 页 / 共 2 页
字号:
.\" Copyright (c) 1987 Entropic Speech, Inc.; All rights reserved.\" @(#)vqdesign.3	1.8 03 Jan 1993 ESI.TH VQDESIGN 3\-ESPSsp 03 Jan 1993.ds ]W "\fI\s+4\ze\h'0.05'e\s-4\v'-0.4m'\fP\(*p\v'0.4m'\ Entropic Speech, Inc..SH NAMEvqdesign \- design full-search vector quantization codebook.SH SYNOPSIS.ft B.nf#include <esps/vq.h>#include <stdio.h>.ta .8iintvqdesign	(histrm, hdetail, data, len, dim, cbk, enc, init, split_crit, 	get_chunk, vec_to_cdwd, distort, split, checkpoint, max_iter)FILE 		*histrm;int 		hdetail;float		**data;long		len;long		dim;struct		vqcbk *cbk;int 		init;long		*enc;int 		split_crit;long		(*get_chunk)();int 		(*vec_to_cdwd)();double		(*distort)();int		(*split)();int		(*checkpoint)();int		max_iter;.fi.ft.SH GENERAL DESCRIPTION.I vqdesignis a fairly-general routine that uses the Linde-Buzo-Gray (LBG)(generalized Lloyd) algorithm to design a full-search vectorquantization codebooks based on a training sequence of feature vectors..I vqdesigncan be used whether or not the training data fits entirely in memory.  Provided that certain conditions are satisfied, .I vqdesigncan be used with arbitrary distortion measures and arbitrarycodebook-splitting algorithms.  .PPThe main assumption that restricts theapplication of .I vqdesignconcerns the computation of a cluster centroid.  It is assumed that acluster centroid is a function (\fIvec_to_cdwd\fP) of the feature vectorthat results from averaging, component by component, all of the featurevectors in the cluster.  This assumption holds for a large class ofdistortion measures, including mean-square error, weighted mean-squareerror, and Itakura-Saito.  It holds for the class of minimumrelative-entropy distortion measures discussed in [1], of which theItakura-Saito is a special case.  .PPThe training data is passed to .I vqdesignthrough the parameter .I data,which points to.I lenfeature vectors of dimension.I dim.The array .I datamay or may not contain the entire set of training data.  If it does not (for example, when the training data does not fit in memory),.I vqdesignuses the function.I get_chunkto update .I datawhenever a chunk of training data is needed.  If .I get_chunkis NULL, then .I datais assumed to contain the entire training sequence.  .PPThe codebook designed by .I vqdesignis passed back to the calling program through the parameter .I cbk.If the codebook passed through .I cbkis not empty when .I vqdesignis called, then this codebook is used as an initial codebook by .I vqdesign.  In this case, the input codebook may or may notbe re-clustered before splitting, depending on the value of .I init(see below).  .PPThe parameter .I encis used by .I vqdesignto pass back the indices of the closest codeword corresponding to the feature vectors passed via .I data.If .I dataholds the full training sequence, then , after .I vqdesign returns, \fIenc\fP[\fIi\fP] is the index of the final codeword closestto \fIdata\fP[\fIi\fP]; that is,\fIcbk\->codeword\fP[\fIenc\fP[\fIi\fP]] is the closest codeword to\fIdata\fP[\fIi\fP].  Actually, .I encis used throughout the design process to hold the indices of the closest codewords to the feature vectors in .I data.Thus, provided that the pointer \fIenc\fP passed to .I vqdesignis in the scope of .I get_chunk,the current contents of .I enccould be copied elsewhere whenever.I get_chunkis called.  This may be useful when .I datadoes not hold the full training sequence, i.e., if .I get_chunkis used to step through the training sequence.  .PPBesides .I get_chunk,several other function pointers are passed to .I vqdesign,namely.I vec_to_cdwd,.I distort,.I split,and.I checkpoint. .PPThe function.I vec_to_cdwdtransforms a feature vector into a codeword; if it is NULL, then no transformation is necessary.  .PPThe function .I distortcomputes a distortion measure between a feature vector and a codeword;if it is NULL a mean-square-error distortion function is used by default.  .PPThe function.I splitis used to split a codeword whenever an additional codeword is needed, either because an empty cell has been found or becausethe codebook is being enlarged.  Which codeword to split is determined by.I split_crit.The .I splitfunction performs the actual splitting operation.  If .I splitis NULL, a "generic split" routine is used by default.  This genericroutine splits each codeword by adding or subtracting a random amountfrom each codeword element.  The amount is uniformly distributed over 1%of the particular codeword element, and the algorithm is used both tocompute a new codeword from an existing as well as to modify theexisting one.  .PPThe function.I checkpointis called by.I vqdesignperiodically to allow the current codebook to be written to a checkpoint file.  It is called after each adjustment of the cluster centroids (i.e., after each pass through the trainingsequence); it is also called before the current codebook is to be enlarged (i.e., after the design has converged at a given size).  .PPThe parameter .I max_iterspecifies the maximum number of iterations for clustering at any given level.  .PP.Ivqdesignwrites history and debugging information to the stream .I histrm.The amount of information written to .I histrm increases as the value of .I hdetailincreases from 0.  If .I hdetailis zero, only fatal error messages are written.  No information iswritten if .I histrmis NULL..PP.I vqdesignreturns one of the following integer status values, which are defined in <esps/vq.h>:.nf.ta .25i 1.5i	0	normal exit, codebook designed OK;	VQ_NOCONVG	convergence failed	VQ_GC_ERR	error in \fIget_chunk\fP	VQ_VECWD_ERR	error in \fIvec_to_cdwd\fP	VQ_DIST_ERR	error in \fIdistort\fP	VQ_SPLIT_ERR	error in \fIsplit\fP	VQ_INPUT_ERR	inconsistency or other problem with input parameters;.fi.PPThe function parameters \fIvec_to_cdwd, split, \fRand\fI checkpoint\fRshould really be of type \fBvoid\fP.  Type \fBint\fP is used owing tocompiler bugs on certain machines.  .PPFor more information, see the section "DETAILED DESCRIPTION".  .SH PARAMETERS.TP .I "histrm, hdetail".I Histrm points to an output stream used by .I vqdesignto write out history and debugging information.  The amount of information written to .I histrm increases as the value of .I hdetailincreases from 0, as described in the following (information written when \fIhdetail == n\fP includes all information written when \fIhdetail \fP< \fIn\fP):.IP\fIhdetail == \fPNULL.IPNo information is written..IP\fIhdetail == \fP0.IPOnly fatal error messages are written.  .IP\fIhdetail == \fP1.IPEach time the codebook has converged at a given current size or afterempty cells have been filled, the following are written:  currentdate and time, current codebook size, size of training sequence forcurrent codebook, total number of clustering iterations so far,average distortion of the current codebook, the total number ofempty cells found so far, and the entropy of the current codebook(probability of each cluster computed as proportional to the clustersize)..IP\fIhdetail == \fP2.IPEach time the full training sequence is encoded with respect to thecurrent codebook, the average distortion is written.  Whenever empty cells are found, the identities of the empty cell and the cell split to replace the empty cell are written.  .IP\fIhdetail == \fP3Each time the information for \fIhdetail == \fP1 is written, so are the following:  the size of each cluster in the last pass overthe training sequence, the average distortion of each cluster, andthe current set of codewords (transformed cluster centroids).  The current set of codewords is also written each time the codebook is enlarged.  Whenever an empty cell has been discarded (and another cell split), the foregoing information is also written.    .IP\fIhdetail == \fP4.IPThe information described for \fIhdetail == \fP1 and \fIhdetail == \fP3is written again after each cluster iteration, i.e., each time thetraining sequence has been encoded and the codebook adjusted.  .IP\fIhdetail == \fP5.IPThe number of training vectors resulting from each call to .I get_chunkis written..IP\fIhdetail == \fP6.IPEach time a feature vector is encoded with respect to the currentcodebook, the following are written out: the feature vector, theindex of the closest codeword, and the distortion with respectto that codeword..TP.I "data, len, dim".I vqdesigninterprets .I dataas a pointer to a .IR len\- rowby.IR dim\- columnmatrix of floats.  Space for this matrix must be allocated by the calling program \- such a pointer can be assigned bymeans of .I f_mat_alloc(3\-ESPSu).  With this interpretation, the pointers\fIdata\fR[0]...\fIdata\fR[\fIlen\fR\-1] each points to a "row"containing a feature vector of dimension .I dim.  Thus, \fIdata\fR[\fIi\fR][\fIj\fR] isthe \fIj\fRth element of the \fIi\fRth feature vector.  .TP.I cbkThis parameter is a pointer to a codebook structure of type .I vqcbk,which is defined in <esps/vq.h>.  The following structure definition contains the subset of the definition in <esps/vq.h> thatis relevant to .I vqdesign\fR:.nf.ta 1.75i\fBstruct\fP vqcbk {\fBdouble\fP *conv_ratio;	\fI/*fractional distortion convergence threshold*/\fP\fBdouble\fP *final_dist;	\fI/*average distortion of current codebook*/\fP\fBfloat\fP **codebook;	\fI/*codeword matrix; codeword[j] points to jth codeword*/\fP\fBfloat\fP *clusterdist;	\fI/*distortion of the cluster corresponding 				    to each codeword*/\fP\fBlong\fP *clustersize;	\fI/*size of the cluster corresponding to each codeword*/\fP\fBlong\fP *train_length;	\fI/*length of training sequence used*/\fP\fBlong\fP *design_size;	\fI/*design goal for number of codewords*/\fP\fBlong\fP *current_size;	\fI/*current number of codewords in codebook*/\fP\fBlong\fP *dimen;	\fI/*dimension of codewords*/\fP\fBlong\fP *num_iter;	\fI/*total number of cluster iterations*/\fP\fBshort\fP *cbk_type; 	\fI/*codebook type, e.g, RC_VQCBK;				  see vq_cbk_types[] in <esps/header.h>*/\fP\fBshort\fP *dist_type;	\fI/*distortion type, e.g, MSE; see				  dist_types[] in <esps/header.h>*/ \fP\fBshort\fP *cbk_struct;	\fI/*codebook structure, e.g., FULL_SEARCH;				  see cbk_structs[] in <esps/header.h>*/\fP};.fi.I cbk\->codebookis interpreted as a pointer to a matrix of floats containing.I cbk\->design_sizerows of .I cbk\->dimencolumns each.  Prior to calling .I vqdesign,the calling program must set the values of .I *cbk\->design_size,.I *cbk\->current_size,.I *cbk\->dimen,.I cbk\->codebook,and.I *cbk\->conv_ratio.  It should also set .I *cbk\->dist_type,although this does not affect the operation of .I vqdesign.  As in the case of .I data,the pointer .I cbk\->codebook can be assigned by means of .I f_mat_alloc(3\-ESPSu).  In most cases, the value of .I cbk\->dimen will be the same as that of the .I vqdesignparameter .I dim (dimension of feature vectors), but that is not necessary provided that the functions .I vec_to_cdwdand.I distortare defined appropriately. .IPIf .I *cbk\->current_size is not zero, this number of rows from .I cbk\->codebook are considered to define an initial codebook.  .IPBefore.I vqdesignreturns, it sets the values of .I "*cbk\->train_length, *cbk\->current_size, *cbk\->final_dist,"and.I *cbk\->num_iter.  (.I *cbk\->num_iteris the total number of clustering iterations since the start of the codebook design.)  .I vqdesignfills the first .I *cbk\->current_sizerows of .I cbk\->codebook with the codewords resulting from the design algorithm.  (Usually, .I "*cbk\->current_size = *cbk\->design_size"when .I vqdesign terminates.)  Also, the values of \fIcbk\->clustersize\fR[\fIj\fR] and \fIcbk\->clusterdist\fR[\fIj\fR]are set to the size and average distortion of the final clustercorresponding to \fIcbk\->codebook\fR[\fIj\fR] (this codeword is the transformed centroid of the cluster).  .IPThe value.I *cbk\->cbk_struct is set to FULL_SEARCH by.I vqdesign.  The values of .I *cbk\->dist_typeand.I *cbk\->cbk_typeare not changed by .I vqdesign..TP.I encThis is a pointer to .I len\fBlong\fP values that are used by .I vqdesignto pass back the index of the closest codeword to the correspondingfeature vector in \fIdata\fP[\fIi\fP].  For more information, see"GENERAL DESCRIPTION".  .TP .I initThis parameter determines whether or not an initial codebook is clustered before being split, according to the following values whichare defined in <esps/vq.h>:.nf.ta .25i 1.5i	INIT_CLUSTER	cluster initial codebook before splitting	INIT_NOCLUSTER	do not cluster initial codebook before splitting

⌨️ 快捷键说明

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