Pow34

Raises a vector to the power of 3/4.

Syntax

IppStatus ippsPow34_32f16s(const Ipp32f* pSrc, Ipp16s* pDst, int len);

IppStatus ippsPow34_32f(const Ipp32f* pSrc, Ipp32f* pDst, int len);

IppStatus ippsPow34_16s_Sfs(const Ipp16s* pSrc, int inscaleFactor, int Ipp16s* pDst, int scaleFactor, int len);

Parameters

pSrc

Pointer to the input data vector [ len].

inscaleFactor

Input data scalefactor value.

pDst

Pointer to the output data vector [ len].

scaleFactor

Scalefactor value.

len

Number of elements in the input and output vectors.

Description

This function is declared in the ippac.h header file. The function ippsPow34 performs the calculation for each element of pSrc by the formula

pDst[i] = |pSrc[i]|3/4, 0i < len,

and stores the result in pDst.

For example, in MPEG-1 Layer III the quantization of the complete vector of spectral values is done according to the following formula:



Here ix is the array of quantized values, i is the number of values in the array, nint is the function used to round non-integer values to the nearest integer value, xr is the vector of the magnitudes of the spectral values, qquant is the quantizer step size information, and quantanf is a constant that depends on the spectral flatness measure.

You can use the function ippsPow34_32f16s for this operation. However, if the maximum of all quantized values is outside the table range or the overall bit sum exceeds the available bits, you should repeat this operation several times with a new qquant value and the same xr array.

Alternatively, you can use the function ippsPow34_32f to calculate the power of 3/4 for xr only once before the inner iteration loop and use it during every quantization iteration with the constant multiplier and convert the resulting values to short.



This operation is supported by the function ippsMulC_Low_32f16s.

Below see example  of using ippsPow34_32f and ippsPow34_16s_Sfs.

The function ippsPow34 is used in the float-point versions of AAC and MP3 encoders included into Intel IPP Samples. See introduction to this section.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when the pSrc or pDst pointer is NULL.

ippStsSizeErr

Indicates an error when len is less than or equal to 0.

ippStsMisalignedBuf

Indicates misaligned data. Supply aligned data for better performance.

ippsPow34 Usage  

IppStatus pow34(void)
{
  Ipp32f pSrc[5] = {-1234.56, 0, 45.89, -3.896, 45328.562};
  Ipp32f pDst[5], pDst32[5];
  Ipp16s pSrc16[5], pDst16[5];
  int inscaleFactor = 1;
  int scaleFactor = -3;
  IppStatus st;
  int i;

		
 st = ippsPow34_32f(pSrc, pDst, 5);
  if (st < ippStsOk) return st;
  printf("\n pDst = ");
  for (i = 0; i < 5; i++)
    printf("%f ", pDst[i]);
  printf("\n");

		
  st = ippsConvert_32f16s_Sfs(pSrc, pSrc16, 5, ippRndNear, inscaleFactor);
  if (st < ippStsOk) return st;
  st = ippsPow34_16s_Sfs(pSrc16, inscaleFactor, pDst16, scaleFactor, 5);
  if (st < ippStsOk) return st;
  st = ippsConvert_16s32f_Sfs(pDst16, pDst32, 5, -scaleFactor);

		
  printf("Before scaling\n pDst16 = ");
  for (i = 0; i < 5; i++)
    printf("%i ", pDst16[i]);
  printf("\n");

		
  printf("After scaling\n pDst16 = ");
  for (i = 0; i < 5; i++)
    printf("%f ", pDst32[i]);
  printf("\n");

		
  return st;
}

		
//Output:
//   pDst = 208.273575 0.000000 17.631470 2.773092 3106.554443 
//   Before scaling
//   pDst16 = 1666 0 141 23 24853 
//   After scaling
//   pDst16 = 208.250000 0.000000 17.625000 2.875000 3106.625000

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.