- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

# hcb.h

    00001 /*
    00002 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
    00003 ** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
    00004 **
    00005 ** This program is free software; you can redistribute it and/or modify
    00006 ** it under the terms of the GNU General Public License as published by
    00007 ** the Free Software Foundation; either version 2 of the License, or
    00008 ** (at your option) any later version.
    00009 **
    00010 ** This program is distributed in the hope that it will be useful,
    00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013 ** GNU General Public License for more details.
    00014 **
    00015 ** You should have received a copy of the GNU General Public License
    00016 ** along with this program; if not, write to the Free Software
    00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00018 **
    00019 ** Any non-GPL usage of this software or parts of this software is strictly
    00020 ** forbidden.
    00021 **
    00022 ** Commercial non-GPL licensing of this software is possible.
    00023 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
    00024 **
    00025 ** $Id: hcb.h,v 1.2 2005/11/01 21:41:43 gabest Exp $
    00026 **/
    00027
    00028 #ifndef __HCB_H__
    00029 #define __HCB_H__
    00030
    00031 #ifdef __cplusplus
    00032 extern "C" {
    00033 #endif
    00034
    00035 /*
    00036  *  Optimal huffman decoding for AAC taken from:
    00037  *  "SELECTING AN OPTIMAL HUFFMAN DECODER FOR AAC" by
    00038  *  VLADIMIR Z. MESAROVIC , RAGHUNATH RAO, MIROSLAV V. DOKIC, and SACHIN DEO
    00039  *  AES paper 5436
    00040  *
    00041  *   2 methods are used for huffman decoding:
    00042  *   - binary search
    00043  *   - 2-step table lookup
    00044  *
    00045  *   The choice of the "optimal" method is based on the fact that if the
    00046  *   memory size for the Two-step is exorbitantly high then the decision
    00047  *   is Binary search for that codebook. However, for marginally more memory
    00048  *   size, if Twostep outperforms even the best case of Binary then the
    00049  *   decision is Two-step for that codebook.
    00050  *
    00051  *   The following methods are used for the different tables.
    00052  *   codebook   "optimal" method
    00053  *    HCB_1      2-Step
    00054  *    HCB_2      2-Step
    00055  *    HCB_3      Binary
    00056  *    HCB_4      2-Step
    00057  *    HCB_5      Binary
    00058  *    HCB_6      2-Step
    00059  *    HCB_7      Binary
    00060  *    HCB_8      2-Step
    00061  *    HCB_9      Binary
    00062  *    HCB_10     2-Step
    00063  *    HCB_11     2-Step
    00064  *    HCB_SF     Binary
    00065  *
    00066  */
    00067
    00068
    00069 #define ZERO_HCB       0
    00070 #define FIRST_PAIR_HCB 5
    00071 #define ESC_HCB        11
    00072 #define QUAD_LEN       4
    00073 #define PAIR_LEN       2
    00074 #define NOISE_HCB      13
    00075 #define INTENSITY_HCB2 14
    00076 #define INTENSITY_HCB  15
    00077
    00078 /* 1st step table */
    00079 typedef struct
    00080 {
    00081     uint8_t offset;
    00082     uint8_t extra_bits;
    00083 } hcb;
    00084
    00085 /* 2nd step table with quadruple data */
    00086 typedef struct
    00087 {
    00088     uint8_t bits;
    00089     int8_t x;
    00090     int8_t y;
    00091 } hcb_2_pair;
    00092
    00093 typedef struct
    00094 {
    00095     uint8_t bits;
    00096     int8_t x;
    00097     int8_t y;
    00098     int8_t v;
    00099     int8_t w;
    00100 } hcb_2_quad;
    00101
    00102 /* binary search table */
    00103 typedef struct
    00104 {
    00105     uint8_t is_leaf;
    00106     int8_t data[4];
    00107 } hcb_bin_quad;
    00108
    00109 typedef struct
    00110 {
    00111     uint8_t is_leaf;
    00112     int8_t data[2];
    00113 } hcb_bin_pair;
    00114
    00115 hcb *hcb_table[];
    00116 hcb_2_quad *hcb_2_quad_table[];
    00117 hcb_2_pair *hcb_2_pair_table[];
    00118 hcb_bin_pair *hcb_bin_table[];
    00119 uint8_t hcbN[];
    00120 uint8_t unsigned_cb[];
    00121 int hcb_2_quad_table_size[];
    00122 int hcb_2_pair_table_size[];
    00123 int hcb_bin_table_size[];
    00124
    00125 #include "codebook/hcb_1.h"
    00126 #include "codebook/hcb_2.h"
    00127 #include "codebook/hcb_3.h"
    00128 #include "codebook/hcb_4.h"
    00129 #include "codebook/hcb_5.h"
    00130 #include "codebook/hcb_6.h"
    00131 #include "codebook/hcb_7.h"
    00132 #include "codebook/hcb_8.h"
    00133 #include "codebook/hcb_9.h"
    00134 #include "codebook/hcb_10.h"
    00135 #include "codebook/hcb_11.h"
    00136 #include "codebook/hcb_sf.h"
    00137
    00138
    00139 #ifdef __cplusplus
    00140 }
    00141 #endif
    00142 #endif