Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 3/22/2024
Public
Document Table of Contents

Hilbert

MODIFIED API. Computes an analytic signal using the Hilbert transform.

Syntax

IppStatus ippsHilbert_32f32fc(const Ipp32f* pSrc, Ipp32fc* pDst, IppsHilbertSpec* pSpec, Ipp8u* pBuffer);

IppStatus ippsHilbert_64f64fc(const Ipp64f* pSrc, Ipp64fc* pDst, IppsHilbertSpec* pSpec, Ipp8u* pBuffer);

Include Files

ipps.h

Domain Dependencies

Headers: ippcore.h, ippvm.h

Libraries: ippcore.lib, ippvm.lib

Parameters

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.

pBuffer

Pointer to the work buffer.

Description

IMPORTANT:
The API of this function has been modified in Intel IPP 9.0 release.

The ippsHilbert 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.

Before using this function, you need to compute the size of the work buffer and specification structure using the HilbertGetSize function and initialize the structure using HilbertInit.

Return Values

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.

Example

The example below shows how to initialize the specification structure and use the function ippsHilbert_32f32fc.

IppStatus hilbert( )
{
   Ipp32f x[10];
   Ipp32fc y[10];
   int n;
   IppStatus status;
   IppsHilbertSpec* pSpec;
   Ipp8u* pBuffer;
   int sizeSpec, sizeBuf;

   status = ippsHilbertGetSize_32f32fc(10, ippAlgHintNone, &sizeSpec, &sizeBuf);

   pSpec = (IppsHilbertSpec*)ippMalloc(sizeSpec);
   pBuffer = (Ipp8u*)ippMalloc(sizeBuf);

   status = ippsHilbertInit_32f32fc(10, ippAlgHintNone, pSpec, pBuffer);

   for (n = 0; n < 10; n ++) {
      x[n] = (Ipp32f)cos(IPP_2PI * n * 2 / 9);
   }

   status = ippsHilbert_32f32fc(x, y, pSpec, pBuffer);

   ippsMagnitude_32fc((Ipp32fc*)y, x, 5);

   ippFree(pSpec);
   ippFree(pBuffer);

   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)

See Also