QuantWeightBlockInv_DV

Performs inverse quantization and inverse weighting on a block.

Syntax

IppStatus ippiQuantWeightBlockInv_DV_16s_C1I(Ipp16s* pSrcDst, constIpp16s* pQuantInvTable, const Ipp16s* pWeightInvTable);

Parameters

pSrcDst

Pointer to the source and destination 8x8 (or 2x4x8) block.

pQuantInvTable

Pointer to an array that contains values of quantification table for the current block.

pWeightInvTable

Pointer to an array that contains values of weight table for the current block.

Note iconNote

There are two different types of blocks: 8x8 and 2x4x8. Select respective weighting tables for 8x8 or 2x4x8 blocks.

Description

This function is declared in the ippvc.h header file. The function ippiQuantWeightBlockInv_DV_16s_C1I performs inverse quantization and inverse weighting on a block in accordance with [SMPTE314M] standard.

The DV frame decoding process is depicted in "BlockParam Structure". The ippiQuantWeightBlockInv_DV_16s_C1I function covers de-quantization and inverse weighting steps. Choose appropriate quantization and weighting tables, that is, dequantization and deweighting tables for decoding. To choose the quantization table, use the values of two parameters - qno (quantization number) and the block quant class. For details, see [SMPTE314M], Table 23 - Quantization step. Use different weighting tables for 8x8 and 2x4x8 blocks.

The ippiQuantWeightBlockInv_DV_16s_C1I function uses the following three pointers as input arguments:

pDataBlock

Pointer to the current block

pQuantTable

Pointer to the quantization table

pWeightTable

Pointer to the weighting table

The function performs the following operations:

for (Ipp32s i = 0;i < 64;i += 1) pDataBlock[i] = (Ipp16s) ( ( ((Ipp16s) pDataBlock [1]>>3 ) * ((Ipp16s) pQuantTable[i] ) * ((Ipp16s) pWeightTable[i] ) )>>16);

The pWeightTable weighting table contains floating point data with values varying from 2.0 to 4.0. Scaling is required for integer multiplication through multiplying the table values by 8192 (1<<13). Then back shift is required through division by 65536 to provide for REAL range, that is, to perform inverse scaling.

After ippiQuantWeightBlockInv_DV_16s_C1I completes dequantization and inverse weighing, iDCT is performed before creating the macroblock.

Compare QuantInv_DV and QuantWeightBlockInv_DV. The ippiQuantInv_DV_16s_C1I function has two arguments: pDataBlock, which is a pointer to the current block, and pQuantTable, a modification of the quantization table with values multiplied by 256 (1<< 8) and divided by weight coefficients for Ipp16s datatype. The ippiQuantWeightBlockInv_DV_16s_C1I function has separate quantization and weighting tables that contain input arguments for the function.

See Example "Inverse Quantization Tables", Example "ippiQuantInv_DV_16s_C1I Usage", and Example "ippiQuantWeightBlockInv_DV_16s_C1I Usage" of ippiQuantInv_DV_16s_C1I and ippiQuantWeightBlockInv_DV_16s_C1I usage.

Inverse Quantization Tables  

