Ejemplo n.º 1
0
static void  DestroyHuffTree(HUFF_ENTRY *root_ptr){
  if (root_ptr){
    if ( root_ptr->ZeroChild )
      DestroyHuffTree(root_ptr->ZeroChild);

    if ( root_ptr->OneChild )
      DestroyHuffTree(root_ptr->OneChild);

    _ogg_free(root_ptr);
  }
}
Ejemplo n.º 2
0
void  ClearHuffmanTrees(HUFF_ENTRY *HuffRoot[NUM_HUFF_TABLES]){
  int i;
  for(i=0; i<NUM_HUFF_TABLES; i++) {
    DestroyHuffTree(HuffRoot[i]);
    HuffRoot[i] = NULL;
  }
}
Ejemplo n.º 3
0
/****************************************************************************
 * 
 *  ROUTINE       :     DestroyHuffTree
 *
 *  INPUTS        :     HUFF_ENTRY * * root_ptr
 *
 *  OUTPUTS       :     None.
 *
 *  RETURNS       :     
 *
 *  FUNCTION      :     This funtion destroys a Huffman tree or sub-tree.
 *
 *  SPECIAL NOTES :     None. 
 *
 *
 *  ERRORS        :     None.
 *
 ****************************************************************************/
void  DestroyHuffTree( HUFF_ENTRY * * root_ptr)
{                                          
    if ( *root_ptr != NULL )
    {
        // Destroy the zero child sub tree. 
        if ( (*root_ptr)->ZeroChild != NULL )
        { 
            DestroyHuffTree((HUFF_ENTRY * *)&((*root_ptr)->ZeroChild));
        }
        
        // Destroy the one child sub tree. 
        if ( (*root_ptr)->OneChild != NULL )
        {
            DestroyHuffTree((HUFF_ENTRY * *)(&(*root_ptr)->OneChild));
        }    
        
        // Once all sub trees to this node are destroyed then free the memory for this node. 
        SystemGlobalFree( (char *) *root_ptr );
        *root_ptr = NULL;
    }
}
Ejemplo n.º 4
0
void DestroyHuffmanTrees()
{    
	UINT32 i;

	// Destroy huffman coding trees
	for ( i = 0; i < NUM_HUFF_TABLES; i++ ) 
	{
		// Tables for encoder versions < 2
		if ( HuffRoot_VP31[i] != NULL )
		{
			DestroyHuffTree( &HuffRoot_VP31[i] );
		}
		HuffRoot_VP31[i] = NULL;

		// Tables for encoder versions >= 2
		if ( HuffRoot_VP33[i] != NULL )
		{
			DestroyHuffTree( &HuffRoot_VP33[i] );
		}
		HuffRoot_VP33[i] = NULL;
	}
}