C++程序  |  2146行  |  109.04 KB

/******************************************************************************
 *                                                                            *
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *****************************************************************************
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
#include <math.h>
#include <string.h>
#include <ixheaacd_type_def.h>
#include "ixheaacd_constants.h"
#include <ixheaacd_basic_ops32.h>
#include <ixheaacd_basic_ops16.h>
#include <ixheaacd_basic_ops40.h>
#include "ixheaacd_bitbuffer.h"
#include "ixheaacd_interface.h"

#include "ixheaacd_tns_usac.h"
#include "ixheaacd_cnst.h"

#include "ixheaacd_acelp_info.h"

#include "ixheaacd_sbrdecsettings.h"
#include "ixheaacd_info.h"
#include "ixheaacd_sbr_common.h"
#include "ixheaacd_drc_data_struct.h"
#include "ixheaacd_drc_dec.h"
#include "ixheaacd_sbrdecoder.h"
#include "ixheaacd_mps_polyphase.h"
#include "ixheaacd_sbr_const.h"
#include "ixheaacd_main.h"
#include "ixheaacd_arith_dec.h"

#include "ixheaacd_bit_extract.h"

#include "ixheaacd_error_codes.h"

#define ARITH_ESCAPE 16

UWORD16 ixheaacd_ari_cf_r[3][4] = {
    {12571, 10569, 3696, 0}, {12661, 5700, 3751, 0}, {10827, 6884, 2929, 0}};

static UWORD16 ixheaacd_ari_lookup_m[742] = {
    0x01, 0x34, 0x0D, 0x13, 0x12, 0x25, 0x00, 0x3A, 0x05, 0x00, 0x21, 0x13,
    0x1F, 0x1A, 0x1D, 0x36, 0x24, 0x2B, 0x1B, 0x33, 0x37, 0x29, 0x1D, 0x33,
    0x37, 0x33, 0x37, 0x33, 0x37, 0x33, 0x2C, 0x00, 0x21, 0x13, 0x25, 0x2A,
    0x00, 0x21, 0x24, 0x12, 0x2C, 0x1E, 0x37, 0x24, 0x1F, 0x35, 0x37, 0x24,
    0x35, 0x37, 0x35, 0x37, 0x38, 0x2D, 0x21, 0x29, 0x1E, 0x21, 0x13, 0x2D,
    0x36, 0x38, 0x29, 0x36, 0x37, 0x24, 0x36, 0x38, 0x37, 0x38, 0x00, 0x20,
    0x23, 0x20, 0x23, 0x36, 0x38, 0x24, 0x3B, 0x24, 0x26, 0x29, 0x1F, 0x30,
    0x2D, 0x0D, 0x12, 0x3F, 0x2D, 0x21, 0x1C, 0x2A, 0x00, 0x21, 0x12, 0x1E,
    0x36, 0x38, 0x36, 0x37, 0x3F, 0x1E, 0x0D, 0x1F, 0x2A, 0x1E, 0x21, 0x24,
    0x12, 0x2A, 0x3C, 0x21, 0x24, 0x1F, 0x3C, 0x21, 0x29, 0x36, 0x38, 0x36,
    0x37, 0x38, 0x21, 0x1E, 0x00, 0x3B, 0x25, 0x1E, 0x20, 0x10, 0x1F, 0x3C,
    0x20, 0x23, 0x29, 0x08, 0x23, 0x12, 0x08, 0x23, 0x21, 0x38, 0x00, 0x20,
    0x13, 0x20, 0x3B, 0x1C, 0x20, 0x3B, 0x29, 0x20, 0x23, 0x24, 0x21, 0x24,
    0x21, 0x24, 0x3B, 0x13, 0x23, 0x26, 0x23, 0x13, 0x21, 0x24, 0x26, 0x29,
    0x12, 0x22, 0x2B, 0x02, 0x1E, 0x0D, 0x1F, 0x2D, 0x00, 0x0D, 0x12, 0x00,
    0x3C, 0x21, 0x29, 0x3C, 0x21, 0x2A, 0x3C, 0x3B, 0x22, 0x1E, 0x20, 0x10,
    0x1F, 0x3C, 0x0D, 0x29, 0x3C, 0x21, 0x24, 0x08, 0x23, 0x20, 0x38, 0x39,
    0x3C, 0x20, 0x13, 0x3C, 0x00, 0x0D, 0x13, 0x1F, 0x3C, 0x09, 0x26, 0x1F,
    0x08, 0x09, 0x26, 0x12, 0x08, 0x23, 0x29, 0x20, 0x23, 0x21, 0x24, 0x20,
    0x13, 0x20, 0x3B, 0x16, 0x20, 0x3B, 0x29, 0x20, 0x3B, 0x29, 0x20, 0x3B,
    0x13, 0x21, 0x24, 0x29, 0x0B, 0x13, 0x09, 0x3B, 0x13, 0x09, 0x3B, 0x13,
    0x21, 0x3B, 0x13, 0x0D, 0x26, 0x29, 0x26, 0x29, 0x3D, 0x12, 0x22, 0x28,
    0x2E, 0x04, 0x08, 0x13, 0x3C, 0x3B, 0x3C, 0x20, 0x10, 0x3C, 0x21, 0x07,
    0x08, 0x10, 0x00, 0x08, 0x0D, 0x29, 0x08, 0x0D, 0x29, 0x08, 0x09, 0x13,
    0x20, 0x23, 0x39, 0x08, 0x09, 0x13, 0x08, 0x09, 0x16, 0x08, 0x09, 0x10,
    0x12, 0x20, 0x3B, 0x3D, 0x09, 0x26, 0x20, 0x3B, 0x24, 0x39, 0x09, 0x26,
    0x20, 0x0D, 0x13, 0x00, 0x09, 0x13, 0x20, 0x0D, 0x26, 0x12, 0x20, 0x3B,
    0x13, 0x21, 0x26, 0x0B, 0x12, 0x09, 0x3B, 0x16, 0x09, 0x3B, 0x3D, 0x09,
    0x26, 0x0D, 0x13, 0x26, 0x3D, 0x1C, 0x12, 0x1F, 0x28, 0x2E, 0x07, 0x0B,
    0x08, 0x09, 0x00, 0x39, 0x0B, 0x08, 0x26, 0x08, 0x09, 0x13, 0x20, 0x0B,
    0x39, 0x10, 0x39, 0x0D, 0x13, 0x20, 0x10, 0x12, 0x09, 0x13, 0x20, 0x3B,
    0x13, 0x09, 0x26, 0x0B, 0x09, 0x3B, 0x1C, 0x09, 0x3B, 0x13, 0x20, 0x3B,
    0x13, 0x09, 0x26, 0x0B, 0x16, 0x0D, 0x13, 0x09, 0x13, 0x09, 0x13, 0x26,
    0x3D, 0x1C, 0x1F, 0x28, 0x2E, 0x07, 0x10, 0x39, 0x0B, 0x39, 0x39, 0x13,
    0x39, 0x0B, 0x39, 0x0B, 0x39, 0x26, 0x39, 0x10, 0x20, 0x3B, 0x16, 0x20,
    0x10, 0x09, 0x26, 0x0B, 0x13, 0x09, 0x13, 0x26, 0x1C, 0x0B, 0x3D, 0x1C,
    0x1F, 0x28, 0x2B, 0x07, 0x0C, 0x39, 0x0B, 0x39, 0x0B, 0x0C, 0x0B, 0x26,
    0x0B, 0x26, 0x3D, 0x0D, 0x1C, 0x14, 0x28, 0x2B, 0x39, 0x0B, 0x0C, 0x0E,
    0x3D, 0x1C, 0x0D, 0x12, 0x22, 0x2B, 0x07, 0x0C, 0x0E, 0x3D, 0x1C, 0x10,
    0x1F, 0x2B, 0x0C, 0x0E, 0x19, 0x14, 0x10, 0x1F, 0x28, 0x0C, 0x0E, 0x19,
    0x14, 0x26, 0x22, 0x2B, 0x0C, 0x0E, 0x19, 0x14, 0x26, 0x28, 0x0E, 0x19,
    0x14, 0x26, 0x28, 0x0E, 0x19, 0x14, 0x28, 0x0E, 0x19, 0x14, 0x22, 0x28,
    0x2B, 0x0E, 0x14, 0x2B, 0x31, 0x00, 0x3A, 0x3A, 0x05, 0x05, 0x1B, 0x1D,
    0x33, 0x06, 0x35, 0x35, 0x20, 0x21, 0x37, 0x21, 0x24, 0x05, 0x1B, 0x2C,
    0x2C, 0x2C, 0x06, 0x34, 0x1E, 0x34, 0x00, 0x08, 0x36, 0x09, 0x21, 0x26,
    0x1C, 0x2C, 0x00, 0x02, 0x02, 0x02, 0x3F, 0x04, 0x04, 0x04, 0x34, 0x39,
    0x20, 0x0A, 0x0C, 0x39, 0x0B, 0x0F, 0x07, 0x07, 0x07, 0x07, 0x34, 0x39,
    0x39, 0x0A, 0x0C, 0x39, 0x0C, 0x0F, 0x07, 0x07, 0x07, 0x00, 0x39, 0x39,
    0x0C, 0x0F, 0x07, 0x07, 0x39, 0x0C, 0x0F, 0x07, 0x39, 0x0C, 0x0F, 0x39,
    0x39, 0x0C, 0x0F, 0x39, 0x0C, 0x39, 0x0C, 0x0F, 0x00, 0x11, 0x27, 0x17,
    0x2F, 0x27, 0x00, 0x27, 0x17, 0x00, 0x11, 0x17, 0x00, 0x11, 0x17, 0x11,
    0x00, 0x27, 0x15, 0x11, 0x17, 0x01, 0x15, 0x11, 0x15, 0x11, 0x15, 0x15,
    0x17, 0x00, 0x27, 0x01, 0x27, 0x27, 0x15, 0x00, 0x27, 0x11, 0x27, 0x15,
    0x15, 0x15, 0x27, 0x15, 0x15, 0x15, 0x15, 0x17, 0x2F, 0x11, 0x17, 0x27,
    0x27, 0x27, 0x11, 0x27, 0x15, 0x27, 0x27, 0x15, 0x15, 0x27, 0x17, 0x2F,
    0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F,
    0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F,
    0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F,
    0x17, 0x2F, 0x2B, 0x00, 0x27, 0x00, 0x00, 0x11, 0x15, 0x00, 0x11, 0x11,
    0x27, 0x27, 0x15, 0x17, 0x15, 0x17, 0x15, 0x17, 0x27, 0x17, 0x27, 0x17,
    0x27, 0x17, 0x27, 0x17, 0x27, 0x17, 0x27, 0x17, 0x27, 0x17, 0x27, 0x17,
    0x27, 0x17, 0x27, 0x17, 0x27, 0x15, 0x27, 0x27, 0x15, 0x27};

static UWORD32 ixheaacd_ari_hash_m[742] = {
    0x00000104UL >> 8, 0x0000030AUL >> 8, 0x00000510UL >> 8, 0x00000716UL >> 8,
    0x00000A1FUL >> 8, 0x00000F2EUL >> 8, 0x00011100UL >> 8, 0x00111103UL >> 8,
    0x00111306UL >> 8, 0x00111436UL >> 8, 0x00111623UL >> 8, 0x00111929UL >> 8,
    0x00111F2EUL >> 8, 0x0011221BUL >> 8, 0x00112435UL >> 8, 0x00112621UL >> 8,
    0x00112D12UL >> 8, 0x00113130UL >> 8, 0x0011331DUL >> 8, 0x00113535UL >> 8,
    0x00113938UL >> 8, 0x0011411BUL >> 8, 0x00114433UL >> 8, 0x00114635UL >> 8,
    0x00114F29UL >> 8, 0x00116635UL >> 8, 0x00116F24UL >> 8, 0x00117433UL >> 8,
    0x0011FF0FUL >> 8, 0x00121102UL >> 8, 0x0012132DUL >> 8, 0x00121436UL >> 8,
    0x00121623UL >> 8, 0x00121912UL >> 8, 0x0012213FUL >> 8, 0x0012232DUL >> 8,
    0x00122436UL >> 8, 0x00122638UL >> 8, 0x00122A29UL >> 8, 0x00122F2BUL >> 8,
    0x0012322DUL >> 8, 0x00123436UL >> 8, 0x00123738UL >> 8, 0x00123B29UL >> 8,
    0x0012411DUL >> 8, 0x00124536UL >> 8, 0x00124938UL >> 8, 0x00124F12UL >> 8,
    0x00125535UL >> 8, 0x00125F29UL >> 8, 0x00126535UL >> 8, 0x0012B837UL >> 8,
    0x0013112AUL >> 8, 0x0013131EUL >> 8, 0x0013163BUL >> 8, 0x0013212DUL >> 8,
    0x0013233CUL >> 8, 0x00132623UL >> 8, 0x00132F2EUL >> 8, 0x0013321EUL >> 8,
    0x00133521UL >> 8, 0x00133824UL >> 8, 0x0013411EUL >> 8, 0x00134336UL >> 8,
    0x00134838UL >> 8, 0x00135135UL >> 8, 0x00135537UL >> 8, 0x00135F12UL >> 8,
    0x00137637UL >> 8, 0x0013FF29UL >> 8, 0x00140024UL >> 8, 0x00142321UL >> 8,
    0x00143136UL >> 8, 0x00143321UL >> 8, 0x00143F25UL >> 8, 0x00144321UL >> 8,
    0x00148638UL >> 8, 0x0014FF29UL >> 8, 0x00154323UL >> 8, 0x0015FF12UL >> 8,
    0x0016F20CUL >> 8, 0x0018A529UL >> 8, 0x00210031UL >> 8, 0x0021122CUL >> 8,
    0x00211408UL >> 8, 0x00211713UL >> 8, 0x00211F2EUL >> 8, 0x0021222AUL >> 8,
    0x00212408UL >> 8, 0x00212710UL >> 8, 0x00212F2EUL >> 8, 0x0021331EUL >> 8,
    0x00213436UL >> 8, 0x00213824UL >> 8, 0x0021412DUL >> 8, 0x0021431EUL >> 8,
    0x00214536UL >> 8, 0x00214F1FUL >> 8, 0x00216637UL >> 8, 0x00220004UL >> 8,
    0x0022122AUL >> 8, 0x00221420UL >> 8, 0x00221829UL >> 8, 0x00221F2EUL >> 8,
    0x0022222DUL >> 8, 0x00222408UL >> 8, 0x00222623UL >> 8, 0x00222929UL >> 8,
    0x00222F2BUL >> 8, 0x0022321EUL >> 8, 0x00223408UL >> 8, 0x00223724UL >> 8,
    0x00223A29UL >> 8, 0x0022411EUL >> 8, 0x00224436UL >> 8, 0x00224823UL >> 8,
    0x00225134UL >> 8, 0x00225621UL >> 8, 0x00225F12UL >> 8, 0x00226336UL >> 8,
    0x00227637UL >> 8, 0x0022FF29UL >> 8, 0x0023112DUL >> 8, 0x0023133CUL >> 8,
    0x00231420UL >> 8, 0x00231916UL >> 8, 0x0023212DUL >> 8, 0x0023233CUL >> 8,
    0x00232509UL >> 8, 0x00232929UL >> 8, 0x0023312DUL >> 8, 0x00233308UL >> 8,
    0x00233509UL >> 8, 0x00233724UL >> 8, 0x0023413CUL >> 8, 0x00234421UL >> 8,
    0x00234A13UL >> 8, 0x0023513CUL >> 8, 0x00235421UL >> 8, 0x00235F1FUL >> 8,
    0x00236421UL >> 8, 0x0023FF29UL >> 8, 0x00240024UL >> 8, 0x0024153BUL >> 8,
    0x00242108UL >> 8, 0x00242409UL >> 8, 0x00242726UL >> 8, 0x00243108UL >> 8,
    0x00243409UL >> 8, 0x00243610UL >> 8, 0x00244136UL >> 8, 0x00244321UL >> 8,
    0x00244523UL >> 8, 0x00244F1FUL >> 8, 0x00245423UL >> 8, 0x0024610AUL >> 8,
    0x00246423UL >> 8, 0x0024FF29UL >> 8, 0x00252510UL >> 8, 0x00253121UL >> 8,
    0x0025343BUL >> 8, 0x00254121UL >> 8, 0x00254510UL >> 8, 0x00254F25UL >> 8,
    0x00255221UL >> 8, 0x0025FF12UL >> 8, 0x00266513UL >> 8, 0x0027F529UL >> 8,
    0x0029F101UL >> 8, 0x002CF224UL >> 8, 0x00310030UL >> 8, 0x0031122AUL >> 8,
    0x00311420UL >> 8, 0x00311816UL >> 8, 0x0031212CUL >> 8, 0x0031231EUL >> 8,
    0x00312408UL >> 8, 0x00312710UL >> 8, 0x0031312AUL >> 8, 0x0031321EUL >> 8,
    0x00313408UL >> 8, 0x00313623UL >> 8, 0x0031411EUL >> 8, 0x0031433CUL >> 8,
    0x00320007UL >> 8, 0x0032122DUL >> 8, 0x00321420UL >> 8, 0x00321816UL >> 8,
    0x0032212DUL >> 8, 0x0032233CUL >> 8, 0x00322509UL >> 8, 0x00322916UL >> 8,
    0x0032312DUL >> 8, 0x00323420UL >> 8, 0x00323710UL >> 8, 0x00323F2BUL >> 8,
    0x00324308UL >> 8, 0x00324623UL >> 8, 0x00324F25UL >> 8, 0x00325421UL >> 8,
    0x00325F1FUL >> 8, 0x00326421UL >> 8, 0x0032FF29UL >> 8, 0x00331107UL >> 8,
    0x00331308UL >> 8, 0x0033150DUL >> 8, 0x0033211EUL >> 8, 0x00332308UL >> 8,
    0x00332420UL >> 8, 0x00332610UL >> 8, 0x00332929UL >> 8, 0x0033311EUL >> 8,
    0x00333308UL >> 8, 0x0033363BUL >> 8, 0x00333A29UL >> 8, 0x0033413CUL >> 8,
    0x00334320UL >> 8, 0x0033463BUL >> 8, 0x00334A29UL >> 8, 0x0033510AUL >> 8,
    0x00335320UL >> 8, 0x00335824UL >> 8, 0x0033610AUL >> 8, 0x00336321UL >> 8,
    0x00336F12UL >> 8, 0x00337623UL >> 8, 0x00341139UL >> 8, 0x0034153BUL >> 8,
    0x00342108UL >> 8, 0x00342409UL >> 8, 0x00342610UL >> 8, 0x00343108UL >> 8,
    0x00343409UL >> 8, 0x00343610UL >> 8, 0x00344108UL >> 8, 0x0034440DUL >> 8,
    0x00344610UL >> 8, 0x0034510AUL >> 8, 0x00345309UL >> 8, 0x0034553BUL >> 8,
    0x0034610AUL >> 8, 0x00346309UL >> 8, 0x0034F824UL >> 8, 0x00350029UL >> 8,
    0x00352510UL >> 8, 0x00353120UL >> 8, 0x0035330DUL >> 8, 0x00353510UL >> 8,
    0x00354120UL >> 8, 0x0035430DUL >> 8, 0x00354510UL >> 8, 0x00354F28UL >> 8,
    0x0035530DUL >> 8, 0x00355510UL >> 8, 0x00355F1FUL >> 8, 0x00356410UL >> 8,
    0x00359626UL >> 8, 0x0035FF12UL >> 8, 0x00366426UL >> 8, 0x0036FF12UL >> 8,
    0x0037F426UL >> 8, 0x0039D712UL >> 8, 0x003BF612UL >> 8, 0x003DF81FUL >> 8,
    0x00410004UL >> 8, 0x00411207UL >> 8, 0x0041150DUL >> 8, 0x0041212AUL >> 8,
    0x00412420UL >> 8, 0x0041311EUL >> 8, 0x00413308UL >> 8, 0x00413509UL >> 8,
    0x00413F2BUL >> 8, 0x00414208UL >> 8, 0x00420007UL >> 8, 0x0042123CUL >> 8,
    0x00421409UL >> 8, 0x00422107UL >> 8, 0x0042223CUL >> 8, 0x00422409UL >> 8,
    0x00422610UL >> 8, 0x0042313CUL >> 8, 0x00423409UL >> 8, 0x0042363BUL >> 8,
    0x0042413CUL >> 8, 0x00424320UL >> 8, 0x0042463BUL >> 8, 0x00425108UL >> 8,
    0x00425409UL >> 8, 0x0042FF29UL >> 8, 0x00431107UL >> 8, 0x00431320UL >> 8,
    0x0043153BUL >> 8, 0x0043213CUL >> 8, 0x00432320UL >> 8, 0x00432610UL >> 8,
    0x0043313CUL >> 8, 0x00433320UL >> 8, 0x0043353BUL >> 8, 0x00433813UL >> 8,
    0x00434108UL >> 8, 0x00434409UL >> 8, 0x00434610UL >> 8, 0x00435108UL >> 8,
    0x0043553BUL >> 8, 0x00435F25UL >> 8, 0x00436309UL >> 8, 0x0043753BUL >> 8,
    0x0043FF29UL >> 8, 0x00441239UL >> 8, 0x0044143BUL >> 8, 0x00442139UL >> 8,
    0x00442309UL >> 8, 0x0044253BUL >> 8, 0x00443108UL >> 8, 0x00443220UL >> 8,
    0x0044353BUL >> 8, 0x0044410AUL >> 8, 0x00444309UL >> 8, 0x0044453BUL >> 8,
    0x00444813UL >> 8, 0x0044510AUL >> 8, 0x00445309UL >> 8, 0x00445510UL >> 8,
    0x00445F25UL >> 8, 0x0044630DUL >> 8, 0x00450026UL >> 8, 0x00452713UL >> 8,
    0x00453120UL >> 8, 0x0045330DUL >> 8, 0x00453510UL >> 8, 0x00454120UL >> 8,
    0x0045430DUL >> 8, 0x00454510UL >> 8, 0x00455120UL >> 8, 0x0045530DUL >> 8,
    0x00456209UL >> 8, 0x00456410UL >> 8, 0x0045FF12UL >> 8, 0x00466513UL >> 8,
    0x0047FF22UL >> 8, 0x0048FF25UL >> 8, 0x0049F43DUL >> 8, 0x004BFB25UL >> 8,
    0x004EF825UL >> 8, 0x004FFF18UL >> 8, 0x00511339UL >> 8, 0x00512107UL >> 8,
    0x00513409UL >> 8, 0x00520007UL >> 8, 0x00521107UL >> 8, 0x00521320UL >> 8,
    0x00522107UL >> 8, 0x00522409UL >> 8, 0x0052313CUL >> 8, 0x00523320UL >> 8,
    0x0052353BUL >> 8, 0x00524108UL >> 8, 0x00524320UL >> 8, 0x00531139UL >> 8,
    0x00531309UL >> 8, 0x00532139UL >> 8, 0x00532309UL >> 8, 0x0053253BUL >> 8,
    0x00533108UL >> 8, 0x0053340DUL >> 8, 0x00533713UL >> 8, 0x00534108UL >> 8,
    0x0053453BUL >> 8, 0x00534F2BUL >> 8, 0x00535309UL >> 8, 0x00535610UL >> 8,
    0x00535F25UL >> 8, 0x0053643BUL >> 8, 0x00541139UL >> 8, 0x00542139UL >> 8,
    0x00542309UL >> 8, 0x00542613UL >> 8, 0x00543139UL >> 8, 0x00543309UL >> 8,
    0x00543510UL >> 8, 0x00543F2BUL >> 8, 0x00544309UL >> 8, 0x00544510UL >> 8,
    0x00544F28UL >> 8, 0x0054530DUL >> 8, 0x0054FF12UL >> 8, 0x00553613UL >> 8,
    0x00553F2BUL >> 8, 0x00554410UL >> 8, 0x0055510AUL >> 8, 0x0055543BUL >> 8,
    0x00555F25UL >> 8, 0x0055633BUL >> 8, 0x0055FF12UL >> 8, 0x00566513UL >> 8,
    0x00577413UL >> 8, 0x0059FF28UL >> 8, 0x005CC33DUL >> 8, 0x005EFB28UL >> 8,
    0x005FFF18UL >> 8, 0x00611339UL >> 8, 0x00612107UL >> 8, 0x00613320UL >> 8,
    0x0061A724UL >> 8, 0x00621107UL >> 8, 0x0062140BUL >> 8, 0x00622107UL >> 8,
    0x00622320UL >> 8, 0x00623139UL >> 8, 0x00623320UL >> 8, 0x00631139UL >> 8,
    0x0063130CUL >> 8, 0x00632139UL >> 8, 0x00632309UL >> 8, 0x00633139UL >> 8,
    0x00633309UL >> 8, 0x00633626UL >> 8, 0x00633F2BUL >> 8, 0x00634309UL >> 8,
    0x00634F2BUL >> 8, 0x0063543BUL >> 8, 0x0063FF12UL >> 8, 0x0064343BUL >> 8,
    0x00643F2BUL >> 8, 0x0064443BUL >> 8, 0x00645209UL >> 8, 0x00665513UL >> 8,
    0x0066610AUL >> 8, 0x00666526UL >> 8, 0x0067A616UL >> 8, 0x0069843DUL >> 8,
    0x006CF612UL >> 8, 0x006EF326UL >> 8, 0x006FFF18UL >> 8, 0x0071130CUL >> 8,
    0x00721107UL >> 8, 0x00722239UL >> 8, 0x0072291CUL >> 8, 0x0072340BUL >> 8,
    0x00731139UL >> 8, 0x00732239UL >> 8, 0x0073630BUL >> 8, 0x0073FF12UL >> 8,
    0x0074430BUL >> 8, 0x00755426UL >> 8, 0x00776F28UL >> 8, 0x00777410UL >> 8,
    0x0078843DUL >> 8, 0x007CF416UL >> 8, 0x007EF326UL >> 8, 0x007FFF18UL >> 8,
    0x00822239UL >> 8, 0x00831139UL >> 8, 0x0083430BUL >> 8, 0x0084530BUL >> 8,
    0x0087561CUL >> 8, 0x00887F25UL >> 8, 0x00888426UL >> 8, 0x008AF61CUL >> 8,
    0x008F0018UL >> 8, 0x008FFF18UL >> 8, 0x00911107UL >> 8, 0x0093230BUL >> 8,
    0x0094530BUL >> 8, 0x0097743DUL >> 8, 0x00998C25UL >> 8, 0x00999616UL >> 8,
    0x009EF825UL >> 8, 0x009FFF18UL >> 8, 0x00A3430BUL >> 8, 0x00A4530BUL >> 8,
    0x00A7743DUL >> 8, 0x00AA9F2BUL >> 8, 0x00AAA616UL >> 8, 0x00ABD61FUL >> 8,
    0x00AFFF18UL >> 8, 0x00B3330BUL >> 8, 0x00B44426UL >> 8, 0x00B7643DUL >> 8,
    0x00BB971FUL >> 8, 0x00BBB53DUL >> 8, 0x00BEF512UL >> 8, 0x00BFFF18UL >> 8,
    0x00C22139UL >> 8, 0x00C5330EUL >> 8, 0x00C7633DUL >> 8, 0x00CCAF2EUL >> 8,
    0x00CCC616UL >> 8, 0x00CFFF18UL >> 8, 0x00D4440EUL >> 8, 0x00D6420EUL >> 8,
    0x00DDCF2EUL >> 8, 0x00DDD516UL >> 8, 0x00DFFF18UL >> 8, 0x00E4330EUL >> 8,
    0x00E6841CUL >> 8, 0x00EEE61CUL >> 8, 0x00EFFF18UL >> 8, 0x00F3320EUL >> 8,
    0x00F55319UL >> 8, 0x00F8F41CUL >> 8, 0x00FAFF2EUL >> 8, 0x00FF002EUL >> 8,
    0x00FFF10CUL >> 8, 0x00FFF33DUL >> 8, 0x00FFF722UL >> 8, 0x00FFFF18UL >> 8,
    0x01000232UL >> 8, 0x0111113EUL >> 8, 0x01112103UL >> 8, 0x0111311AUL >> 8,
    0x0112111AUL >> 8, 0x01122130UL >> 8, 0x01123130UL >> 8, 0x0112411DUL >> 8,
    0x01131102UL >> 8, 0x01132102UL >> 8, 0x01133102UL >> 8, 0x01141108UL >> 8,
    0x01142136UL >> 8, 0x01143136UL >> 8, 0x01144135UL >> 8, 0x0115223BUL >> 8,
    0x01211103UL >> 8, 0x0121211AUL >> 8, 0x01213130UL >> 8, 0x01221130UL >> 8,
    0x01222130UL >> 8, 0x01223102UL >> 8, 0x01231104UL >> 8, 0x01232104UL >> 8,
    0x01233104UL >> 8, 0x01241139UL >> 8, 0x01241220UL >> 8, 0x01242220UL >> 8,
    0x01251109UL >> 8, 0x0125223BUL >> 8, 0x0125810AUL >> 8, 0x01283212UL >> 8,
    0x0131111AUL >> 8, 0x01312130UL >> 8, 0x0131222CUL >> 8, 0x0131322AUL >> 8,
    0x0132122AUL >> 8, 0x0132222DUL >> 8, 0x0132322DUL >> 8, 0x01331207UL >> 8,
    0x01332234UL >> 8, 0x01333234UL >> 8, 0x01341139UL >> 8, 0x01343134UL >> 8,
    0x01344134UL >> 8, 0x01348134UL >> 8, 0x0135220BUL >> 8, 0x0136110BUL >> 8,
    0x01365224UL >> 8, 0x01411102UL >> 8, 0x01412104UL >> 8, 0x01431239UL >> 8,
    0x01432239UL >> 8, 0x0143320AUL >> 8, 0x01435134UL >> 8, 0x01443107UL >> 8,
    0x01444134UL >> 8, 0x01446134UL >> 8, 0x0145220EUL >> 8, 0x01455134UL >> 8,
    0x0147110EUL >> 8, 0x01511102UL >> 8, 0x01521239UL >> 8, 0x01531239UL >> 8,
    0x01532239UL >> 8, 0x01533107UL >> 8, 0x0155220EUL >> 8, 0x01555134UL >> 8,
    0x0157110EUL >> 8, 0x01611107UL >> 8, 0x01621239UL >> 8, 0x01631239UL >> 8,
    0x01661139UL >> 8, 0x01666134UL >> 8, 0x01711107UL >> 8, 0x01721239UL >> 8,
    0x01745107UL >> 8, 0x0177110CUL >> 8, 0x01811107UL >> 8, 0x01821107UL >> 8,
    0x0185110CUL >> 8, 0x0188210CUL >> 8, 0x01911107UL >> 8, 0x01933139UL >> 8,
    0x01A11107UL >> 8, 0x01A31139UL >> 8, 0x01F5220EUL >> 8, 0x02000001UL >> 8,
    0x02000127UL >> 8, 0x02000427UL >> 8, 0x02000727UL >> 8, 0x02000E2FUL >> 8,
    0x02110000UL >> 8, 0x02111200UL >> 8, 0x02111411UL >> 8, 0x02111827UL >> 8,
    0x02111F2FUL >> 8, 0x02112411UL >> 8, 0x02112715UL >> 8, 0x02113200UL >> 8,
    0x02113411UL >> 8, 0x02113715UL >> 8, 0x02114200UL >> 8, 0x02121200UL >> 8,
    0x02121301UL >> 8, 0x02121F2FUL >> 8, 0x02122200UL >> 8, 0x02122615UL >> 8,
    0x02122F2FUL >> 8, 0x02123311UL >> 8, 0x02123F2FUL >> 8, 0x02124411UL >> 8,
    0x02131211UL >> 8, 0x02132311UL >> 8, 0x02133211UL >> 8, 0x02184415UL >> 8,
    0x02211200UL >> 8, 0x02211311UL >> 8, 0x02211F2FUL >> 8, 0x02212311UL >> 8,
    0x02212F2FUL >> 8, 0x02213211UL >> 8, 0x02221201UL >> 8, 0x02221311UL >> 8,
    0x02221F2FUL >> 8, 0x02222311UL >> 8, 0x02222F2FUL >> 8, 0x02223211UL >> 8,
    0x02223F2FUL >> 8, 0x02231211UL >> 8, 0x02232211UL >> 8, 0x02232F2FUL >> 8,
    0x02233211UL >> 8, 0x02233F2FUL >> 8, 0x02287515UL >> 8, 0x022DAB17UL >> 8,
    0x02311211UL >> 8, 0x02311527UL >> 8, 0x02312211UL >> 8, 0x02321211UL >> 8,
    0x02322211UL >> 8, 0x02322F2FUL >> 8, 0x02323311UL >> 8, 0x02323F2FUL >> 8,
    0x02331211UL >> 8, 0x02332211UL >> 8, 0x02332F2FUL >> 8, 0x02333F2FUL >> 8,
    0x0237FF17UL >> 8, 0x02385615UL >> 8, 0x023D9517UL >> 8, 0x02410027UL >> 8,
    0x02487827UL >> 8, 0x024E3117UL >> 8, 0x024FFF2FUL >> 8, 0x02598627UL >> 8,
    0x025DFF2FUL >> 8, 0x025FFF2FUL >> 8, 0x02687827UL >> 8, 0x026DFA17UL >> 8,
    0x026FFF2FUL >> 8, 0x02796427UL >> 8, 0x027E4217UL >> 8, 0x027FFF2FUL >> 8,
    0x02888727UL >> 8, 0x028EFF2FUL >> 8, 0x028FFF2FUL >> 8, 0x02984327UL >> 8,
    0x029F112FUL >> 8, 0x029FFF2FUL >> 8, 0x02A76527UL >> 8, 0x02AEF717UL >> 8,
    0x02AFFF2FUL >> 8, 0x02B7C827UL >> 8, 0x02BEF917UL >> 8, 0x02BFFF2FUL >> 8,
    0x02C66527UL >> 8, 0x02CD5517UL >> 8, 0x02CFFF2FUL >> 8, 0x02D63227UL >> 8,
    0x02DDD527UL >> 8, 0x02DFFF2BUL >> 8, 0x02E84717UL >> 8, 0x02EEE327UL >> 8,
    0x02EFFF2FUL >> 8, 0x02F54527UL >> 8, 0x02FCF817UL >> 8, 0x02FFEF2BUL >> 8,
    0x02FFFA2FUL >> 8, 0x02FFFE2FUL >> 8, 0x03000127UL >> 8, 0x03000201UL >> 8,
    0x03111200UL >> 8, 0x03122115UL >> 8, 0x03123200UL >> 8, 0x03133211UL >> 8,
    0x03211200UL >> 8, 0x03213127UL >> 8, 0x03221200UL >> 8, 0x03345215UL >> 8,
    0x04000F17UL >> 8, 0x04122F17UL >> 8, 0x043F6515UL >> 8, 0x043FFF17UL >> 8,
    0x044F5527UL >> 8, 0x044FFF17UL >> 8, 0x045F0017UL >> 8, 0x045FFF17UL >> 8,
    0x046F6517UL >> 8, 0x04710027UL >> 8, 0x047F4427UL >> 8, 0x04810027UL >> 8,
    0x048EFA15UL >> 8, 0x048FFF2FUL >> 8, 0x049F4427UL >> 8, 0x049FFF2FUL >> 8,
    0x04AEA727UL >> 8, 0x04AFFF2FUL >> 8, 0x04BE9C15UL >> 8, 0x04BFFF2FUL >> 8,
    0x04CE5427UL >> 8, 0x04CFFF2FUL >> 8, 0x04DE3527UL >> 8, 0x04DFFF17UL >> 8,
    0x04EE4627UL >> 8, 0x04EFFF17UL >> 8, 0x04FEF327UL >> 8, 0x04FFFF2FUL >> 8,
    0x06000F27UL >> 8, 0x069FFF17UL >> 8, 0x06FFFF17UL >> 8, 0x08110017UL >> 8,
    0x08EFFF15UL >> 8, 0xFFFFFF00UL >> 8};

static UWORD8 ixheaacd_ari_hash_m_1[742] = {
    (UWORD8)0x04, (UWORD8)0x0A, (UWORD8)0x10, (UWORD8)0x16, (UWORD8)0x1F,
    (UWORD8)0x2E, (UWORD8)0x00, (UWORD8)0x03, (UWORD8)0x06, (UWORD8)0x36,
    (UWORD8)0x23, (UWORD8)0x29, (UWORD8)0x2E, (UWORD8)0x1B, (UWORD8)0x35,
    (UWORD8)0x21, (UWORD8)0x12, (UWORD8)0x30, (UWORD8)0x1D, (UWORD8)0x35,
    (UWORD8)0x38, (UWORD8)0x1B, (UWORD8)0x33, (UWORD8)0x35, (UWORD8)0x29,
    (UWORD8)0x35, (UWORD8)0x24, (UWORD8)0x33, (UWORD8)0x0F, (UWORD8)0x02,
    (UWORD8)0x2D, (UWORD8)0x36, (UWORD8)0x23, (UWORD8)0x12, (UWORD8)0x3F,
    (UWORD8)0x2D, (UWORD8)0x36, (UWORD8)0x38, (UWORD8)0x29, (UWORD8)0x2B,
    (UWORD8)0x2D, (UWORD8)0x36, (UWORD8)0x38, (UWORD8)0x29, (UWORD8)0x1D,
    (UWORD8)0x36, (UWORD8)0x38, (UWORD8)0x12, (UWORD8)0x35, (UWORD8)0x29,
    (UWORD8)0x35, (UWORD8)0x37, (UWORD8)0x2A, (UWORD8)0x1E, (UWORD8)0x3B,
    (UWORD8)0x2D, (UWORD8)0x3C, (UWORD8)0x23, (UWORD8)0x2E, (UWORD8)0x1E,
    (UWORD8)0x21, (UWORD8)0x24, (UWORD8)0x1E, (UWORD8)0x36, (UWORD8)0x38,
    (UWORD8)0x35, (UWORD8)0x37, (UWORD8)0x12, (UWORD8)0x37, (UWORD8)0x29,
    (UWORD8)0x24, (UWORD8)0x21, (UWORD8)0x36, (UWORD8)0x21, (UWORD8)0x25,
    (UWORD8)0x21, (UWORD8)0x38, (UWORD8)0x29, (UWORD8)0x23, (UWORD8)0x12,
    (UWORD8)0x0C, (UWORD8)0x29, (UWORD8)0x31, (UWORD8)0x2C, (UWORD8)0x08,
    (UWORD8)0x13, (UWORD8)0x2E, (UWORD8)0x2A, (UWORD8)0x08, (UWORD8)0x10,
    (UWORD8)0x2E, (UWORD8)0x1E, (UWORD8)0x36, (UWORD8)0x24, (UWORD8)0x2D,
    (UWORD8)0x1E, (UWORD8)0x36, (UWORD8)0x1F, (UWORD8)0x37, (UWORD8)0x04,
    (UWORD8)0x2A, (UWORD8)0x20, (UWORD8)0x29, (UWORD8)0x2E, (UWORD8)0x2D,
    (UWORD8)0x08, (UWORD8)0x23, (UWORD8)0x29, (UWORD8)0x2B, (UWORD8)0x1E,
    (UWORD8)0x08, (UWORD8)0x24, (UWORD8)0x29, (UWORD8)0x1E, (UWORD8)0x36,
    (UWORD8)0x23, (UWORD8)0x34, (UWORD8)0x21, (UWORD8)0x12, (UWORD8)0x36,
    (UWORD8)0x37, (UWORD8)0x29, (UWORD8)0x2D, (UWORD8)0x3C, (UWORD8)0x20,
    (UWORD8)0x16, (UWORD8)0x2D, (UWORD8)0x3C, (UWORD8)0x09, (UWORD8)0x29,
    (UWORD8)0x2D, (UWORD8)0x08, (UWORD8)0x09, (UWORD8)0x24, (UWORD8)0x3C,
    (UWORD8)0x21, (UWORD8)0x13, (UWORD8)0x3C, (UWORD8)0x21, (UWORD8)0x1F,
    (UWORD8)0x21, (UWORD8)0x29, (UWORD8)0x24, (UWORD8)0x3B, (UWORD8)0x08,
    (UWORD8)0x09, (UWORD8)0x26, (UWORD8)0x08, (UWORD8)0x09, (UWORD8)0x10,
    (UWORD8)0x36, (UWORD8)0x21, (UWORD8)0x23, (UWORD8)0x1F, (UWORD8)0x23,
    (UWORD8)0x0A, (UWORD8)0x23, (UWORD8)0x29, (UWORD8)0x10, (UWORD8)0x21,
    (UWORD8)0x3B, (UWORD8)0x21, (UWORD8)0x10, (UWORD8)0x25, (UWORD8)0x21,
    (UWORD8)0x12, (UWORD8)0x13, (UWORD8)0x29, (UWORD8)0x01, (UWORD8)0x24,
    (UWORD8)0x30, (UWORD8)0x2A, (UWORD8)0x20, (UWORD8)0x16, (UWORD8)0x2C,
    (UWORD8)0x1E, (UWORD8)0x08, (UWORD8)0x10, (UWORD8)0x2A, (UWORD8)0x1E,
    (UWORD8)0x08, (UWORD8)0x23, (UWORD8)0x1E, (UWORD8)0x3C, (UWORD8)0x07,
    (UWORD8)0x2D, (UWORD8)0x20, (UWORD8)0x16, (UWORD8)0x2D, (UWORD8)0x3C,
    (UWORD8)0x09, (UWORD8)0x16, (UWORD8)0x2D, (UWORD8)0x20, (UWORD8)0x10,
    (UWORD8)0x2B, (UWORD8)0x08, (UWORD8)0x23, (UWORD8)0x25, (UWORD8)0x21,
    (UWORD8)0x1F, (UWORD8)0x21, (UWORD8)0x29, (UWORD8)0x07, (UWORD8)0x08,
    (UWORD8)0x0D, (UWORD8)0x1E, (UWORD8)0x08, (UWORD8)0x20, (UWORD8)0x10,
    (UWORD8)0x29, (UWORD8)0x1E, (UWORD8)0x08, (UWORD8)0x3B, (UWORD8)0x29,
    (UWORD8)0x3C, (UWORD8)0x20, (UWORD8)0x3B, (UWORD8)0x29, (UWORD8)0x0A,
    (UWORD8)0x20, (UWORD8)0x24, (UWORD8)0x0A, (UWORD8)0x21, (UWORD8)0x12,
    (UWORD8)0x23, (UWORD8)0x39, (UWORD8)0x3B, (UWORD8)0x08, (UWORD8)0x09,
    (UWORD8)0x10, (UWORD8)0x08, (UWORD8)0x09, (UWORD8)0x10, (UWORD8)0x08,
    (UWORD8)0x0D, (UWORD8)0x10, (UWORD8)0x0A, (UWORD8)0x09, (UWORD8)0x3B,
    (UWORD8)0x0A, (UWORD8)0x09, (UWORD8)0x24, (UWORD8)0x29, (UWORD8)0x10,
    (UWORD8)0x20, (UWORD8)0x0D, (UWORD8)0x10, (UWORD8)0x20, (UWORD8)0x0D,
    (UWORD8)0x10, (UWORD8)0x28, (UWORD8)0x0D, (UWORD8)0x10, (UWORD8)0x1F,
    (UWORD8)0x10, (UWORD8)0x26, (UWORD8)0x12, (UWORD8)0x26, (UWORD8)0x12,
    (UWORD8)0x26, (UWORD8)0x12, (UWORD8)0x12, (UWORD8)0x1F, (UWORD8)0x04,
    (UWORD8)0x07, (UWORD8)0x0D, (UWORD8)0x2A, (UWORD8)0x20, (UWORD8)0x1E,
    (UWORD8)0x08, (UWORD8)0x09, (UWORD8)0x2B, (UWORD8)0x08, (UWORD8)0x07,
    (UWORD8)0x3C, (UWORD8)0x09, (UWORD8)0x07, (UWORD8)0x3C, (UWORD8)0x09,
    (UWORD8)0x10, (UWORD8)0x3C, (UWORD8)0x09, (UWORD8)0x3B, (UWORD8)0x3C,
    (UWORD8)0x20, (UWORD8)0x3B, (UWORD8)0x08, (UWORD8)0x09, (UWORD8)0x29,
    (UWORD8)0x07, (UWORD8)0x20, (UWORD8)0x3B, (UWORD8)0x3C, (UWORD8)0x20,
    (UWORD8)0x10, (UWORD8)0x3C, (UWORD8)0x20, (UWORD8)0x3B, (UWORD8)0x13,
    (UWORD8)0x08, (UWORD8)0x09, (UWORD8)0x10, (UWORD8)0x08, (UWORD8)0x3B,
    (UWORD8)0x25, (UWORD8)0x09, (UWORD8)0x3B, (UWORD8)0x29, (UWORD8)0x39,
    (UWORD8)0x3B, (UWORD8)0x39, (UWORD8)0x09, (UWORD8)0x3B, (UWORD8)0x08,
    (UWORD8)0x20, (UWORD8)0x3B, (UWORD8)0x0A, (UWORD8)0x09, (UWORD8)0x3B,
    (UWORD8)0x13, (UWORD8)0x0A, (UWORD8)0x09, (UWORD8)0x10, (UWORD8)0x25,
    (UWORD8)0x0D, (UWORD8)0x26, (UWORD8)0x13, (UWORD8)0x20, (UWORD8)0x0D,
    (UWORD8)0x10, (UWORD8)0x20, (UWORD8)0x0D, (UWORD8)0x10, (UWORD8)0x20,
    (UWORD8)0x0D, (UWORD8)0x09, (UWORD8)0x10, (UWORD8)0x12, (UWORD8)0x13,
    (UWORD8)0x22, (UWORD8)0x25, (UWORD8)0x3D, (UWORD8)0x25, (UWORD8)0x25,
    (UWORD8)0x18, (UWORD8)0x39, (UWORD8)0x07, (UWORD8)0x09, (UWORD8)0x07,
    (UWORD8)0x07, (UWORD8)0x20, (UWORD8)0x07, (UWORD8)0x09, (UWORD8)0x3C,
    (UWORD8)0x20, (UWORD8)0x3B, (UWORD8)0x08, (UWORD8)0x20, (UWORD8)0x39,
    (UWORD8)0x09, (UWORD8)0x39, (UWORD8)0x09, (UWORD8)0x3B, (UWORD8)0x08,
    (UWORD8)0x0D, (UWORD8)0x13, (UWORD8)0x08, (UWORD8)0x3B, (UWORD8)0x2B,
    (UWORD8)0x09, (UWORD8)0x10, (UWORD8)0x25, (UWORD8)0x3B, (UWORD8)0x39,
    (UWORD8)0x39, (UWORD8)0x09, (UWORD8)0x13, (UWORD8)0x39, (UWORD8)0x09,
    (UWORD8)0x10, (UWORD8)0x2B, (UWORD8)0x09, (UWORD8)0x10, (UWORD8)0x28,
    (UWORD8)0x0D, (UWORD8)0x12, (UWORD8)0x13, (UWORD8)0x2B, (UWORD8)0x10,
    (UWORD8)0x0A, (UWORD8)0x3B, (UWORD8)0x25, (UWORD8)0x3B, (UWORD8)0x12,
    (UWORD8)0x13, (UWORD8)0x13, (UWORD8)0x28, (UWORD8)0x3D, (UWORD8)0x28,
    (UWORD8)0x18, (UWORD8)0x39, (UWORD8)0x07, (UWORD8)0x20, (UWORD8)0x24,
    (UWORD8)0x07, (UWORD8)0x0B, (UWORD8)0x07, (UWORD8)0x20, (UWORD8)0x39,
    (UWORD8)0x20, (UWORD8)0x39, (UWORD8)0x0C, (UWORD8)0x39, (UWORD8)0x09,
    (UWORD8)0x39, (UWORD8)0x09, (UWORD8)0x26, (UWORD8)0x2B, (UWORD8)0x09,
    (UWORD8)0x2B, (UWORD8)0x3B, (UWORD8)0x12, (UWORD8)0x3B, (UWORD8)0x2B,
    (UWORD8)0x3B, (UWORD8)0x09, (UWORD8)0x13, (UWORD8)0x0A, (UWORD8)0x26,
    (UWORD8)0x16, (UWORD8)0x3D, (UWORD8)0x12, (UWORD8)0x26, (UWORD8)0x18,
    (UWORD8)0x0C, (UWORD8)0x07, (UWORD8)0x39, (UWORD8)0x1C, (UWORD8)0x0B,
    (UWORD8)0x39, (UWORD8)0x39, (UWORD8)0x0B, (UWORD8)0x12, (UWORD8)0x0B,
    (UWORD8)0x26, (UWORD8)0x28, (UWORD8)0x10, (UWORD8)0x3D, (UWORD8)0x16,
    (UWORD8)0x26, (UWORD8)0x18, (UWORD8)0x39, (UWORD8)0x39, (UWORD8)0x0B,
    (UWORD8)0x0B, (UWORD8)0x1C, (UWORD8)0x25, (UWORD8)0x26, (UWORD8)0x1C,
    (UWORD8)0x18, (UWORD8)0x18, (UWORD8)0x07, (UWORD8)0x0B, (UWORD8)0x0B,
    (UWORD8)0x3D, (UWORD8)0x25, (UWORD8)0x16, (UWORD8)0x25, (UWORD8)0x18,
    (UWORD8)0x0B, (UWORD8)0x0B, (UWORD8)0x3D, (UWORD8)0x2B, (UWORD8)0x16,
    (UWORD8)0x1F, (UWORD8)0x18, (UWORD8)0x0B, (UWORD8)0x26, (UWORD8)0x3D,
    (UWORD8)0x1F, (UWORD8)0x3D, (UWORD8)0x12, (UWORD8)0x18, (UWORD8)0x39,
    (UWORD8)0x0E, (UWORD8)0x3D, (UWORD8)0x2E, (UWORD8)0x16, (UWORD8)0x18,
    (UWORD8)0x0E, (UWORD8)0x0E, (UWORD8)0x2E, (UWORD8)0x16, (UWORD8)0x18,
    (UWORD8)0x0E, (UWORD8)0x1C, (UWORD8)0x1C, (UWORD8)0x18, (UWORD8)0x0E,
    (UWORD8)0x19, (UWORD8)0x1C, (UWORD8)0x2E, (UWORD8)0x2E, (UWORD8)0x0C,
    (UWORD8)0x3D, (UWORD8)0x22, (UWORD8)0x18, (UWORD8)0x32, (UWORD8)0x3E,
    (UWORD8)0x03, (UWORD8)0x1A, (UWORD8)0x1A, (UWORD8)0x30, (UWORD8)0x30,
    (UWORD8)0x1D, (UWORD8)0x02, (UWORD8)0x02, (UWORD8)0x02, (UWORD8)0x08,
    (UWORD8)0x36, (UWORD8)0x36, (UWORD8)0x35, (UWORD8)0x3B, (UWORD8)0x03,
    (UWORD8)0x1A, (UWORD8)0x30, (UWORD8)0x30, (UWORD8)0x30, (UWORD8)0x02,
    (UWORD8)0x04, (UWORD8)0x04, (UWORD8)0x04, (UWORD8)0x39, (UWORD8)0x20,
    (UWORD8)0x20, (UWORD8)0x09, (UWORD8)0x3B, (UWORD8)0x0A, (UWORD8)0x12,
    (UWORD8)0x1A, (UWORD8)0x30, (UWORD8)0x2C, (UWORD8)0x2A, (UWORD8)0x2A,
    (UWORD8)0x2D, (UWORD8)0x2D, (UWORD8)0x07, (UWORD8)0x34, (UWORD8)0x34,
    (UWORD8)0x39, (UWORD8)0x34, (UWORD8)0x34, (UWORD8)0x34, (UWORD8)0x0B,
    (UWORD8)0x0B, (UWORD8)0x24, (UWORD8)0x02, (UWORD8)0x04, (UWORD8)0x39,
    (UWORD8)0x39, (UWORD8)0x0A, (UWORD8)0x34, (UWORD8)0x07, (UWORD8)0x34,
    (UWORD8)0x34, (UWORD8)0x0E, (UWORD8)0x34, (UWORD8)0x0E, (UWORD8)0x02,
    (UWORD8)0x39, (UWORD8)0x39, (UWORD8)0x39, (UWORD8)0x07, (UWORD8)0x0E,
    (UWORD8)0x34, (UWORD8)0x0E, (UWORD8)0x07, (UWORD8)0x39, (UWORD8)0x39,
    (UWORD8)0x39, (UWORD8)0x34, (UWORD8)0x07, (UWORD8)0x39, (UWORD8)0x07,
    (UWORD8)0x0C, (UWORD8)0x07, (UWORD8)0x07, (UWORD8)0x0C, (UWORD8)0x0C,
    (UWORD8)0x07, (UWORD8)0x39, (UWORD8)0x07, (UWORD8)0x39, (UWORD8)0x0E,
    (UWORD8)0x01, (UWORD8)0x27, (UWORD8)0x27, (UWORD8)0x27, (UWORD8)0x2F,
    (UWORD8)0x00, (UWORD8)0x00, (UWORD8)0x11, (UWORD8)0x27, (UWORD8)0x2F,
    (UWORD8)0x11, (UWORD8)0x15, (UWORD8)0x00, (UWORD8)0x11, (UWORD8)0x15,
    (UWORD8)0x00, (UWORD8)0x00, (UWORD8)0x01, (UWORD8)0x2F, (UWORD8)0x00,
    (UWORD8)0x15, (UWORD8)0x2F, (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x11,
    (UWORD8)0x11, (UWORD8)0x11, (UWORD8)0x11, (UWORD8)0x15, (UWORD8)0x00,
    (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x11,
    (UWORD8)0x01, (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x11, (UWORD8)0x2F,
    (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x11, (UWORD8)0x11, (UWORD8)0x2F,
    (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x15, (UWORD8)0x17, (UWORD8)0x11,
    (UWORD8)0x27, (UWORD8)0x11, (UWORD8)0x11, (UWORD8)0x11, (UWORD8)0x2F,
    (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x11, (UWORD8)0x11, (UWORD8)0x2F,
    (UWORD8)0x2F, (UWORD8)0x17, (UWORD8)0x15, (UWORD8)0x17, (UWORD8)0x27,
    (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x2F,
    (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x2F, (UWORD8)0x27,
    (UWORD8)0x17, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x2F, (UWORD8)0x2F,
    (UWORD8)0x27, (UWORD8)0x2F, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x17,
    (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x2F, (UWORD8)0x27,
    (UWORD8)0x17, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x27, (UWORD8)0x2B,
    (UWORD8)0x17, (UWORD8)0x27, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x17,
    (UWORD8)0x2B, (UWORD8)0x2F, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x01,
    (UWORD8)0x00, (UWORD8)0x15, (UWORD8)0x00, (UWORD8)0x11, (UWORD8)0x00,
    (UWORD8)0x27, (UWORD8)0x00, (UWORD8)0x15, (UWORD8)0x17, (UWORD8)0x17,
    (UWORD8)0x15, (UWORD8)0x17, (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x17,
    (UWORD8)0x17, (UWORD8)0x17, (UWORD8)0x27, (UWORD8)0x27, (UWORD8)0x27,
    (UWORD8)0x15, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x2F, (UWORD8)0x27,
    (UWORD8)0x2F, (UWORD8)0x15, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x2F,
    (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x27,
    (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x17, (UWORD8)0x17,
    (UWORD8)0x15, (UWORD8)0x00};

UWORD16 ixheaacd_ari_cf_m[64][17] = {
    {708, 706, 579, 569, 568, 567, 479, 469, 297, 138, 97, 91, 72, 52, 38, 34,
     0},
    {7619, 6917, 6519, 6412, 5514, 5003, 4683, 4563, 3907, 3297, 3125, 3060,
     2904, 2718, 2631, 2590, 0},
    {7263, 4888, 4810, 4803, 1889, 415, 335, 327, 195, 72, 52, 49, 36, 20, 15,
     14, 0},
    {3626, 2197, 2188, 2187, 582, 57, 47, 46, 30, 12, 9, 8, 6, 4, 3, 2, 0},
    {7806, 5541, 5451, 5441, 2720, 834, 691, 674, 487, 243, 179, 167, 139, 98,
     77, 70, 0},
    {6684, 4101, 4058, 4055, 1748, 426, 368, 364, 322, 257, 235, 232, 228, 222,
     217, 215, 0},
    {9162, 5964, 5831, 5819, 3269, 866, 658, 638, 535, 348, 258, 244, 234, 214,
     195, 186, 0},
    {10638, 8491, 8365, 8351, 4418, 2067, 1859, 1834, 1190, 601, 495, 478, 356,
     217, 174, 164, 0},
    {13389, 10514, 10032, 9961, 7166, 3488, 2655, 2524, 2015, 1140, 760, 672,
     585, 426, 325, 283, 0},
    {14861, 12788, 12115, 11952, 9987, 6657, 5323, 4984, 4324, 3001, 2205, 1943,
     1764, 1394, 1115, 978, 0},
    {12876, 10004, 9661, 9610, 7107, 3435, 2711, 2595, 2257, 1508, 1059, 952,
     893, 753, 609, 538, 0},
    {15125, 13591, 13049, 12874, 11192, 8543, 7406, 7023, 6291, 4922, 4104,
     3769, 3465, 2890, 2486, 2275, 0},
    {14574, 13106, 12731, 12638, 10453, 7947, 7233, 7037, 6031, 4618, 4081,
     3906, 3465, 2802, 2476, 2349, 0},
    {15070, 13179, 12517, 12351, 10742, 7657, 6200, 5825, 5264, 3998, 3014,
     2662, 2510, 2153, 1799, 1564, 0},
    {15542, 14466, 14007, 13844, 12489, 10409, 9481, 9132, 8305, 6940, 6193,
     5867, 5458, 4743, 4291, 4047, 0},
    {15165, 14384, 14084, 13934, 12911, 11485, 10844, 10513, 10002, 8993, 8380,
     8051, 7711, 7036, 6514, 6233, 0},
    {15642, 14279, 13625, 13393, 12348, 9971, 8405, 7858, 7335, 6119, 4918,
     4376, 4185, 3719, 3231, 2860, 0},
    {13408, 13407, 11471, 11218, 11217, 11216, 9473, 9216, 6480, 3689, 2857,
     2690, 2256, 1732, 1405, 1302, 0},
    {16098, 15584, 15191, 14931, 14514, 13578, 12703, 12103, 11830, 11172,
     10475, 9867, 9695, 9281, 8825, 8389, 0},
    {15844, 14873, 14277, 13996, 13230, 11535, 10205, 9543, 9107, 8086, 7085,
     6419, 6214, 5713, 5195, 4731, 0},
    {16131, 15720, 15443, 15276, 14848, 13971, 13314, 12910, 12591, 11874,
     11225, 10788, 10573, 10077, 9585, 9209, 0},
    {16331, 16330, 12283, 11435, 11434, 11433, 8725, 8049, 6065, 4138, 3187,
     2842, 2529, 2171, 1907, 1745, 0},
    {16011, 15292, 14782, 14528, 14008, 12767, 11556, 10921, 10591, 9759, 8813,
     8043, 7855, 7383, 6863, 6282, 0},
    {16380, 16379, 15159, 14610, 14609, 14608, 12859, 12111, 11046, 9536, 8348,
     7713, 7216, 6533, 5964, 5546, 0},
    {16367, 16333, 16294, 16253, 16222, 16143, 16048, 15947, 15915, 15832,
     15731, 15619, 15589, 15512, 15416, 15310, 0},
    {15967, 15319, 14937, 14753, 14010, 12638, 11787, 11360, 10805, 9706, 8934,
     8515, 8166, 7456, 6911, 6575, 0},
    {4906, 3005, 2985, 2984, 875, 102, 83, 81, 47, 17, 12, 11, 8, 5, 4, 3, 0},
    {7217, 4346, 4269, 4264, 1924, 428, 340, 332, 280, 203, 179, 175, 171, 164,
     159, 157, 0},
    {16010, 15415, 15032, 14805, 14228, 13043, 12168, 11634, 11265, 10419, 9645,
     9110, 8892, 8378, 7850, 7437, 0},
    {8573, 5218, 5046, 5032, 2787, 771, 555, 533, 443, 286, 218, 205, 197, 181,
     168, 162, 0},
    {11474, 8095, 7822, 7796, 4632, 1443, 1046, 1004, 748, 351, 218, 194, 167,
     121, 93, 83, 0},
    {16152, 15764, 15463, 15264, 14925, 14189, 13536, 13070, 12846, 12314,
     11763, 11277, 11131, 10777, 10383, 10011, 0},
    {14187, 11654, 11043, 10919, 8498, 4885, 3778, 3552, 2947, 1835, 1283, 1134,
     998, 749, 585, 514, 0},
    {14162, 11527, 10759, 10557, 8601, 5417, 4105, 3753, 3286, 2353, 1708, 1473,
     1370, 1148, 959, 840, 0},
    {16205, 15902, 15669, 15498, 15213, 14601, 14068, 13674, 13463, 12970,
     12471, 12061, 11916, 11564, 11183, 10841, 0},
    {15043, 12972, 12092, 11792, 10265, 7446, 5934, 5379, 4883, 3825, 3036,
     2647, 2507, 2185, 1901, 1699, 0},
    {15320, 13694, 12782, 12352, 11191, 8936, 7433, 6671, 6255, 5366, 4622,
     4158, 4020, 3712, 3420, 3198, 0},
    {16255, 16020, 15768, 15600, 15416, 14963, 14440, 14006, 13875, 13534,
     13137, 12697, 12602, 12364, 12084, 11781, 0},
    {15627, 14503, 13906, 13622, 12557, 10527, 9269, 8661, 8117, 6933, 5994,
     5474, 5222, 4664, 4166, 3841, 0},
    {16366, 16365, 14547, 14160, 14159, 14158, 11969, 11473, 8735, 6147, 4911,
     4530, 3865, 3180, 2710, 2473, 0},
    {16257, 16038, 15871, 15754, 15536, 15071, 14673, 14390, 14230, 13842,
     13452, 13136, 13021, 12745, 12434, 12154, 0},
    {15855, 14971, 14338, 13939, 13239, 11782, 10585, 9805, 9444, 8623, 7846,
     7254, 7079, 6673, 6262, 5923, 0},
    {9492, 6318, 6197, 6189, 3004, 652, 489, 477, 333, 143, 96, 90, 78, 60, 50,
     47, 0},
    {16313, 16191, 16063, 15968, 15851, 15590, 15303, 15082, 14968, 14704,
     14427, 14177, 14095, 13899, 13674, 13457, 0},
    {8485, 5473, 5389, 5383, 2411, 494, 386, 377, 278, 150, 117, 112, 103, 89,
     81, 78, 0},
    {10497, 7154, 6959, 6943, 3788, 1004, 734, 709, 517, 238, 152, 138, 120, 90,
     72, 66, 0},
    {16317, 16226, 16127, 16040, 15955, 15762, 15547, 15345, 15277, 15111,
     14922, 14723, 14671, 14546, 14396, 14239, 0},
    {16382, 16381, 15858, 15540, 15539, 15538, 14704, 14168, 13768, 13092,
     12452, 11925, 11683, 11268, 10841, 10460, 0},
    {5974, 3798, 3758, 3755, 1275, 205, 166, 162, 95, 35, 26, 24, 18, 11, 8, 7,
     0},
    {3532, 2258, 2246, 2244, 731, 135, 118, 115, 87, 45, 36, 34, 29, 21, 17, 16,
     0},
    {7466, 4882, 4821, 4811, 2476, 886, 788, 771, 688, 531, 469, 457, 437, 400,
     369, 361, 0},
    {9580, 5772, 5291, 5216, 3444, 1496, 1025, 928, 806, 578, 433, 384, 366,
     331, 296, 273, 0},
    {10692, 7730, 7543, 7521, 4679, 1746, 1391, 1346, 1128, 692, 495, 458, 424,
     353, 291, 268, 0},
    {11040, 7132, 6549, 6452, 4377, 1875, 1253, 1130, 958, 631, 431, 370, 346,
     296, 253, 227, 0},
    {12687, 9332, 8701, 8585, 6266, 3093, 2182, 2004, 1683, 1072, 712, 608, 559,
     458, 373, 323, 0},
    {13429, 9853, 8860, 8584, 6806, 4039, 2862, 2478, 2239, 1764, 1409, 1224,
     1178, 1077, 979, 903, 0},
    {14685, 12163, 11061, 10668, 9101, 6345, 4871, 4263, 3908, 3200, 2668, 2368,
     2285, 2106, 1942, 1819, 0},
    {13295, 11302, 10999, 10945, 7947, 5036, 4490, 4385, 3391, 2185, 1836, 1757,
     1424, 998, 833, 785, 0},
    {4992, 2993, 2972, 2970, 1269, 575, 552, 549, 530, 505, 497, 495, 493, 489,
     486, 485, 0},
    {15419, 13862, 13104, 12819, 11429, 8753, 7220, 6651, 6020, 4667, 3663,
     3220, 2995, 2511, 2107, 1871, 0},
    {12468, 9263, 8912, 8873, 5758, 2193, 1625, 1556, 1187, 589, 371, 330, 283,
     200, 149, 131, 0},
    {15870, 15076, 14615, 14369, 13586, 12034, 10990, 10423, 9953, 8908, 8031,
     7488, 7233, 6648, 6101, 5712, 0},
    {1693, 978, 976, 975, 194, 18, 16, 15, 11, 7, 6, 5, 4, 3, 2, 1, 0},
    {7992, 5218, 5147, 5143, 2152, 366, 282, 276, 173, 59, 38, 35, 27, 16, 11,
     10, 0}};

typedef struct { WORD32 low, high, value; } state_arith;

const WORD32 ixheaacd_table_frac[7] = {
    638450709,  759250126,  902905651,  1073741824,
    1276901417, 1518500250, 1805811302,
};

const WORD64 ixheaacd_table_exp[32] = {
    1,         2,         4,          8,         16,       32,       64,
    128,       256,       512,        1024,      2048,     4096,     8192,
    16384,     32768,     65536,      131072,    262144,   524288,   1048576,
    2097152,   4194304,   8388608,    16777216,  33554432, 67108864, 134217728,
    268435456, 536870912, 1073741824, 2147483648};

static const WORD32 ixheaacd_pow_14_3[8] = {0,    3251, 4096,  5161,
                                            6502, 8192, 10321, 13004};

const WORD32 ixheaacd_pow_table_Q13[1024] = {0,
                                             131072 >> 4,
                                             330281 >> 4,
                                             567116 >> 4,
                                             832256 >> 4,
                                             1120650 >> 4,
                                             1429042 >> 4,
                                             1755122 >> 4,
                                             2097152 >> 4,
                                             2453767 >> 4,
                                             2823861 >> 4,
                                             3206517 >> 4,
                                             3600960 >> 4,
                                             4006524 >> 4,
                                             4422631 >> 4,
                                             4848770 >> 4,
                                             5284492 >> 4,
                                             5729392 >> 4,
                                             6183105 >> 4,
                                             6645302 >> 4,
                                             7115683 >> 4,
                                             7593972 >> 4,
                                             8079916 >> 4,
                                             8573281 >> 4,
                                             9073850 >> 4,
                                             9581422 >> 4,
                                             10095808 >> 4,
                                             10616832 >> 4,
                                             11144330 >> 4,
                                             11678147 >> 4,
                                             12218136 >> 4,
                                             12764159 >> 4,
                                             13316085 >> 4,
                                             13873792 >> 4,
                                             14437162 >> 4,
                                             15006082 >> 4,
                                             15580448 >> 4,
                                             16160157 >> 4,
                                             16745112 >> 4,
                                             17335222 >> 4,
                                             17930398 >> 4,
                                             18530554 >> 4,
                                             19135610 >> 4,
                                             19745488 >> 4,
                                             20360112 >> 4,
                                             20979411 >> 4,
                                             21603314 >> 4,
                                             22231755 >> 4,
                                             22864669 >> 4,
                                             23501994 >> 4,
                                             24143669 >> 4,
                                             24789637 >> 4,
                                             25439841 >> 4,
                                             26094226 >> 4,
                                             26752740 >> 4,
                                             27415332 >> 4,
                                             28081952 >> 4,
                                             28752552 >> 4,
                                             29427086 >> 4,
                                             30105507 >> 4,
                                             30787772 >> 4,
                                             31473838 >> 4,
                                             32163664 >> 4,
                                             32857208 >> 4,
                                             33554432 >> 4,
                                             34255297 >> 4,
                                             34959765 >> 4,
                                             35667801 >> 4,
                                             36379368 >> 4,
                                             37094431 >> 4,
                                             37812958 >> 4,
                                             38534914 >> 4,
                                             39260268 >> 4,
                                             39988988 >> 4,
                                             40721043 >> 4,
                                             41456403 >> 4,
                                             42195038 >> 4,
                                             42936921 >> 4,
                                             43682022 >> 4,
                                             44430314 >> 4,
                                             45181770 >> 4,
                                             45936364 >> 4,
                                             46694070 >> 4,
                                             47454862 >> 4,
                                             48218716 >> 4,
                                             48985607 >> 4,
                                             49755512 >> 4,
                                             50528406 >> 4,
                                             51304267 >> 4,
                                             52083073 >> 4,
                                             52864802 >> 4,
                                             53649431 >> 4,
                                             54436939 >> 4,
                                             55227306 >> 4,
                                             56020511 >> 4,
                                             56816534 >> 4,
                                             57615355 >> 4,
                                             58416954 >> 4,
                                             59221313 >> 4,
                                             60028412 >> 4,
                                             60838233 >> 4,
                                             61650759 >> 4,
                                             62465970 >> 4,
                                             63283850 >> 4,
                                             64104381 >> 4,
                                             64927547 >> 4,
                                             65753329 >> 4,
                                             66581713 >> 4,
                                             67412681 >> 4,
                                             68246218 >> 4,
                                             69082308 >> 4,
                                             69920936 >> 4,
                                             70762086 >> 4,
                                             71605743 >> 4,
                                             72451892 >> 4,
                                             73300519 >> 4,
                                             74151609 >> 4,
                                             75005149 >> 4,
                                             75861124 >> 4,
                                             76719520 >> 4,
                                             77580324 >> 4,
                                             78443523 >> 4,
                                             79309103 >> 4,
                                             80177051 >> 4,
                                             81047354 >> 4,
                                             81920000 >> 4,
                                             82794977 >> 4,
                                             83672271 >> 4,
                                             84551871 >> 4,
                                             5339610,
                                             5394871,
                                             5450274,
                                             5505818,
                                             5561502,
                                             5617327,
                                             5673290,
                                             5729391,
                                             5785631,
                                             5842007,
                                             5898519,
                                             5955168,
                                             6011951,
                                             6068869,
                                             6125920,
                                             6183105,
                                             6240422,
                                             6297871,
                                             6355451,
                                             6413162,
                                             6471004,
                                             6528974,
                                             6587074,
                                             6645302,
                                             6703658,
                                             6762141,
                                             6820751,
                                             6879487,
                                             6938349,
                                             6997336,
                                             7056447,
                                             7115683,
                                             7175042,
                                             7234524,
                                             7294129,
                                             7353855,
                                             7413703,
                                             7473672,
                                             7533762,
                                             7593972,
                                             7654301,
                                             7714750,
                                             7775317,
                                             7836002,
                                             7896805,
                                             7957725,
                                             8018762,
                                             8079916,
                                             8141185,
                                             8202570,
                                             8264070,
                                             8325685,
                                             8387413,
                                             8449256,
                                             8511212,
                                             8573281,
                                             8635462,
                                             8697756,
                                             8760161,
                                             8822678,
                                             8885305,
                                             8948043,
                                             9010892,
                                             9073850,
                                             9136917,
                                             9200094,
                                             9263379,
                                             9326772,
                                             9390274,
                                             9453882,
                                             9517598,
                                             9581421,
                                             9645351,
                                             9709386,
                                             9773527,
                                             9837774,
                                             9902125,
                                             9966582,
                                             10031143,
                                             10095807,
                                             10160576,
                                             10225448,
                                             10290423,
                                             10355500,
                                             10420681,
                                             10485963,
                                             10551347,
                                             10616832,
                                             10682419,
                                             10748106,
                                             10813894,
                                             10879782,
                                             10945770,
                                             11011857,
                                             11078044,
                                             11144330,
                                             11210715,
                                             11277198,
                                             11343779,
                                             11410458,
                                             11477234,
                                             11544108,
                                             11611079,
                                             11678147,
                                             11745311,
                                             11812571,
                                             11879927,
                                             11947378,
                                             12014925,
                                             12082567,
                                             12150304,
                                             12218135,
                                             12286061,
                                             12354081,
                                             12422194,
                                             12490401,
                                             12558701,
                                             12627094,
                                             12695580,
                                             12764158,
                                             12832829,
                                             12901592,
                                             12970446,
                                             13039392,
                                             13108429,
                                             13177557,
                                             13246776,
                                             13316085,
                                             13385485,
                                             13454975,
                                             13524554,
                                             13594224,
                                             13663982,
                                             13733830,
                                             13803767,
                                             13873792,
                                             13943906,
                                             14014108,
                                             14084398,
                                             14154776,
                                             14225242,
                                             14295794,
                                             14366435,
                                             14437162,
                                             14507975,
                                             14578876,
                                             14649862,
                                             14720935,
                                             14792093,
                                             14863337,
                                             14934667,
                                             15006082,
                                             15077582,
                                             15149167,
                                             15220837,
                                             15292591,
                                             15364429,
                                             15436351,
                                             15508358,
                                             15580448,
                                             15652621,
                                             15724878,
                                             15797217,
                                             15869640,
                                             15942146,
                                             16014734,
                                             16087404,
                                             16160156,
                                             16232991,
                                             16305907,
                                             16378905,
                                             16451984,
                                             16525145,
                                             16598386,
                                             16671709,
                                             16745112,
                                             16818596,
                                             16892160,
                                             16965804,
                                             17039528,
                                             17113332,
                                             17187216,
                                             17261179,
                                             17335222,
                                             17409343,
                                             17483544,
                                             17557824,
                                             17632182,
                                             17706618,
                                             17781133,
                                             17855726,
                                             17930397,
                                             18005146,
                                             18079973,
                                             18154877,
                                             18229858,
                                             18304917,
                                             18380052,
                                             18455265,
                                             18530554,
                                             18605920,
                                             18681362,
                                             18756880,
                                             18832475,
                                             18908145,
                                             18983891,
                                             19059713,
                                             19135610,
                                             19211583,
                                             19287630,
                                             19363753,
                                             19439951,
                                             19516223,
                                             19592571,
                                             19668992,
                                             19745488,
                                             19822058,
                                             19898702,
                                             19975420,
                                             20052211,
                                             20129076,
                                             20206015,
                                             20283027,
                                             20360112,
                                             20437270,
                                             20514501,
                                             20591805,
                                             20669181,
                                             20746630,
                                             20824151,
                                             20901745,
                                             20979410,
                                             21057148,
                                             21134957,
                                             21212838,
                                             21290791,
                                             21368815,
                                             21446910,
                                             21525076,
                                             21603314,
                                             21681622,
                                             21760001,
                                             21838451,
                                             21916971,
                                             21995561,
                                             22074222,
                                             22152953,
                                             22231754,
                                             22310625,
                                             22389566,
                                             22468576,
                                             22547656,
                                             22626806,
                                             22706024,
                                             22785312,
                                             22864669,
                                             22944094,
                                             23023589,
                                             23103152,
                                             23182783,
                                             23262484,
                                             23342252,
                                             23422089,
                                             23501993,
                                             23581966,
                                             23662007,
                                             23742115,
                                             23822291,
                                             23902534,
                                             23982845,
                                             24063223,
                                             24143669,
                                             24224181,
                                             24304761,
                                             24385407,
                                             24466120,
                                             24546899,
                                             24627745,
                                             24708658,
                                             24789637,
                                             24870682,
                                             24951793,
                                             25032970,
                                             25114213,
                                             25195521,
                                             25276895,
                                             25358335,
                                             25439841,
                                             25521411,
                                             25603047,
                                             25684748,
                                             25766514,
                                             25848345,
                                             25930241,
                                             26012201,
                                             26094226,
                                             26176316,
                                             26258469,
                                             26340688,
                                             26422970,
                                             26505317,
                                             26587727,
                                             26670202,
                                             26752740,
                                             26835342,
                                             26918008,
                                             27000737,
                                             27083530,
                                             27166386,
                                             27249305,
                                             27332287,
                                             27415332,
                                             27498440,
                                             27581611,
                                             27664845,
                                             27748142,
                                             27831501,
                                             27914922,
                                             27998406,
                                             28081952,
                                             28165561,
                                             28249231,
                                             28332963,
                                             28416758,
                                             28500614,
                                             28584532,
                                             28668511,
                                             28752552,
                                             28836655,
                                             28920819,
                                             29005044,
                                             29089330,
                                             29173677,
                                             29258086,
                                             29342555,
                                             29427086,
                                             29511676,
                                             29596328,
                                             29681040,
                                             29765813,
                                             29850646,
                                             29935539,
                                             30020493,
                                             30105507,
                                             30190581,
                                             30275714,
                                             30360908,
                                             30446162,
                                             30531475,
                                             30616848,
                                             30702280,
                                             30787772,
                                             30873323,
                                             30958934,
                                             31044604,
                                             31130332,
                                             31216120,
                                             31301967,
                                             31387873,
                                             31473838,
                                             31559862,
                                             31645944,
                                             31732084,
                                             31818284,
                                             31904541,
                                             31990857,
                                             32077231,
                                             32163664,
                                             32250154,
                                             32336703,
                                             32423309,
                                             32509974,
                                             32596696,
                                             32683476,
                                             32770313,
                                             32857208,
                                             32944161,
                                             33031171,
                                             33118238,
                                             33205363,
                                             33292544,
                                             33379783,
                                             33467079,
                                             33554432,
                                             33641842,
                                             33729308,
                                             33816832,
                                             33904412,
                                             33992048,
                                             34079741,
                                             34167491,
                                             34255297,
                                             34343159,
                                             34431078,
                                             34519052,
                                             34607083,
                                             34695170,
                                             34783312,
                                             34871511,
                                             34959765,
                                             35048075,
                                             35136441,
                                             35224862,
                                             35313339,
                                             35401872,
                                             35490459,
                                             35579102,
                                             35667801,
                                             35756554,
                                             35845363,
                                             35934226,
                                             36023145,
                                             36112118,
                                             36201147,
                                             36290230,
                                             36379367,
                                             36468560,
                                             36557807,
                                             36647108,
                                             36736464,
                                             36825875,
                                             36915339,
                                             37004858,
                                             37094431,
                                             37184058,
                                             37273739,
                                             37363474,
                                             37453263,
                                             37543106,
                                             37633003,
                                             37722953,
                                             37812957,
                                             37903015,
                                             37993126,
                                             38083291,
                                             38173509,
                                             38263780,
                                             38354105,
                                             38444483,
                                             38534914,
                                             38625398,
                                             38715935,
                                             38806525,
                                             38897168,
                                             38987864,
                                             39078612,
                                             39169414,
                                             39260268,
                                             39351174,
                                             39442133,
                                             39533145,
                                             39624209,
                                             39715325,
                                             39806494,
                                             39897714,
                                             39988987,
                                             40080312,
                                             40171690,
                                             40263119,
                                             40354600,
                                             40446133,
                                             40537718,
                                             40629354,
                                             40721042,
                                             40812782,
                                             40904574,
                                             40996417,
                                             41088311,
                                             41180257,
                                             41272254,
                                             41364303,
                                             41456402,
                                             41548553,
                                             41640755,
                                             41733008,
                                             41825313,
                                             41917668,
                                             42010074,
                                             42102530,
                                             42195038,
                                             42287596,
                                             42380205,
                                             42472865,
                                             42565575,
                                             42658336,
                                             42751147,
                                             42844009,
                                             42936921,
                                             43029883,
                                             43122895,
                                             43215958,
                                             43309071,
                                             43402233,
                                             43495446,
                                             43588709,
                                             43682022,
                                             43775384,
                                             43868797,
                                             43962259,
                                             44055771,
                                             44149332,
                                             44242943,
                                             44336604,
                                             44430314,
                                             44524073,
                                             44617882,
                                             44711741,
                                             44805648,
                                             44899605,
                                             44993611,
                                             45087666,
                                             45181770,
                                             45275923,
                                             45370126,
                                             45464377,
                                             45558677,
                                             45653025,
                                             45747423,
                                             45841869,
                                             45936364,
                                             46030908,
                                             46125500,
                                             46220141,
                                             46314830,
                                             46409567,
                                             46504353,
                                             46599187,
                                             46694070,
                                             46789001,
                                             46883980,
                                             46979007,
                                             47074082,
                                             47169205,
                                             47264376,
                                             47359595,
                                             47454862,
                                             47550177,
                                             47645540,
                                             47740950,
                                             47836408,
                                             47931914,
                                             48027467,
                                             48123068,
                                             48218716,
                                             48314412,
                                             48410155,
                                             48505945,
                                             48601783,
                                             48697668,
                                             48793601,
                                             48889580,
                                             48985607,
                                             49081681,
                                             49177802,
                                             49273969,
                                             49370184,
                                             49466446,
                                             49562754,
                                             49659109,
                                             49755511,
                                             49851960,
                                             49948456,
                                             50044998,
                                             50141586,
                                             50238222,
                                             50334903,
                                             50431631,
                                             50528406,
                                             50625227,
                                             50722094,
                                             50819007,
                                             50915967,
                                             51012973,
                                             51110025,
                                             51207123,
                                             51304267,
                                             51401457,
                                             51498694,
                                             51595976,
                                             51693304,
                                             51790677,
                                             51888097,
                                             51985562,
                                             52083073,
                                             52180630,
                                             52278232,
                                             52375880,
                                             52473573,
                                             52571312,
                                             52669097,
                                             52766926,
                                             52864801,
                                             52962722,
                                             53060688,
                                             53158699,
                                             53256755,
                                             53354856,
                                             53453002,
                                             53551194,
                                             53649430,
                                             53747712,
                                             53846038,
                                             53944410,
                                             54042826,
                                             54141287,
                                             54239793,
                                             54338344,
                                             54436939,
                                             54535579,
                                             54634263,
                                             54732993,
                                             54831766,
                                             54930585,
                                             55029447,
                                             55128354,
                                             55227306,
                                             55326302,
                                             55425342,
                                             55524426,
                                             55623555,
                                             55722728,
                                             55821945,
                                             55921206,
                                             56020511,
                                             56119860,
                                             56219253,
                                             56318690,
                                             56418171,
                                             56517696,
                                             56617265,
                                             56716877,
                                             56816534,
                                             56916234,
                                             57015977,
                                             57115765,
                                             57215595,
                                             57315470,
                                             57415388,
                                             57515349,
                                             57615354,
                                             57715403,
                                             57815494,
                                             57915629,
                                             58015808,
                                             58116030,
                                             58216294,
                                             58316602,
                                             58416954,
                                             58517348,
                                             58617785,
                                             58718266,
                                             58818789,
                                             58919356,
                                             59019965,
                                             59120617,
                                             59221312,
                                             59322050,
                                             59422831,
                                             59523654,
                                             59624521,
                                             59725429,
                                             59826381,
                                             59927375,
                                             60028412,
                                             60129491,
                                             60230613,
                                             60331777,
                                             60432983,
                                             60534232,
                                             60635524,
                                             60736857,
                                             60838233,
                                             60939651,
                                             61041112,
                                             61142614,
                                             61244159,
                                             61345746,
                                             61447375,
                                             61549046,
                                             61650759,
                                             61752513,
                                             61854310,
                                             61956149,
                                             62058030,
                                             62159952,
                                             62261916,
                                             62363922,
                                             62465970,
                                             62568059,
                                             62670191,
                                             62772363,
                                             62874578,
                                             62976833,
                                             63079131,
                                             63181470,
                                             63283850,
                                             63386272,
                                             63488735,
                                             63591239,
                                             63693785,
                                             63796372,
                                             63899001,
                                             64001670,
                                             64104381,
                                             64207133,
                                             64309926,
                                             64412760,
                                             64515636,
                                             64618552,
                                             64721509,
                                             64824507,
                                             64927546,
                                             65030627,
                                             65133747,
                                             65236909,
                                             65340112,
                                             65443355,
                                             65546639,
                                             65649964,
                                             65753329,
                                             65856735,
                                             65960182,
                                             66063669,
                                             66167197,
                                             66270765,
                                             66374374,
                                             66478023,
                                             66581713,
                                             66685443,
                                             66789213,
                                             66893024,
                                             66996875,
                                             67100766,
                                             67204698,
                                             67308669,
                                             67412681,
                                             67516733,
                                             67620825,
                                             67724957,
                                             67829130,
                                             67933342,
                                             68037594,
                                             68141886,
                                             68246218,
                                             68350590,
                                             68455002,
                                             68559454,
                                             68663945,
                                             68768476,
                                             68873047,
                                             68977658,
                                             69082308,
                                             69186998,
                                             69291728,
                                             69396497,
                                             69501306,
                                             69606154,
                                             69711042,
                                             69815969,
                                             69920936,
                                             70025942,
                                             70130987,
                                             70236072,
                                             70341196,
                                             70446360,
                                             70551562,
                                             70656804,
                                             70762085,
                                             70867406,
                                             70972765,
                                             71078164,
                                             71183601,
                                             71289078,
                                             71394594,
                                             71500149,
                                             71605742,
                                             71711375,
                                             71817046,
                                             71922757,
                                             72028506,
                                             72134294,
                                             72240121,
                                             72345987,
                                             72451892,
                                             72557835,
                                             72663817,
                                             72769837,
                                             72875896,
                                             72981994,
                                             73088130,
                                             73194305,
                                             73300519,
                                             73406770,
                                             73513061,
                                             73619390,
                                             73725757,
                                             73832162,
                                             73938606,
                                             74045088,
                                             74151609,
                                             74258168,
                                             74364765,
                                             74471400,
                                             74578073,
                                             74684785,
                                             74791535,
                                             74898323,
                                             75005149,
                                             75112012,
                                             75218914,
                                             75325854,
                                             75432832,
                                             75539848,
                                             75646902,
                                             75753994,
                                             75861123,
                                             75968291,
                                             76075496,
                                             76182739,
                                             76290020,
                                             76397338,
                                             76504694,
                                             76612088,
                                             76719520,
                                             76826989,
                                             76934495,
                                             77042040,
                                             77149622,
                                             77257241,
                                             77364898,
                                             77472592,
                                             77580324,
                                             77688093,
                                             77795899,
                                             77903743,
                                             78011625,
                                             78119543,
                                             78227499,
                                             78335492,
                                             78443522,
                                             78551590,
                                             78659695,
                                             78767836,
                                             78876015,
                                             78984232,
                                             79092485,
                                             79200775,
                                             79309102,
                                             79417467,
                                             79525868,
                                             79634306,
                                             79742781,
                                             79851293,
                                             79959842,
                                             80068428,
                                             80177050,
                                             80285710,
                                             80394406,
                                             80503139,
                                             80611908,
                                             80720715,
                                             80829558,
                                             80938438,
                                             81047354,
                                             81156307,
                                             81265296,
                                             81374322,
                                             81483385,
                                             81592484,
                                             81701620,
                                             81810792,
                                             81920000,
                                             82029245,
                                             82138526,
                                             82247844,
                                             82357198,
                                             82466588,
                                             82576014,
                                             82685477,
                                             82794976,
                                             82904512,
                                             83014083,
                                             83123691,
                                             83233334,
                                             83343014,
                                             83452730,
                                             83562482,
                                             83672271,
                                             83782095,
                                             83891955,
                                             84001851,
                                             84111783,
                                             84221751,
                                             84331755,
                                             84441795};

static WORD32 ixheaacd_esc_nb_offset[8] = {0,      131072, 262144, 393216,
                                           524288, 655360, 786432, 917504};

static void ixheaacd_arith_map_context(WORD32 pres_n, WORD32 prev_n,
                                       WORD8 *c_prev, WORD8 *c,
                                       WORD32 arith_reset_flag,
                                       WORD8 *ptr_scratch) {
  WORD32 i, k;
  FLOAT32 ratio;
  WORD8 *c_prev_tmp = ptr_scratch;
  WORD8 *c_tmp = ptr_scratch + 516;

  if (arith_reset_flag) {
    for (i = 0; i < (1024 / 2) + 4; i++) {
      c_prev[i] = 0;
      c[i] = 0;
    }

  } else {
    for (i = 2; i < (prev_n / 2 + 4); i++) {
      c_prev_tmp[i] = c_prev[i];
      c_tmp[i] = c[i];
    }

    ratio = (FLOAT32)(prev_n) / (FLOAT32)(pres_n);
    for (i = 0; i < (pres_n / 2); i++) {
      k = (WORD32)((FLOAT32)(i)*ratio);
      c_prev[2 + i] = c_prev_tmp[2 + k];
      c[2 + i] = c_tmp[2 + k];
    }
    c_prev[(pres_n / 2) + 2] = c_prev_tmp[(prev_n / 2) + 2];
    c[(pres_n / 2) + 3] = c_tmp[(prev_n / 2) + 3];
  }
}

VOID ixheaacd_copy_to_bitbuff(ia_bit_buf_struct *it_bit_buff_src,
                              ia_bit_buf_struct *it_bit_buff_dst) {
  it_bit_buff_dst->ptr_bit_buf_base = it_bit_buff_src->ptr_bit_buf_base;
  it_bit_buff_dst->ptr_bit_buf_end = it_bit_buff_src->ptr_bit_buf_end;

  it_bit_buff_dst->ptr_read_next = it_bit_buff_src->ptr_read_next;

  it_bit_buff_dst->bit_pos = it_bit_buff_src->bit_pos;
  it_bit_buff_dst->cnt_bits = it_bit_buff_src->cnt_bits;

  it_bit_buff_dst->size = it_bit_buff_src->size;

  it_bit_buff_dst->max_size = it_bit_buff_src->max_size;
}

static WORD32 ixheaacd_arith_get_context(WORD8 *c_prev, WORD8 *c_pres,
                                         WORD32 *c, WORD32 i) {
  WORD32 tmp = (WORD32)c_prev[1] << 12;

  *c = *c >> 4;
  *c = *c + tmp;
  *c = (*c & 0xFFF0) + c_pres[-1];

  if (i > 3) {
    if ((c_pres[-1] + c_pres[-2] + c_pres[-3]) < 5) {
      return (*c + 0x10000);
    }
  }

  return (*c);
}

static WORD32 ixheaacd_arith_first_symbol(ia_bit_buf_struct *it_bit_buff,
                                          state_arith *s) {
  register WORD32 val;

  WORD32 bit_count = 16;

  val = 0;
  val = ixheaacd_read_bits_buf(it_bit_buff, 16);

  s->low = 0;
  s->high = 65535;
  s->value = val;

  return bit_count;
}

static UWORD32 ixheaacd_arith_get_pk(UWORD32 c) {
  UWORD32 j;
  WORD32 i, i_min, i_max;

  i_min = -1;
  i = i_min;
  i_max = 742 - 1;
  while ((i_max - i_min) > 1) {
    i = i_min + ((i_max - i_min) >> 1);
    j = ixheaacd_ari_hash_m[i];
    if (c < j)
      i_max = i;
    else if (c > j)
      i_min = i;
    else
      return (UWORD32)ixheaacd_ari_hash_m_1[i];
  }

  return (ixheaacd_ari_lookup_m[i_max]);
}

static WORD32 ixheaacd_arith_decode(ia_bit_buf_struct *it_bit_buff,
                                    WORD32 bit_count, WORD32 *m, state_arith *s,
                                    UWORD16 const *cum_freq, WORD32 cfl) {
  register WORD32 symbol;
  register WORD32 low, high, range, value;
  register WORD32 cum;
  register UWORD16 const *p;
  register UWORD16 const *q;

  low = s->low;
  high = s->high;
  value = s->value;

  range = high - low + 1;
  cum = ((((WORD32)(value - low + 1)) << 14) - ((WORD32)1)) / ((WORD32)range);

  p = cum_freq - 1;

  do {
    q = p + (cfl >> 1);

    if (*q > cum) {
      p = q;
      cfl++;
    }
    cfl >>= 1;
  } while (cfl > 1);

  symbol = p - cum_freq + 1;

  if (symbol) high = low + ((range * cum_freq[symbol - 1]) >> 14) - 1;

  low += ((range * cum_freq[symbol]) >> 14);

  for (;;) {
    if (high < 32768) {
    } else if (low >= 32768) {
      value -= 32768;
      low -= 32768;
      high -= 32768;
    } else if (low >= 16384 && high < 49152) {
      value -= 16384;
      low -= 16384;
      high -= 16384;
    } else
      break;

    low += low;
    high += high + 1;

    value = (value << 1) | ixheaacd_read_bits_buf(it_bit_buff, 1);
    bit_count++;
  }

  s->low = low;
  s->high = high;
  s->value = value;

  *m = symbol;

  return bit_count;
}

WORD32 ixheaacd_arth_decoding_level2(ia_bit_buf_struct *it_bit_buff,
                                     WORD8 *c_prev, WORD8 *c_pres, WORD32 n,
                                     WORD32 pres_n, WORD32 *quant) {
  state_arith as;
  WORD32 a, b;
  WORD32 i, j, lev, pki, esc_nb;
  WORD32 m;
  WORD32 c = 0;
  struct ia_bit_buf_struct it_bit_buff_temp;
  WORD32 bit_count = 0;
  WORD32 s1;
  WORD32 temp;
  WORD32 bit_count_5;
  ixheaacd_copy_to_bitbuff(it_bit_buff, &it_bit_buff_temp);

  for (i = 0; i < pres_n; i++) {
    c_prev[i] = c_pres[i];
    c_pres[i] = 1;
  }

  bit_count = ixheaacd_arith_first_symbol(&it_bit_buff_temp, &as);

  c = (WORD32)c_prev[0] << 12;
  lev = 0;

  for (i = 0; i < n; i++) {
    s1 = ixheaacd_arith_get_context(c_prev + i, c_pres + i, &c, i);

    for (lev = esc_nb = 0;;) {
      pki = ixheaacd_arith_get_pk(s1 + ixheaacd_esc_nb_offset[esc_nb]);
      bit_count = ixheaacd_arith_decode(&it_bit_buff_temp, bit_count, &m, &as,
                                        ixheaacd_ari_cf_m[pki], 17);
      if (bit_count == -1) {
        return -1;
      }

      if (m < ARITH_ESCAPE) {
        break;
      }

      lev += 1;
      esc_nb = lev;

      if (esc_nb > 7) {
        esc_nb = 7;
      }
      if (esc_nb < 0) {
        esc_nb = 0;
        return -1;
      }
    }

    if (m == 0) {
      if (esc_nb > 0) break;

      quant[2 * i + 0] = 0;
      quant[2 * i + 1] = 0;
      c_pres[i] = 1;
    } else {
      b = m >> 2;
      a = m & 0x3;

      for (j = 0; j < lev; j++) {
        WORD32 lsbidx = (a == 0) ? 1 : ((b == 0) ? 0 : 2);
        bit_count = ixheaacd_arith_decode(&it_bit_buff_temp, bit_count, &m, &as,
                                          ixheaacd_ari_cf_r[lsbidx], 4);
        if (bit_count == -1) {
          return -1;
        }
        a = (a << 1) | (m & 1);
        b = (b << 1) | ((m >> 1) & 1);
      }
      if ((a > (8183)) || (b > (8183))) return -1;
      if ((a < (-8183)) || (b < (-8183))) return -1;
      quant[2 * i + 0] = a;
      quant[2 * i + 1] = b;
      temp = a + b + 1;
      c_pres[i] = (WORD8)temp;
      if (temp > 0xF) {
        c_pres[i] = 0xF;
      }
    }
  }

  bit_count -= 16 - 2;
  if (bit_count > it_bit_buff->cnt_bits)
    return IA_ENHAACPLUS_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES;

  if (bit_count > 0) {
    bit_count_5 = bit_count >> 5;
    for (i = 0; i < bit_count_5; i++) ixheaacd_read_bits_buf(it_bit_buff, 32);
    ixheaacd_read_bits_buf(it_bit_buff, bit_count & 31);
  }

  for (i = 0; i < pres_n; i++) {
    WORD32 temp0 = quant[0];
    WORD32 temp1 = quant[1];
    if (temp0) {
      m = ixheaacd_read_bits_buf(it_bit_buff, 1);
      bit_count++;

      m = (m << 1) * temp0;
      temp0 = m - (temp0);
    }

    if (temp1) {
      m = ixheaacd_read_bits_buf(it_bit_buff, 1);
      bit_count++;

      m = (m << 1) * temp1;
      temp1 = m - (temp1);
    }
    if ((temp0 > (8183)) || (temp1 > (8183))) return -1;
    if ((temp0 < (-8183)) || (temp1 < (-8183))) return -1;
    *quant++ = temp0;
    *quant++ = temp1;
  }
  return 0;
}

static WORD32 ixheaacd_randomsign_fix(UWORD32 *seed) {
  WORD32 sign = 0;
  *seed = (UWORD32)(((UWORD64)(*seed) * (UWORD64)69069) + 5);
  if (((*seed) & 0x10000) > 0) {
    sign = -1;
  } else {
    sign = +1;
  }
  return sign;
}

static VOID ixheaacd_esc_iquant(WORD32 *q, WORD32 *coef, WORD32 noise_level,
                                WORD32 with_noise, UWORD32 *seed_value,
                                WORD32 length, WORD64 fac_fix) {
  WORD32 q1 = 0;
  WORD64 temp;
  WORD16 interp;
  WORD32 i;
  WORD16 flag;

  for (i = 0; i < length; i++) {
    flag = 1;

    if (with_noise) {
      if (q[i] == 0) {
        coef[i] = (ixheaacd_randomsign_fix(seed_value) * noise_level);
        temp = (fac_fix * coef[i]);
        coef[i] = (WORD32)(temp >> 25);
        continue;
      }
    }

    if (q[i] >= 8192) {
      q[i] = 8191;
    }

    if (q[i] < 0) {
      flag = -1;
      q[i] = -q[i];
    }

    if (q[i] < 1024) {
      coef[i] = flag * ixheaacd_pow_table_Q13[q[i]];
    } else {
      q1 = (q[i]) >> 3;

      interp = q[i] - (q1 << 3);

      coef[i] = ixheaacd_pow_table_Q13[q1 + 1] - ixheaacd_pow_table_Q13[q1];

      coef[i] = (WORD32)(coef[i] * (WORD32)interp);

      coef[i] = coef[i] + (ixheaacd_pow_table_Q13[q1] << 3);

      coef[i] = flag * (coef[i] << 1);
    }
    temp = ixheaacd_mult64_sat(fac_fix, (WORD64)coef[i]);

    coef[i] = (WORD32)(temp >> 22);
  }

  return;
}

static void ixheaacd_apply_scfs_and_nf(WORD32 noise_filling,
                                       ia_usac_data_struct *usac_data,
                                       WORD32 *quant, WORD32 noise_level,
                                       WORD32 noise_offset, UWORD8 max_sfb,
                                       WORD32 ch) {
  WORD32 grp = 0, win_tot = 0, sfb = 0;
  WORD32 noise_filling_start_offset = 0;
  WORD32 fac = 0, length = 0;
  WORD64 fac_fix;
  WORD32 noise_level_fix = 0;
  ia_sfb_info_struct *pstr_sfb_info = usac_data->pstr_sfb_info[ch];
  WORD32 *coef = &usac_data->coef_fix[ch][0];
  WORD16 *factors = usac_data->factors[ch];
  UWORD32 *seed_value = &usac_data->seed_value[ch];

  if (noise_filling) {
    noise_level_fix = ixheaacd_pow_14_3[noise_level];
    noise_filling_start_offset = (usac_data->ccfl == 768)
                                     ? (pstr_sfb_info->islong ? 120 : 15)
                                     : (pstr_sfb_info->islong ? 160 : 20);
  }

  for (grp = 0; grp < pstr_sfb_info->num_groups; grp++) {
    WORD32 grp_win = 0;
    for (sfb = 0; sfb < (WORD32)max_sfb; sfb++) {
      WORD32 noise_filling_present = 0;
      WORD32 band_quantized_to_zero = 1;

      WORD32 sfb_offset = win_tot * pstr_sfb_info->sfb_per_sbk;
      fac = (WORD32)(factors[sfb_offset + sfb] - SF_OFFSET);

      if (noise_filling) {
        for (grp_win = 0; grp_win < pstr_sfb_info->group_len[grp]; grp_win++) {
          WORD32 win = grp_win + win_tot;
          WORD32 ixheaacd_drc_offset = win * pstr_sfb_info->bins_per_sbk;
          WORD32 start = (sfb == 0) ? 0 : pstr_sfb_info->ptr_sfb_tbl[sfb - 1];
          WORD32 idx = 0;
          for (idx = start; idx < pstr_sfb_info->ptr_sfb_tbl[sfb]; idx++) {
            if (quant[ixheaacd_drc_offset + idx] != 0) {
              band_quantized_to_zero = 0;
              break;
            }
            if (!band_quantized_to_zero) break;
          }
        }
      }

      if (band_quantized_to_zero && noise_filling) fac += (noise_offset - 16);
      {
        WORD16 exp, frac;

        exp = fac >> 2;
        frac = fac & 3;

        if (exp > 31) exp = 31;

        if (fac < 0)
          fac_fix = 0;
        else {
          fac_fix = (WORD64)((WORD64)ixheaacd_table_frac[3 + frac] *
                             (WORD64)ixheaacd_table_exp[exp]);
          fac_fix >>= 15;
        }
      }

      for (grp_win = 0; grp_win < pstr_sfb_info->group_len[grp]; grp_win++) {
        WORD32 win = win_tot + grp_win;
        WORD32 start = (sfb == 0) ? 0 : pstr_sfb_info->ptr_sfb_tbl[sfb - 1];
        WORD32 ixheaacd_drc_offset = win * pstr_sfb_info->bins_per_sbk;

        if (noise_filling) {
          noise_filling_present =
              (start >= noise_filling_start_offset) & noise_filling;
        }

        length = pstr_sfb_info->ptr_sfb_tbl[sfb] - start;

        ixheaacd_esc_iquant(&quant[ixheaacd_drc_offset + start],
                            &coef[ixheaacd_drc_offset + start], noise_level_fix,
                            noise_filling_present, seed_value, length, fac_fix);
      }
    }

    win_tot += pstr_sfb_info->group_len[grp];
  }

  return;
}

WORD32 ixheaacd_ac_spectral_data(ia_usac_data_struct *usac_data,
                                 WORD32 max_spec_coefficients,
                                 WORD32 noise_level, WORD32 noise_offset,
                                 WORD32 arith_pres_n,
                                 ia_bit_buf_struct *it_bit_buff, UWORD8 max_sfb,
                                 WORD32 arith_reset_flag, WORD32 noise_filling,
                                 WORD32 ch) {
  WORD32 i;

  WORD32 *x_ac_dec = usac_data->x_ac_dec;
  WORD32 sbk;
  WORD32 err_code = 0;

  const WORD32 max_win_len = usac_data->pstr_sfb_info[ch]->max_win_len;
  WORD8 *c_prev = &usac_data->c_prev[ch][0];
  WORD8 *c_pres = &usac_data->c[ch][0];

  WORD8 *ptr_scratch_buf = (WORD8 *)&usac_data->scratch_buffer[0];

  memset(x_ac_dec, 0, 1024 * sizeof(WORD32));

  ixheaacd_arith_map_context(arith_pres_n, usac_data->arith_prev_n[ch], c_prev,
                             c_pres, arith_reset_flag, ptr_scratch_buf);

  usac_data->arith_prev_n[ch] = arith_pres_n;

  if (max_spec_coefficients > 0) {
    for (sbk = 0; sbk < max_win_len; sbk++) {
      err_code = ixheaacd_arth_decoding_level2(
          it_bit_buff, c_prev + 2, c_pres + 2, max_spec_coefficients / 2,
          arith_pres_n / 2, &x_ac_dec[sbk * arith_pres_n]);
      if (err_code != 0) {
        return err_code;
      }

      for (i = max_spec_coefficients / 2; i < arith_pres_n / 2; i++) {
        x_ac_dec[sbk * arith_pres_n + 2 * i + 0] = 0;
        x_ac_dec[sbk * arith_pres_n + 2 * i + 1] = 0;
      }
    }
  } else {
    for (i = 0; i < (arith_pres_n / 2); i++) {
      c_pres[i + 2] = 1;
    }
  }

  ixheaacd_apply_scfs_and_nf(noise_filling, usac_data, x_ac_dec, noise_level,
                             noise_offset, max_sfb, ch);

  return 0;
}

WORD32 ixheaacd_arith_data(ia_td_frame_data_struct *pstr_td_frame_data,
                           WORD32 *x_ac_dec, ia_usac_data_struct *usac_data,
                           ia_bit_buf_struct *it_bit_buff,
                           WORD32 first_tcx_flag, WORD32 k) {
  WORD32 *arith_prev_n = &usac_data->arith_prev_n[usac_data->present_chan];
  WORD32 arith_reset_flag =
      first_tcx_flag && pstr_td_frame_data->arith_reset_flag;
  WORD32 err_code = 0;
  WORD32 tcx_size = pstr_td_frame_data->tcx_lg[k];
  WORD8 *c_prev = usac_data->c_prev[usac_data->present_chan];
  WORD8 *c_pres = usac_data->c[usac_data->present_chan];

  WORD8 *ptr_scratch_buf = (WORD8 *)&usac_data->scratch_buffer[0];

  memset(x_ac_dec, 0, tcx_size * sizeof(WORD32));

  ixheaacd_arith_map_context(tcx_size, *arith_prev_n, c_prev, c_pres,
                             arith_reset_flag, ptr_scratch_buf);

  *arith_prev_n = tcx_size;

  err_code =
      ixheaacd_arth_decoding_level2(it_bit_buff, c_prev + 2, c_pres + 2,
                                    tcx_size / 2, tcx_size / 2, x_ac_dec);

  return err_code;
}