我要评分
获取效率
正确性
完整性
易理解

Function Naming

Names of functions in the HMPP are in the following format: [HMPPS|HMPPI]_<name>_<datatype>[_<descriptor>](<parameters>)

Example: HmppResult HMPPS_MulC_64f64s_IS(double val, int64_t *srcDst, uint32_t len, int32_t scale)

In the preceding example:

  1. The prefix can be HMPP (basic functions), HMPPI (image library), HMPPS (signal library), or HMPPA (audio library).
  1. MulC is a function, which multiplies a vector by a constant.
  1. 64f64s indicates the data types of the two input parameters of the function, which are 64f (double) and 64s (long long).
  2. Extended description _IS:

    I indicates that the function is an in-place function. The function obtains values from the input vector in sequence, performs a series of operations, and saves the result in the source vector.

    S indicates that the function scales the output using the metric factor of the input parameter. The actual result can be restored after the output vector and scaling factor are calculated. The calculation precision is retained.

  3. The parameters in the parentheses are input through the interface.

Function Name <name>

The name of a function indicates what the function does. The format is <name>=<operation>[_modifier].

  • operation consists of one or more words, acronyms, or abbreviations that describe the basic operation of a function.
  • modifier consists of a word or abbreviation that denotes the extended capabilities of a function. It is optional. For example, for the Norm and NormDiff functions for calculating vector norms, there is an identifier indicating whether the function calculates the 1-norm (_L1), 2-norm (_L2), or infinite norm (_Inf). Similar functions include Threshold and FFT.

Data Type <datatype>

The <datatype> element indicates data types of parameters in a function. For details about the data types used in the HMPP, see Basic Data Types.

The format is <bit depth><bit interpretation>.

  • bit depth indicates the bit width, which can be 8 bits, 16 bits, 32 bits, or 64 bits.
  • bit interpretation indicates the data type, which can be unsigned integer (u), signed integer (s), floating point (f), or complex (c).

For functions that perform operations on a single data type, the <datatype> field contains only one of the values listed above. If a function operates on source and destination vectors that have different data types, the respective data type identifiers are listed in the function name and follow a fixed sequence: <datatype>=<src1Datatype>[src2Datatype][dstDatatype].

For example, the HMPPS_DotProd_32f32fc function computes the dot product of 32-bit floating-point and 32-bit floating-point complex source vectors, and stores the result in a destination vector of the 32-bit floating-point complex type.

Descriptor <descriptor>

A descriptor consists of one or more letters, showing more details about a function and further describing the function's operation.

Table 1 describes the main descriptors.

Table 1 <descriptor> description

Descriptor

Description

Example

I

The function executes an in-place operation, that is, the source and destination vectors are the same vector. By default, a not-in-place operation is performed.

For example, the formula for an in-place addition is: srcDst = srcDst + src

HMPPS_Add_16s_I

S

The function result is saturated and the scaling mode is fixed (saturated and no scaling by default).

HMPPS_Add_16s_S

Axx

xx valid binary digits are rounded off.

HMPPS_Powx_32f_A11

  • If a function has two or more descriptors, the descriptors are presented in alphabetical order in the function name (for example, HMPPS_Add_16s_IS).
  • For a function without a descriptor, the function name does not contain this field.

Parameters <parameters>

The <parameters> element specifies all parameters of a function.

The parameters are arranged in the following sequence:

  1. Source operand, which is usually a vector or constant of a certain length
  2. Destination operand
  3. Other parameters that contain specific operations

Parameter names comply with the following conventions:

  1. Each parameter name specifies its functionality.
  2. Input parameters are named src. In specific scenarios, numbers or words are added to further describe the meanings of input parameters, for example, src2 and srcLen.
  3. Output parameters are named dst. In specific scenarios, numbers or words are added to further describe the meanings of output parameters, for example, dst2 and dstLen.
  4. For functions that perform in-place operations, input and output parameters are named srcDst.