QuantFwd8x8_JPEG

Performs quantization of an 8x8 block of DCT coefficients.

Syntax

IppStatus ippiQuantFwd8x8_JPEG_16s_C1I(Ipp16s* pSrcDst, const Ipp16u* pQuantFwdTable);

Parameters

pSrcDst

Pointer to the 8x8 block of DCT coefficients.

pQuantFwdTable

Pointer to the quantization table for the encoder.

Description

The function ippiQuantFwd8x8_JPEG is declared in the ippj.h file. This function performs quantization of computed DCT coefficients for an 8x8 block. Quantization is defined in [ISO10918], Annex A.3.4, DCT Coefficient Quantization and Dequantization, as

Sq(u,v) = round(S(u,v)/Q(u,v)),

where Sq(u,v) is the quantized DCT coefficient, S(u,v) is a computed DCT coefficient, and Q(u,v) is a quantization table element.

Rounding is to the nearest integer. To avoid division, quantization table elements are scaled up by 215. After that, division operation is replaced by multiplication of DCT coefficients by scaled quantization table elements. Then the products are rescaled back by 15 bits.

Example “Using Intel IPP for Quantization of 8x8 Block of DCT Coefficients” shows how to use the function ippiQuantFwd8x8_JPEG_16s_C1I.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error condition if one or both specified pointers are NULL.

Using Intel IPP for Quantization of 8x8 Block of DCT Coefficients

Ipp8u pQuantRawTable[64]= {16,  11,  12,  14,  12,  10,  16,  14,
                            13,  14,  18,  17,  16,  19,  24,  40,
                            26,  24,  22,  22,  24,  49,  35,  37,
                            29,  40,  58,  51,  61,  60,  57,  51,
                            56,  55,  64,  72,  92,  78,  64,  68,
                            87,  69,  55,  56,  80, 109,  81,  87,
                            95,  98, 103, 104, 103,  62,  77, 113,
                           121, 112, 100, 120, 92,  101, 103,  99 };
 
Ipp16s dstFwd[8*8] = { 4,  4, 4,  4,  4,  4,  4, 4,
                       4,  3, 3,  3, -3, 3, -3, 4,
                       4, -3, 2,  0,  0,  2,  3, 4,
                       4,  3, 0,  1, -1,  0, -3, 4,
                       4, -3, 0, -1,  1,  0,  3, 4,
                       4,  3, 2,  0,  0,  2, -3, 4,
                       4, -3, 3, -3,  3, -3,  3, 4,
                       4,  4, 4,  4,  4,  4,  4, 4};
 
Ipp16u pQuantFwdTable[64];
int quality = 75;
 
ippiQuantFwdRawTableInit_JPEG_8u ( pQuantRawTable, quality );

		
ippiQuantFwdTableInit_JPEG_8u16u ( pQuantRawTable, pQuantFwdTable );
 
ippiQuantFwd8x8_JPEG_16s_C1I ( dstFwd, pQuantFwdTable );
 
result:
pQuantRawTable (with quality)
8 6 6 7 6 5 8 7
7 7 9 9 8 10 12 20
13 12 11 11 12 25 18 19
15 20 29 26 31 30 29 26
28 28 32 36 46 39 32 34
44 35 28 28 40 55 41 44
48 49 52 52 52 31 39 57
61 56 50 60 46 51 52 50
 
pQuantFwdTable
4096 5461 6554 4096 2731 1638 1260 1057
5461 5461 4681 3277 2521 1130 1092 1170
4681 4681 4096 2731 1638 1130  936 1170
4681 3641 2979 2185 1260  745  819 1057
3641 2979 1725 1170  964  596  630  840
2731 1820 1170 1024  799  630  575  712
1311 1024  840  745  630  537  546  643
 910  712  683  669  585  655  630  655
 
 
 
dstFwd (after pQuantFwdTable)
0 1 1 0 0 0 0 0
1 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

Submit feedback on this help topic

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