InitAllocHuffmanTable_DV

Allocates memory and initializes table.

Syntax

IppStatus ippiInitAllocHuffmanTable_DV_32u(Ipp32s* pSrcTable1, Ipp32s* pSrcTable2, Ipp32u** ppHuffTable);

Parameters

pSrcTable1

Pointer to Source Table 1.

pSrcTable2

Pointer to Source Table 2.

ppHuffTable

Double pointer to the destination decoding table.

Description

This function is declared in the ippvc.h header file. The function ippiInitAllocHuffmanTable_DV_32u allocates memory and initializes the table that contains codes for DCT coefficients (Run-Level codes). The function allocates memory at the address that **ppHuffTable points to, and fills it with data from Source Table 1 that pSrcTable1 points to and from Source Table 2 that pSrcTable2 points to. See Example “Source Table Structure” for the source table structure. When filling the destination decoding table the function multiplies the value of level by 64 (shift left by 6).

While decoding, the search for code is performed through the first subtable (Figure "VLC Subtables" ), which contains the most frequent and shortest codes. If the code value is not found, then the search continues through the following subtables, containing additional bits for longer codes. Those subtables also forward the search to the next ones, if the code value is not found.

HuffT Structure



length _code = length code (if source tables == pSrcTable1),

length _code = length code + 4 (if source tables == pSrcTable2)

ippiInitAllocHuffmanTable_DV_32u Usage  

Ipp32s HuffSrcTable1[] =
{
    9, /* Maximum length of code in this table*/
    0, /* Not used*/
    0, /* Not used*/
    0, /* Number of 1-bit codes*/
    0, /* Number of 2-bit codes*/
    2, /* Number of 3-bit codes*/
    0x0000, 0, 1,       0x0001, 0, -1,
    3, /* Number of  4-bit codes*/
    0x0004, 0,  2,      0x0005, 0, -2,

    0x0006, 100, 100,  /* EOB*/

    6, /* Number of 5-bit codes*/
    0x000e, 1, 1,       0x000f, 1, -1,
    0x0010, 0, 3,       0x0011, 0, -3,
    0x0012, 0, 4,       0x0013, 0, -4,
    8, /* Number of 6-bit codes*/
    0x0028, 2, 1,       0x0029, 2, -1,
    0x002a, 1, 2,       0x002b, 1, -2,
    0x002c, 0, 5,       0x002d, 0, -5,
    0x002e, 0, 6,       0x002f, 0, -6,
    8, /* Number of 7-bit codes*/
    0x0060, 3, 1,       0x0061, 3, -1,
    0x0062, 4, 1,       0x0063, 4, -1,
    0x0064, 0, 7,       0x0065, 0, -7,
    0x0066, 0, 8,       0x0067, 0, -8,
    16, /* Number of 8-bit codes*/
    0x00d0, 5, 1,       0x00d1, 5, -1,
    0x00d2, 6, 1,       0x00d3, 6, -1,
    0x00d4, 2, 2,       0x00d5, 2, -2,
    0x00d6, 1, 3,       0x00d7, 1, -3,
    0x00d8, 1, 4,       0x00d9, 1, -4,
    0x00da, 0, 9,       0x00db, 0, -9,
    0x00dc, 0, 10,      0x00dd, 0, -10,
    0x00de, 0, 11,      0x00df, 0, -11,
    32, /* Number of 9-bit codes*/
    0x01c0, 7, 1,       0x01c1, 7, -1,
    0x01c2, 8, 1,       0x01c3, 8, -1,
    0x01c4, 9, 1,       0x01c5, 9, -1,
    0x01c6, 10, 1,      0x01c7, 10, -1,
    0x01c8, 3, 2,       0x01c9, 3, -2,
    0x01ca, 4, 2,       0x01cb, 4, -2,
    0x01cc, 2, 3,       0x01cd, 2, -3,
    0x01ce, 1, 5,       0x01cf, 1, -5,
    0x01d0, 1, 6,       0x01d1, 1, -6,
    0x01d2, 1, 7,       0x01d3, 1, -7,
    0x01d4, 0, 12,      0x01d5, 0, -12,
    0x01d6, 0, 13,      0x01d7, 0, -13,
    0x01d8, 0, 14,      0x01d9, 0, -14,
    0x01da, 0, 15,      0x01db, 0, -15,
    0x01dc, 0, 16,      0x01dd, 0, -16,
    0x01de, 0, 17,      0x01df, 0, -17,
    -1 /* end of table*/
};

