Computes an analytic signal using the Hilbert transform.
IppStatus ippsHilbert_32f32fc(const Ipp32f* pSrc, Ipp32fc* pDst, IppsHilbertSpec_32f32fc* pSpec);
IppStatus ippsHilbert_16s32fc(const Ipp16s* pSrc, Ipp32fc* pDst, IppsHilbertSpec_16s32fc* pSpec);
IppStatus ippsHilbert_16s16sc_Sfs(const Ipp16s* pSrc, Ipp16sc* pDst, IppsHilbertSpec_16s16sc* pSpec, int scaleFactor);
pSpec |
Pointer to the Hilbert specification structure. |
pSrc |
Pointer to the vector containing original real data. |
pDst |
Pointer to the output array containing complex data. |
scaleFactor |
Scale factor, refer to Integer Scaling. |
The function ippsHilbert is declared in the ipps.h file. This function computes a complex analytic signal pDst, which contains the original real signal pSrc as its real part and computed Hilbert transform as its imaginary part. The Hilbert transform is performed according to the pSpec specification parameters: the number of samples len, and the specific code hint. The input data is zero-padded or truncated to the size of len as appropriate. For integer data types, the output result is scaled according to the scaleFactor value, which ensures that the output signal range and precision are retained.
Example below shows how to initialize the specification structure and use the function ippsHilbert_32f32fc.
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error when one of the specified pointers is NULL. |
ippStsContextMatchErr |
Indicates an error when the specification identifier pSpec is incorrect. |
ippStsMemAllocErr |
Indicates an error when no memory is allocated. |
IppStatus hilbert(void) {
Ipp32f x[10];
Ipp32fc y[10];
int n;
IppStatus status;
IppsHilbertSpec_32f32fc* spec;
status = ippsHilbertInitAlloc_32f32fc(&spec, 10, ippAlgHintNone);
for(n = 0; n < 10; n ++) {
x[n] = (Ipp32f)cos(IPP_2PI * n * 2 / 9);
}
status = ippsHilbert_32f32fc(x, y, spec);
ippsMagnitude_32fc((Ipp32fc*)y, x, 5);
ippsHilbertFree_32f32fc(spec);
printf_32f("hilbert magn =", x, 5, status);
return status;
}
Output:
hilbert magn = 1.0944 1.1214 1.0413 0.9707 0.9839
Matlab* Analog:
>> n=0:9; x=cos(2*pi*n*2/9); y=abs(hilbert(x)); y(1:5)
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.