imsvq
Functions
-
int main(int argc, char *argv[])
imsvq [ option ] [ infile ]
-l int
length of vector \((1 \le M + 1)\)
-m int
order of vector \((0 \le M)\)
-s str
codebook file
infile str
int-type codebook index
stdout
double-type quantized vector
In the below example, decoding of multistage vector quantization is performed using two codebook files
cbfile1
andcbfile2
.imsvq -s cbfile1 -s cbfile2 < data.i > data.q
- Parameters:
argc – [in] Number of arguments.
argv – [in] Argument vector.
- Returns:
0 on success, 1 on failure.
-
class InverseMultistageVectorQuantization
Perform inverse multistage vector quantization.
The input is the \(N\) indices of codebook vectors:
\[ \begin{array}{cccc} i(1), & i(2), & \ldots, & i(N), \end{array} \]and the \(M\)-th order \(N \times I\) codebook vectors, \(\left\{ c_i^{(n)}(m) \right\}\). The output is the \(M\)-th order reconstructed vector:\[ \begin{array}{cccc} x^{(N)}(0), & x^{(N)}(1), & \ldots, & x^{(N)}(M). \end{array} \]The reconstructed vector is obtained by the recursion:\[ x^{(n)}(m) = c_{i(n)}^{(n)}(m) + x^{(n-1)}(m), \]where \(x^{(0)}(m) = 0\) for any \(m\).Public Functions
-
InverseMultistageVectorQuantization(int num_order, int num_stage)
- Parameters:
num_order – [in] Order of vector, \(M\).
num_stage – [in] Number of quantization stages, \(N\).
-
inline int GetNumOrder() const
- Returns:
Order of vector.
-
inline int GetNumStage() const
- Returns:
Number of stages.
-
inline bool IsValid() const
- Returns:
True if this object is valid.
-
bool Run(const std::vector<int> &codebook_indices, const std::vector<std::vector<std::vector<double>>> &codebook_vectors, std::vector<double> *reconstructed_vector, InverseMultistageVectorQuantization::Buffer *buffer) const
- Parameters:
codebook_indices – [in] \(N\) codebook indices.
codebook_vectors – [in] \(M\)-th order \(I\) codebook vectors. The shape is \([N, I, M+1]\).
reconstructed_vector – [out] \(M\)-th order output vector.
buffer – [out] Buffer.
- Returns:
True on success, false on failure.
-
class Buffer
Buffer for InverseMultistageVectorQuantization class.
-
InverseMultistageVectorQuantization(int num_order, int num_stage)
-
class InverseVectorQuantization
Perform inverse vector quantization.
The input is the index of a codebook vector \(i\) and the \(M\)-th order codebook vectors:
\[ \begin{array}{cccc} \boldsymbol{c}_0, & \boldsymbol{c}_1, & \ldots, & \boldsymbol{c}_{I-1}. \end{array} \]The output is simply the \(i\)-th codebook vector \(\boldsymbol{c}_i\).Public Functions
-
explicit InverseVectorQuantization(int num_order)
- Parameters:
num_order – [in] Order of vector, \(M\).
-
inline int GetNumOrder() const
- Returns:
Order of vector.
-
inline bool IsValid() const
- Returns:
True if this object is valid.
-
bool Run(int codebook_index, const std::vector<std::vector<double>> &codebook_vectors, std::vector<double> *reconstructed_vector) const
- Parameters:
codebook_index – [in] Codebook index.
codebook_vectors – [in] \(M\)-th order \(I\) codebook vectors. The shape is \([I, M+1]\).
reconstructed_vector – [out] \(M\)-th order codebook vector.
- Returns:
True on success, false on failure.
-
explicit InverseVectorQuantization(int num_order)