AudRecordLib
Namespaces | Classes | Functions
detail Namespace Reference

Namespaces

namespace  SSE

Classes

struct  IfThenElse< true, TrueType, FalseType >
struct  IfThenElse< false, TrueType, FalseType >
struct  ScaleFactor
struct  ScaleFactor< Source, Source >

Functions

DWORD ConvertCopy (LPCVOID pSrcArray, DWORD numFrames, PVOID pDstArray, WORD sampleSize, WORD numChannels)
 DEFINE_DETERMINE_PCM_CHANNEL_X_HELPER (Up)
 DEFINE_DETERMINE_PCM_CHANNEL_X_HELPER (Down)
 DEFINE_DETERMINE_PCM_CHANNEL_X_HELPER (Equal)
 DEFINE_DETERMINE_FLOAT_CHANNEL_X_HELPER (Up)
 DEFINE_DETERMINE_FLOAT_CHANNEL_X_HELPER (Down)
 DEFINE_DETERMINE_FLOAT_CHANNEL_X_HELPER (Equal)
template<class SourceSampleType , class DestSampleType >
DWORD ConvertChannelEqual (LPCVOID pSrcArray, DWORD numFrames, PVOID pDstArray, WORD srcChannels, WORD)
template<class DestSampleType >
DWORD ConvertChannelEqual (LPCVOID pSrcArray, DWORD numFrames, PVOID pDstArray, WORD srcChannels)
template<class DestSampleType >
DWORD ConvertChannelEqualSSE (LPCVOID pSrcArray, DWORD numFrames, PVOID pDstArray, WORD srcChannels)
template<class SourceSampleType , class DestSampleType >
DWORD ConvertChannelDown (LPCVOID pSrcArray, DWORD numFrames, PVOID pDstArray, WORD srcChannels, WORD dstChannels)
template<class SourceSampleType , class DestSampleType >
DWORD ConvertChannelUp (LPCVOID pSrcArray, DWORD numFrames, PVOID pDstArray, WORD srcChannels, WORD dstChannels)

Detailed Description

Contains functions and values used in samples conversion These are not to be used directly, instead the relevant functions are chosen by DetermineSampleConverter() and called indirectly by the ConverterFnPtr variable it returns


Function Documentation

template<class SourceSampleType , class DestSampleType >
DWORD detail::ConvertChannelDown ( LPCVOID  pSrcArray,
DWORD  numFrames,
PVOID  pDstArray,
WORD  srcChannels,
WORD  dstChannels 
)

Folds down samples when there are more source channels than destination ones

For every frame, an average of every (srcChannels / dstChannels) scaled samples are taken. Left over channel samples from the division (i.e. srcChannels % dstChannels) are included in the average at the rate of one extra per dstChannel until they've all been included.

Parameters:
pSrcArrayThe (srcChannels * numFrames) samples
numFramesThe number of frames of data in pSrcArray
pDstArrayOutput buffer for the dest type samples
srcChannelsNumber of channels of data in the input buffer
dstChannelsNumber of channels of data in the output buffer
Returns:
Number of bytes written to pDstArray
template<class SourceSampleType , class DestSampleType >
DWORD detail::ConvertChannelEqual ( LPCVOID  pSrcArray,
DWORD  numFrames,
PVOID  pDstArray,
WORD  srcChannels,
WORD   
)

Simply converts source samples to destination samples

Loops through (srcChannels * numFrames) source samples, converting them to destination samples by dividing by the scale factor. The unused parameter would be for the dstChannels variable, but with an equal number of channels this is the same value as the srcChannels variable so it is unnecessary

Parameters:
pSrcArrayThe (srcChannels * numFrames) source samples of type SourceSampleType
numFramesThe number of frames of data in pSrcArray
pDstArrayOutput buffer for the dest type samples
srcChannelsNumber of channels of data in the input and output
Returns:
Number of bytes written to pDstArray
template<class DestSampleType >
DWORD detail::ConvertChannelEqual ( LPCVOID  pSrcArray,
DWORD  numFrames,
PVOID  pDstArray,
WORD  srcChannels 
)

Simply converts float samples to destination samples

Loops through (srcChannels * numFrames) float samples, converting them to destination samples by multiplying by max(DestSampleType). These are multiplied rather than divided because float samples are in the range of [-1,1].

Parameters:
pSrcArrayThe (srcChannels * numFrames) float samples
numFramesThe number of frames of data in pSrcArray
pDstArrayOutput buffer for the dest type samples
srcChannelsNumber of channels of data in the input and output
Returns:
Number of bytes written to pDstArray
template<class DestSampleType >
DWORD detail::ConvertChannelEqualSSE ( LPCVOID  pSrcArray,
DWORD  numFrames,
PVOID  pDstArray,
WORD  srcChannels 
)

Converts float samples to destination samples using SSE

Converts the source sample floats to their integer destination type (int or short) first in groups of 16, then in groups of 4 and then individually for any odd leftovers. From testing float->integral with channels equal is the most common case, hence why this has an SSE implementation.

Parameters:
pSrcArrayThe (srcChannels * numFrames) float samples
numFramesThe number of frames of data in pSrcArray
pDstArrayOutput buffer for the dest type samples
srcChannelsNumber of channels of data in the input and output
Returns:
Number of bytes written to pDstArray
template<class SourceSampleType , class DestSampleType >
DWORD detail::ConvertChannelUp ( LPCVOID  pSrcArray,
DWORD  numFrames,
PVOID  pDstArray,
WORD  srcChannels,
WORD  dstChannels 
)

Replicates samples when there are more destination channels than source ones

For every frame, one converted source channel is copied to every (dstChannels / srcChannels) channels. Channels unaccounted for by this division (i.e. dstChannels % srcChannels) are written at the rate of one per source channel until they've all been filled.

Parameters:
pSrcArrayThe (srcChannels * numFrames) samples
numFramesThe number of frames of data in pSrcArray
pDstArrayOutput buffer for the dest type samples
srcChannelsNumber of channels of data in the input buffer
dstChannelsNumber of channels of data in the output buffer
Returns:
Number of bytes written to pDstArray
DWORD detail::ConvertCopy ( LPCVOID  pSrcArray,
DWORD  numFrames,
PVOID  pDstArray,
WORD  sampleSize,
WORD  numChannels 
)

Simply copies samples from source to dest without converting them

Parameters:
pSrcArrayThe (srcChannels * numFrames) samples
numFramesThe number of frames of data in pSrcArray
pDstArrayOutput buffer for the dest type samples
sampleSizeThe size in bytes of one channel sample
numChannelsNumber of channels of data in the input buffer
Returns:
(numChannels * numFrames) * sampleSize
detail::DEFINE_DETERMINE_FLOAT_CHANNEL_X_HELPER ( Up  )

Defines the float to ? determination function when there are more dest channels than source

detail::DEFINE_DETERMINE_FLOAT_CHANNEL_X_HELPER ( Down  )

Defines the float to ? determination function when there are more source channels than dest ones

detail::DEFINE_DETERMINE_FLOAT_CHANNEL_X_HELPER ( Equal  )

Defines the float to ? determination function when there number of channels are equal

detail::DEFINE_DETERMINE_PCM_CHANNEL_X_HELPER ( Up  )

Defines the int to int determination function when there are more dest channels than source

detail::DEFINE_DETERMINE_PCM_CHANNEL_X_HELPER ( Down  )

Defines the int to int determination function when there are more source channels than dest

detail::DEFINE_DETERMINE_PCM_CHANNEL_X_HELPER ( Equal  )

Defines the int to int determination function when the number of channels are equal

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Defines