Table of Contents

NAME

QccChannelNormalize, QccChannelDenormalize - channel normalization

SYNOPSIS

#include "libQccPack.h"

int QccChannelNormalize(QccChannel *channel);
int QccChannelDenormalize(QccChannel *channel);

DESCRIPTION

The channel symbols written to a CHN-format file must be nonnegative, with the exception that a symbol of value of QCCCHANNEL_NULLSYMBOL, which is defined as -1, can denote a null symbol (i.e., the absence of a symbol in the channel). However, some applications may wish to store both positive and negative symbols in a QccChannel structure. QccChannelNormalize() and QccChannelDenormalize() allow such QccChannel channels with positive and negative symbols to be written to and read from CHN-format files. The idea is, before writing the file, add a constant to each symbol to make all symbols nonegative. Likewise, this same constant is subtracted from the symbols when the file is read to shift the symbols back into their original range. Note that null channel symbols are no longer allowed in this scheme.

QccChannelNormalize() provides the shifting of positive and negative symbols into nonnegative symbols. Assume that the channel symbols originally have range -N to N; consequently, channel->alphabet_size is 2*N + 1. QccChannelNormalize() adds channel->alphabet_size/2 to each symbol in channel->channel_symbols so the the range of the new symbols is 0 through channel->channel_symbols - 1. These new symbols can then be written to a CHN-format file with QccChannelWriteBlock(3) or QccChannelWriteWholefile(3) .

QccChannelDenormalize() performs the opposite action: channel->alphabet_size/2 is subtracted from each symbol in channel->channel_symbols so that the symbols are shifted back to their original range of -N to N. QccChannelDenormalize() would typically be called after QccChannelReadBlock(3) or QccChannelReadWholefile(3) .

Prior to calling these routines, channel->channel_length, channel->access_block_size, and channel->alphabet_size must contain valid values and channel->channel_symbols must be allocated to the appropriate size.

RETURN VALUE

These routines return 0 on successful completion, 1 if an error occurs while writing the file.

SEE ALSO

QccChannel(3) , QccChannelWrite(3) , QccChannelRead(3) , QccPack(3)

AUTHOR

Copyright (C) 1997-2021 James E. Fowler


Table of Contents



Get QccPack at SourceForge.net. Fast, secure and Free Open Source software downloads