Ipp32s HuffSrcTable2[] =
{
    9, /* Maximum length of code. Note that 4 is added to
          all code lengths in the second table*/
    0, /* Not used*/
    0, /* Not used*/

    0,  /* Number of 1(5)-bit codes*/
    0,  /* Number of 2(6)-bit codes*/
    0,  /* Number of 3(7)-bit codes*/
    0,  /* Number of 4(8)-bit codes*/
    0,  /* Number of 5(9)-bit codes*/
    32, /* Number of 6(10)-bit codes*/
    0x0000, 11, 1,      0x0001, 11, -1,
    0x0002, 12, 1,      0x0003, 12, -1,
    0x0004, 13, 1,      0x0005, 13, -1,
    0x0006, 14, 1,      0x0007, 14, -1,
    0x0008, 5,  2,      0x0009, 5 , -2,
    0x000a, 6 , 2,      0x000b, 6 , -2,
    0x000c, 3,  3,      0x000d, 3 , -3,
    0x000e, 4 , 3,      0x000f, 4 , -3,

    0x0010, 2, 4 ,      0x0011, 2, -4 ,
    0x0012, 2, 5 ,      0x0013, 2, -5,
    0x0014, 1, 8 ,      0x0015, 1, -8 ,
    0x0016, 0, 18,      0x0017, 0, -18,
    0x0018, 0, 19,      0x0019, 0, -19,
    0x001a, 0, 20,      0x001b, 0, -20,
    0x001c, 0, 21,      0x001d, 0, -21,
    0x001e, 0, 22,      0x001f, 0, -22,
    16, /* Number of 7(11)-bit codes*/
    0x0040, 5, 3,       0x0041, 5, -3,
    0x0042, 3, 4,       0x0043, 3, -4,
    0x0044, 3, 5,       0x0045, 3, -5,
    0x0046, 2, 6,       0x0047, 2, -6,
    0x0048, 1, 9,       0x0049, 1, -9,
    0x004a, 1,10,       0x004b, 1, -10,
    0x004c, 1, 11,      0x004d, 1, -11,
    0x004e, 0, 0,       0x004f, 1, 0,
    16,  /* Number of 8(12)-bit codes*/
    0x00a0, 6, 3,       0x00a1, 6, -3,
    0x00a2, 4, 4,       0x00a3, 4, -4,
    0x00a4, 3, 6,       0x00a5, 3, -6,
    0x00a6, 1,12,       0x00a7, 1,-12,
    0x00a8, 1,13,       0x00a9, 1,-13,
    0x00aa, 1,14,       0x00ab, 1,-14,
    0x00ac, 2, 0,       0x00ad, 3, 0,
    0x00ae, 4, 0,       0x00af, 5, 0,

    16*2 + 56 + 6 + 2,  /* Number of 9(13)-bit codes*/
    0x0160, 7, 2,       0x0161, 7, -2,
    0x0162, 8, 2,       0x0163, 8, -2,
    0x0164, 9, 2,       0x0165, 9, -2,
    0x0166, 10, 2,      0x0167, 10, -2,
    0x0168, 7, 3,       0x0169, 7, -3,
    0x016a, 8, 3,       0x016b, 8, -3,
    0x016c, 4, 5,       0x016d, 4, -5,
    0x016e, 3, 7,       0x016f, 3, -7,

    0x0170, 2, 7,       0x0171, 2, -7,
    0x0172, 2, 8,       0x0173, 2, -8,
    0x0174, 2, 9,       0x0175, 2, -9,
    0x0176, 2, 10,      0x0177, 2, -10,
    0x0178, 2, 11,      0x0179, 2, -11,
    0x017a, 1, 15,      0x017b, 1, -15,
    0x017c, 1, 16,      0x017d, 1, -16,
    0x017e, 1, 17,      0x017f, 1, -17,

    /* Combinations (0,0) through (6,0) have special codes*/
    0x0180 + 0, 0, 0,    0x0180 + 1, 0, 0,
    0x0180 + 2, 0, 0,    0x0180 + 3, 0, 0,
    0x0180 + 4, 0, 0,    0x0180 + 5, 0, 0, /* 1*/

   0x0180 + 6,  6,  0,   0x0180 + 7,  7, 0,  0x0180 +  8,  8, 0,  0x0180 +  9,  9, 0,/*  1*/
   0x0180 + 10, 10, 0,   0x0180 + 11, 11, 0, 0x0180 + 12, 12, 0,  0x0180 + 13, 13, 0,/*  2*/
   0x0180 + 14, 14, 0,   0x0180 + 15, 15, 0, 0x0180 + 16, 16, 0,  0x0180 + 17, 17, 0,/*  3*/
   0x0180 + 18, 18, 0,   0x0180 + 19, 19, 0, 0x0180 + 20, 20, 0,  0x0180 + 21, 21, 0,/*  4*/
   0x0180 + 22, 22, 0,   0x0180 + 23, 23, 0, 0x0180 + 24, 24, 0,  0x0180 + 25, 25, 0,/*  5*/
   0x0180 + 26, 26, 0,   0x0180 + 27, 27, 0, 0x0180 + 28, 28, 0,  0x0180 + 29, 29, 0,/*  6*/
   0x0180 + 30, 30, 0,   0x0180 + 31, 31, 0, 0x0180 + 32, 32, 0,  0x0180 + 33, 33, 0,/*  7*/
   0x0180 + 34, 34, 0,   0x0180 + 35, 35, 0, 0x0180 + 36, 36, 0,  0x0180 + 37, 37, 0,/*  8*/
   0x0180 + 38, 38, 0,   0x0180 + 39, 39, 0, 0x0180 + 40, 40, 0,  0x0180 + 41, 41, 0,/*  9*/
   0x0180 + 42, 42, 0,   0x0180 + 43, 43, 0, 0x0180 + 44, 44, 0,  0x0180 + 45, 45, 0,/* 10*/
   0x0180 + 46, 46, 0,   0x0180 + 47, 47, 0, 0x0180 + 48, 48, 0,  0x0180 + 49, 49, 0,/* 11*/
   0x0180 + 50, 50, 0,   0x0180 + 51, 51, 0, 0x0180 + 52, 52, 0,  0x0180 + 53, 53, 0,/* 12*/
   0x0180 + 54, 54, 0,   0x0180 + 55, 55, 0, 0x0180 + 56, 56, 0,  0x0180 + 57, 57, 0,/* 13*/
   0x0180 + 58, 58, 0,   0x0180 + 59, 59, 0, 0x0180 + 60, 60, 0,  0x0180 + 61, 61, 0,/* 14 (14*4=56)*/
   0x0180 + 62, 0, 0,    0x0180 + 63, 0, 0, /* combinations (62,0) and (63,0) are not anticipated*
  -1 /* end of table*/
};

{
    if (ippStsOk != ippiInitAllocHuffmanTable_DV_32u(SrcTable1,
                                                     SrcTable2,
                                                     &pHuffTable))
    {
        /* Process errors*/
    }
}

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 at least one input pointer is NULL.

ippStsMemAllocErr

Indicates an error when no memory is allocated.


Submit feedback on this help topic

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