{

//-----------------------------------------------------------------------------
//Several necessary tables

#define _INTERNAL_CS1 0.980785  //cos(1*PI/16)
#define _INTERNAL_CS2 0.923880  //cos(2*PI/16)
#define _INTERNAL_CS3 0.831470  //cos(3*PI/16)
#define _INTERNAL_CS4 0.707107  //cos(4*PI/16)
#define _INTERNAL_CS5 0.555570  //cos(5*PI/16)
#define _INTERNAL_CS6 0.382683  //cos(6*PI/16)
#define _INTERNAL_CS7 0.195090  //cos(7*PI/16)

#define _W0 (1.0000001)
#define _W1 (_INTERNAL_CS4 / (4.0*  _INTERNAL_CS7*  _INTERNAL_CS2))
#define _W2 (_INTERNAL_CS4 / (2.0*  _INTERNAL_CS6))
#define _W3 (1.0 / (2.0*  _INTERNAL_CS5))
#define _W4 (7.0 / 8.0) 
#define _W5 (_INTERNAL_CS4 / _INTERNAL_CS3)
#define _W6 (_INTERNAL_CS4 / _INTERNAL_CS2)
#define _W7 (_INTERNAL_CS4 / _INTERNAL_CS1)

 tabl1[] = 
    {
        0,1,8,16,    9,2,3,10,
        17,24,32,25, 18,11,4,5,
        12,19,26,33, 40,48,41,34,
        27,20,13,6,  7,14,21,28,
        35,42,49,56, 57,50,43,36,
        29,22,15,23, 30,37,44,51,
        58,59,52,45, 38,31,39,46,
        53,60,61,54, 47,55,62,63
    };

    Ipp16s tabl2[] =
    {
        0,  32,  1, 33,  8, 40,  2, 34,
        9,  41, 16, 48, 24, 56, 17, 49,
        10, 42,  3, 35,  4, 36, 11, 43,
        18, 50, 25, 57, 26, 58, 19, 51,
        12, 44,  5, 37,  6, 38, 13, 45,
        20, 52, 27, 59, 28, 60, 21, 53,
        14, 46,  7, 39, 15, 47, 22, 54,
        29, 61, 30, 62, 23, 55, 31, 63       
    };

    static double TablW0[] =
    {

 (0.5/*2500076*/),(_W0*_W1/2),(_W0*_W2/2),(_W0*_W3/2),(_W0*_W4/2),(_W0*_W5/2),(_W0*_W6/2),(_W0*_W7/2),
 (_W1*_W0/2),(_W1*_W1/2),(_W1*_W2/2),(_W1*_W3/2),(_W1*_W4/2),(_W1*_W5/2),(_W1*_W6/2),(_W1*_W7/2),
 (_W2*_W0/2),(_W2*_W1/2),(_W2*_W2/2),(_W2*_W3/2),(_W2*_W4/2),(_W2*_W5/2),(_W2*_W6/2),(_W2*_W7/2),
 (_W3*_W0/2),(_W3*_W1/2),(_W3*_W2/2),(_W3*_W3/2),(_W3*_W4/2),(_W3*_W5/2),(_W3*_W6/2),(_W3*_W7/2),
 (_W4*_W0/2),(_W4*_W1/2),(_W4*_W2/2),(_W4*_W3/2),(_W4*_W4/2),(_W4*_W5/2),(_W4*_W6/2),(_W4*_W7/2),
 (_W5*_W0/2),(_W5*_W1/2),(_W5*_W2/2),(_W5*_W3/2),(_W5*_W4/2),(_W5*_W5/2),(_W5*_W6/2),(_W5*_W7/2),
 (_W6*_W0/2),(_W6*_W1/2),(_W6*_W2/2),(_W6*_W3/2),(_W6*_W4/2),(_W6*_W5/2),(_W6*_W6/2),(_W6*_W7/2),
 (_W7*_W0/2),(_W7*_W1/2),(_W7*_W2/2),(_W7*_W3/2),(_W7*_W4/2),(_W7*_W5/2),(_W7*_W6/2),(_W7*_W7/2)
    };

  static Ipp16s TablW0_Scale_ZigZag[] =
{
(Ipp16s)(8192.0/TablW0[0]), (Ipp16s)(8192.0/TablW0[1]), (Ipp16s)(8192.0/TablW0[8]), (Ipp16s)(8192.0/TablW0[16]),
(Ipp16s)(8192.0/TablW0[9]), (Ipp16s)(8192.0/TablW0[2]), (Ipp16s)(8192.0/TablW0[3]), (Ipp16s)(8192.0/TablW0[10]),
(Ipp16s)(8192.0/TablW0[17]),(Ipp16s)(8192.0/TablW0[24]),(Ipp16s)(8192.0/TablW0[32]),(Ipp16s)(8192.0/TablW0[25]),
(Ipp16s)(8192.0/TablW0[18]),(Ipp16s)(8192.0/TablW0[11]),(Ipp16s)(8192.0/TablW0[4]), (Ipp16s)(8192.0/TablW0[5]),
(Ipp16s)(8192.0/TablW0[12]),(Ipp16s)(8192.0/TablW0[19]),(Ipp16s)(8192.0/TablW0[26]),(Ipp16s)(8192.0/TablW0[33]),
(Ipp16s)(8192.0/TablW0[40]),(Ipp16s)(8192.0/TablW0[48]),(Ipp16s)(8192.0/TablW0[41]),(Ipp16s)(8192.0/TablW0[34]),
(Ipp16s)(8192.0/TablW0[27]),(Ipp16s)(8192.0/TablW0[20]),(Ipp16s)(8192.0/TablW0[13]),(Ipp16s)(8192.0/TablW0[6]),
(Ipp16s)(8192.0/TablW0[7]), (Ipp16s)(8192.0/TablW0[14]),(Ipp16s)(8192.0/TablW0[21]),(Ipp16s)(8192.0/TablW0[28]),
(Ipp16s)(8192.0/TablW0[35]),(Ipp16s)(8192.0/TablW0[42]),(Ipp16s)(8192.0/TablW0[49]),(Ipp16s)(8192.0/TablW0[56]),
(Ipp16s)(8192.0/TablW0[57]),(Ipp16s)(8192.0/TablW0[50]),(Ipp16s)(8192.0/TablW0[43]),(Ipp16s)(8192.0/TablW0[36]),
(Ipp16s)(8192.0/TablW0[29]),(Ipp16s)(8192.0/TablW0[22]),(Ipp16s)(8192.0/TablW0[15]),(Ipp16s)(8192.0/TablW0[23]),
(Ipp16s)(8192.0/TablW0[30]),(Ipp16s)(8192.0/TablW0[37]),(Ipp16s)(8192.0/TablW0[44]),(Ipp16s)(8192.0/TablW0[51]),
(Ipp16s)(8192.0/TablW0[58]),(Ipp16s)(8192.0/TablW0[59]),(Ipp16s)(8192.0/TablW0[52]),(Ipp16s)(8192.0/TablW0[45]),
(Ipp16s)(8192.0/TablW0[38]),(Ipp16s)(8192.0/TablW0[31]),(Ipp16s)(8192.0/TablW0[39]),(Ipp16s)(8192.0/TablW0[46]),
(Ipp16s)(8192.0/TablW0[53]),(Ipp16s)(8192.0/TablW0[60]),(Ipp16s)(8192.0/TablW0[61]),(Ipp16s)(8192.0/TablW0[54]),
(Ipp16s)(8192.0/TablW0[47]),(Ipp16s)(8192.0/TablW0[55]), (Ipp16s)(8192.0/TablW0[62]),(Ipp16s)(8192.0/TablW0[63])

};

    static double TablW1[] =
    {
(0.5/*2500076*/),(_W0*_W1/2),(_W0*_W2/2),(_W0*_W3/2),(_W0*_W4/2),(_W0*_W5/2),(_W0*_W6/2),(_W0*_W7/2),
(_W2*_W0/2),(_W2*_W1/2),(_W2*_W2/2),(_W2*_W3/2),(_W2*_W4/2),(_W2*_W5/2),(_W2*_W6/2),(_W2*_W7/2),
(_W4*_W0/2),(_W4*_W1/2),(_W4*_W2/2),(_W4*_W3/2),(_W4*_W4/2),(_W4*_W5/2),(_W4*_W6/2),(_W4*_W7/2),
(_W6*_W0/2),(_W6*_W1/2),(_W6*_W2/2),(_W6*_W3/2),(_W6*_W4/2),(_W6*_W5/2),(_W6*_W6/2),(_W6*_W7/2),
(_W0*_W0/2),(_W0*_W1/2),(_W0*_W2/2),(_W0*_W3/2),(_W0*_W4/2),(_W0*_W5/2),(_W0*_W6/2),(_W0*_W7/2),
(_W2*_W0/2),(_W2*_W1/2),(_W2*_W2/2),(_W2*_W3/2),(_W2*_W4/2),(_W2*_W5/2),(_W2*_W6/2),(_W2*_W7/2),
(_W4*_W0/2),(_W4*_W1/2),(_W4*_W2/2),(_W4*_W3/2),(_W4*_W4/2),(_W4*_W5/2),(_W4*_W6/2),(_W4*_W7/2),
(_W6*_W0/2),(_W6*_W1/2),(_W6*_W2/2),(_W6*_W3/2),(_W6*_W4/2),(_W6*_W5/2),(_W6*_W6/2),(_W6*_W7/2),
    };

    static Ipp16s TablW1_Scale_ZigZag[] =
{
(Ipp16s)(8192.0/TablW1[0]), (Ipp16s)(8192.0/TablW1[32]),(Ipp16s)(8192.0/TablW1[1]), (Ipp16s)(8192.0/TablW1[33]),
(Ipp16s)(8192.0/TablW1[8]), (Ipp16s)(8192.0/TablW1[40]),(Ipp16s)(8192.0/TablW1[2]), (Ipp16s)(8192.0/TablW1[34]),
(Ipp16s)(8192.0/TablW1[9]), (Ipp16s)(8192.0/TablW1[41]),(Ipp16s)(8192.0/TablW1[16]),(Ipp16s)(8192.0/TablW1[48]),
(Ipp16s)(8192.0/TablW1[24]),(Ipp16s)(8192.0/TablW1[56]),(Ipp16s)(8192.0/TablW1[17]),(Ipp16s)(8192.0/TablW1[49]),
(Ipp16s)(8192.0/TablW1[10]),(Ipp16s)(8192.0/TablW1[42]),(Ipp16s)(8192.0/TablW1[3]), (Ipp16s)(8192.0/TablW1[35]),
(Ipp16s)(8192.0/TablW1[4]), (Ipp16s)(8192.0/TablW1[36]),(Ipp16s)(8192.0/TablW1[11]),(Ipp16s)(8192.0/TablW1[43]),
(Ipp16s)(8192.0/TablW1[18]),(Ipp16s)(8192.0/TablW1[50]),(Ipp16s)(8192.0/TablW1[25]),(Ipp16s)(8192.0/TablW1[57]),
(Ipp16s)(8192.0/TablW1[26]),(Ipp16s)(8192.0/TablW1[58]),(Ipp16s)(8192.0/TablW1[19]),(Ipp16s)(8192.0/TablW1[51]),
(Ipp16s)(8192.0/TablW1[12]),(Ipp16s)(8192.0/TablW1[44]),(Ipp16s)(8192.0/TablW1[5]), (Ipp16s)(8192.0/TablW1[37]),
(Ipp16s)(8192.0/TablW1[6]), (Ipp16s)(8192.0/TablW1[38]),(Ipp16s)(8192.0/TablW1[13]),(Ipp16s)(8192.0/TablW1[45]),
(Ipp16s)(8192.0/TablW1[20]),(Ipp16s)(8192.0/TablW1[52]),(Ipp16s)(8192.0/TablW1[27]),(Ipp16s)(8192.0/TablW1[59]),
(Ipp16s)(8192.0/TablW1[28]),(Ipp16s)(8192.0/TablW1[60]),(Ipp16s)(8192.0/TablW1[21]),(Ipp16s)(8192.0/TablW1[53]),
(Ipp16s)(8192.0/TablW1[14]),(Ipp16s)(8192.0/TablW1[46]),(Ipp16s)(8192.0/TablW1[7]), (Ipp16s)(8192.0/TablW1[39]),
(Ipp16s)(8192.0/TablW1[15]),(Ipp16s)(8192.0/TablW1[47]),(Ipp16s)(8192.0/TablW1[22]),(Ipp16s)(8192.0/TablW1[54]),
(Ipp16s)(8192.0/TablW1[29]),(Ipp16s)(8192.0/TablW1[61]),(Ipp16s)(8192.0/TablW1[30]),(Ipp16s)(8192.0/TablW1[62]),
(Ipp16s)(8192.0/TablW1[23]),(Ipp16s)(8192.0/TablW1[55]),(Ipp16s)(8192.0/TablW1[31]),(Ipp16s)(8192.0/TablW1[63])
};
}

