QuantInterUniform_VC1, QuantInterNonuniform_VC1

Perform uniform/nonuniform quantization of inter blocks.

Syntax

IppStatus ippiQuantInterUniform_VC1_16s_C1IR( Ipp16s* pSrcDst, Ipp32s srcDstStep, Ipp32s doubleQuant, IppiSize roiSize );

IppStatus ippiQuantInterNonuniform_VC1_16s_C1IR( Ipp16s* pSrcDst, Ipp32s srcDstStep, Ipp32s doubleQuant, IppiSize roiSize );

Include Files

ippvc.h

Parameters

pSrcDst

Pointer to the source and destination block.

srcDstStep

Distance in bytes between starts of the consecutive lines in the source and destination blocks.

doubleQuant

Quant coefficient; should be an even number within the range [2, 62].

roiSize

Inter block size; should be 8x8, 8x4, 4x8 or 4x4.

Description

The functions perform quantization of inter blocks according to 8.1.2.8 of [SMPTE421M] .

In the case of uniform quantization:

a[i]=a[i]/quant_coef;

In the case of nonuniform quantization:

a[i]=(a[i]-sign(a[i])*(quant_coef >> 1))/quant_coef;

where a[i] is the coefficient of the inter block, and quant_coef is the quant coefficient.

The doubleQuant parameter should be equal to 2*MQUANT+HALFQP, where MQUANT and HALFQP are defined in the VC-1 standard. MQUANT should be within the range [1;31], HALFQP should be within the range [0,1] if MQUANT ≤ 8 and should be equal to 0, if MQUANT > 8.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error condition when pSrcDst is NULL.

ippStsDivByZeroErr

Indicates an error condition when the doubleQuant quantizer is equal to zero.

Example

The code example below shows how to use ippiQuantInterUniform_VC1_16s_C1IR function.

{
Ipp16s*  pSrcDstData = pointer_on_source_and_destination_block;
Ipp32s doubleQuant = quant_coefficient; /* It should be an even number in the
range [2,62]; */
Ipp32s srcDstStep = source_and_destination_step; /* Step of the pointer
pSrcDstData (source and destination array) in bytes */
IppSize roiSize = inter_block_size;
/* It should be: 
8x8 (roiSize.width=8, roiSize.height=8)
4x8 (roiSize.width=4, roiSize.height=8)
8x4 (roiSize.width=8, roiSize.height=4)
4x4 (roiSize.width=4, roiSize.height=4)
*/
IppStatus result;

/*
ippStsNoErr         Indicates no error
ippStsNullPtrErr    Indicates an error when pSrcDstData is NULL
ippStsOutOfRangeErr Indicates an error when quantizer doubleQuant is less than 2
or higher than 62 
ippStsSizeErr       Indicates an error when roiSize.height is not equal 4 or 8
or roiSize.width is not equal 4 or 8
*/

result = ippiQuantInterUniform_VC1_16s_C1IR( pSrcDstData, srcDstStep,
doubleQuant );

/*  Performs uniform quantization process for inter block according to 8.1.2.8
"Inverse AC Coefficient Quantization" specification of SMPTE 421M
*/
}

The code example below shows how to use ippiQuantInterNonuniform_VC1_16s_C1IR function.

{
Ipp16s*  pSrcDstData = pointer_on_source_and_destination_block;
Ipp32s doubleQuant = quant_coefficient;  /* It should be an even number in the
range [2,62]; */
Ipp32s srcDstStep = source_and_destination_step; /* Step of the pointer
pSrcDstData (source and destination array) in bytes */
IppSize roiSize = inter_block_size;
/* It should be:
8x8 (roiSize.width=8, roiSize.height=8)
4x8 (roiSize.width=4, roiSize.height=8)
8x4 (roiSize.width=8, roiSize.height=4)
4x4 (roiSize.width=4, roiSize.height=4)
*/
IppStatus result;
/*
ippStsNoErr         Indicates no error
ippStsNullPtrErr    Indicates an error when pSrcDstData is NULL
ippStsOutOfRangeErr Indicates an error when quantizer doubleQuant is less than 2
or higher than 62
ippStsSizeErr       Indicates an error when roiSize.height is not equal 4 or 8
or roiSize.width is not equal 4 or 8
*/

result = ippiQuantInterNonuniform_VC1_16s_C1IR( pSrcDstData, srcDstStep,
doubleQuant );

/*  Performs nonuniform quantization process for inter block according to
8.1.2.8 "Inverse AC Coefficient Quantization" specification of SMPTE 421M
*/
}
For more complete information about compiler optimizations, see our Optimization Notice.