ippiQuantInv_DV_16s_C1I Usage  

{
     	ippiHuffmanDecodeSegment_DV_8u16s((short* ) pDataBlock, ...);
      // get pointer to corresponding dequantize table
      // depends on qno & block quant class 
     	pQuantTable = (...);
     	if (0 == block_type)
    {
        for (Ipp32s iI = 0; iI < 64; iI++)
           		pQuantTable [iI] = pQuntTable [iI]* (Ipp16s)((double) (1 << 8) /
  TablW0[tabl1[iI]);

     	// do inverse and adaptive dequantization	
     	ippiQuantInv_DV_16s_C1I((short* ) pDataBlock), (short* ) pQuantTable);
     	// do iDCT
     	ippiDCT8x8Inv_16s_C1I((short* ) (pDataBlock));
    }

    else
    {
     	for (Ipp32s iI = 0; iI < 64; iI++)
	     pQuantTable [iI] = pQuantTable [iI]* (Ipp16s)(((double) (1 << 8)) /
  TablW1[tabl2[iI]);

	     // do inverse and adaptive dequantization
     	ippiQuantInv_DV_16s_C1I((short* ) pDataBlock), (short* ) pQuantTable);
     	// do iDCT
     	ippiDCT2x4x8Inv_16s_C1I((short* ) (pDataBlock) );
    }
};

ippiQuantWeightBlockInv_DV_16s_C1I Usage  

{
    	ippiHuffmanDecodeSegment_DV_8u16s((short *) lpsBlocks,...);
    	// get pointer to corresponding dequantization table
    	// depends on qno & block quant class
    	pQauntTable = (...);

    	if (0 == block_type)
    	{
         		ippiQuantWeightBlockInv_DV_16s_C1I( (Ipp16s *) (pDataBlock),
                                               (Ipp16s *) pQuantTable,
                                               (Ipp16s *) TablW0_Scale_ZigZag );
   		// do iDCT
   		ippiDCT8x8Inv_16s_C1I((short *) (pDataBlock));
	 } 

	else
	 {
   		ippiQuantWeightBlockInv_DV_16s_C1I( (Ipp16s *) (pDataBlock),
                                         (Ipp16s *) pQuantTable,
                                         (Ipp16s *) TablW0_Scale_ZigZag );


		   // do iDCT
		   ippiDCT2x4x8Inv_16s_C1I((short *) (pDataBlock));
	 } 
};

This function is used in the DV decoder included into Intel IPP Samples. See introduction to DV.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when the pSrcDst pointer is NULL.


Submit feedback on this help topic

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