亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? unbitarrayold.cpp

?? Lossless Audio 縮解壓 window
?? CPP
字號:
#include "All.h"
#ifdef BACKWARDS_COMPATIBILITY

#include "../APEInfo.h"
#include "UnBitarrayOld.h"
#include "../BitArray.h"

const uint32 K_SUM_MIN_BOUNDARY_OLD[32] = {0,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,0,0,0,0,0,0};
const uint32 K_SUM_MAX_BOUNDARY_OLD[32] = {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,0,0,0,0,0,0,0};
const uint32 Powers_of_Two[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};
const uint32 Powers_of_Two_Reversed[32] = {2147483648,1073741824,536870912,268435456,134217728,67108864,33554432,16777216,8388608,4194304,2097152,1048576,524288,262144,131072,65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1};
const uint32 Powers_of_Two_Minus_One[33] = {0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,4294967295};
const uint32 Powers_of_Two_Minus_One_Reversed[33] = {4294967295,2147483647,1073741823,536870911,268435455,134217727,67108863,33554431,16777215,8388607,4194303,2097151,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,0};

const uint32 K_SUM_MIN_BOUNDARY[32] = {0,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,0,0,0,0};
const uint32 K_SUM_MAX_BOUNDARY[32] = {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,0,0,0,0,0};

/***********************************************************************************
Construction
***********************************************************************************/
CUnBitArrayOld::CUnBitArrayOld(IAPEDecompress * pAPEDecompress, int nVersion) 
{
    int nBitArrayBytes = 262144;

    // calculate the bytes
    if (nVersion <= 3880)
    {
        int nMaxFrameBytes = (pAPEDecompress->GetInfo(APE_INFO_BLOCKS_PER_FRAME) * 50) / 8;
        nBitArrayBytes = 65536;
        while (nBitArrayBytes < nMaxFrameBytes)
        {
            nBitArrayBytes <<= 1;
        }
        
        nBitArrayBytes = max(nBitArrayBytes, 262144);
    }
    else if (nVersion <= 3890)
    {
        nBitArrayBytes = 65536;
    }
    else
    {
        // error
    }
    
    CreateHelper(GET_IO(pAPEDecompress), nBitArrayBytes, nVersion);

    // set the refill threshold
    if (m_nVersion <= 3880)
        m_nRefillBitThreshold = (m_nBits - (16384 * 8));
    else
        m_nRefillBitThreshold = (m_nBits - 512);
}

CUnBitArrayOld::~CUnBitArrayOld()
{
    SAFE_ARRAY_DELETE(m_pBitArray)
}

////////////////////////////////////////////////////////////////////////////////////
// Gets the number of m_nBits of data left in the m_nCurrentBitIndex array
////////////////////////////////////////////////////////////////////////////////////
uint32 CUnBitArrayOld::GetBitsRemaining()
{
    return (m_nElements * 32 - m_nCurrentBitIndex);
}

////////////////////////////////////////////////////////////////////////////////////
// Gets a rice value from the array
////////////////////////////////////////////////////////////////////////////////////
uint32 CUnBitArrayOld::DecodeValueRiceUnsigned(uint32 k) 
{
    // variable declares
    uint32 v;
    
    // plug through the string of 0's (the overflow)
    uint32 BitInitial = m_nCurrentBitIndex;
    while (!(m_pBitArray[m_nCurrentBitIndex >> 5] & Powers_of_Two_Reversed[m_nCurrentBitIndex++ & 31])) {}
    
    // if k = 0, your done
    if (k == 0)
        return (m_nCurrentBitIndex - BitInitial - 1);
    
    // put the overflow value into v
    v = (m_nCurrentBitIndex - BitInitial - 1) << k;
    
    return v | DecodeValueXBits(k);
}

////////////////////////////////////////////////////////////////////////////////////
// Get the optimal k for a given value
////////////////////////////////////////////////////////////////////////////////////
__inline uint32 CUnBitArrayOld::Get_K(uint32 x) 
{
    if (x == 0)    return 0;

    uint32 k = 0;
    while (x >= Powers_of_Two[++k]) {}
    return k;    
}

unsigned int CUnBitArrayOld::DecodeValue(DECODE_VALUE_METHOD DecodeMethod, int nParam1, int nParam2)
{
    switch (DecodeMethod)
    {
    case DECODE_VALUE_METHOD_UNSIGNED_INT:
        return DecodeValueXBits(32);
    case DECODE_VALUE_METHOD_UNSIGNED_RICE:
        return DecodeValueRiceUnsigned(nParam1);
    case DECODE_VALUE_METHOD_X_BITS:
        return DecodeValueXBits(nParam1);
    }

    return 0;
}

////////////////////////////////////////////////////////////////////////////////////
// Generates an array from the m_nCurrentBitIndexarray
////////////////////////////////////////////////////////////////////////////////////
void CUnBitArrayOld::GenerateArrayOld(int* Output_Array, uint32 Number_of_Elements, int Minimum_nCurrentBitIndex_Array_Bytes) {

    //variable declarations
    uint32 K_Sum;
    uint32 q;
    uint32 kmin, kmax;
    uint32 k;
    uint32 Max;
    int *p1, *p2;

    // fill bit array if necessary
    // could use seek information to determine what the max was...
    uint32 Max_Bits_Needed = Number_of_Elements * 50;

    if (Minimum_nCurrentBitIndex_Array_Bytes > 0) 
    {
        // this is actually probably double what is really needed
        // we can only calculate the space needed for both arrays in multichannel
        Max_Bits_Needed = ((Minimum_nCurrentBitIndex_Array_Bytes + 4) * 8);
    }
    
    if (Max_Bits_Needed > GetBitsRemaining())
        FillBitArray();

    // decode the first 5 elements (all k = 10)
    Max = (Number_of_Elements < 5) ? Number_of_Elements : 5;
    for (q = 0; q < Max; q++) 
    {
        Output_Array[q] = DecodeValueRiceUnsigned(10);
    }
    
    // quit if that was all
    if (Number_of_Elements <= 5) 
    { 
        for (p2 = &Output_Array[0]; p2 < &Output_Array[Number_of_Elements]; p2++)
            *p2 = (*p2 & 1) ? (*p2 >> 1) + 1 : -(*p2 >> 1);
        return; 
    }

    // update k and K_Sum
    K_Sum = Output_Array[0] + Output_Array[1] + Output_Array[2] + Output_Array[3] + Output_Array[4];
    k = Get_K(K_Sum / 10);

    // work through the rest of the elements before the primary loop
    Max = (Number_of_Elements < 64) ? Number_of_Elements : 64;
    for (q = 5; q < Max; q++) 
    {
        Output_Array[q] = DecodeValueRiceUnsigned(k);
        K_Sum += Output_Array[q];
        k = Get_K(K_Sum / (q  + 1) / 2);
    }

    // quit if that was all
    if (Number_of_Elements <= 64) 
    { 
        for (p2 = &Output_Array[0]; p2 < &Output_Array[Number_of_Elements]; p2++)
            *p2 = (*p2 & 1) ? (*p2 >> 1) + 1 : -(*p2 >> 1);
        return; 
    }
        
    // set all of the variables up for the primary loop
    uint32 v, Bit_Array_Index;
    k = Get_K(K_Sum >> 7);
    kmin = K_SUM_MIN_BOUNDARY_OLD[k];
    kmax = K_SUM_MAX_BOUNDARY_OLD[k];
    p1 = &Output_Array[64]; p2 = &Output_Array[0];

    // the primary loop
    for (p1 = &Output_Array[64], p2 = &Output_Array[0]; p1 < &Output_Array[Number_of_Elements]; p1++, p2++) 
    {
        // plug through the string of 0's (the overflow)
        uint32 Bit_Initial = m_nCurrentBitIndex;
        while (!(m_pBitArray[m_nCurrentBitIndex >> 5] & Powers_of_Two_Reversed[m_nCurrentBitIndex++ & 31])) {}
    
        // if k = 0, your done
        if (k == 0) 
        {
            v = (m_nCurrentBitIndex - Bit_Initial - 1);
        }
        else 
        {
            // put the overflow value into v
            v = (m_nCurrentBitIndex - Bit_Initial - 1) << k;
    
            // store the bit information and incement the bit pointer by 'k'
            Bit_Array_Index = m_nCurrentBitIndex >> 5;
            unsigned int Bit_Index = m_nCurrentBitIndex & 31;
            m_nCurrentBitIndex += k;

            // figure the extra bits on the left and the left value
            int Left_Extra_Bits = (32 - k) - Bit_Index;
            unsigned int Left_Value = m_pBitArray[Bit_Array_Index] & Powers_of_Two_Minus_One_Reversed[Bit_Index];
            
            if (Left_Extra_Bits >= 0) 
                v |= (Left_Value >> Left_Extra_Bits);
            else 
                v |= (Left_Value << -Left_Extra_Bits) | (m_pBitArray[Bit_Array_Index + 1] >> (32 + Left_Extra_Bits));
        }    

        *p1 = v;
        K_Sum += *p1 - *p2;

        // convert *p2 to unsigned
        *p2 = (*p2 % 2) ? (*p2 >> 1) + 1 : -(*p2 >> 1);

        // adjust k if necessary
        if ((K_Sum < kmin) || (K_Sum >= kmax)) 
        {
            if (K_Sum < kmin) 
                while (K_Sum < K_SUM_MIN_BOUNDARY_OLD[--k]) {}
            else
                while (K_Sum >= K_SUM_MAX_BOUNDARY_OLD[++k]) {}

            kmax = K_SUM_MAX_BOUNDARY_OLD[k];
            kmin = K_SUM_MIN_BOUNDARY_OLD[k];
        }
    }

    for (; p2 < &Output_Array[Number_of_Elements]; p2++)
        *p2 = (*p2 & 1) ? (*p2 >> 1) + 1 : -(*p2 >> 1);
}

void CUnBitArrayOld::GenerateArray(int *pOutputArray, int nElements, int nBytesRequired) 
{
    if (m_nVersion < 3860)
    {
        GenerateArrayOld(pOutputArray, nElements, nBytesRequired);
    }
    else if (m_nVersion <= 3890)
    {
        GenerateArrayRice(pOutputArray, nElements, nBytesRequired);
    }
    else
    {    
        // error
    }
}

void CUnBitArrayOld::GenerateArrayRice(int* Output_Array, uint32 Number_of_Elements, int Minimum_nCurrentBitIndex_Array_Bytes) 
{
    /////////////////////////////////////////////////////////////////////////////
    // decode the bit array
    /////////////////////////////////////////////////////////////////////////////
    
    k = 10;
    K_Sum = 1024 * 16;

    if (m_nVersion <= 3880)
    {
        // the primary loop
        for (int *p1 = &Output_Array[0]; p1 < &Output_Array[Number_of_Elements]; p1++) 
        {
            *p1 = DecodeValueNew(FALSE);
        }
    }
    else
    {
        // the primary loop
        for (int *p1 = &Output_Array[0]; p1 < &Output_Array[Number_of_Elements]; p1++) 
        {
            *p1 = DecodeValueNew(TRUE);
        }
    }
}

__inline int CUnBitArrayOld::DecodeValueNew(BOOL bCapOverflow)
{
    // make sure there is room for the data
    // this is a little slower than ensuring a huge block to start with, but it's safer
    if (m_nCurrentBitIndex > m_nRefillBitThreshold)
    {
        FillBitArray();
    }
    
    unsigned int v;
    
    // plug through the string of 0's (the overflow)
    uint32 Bit_Initial = m_nCurrentBitIndex;
    while (!(m_pBitArray[m_nCurrentBitIndex >> 5] & Powers_of_Two_Reversed[m_nCurrentBitIndex++ & 31])) {}
    
    int nOverflow = (m_nCurrentBitIndex - Bit_Initial - 1);
    
    if (bCapOverflow)
    {
        while (nOverflow >= 16)
        {
            k += 4;
            nOverflow -= 16;
        }
    }
    
    // if k = 0, your done
    if (k != 0)
    {
        // put the overflow value into v
        v = nOverflow << k;
        
        // store the bit information and incement the bit pointer by 'k'
        unsigned int Bit_Array_Index = m_nCurrentBitIndex >> 5;
        unsigned int Bit_Index = m_nCurrentBitIndex & 31;
        m_nCurrentBitIndex += k;
        
        // figure the extra bits on the left and the left value
        int Left_Extra_Bits = (32 - k) - Bit_Index;
        unsigned int Left_Value = m_pBitArray[Bit_Array_Index] & Powers_of_Two_Minus_One_Reversed[Bit_Index];
        
        if (Left_Extra_Bits >= 0) 
        {
            v |= (Left_Value >> Left_Extra_Bits);
        }
        else 
        {
            v |= (Left_Value << -Left_Extra_Bits) | (m_pBitArray[Bit_Array_Index + 1] >> (32 + Left_Extra_Bits));
        }
    }    
    else
    {
        v = nOverflow;
    }
    
    // update K_Sum
    K_Sum += v - ((K_Sum + 8) >> 4);
    
    // update k
    if (K_Sum < K_SUM_MIN_BOUNDARY[k]) 
        k--;
    else if (K_Sum >= K_SUM_MAX_BOUNDARY[k]) 
        k++;
    
    // convert to unsigned and save
    return (v & 1) ? (v >> 1) + 1 : -(int(v >> 1));
}

#endif // #ifdef BACKWARDS_COMPATIBILITY

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩激情一区二区| 一本高清dvd不卡在线观看| 亚洲一区在线视频观看| 最新国产精品久久精品| 国产精品三级电影| 国产精品初高中害羞小美女文| 日本一区二区视频在线| 中文字幕av一区 二区| 国产三级精品在线| 亚洲欧洲精品一区二区精品久久久| 亚洲国产精品精华液2区45| 国产欧美日韩中文久久| 国产精品久久国产精麻豆99网站| 国产精品高潮呻吟| 亚洲欧美一区二区三区孕妇| 一区二区三区国产精华| 日韩和欧美一区二区三区| 日本美女一区二区| 国内外成人在线| 成人精品小蝌蚪| 在线一区二区视频| 91精品国产综合久久婷婷香蕉 | 欧美丰满嫩嫩电影| 日韩免费看的电影| 中文字幕在线不卡一区| 亚洲一区二区三区激情| 精品一区二区三区免费毛片爱| 国产精品亚洲一区二区三区妖精 | 成人高清免费在线播放| 91蝌蚪porny| 日韩一区二区三免费高清| 欧美xingq一区二区| 亚洲婷婷综合久久一本伊一区| 亚洲成av人在线观看| 国产精品一二三四五| 欧美午夜精品电影| 国产精品视频一二| 日韩激情一二三区| 色菇凉天天综合网| 久久亚洲综合av| 亚洲在线视频网站| 成人一区在线观看| 日韩一区二区三区免费看 | 99久久免费视频.com| 欧美男同性恋视频网站| 国产亚洲一本大道中文在线| 亚洲一区二区三区四区不卡 | 136国产福利精品导航| 青青草一区二区三区| 色婷婷亚洲一区二区三区| 337p日本欧洲亚洲大胆精品| 亚洲激情图片qvod| 国产成人精品免费看| 欧美日韩mp4| 一区二区三区资源| 国产1区2区3区精品美女| 欧美一区永久视频免费观看| 亚洲欧美一区二区三区久本道91| 国产黄色精品网站| 亚洲精品一区二区三区在线观看| 亚洲一区在线免费观看| 色综合欧美在线视频区| 国产精品五月天| 国产一区二区三区四区在线观看| 日韩亚洲欧美在线| 日本亚洲天堂网| 4438x成人网最大色成网站| 樱花草国产18久久久久| 91丨porny丨首页| 亚洲青青青在线视频| 99久久er热在这里只有精品15| 中文字幕欧美区| 成人av电影免费在线播放| 国产日韩亚洲欧美综合| 国产成人精品一区二区三区网站观看| 日韩精品中文字幕在线不卡尤物| 午夜精品久久久久久久久久| 色屁屁一区二区| 亚洲精品成人少妇| 欧美日韩高清影院| 五月综合激情网| 欧美精品亚洲一区二区在线播放| 丝袜亚洲精品中文字幕一区| 欧美高清视频在线高清观看mv色露露十八 | 日韩午夜激情免费电影| 精品一区二区三区的国产在线播放| 日韩欧美一区中文| 激情五月激情综合网| 国产婷婷色一区二区三区| 成人国产在线观看| 亚洲欧美一区二区久久| 欧美日韩视频在线观看一区二区三区| 亚洲综合一区二区| 日韩欧美一级精品久久| 国产乱一区二区| 亚洲欧美日韩一区二区 | 日韩欧美国产综合| 国产成人午夜精品5599| 中文字幕一区在线观看| 欧美影院午夜播放| 久久99精品视频| 亚洲天堂网中文字| 777久久久精品| 国产99精品国产| 一区二区三区欧美日| 欧美一级免费观看| 白白色 亚洲乱淫| 三级成人在线视频| 国产日韩欧美制服另类| 91福利在线播放| 国产麻豆午夜三级精品| 亚洲精品菠萝久久久久久久| 日韩色视频在线观看| av网站免费线看精品| 免费成人在线网站| 日韩理论在线观看| 欧美xxxxx牲另类人与| 91久久精品一区二区三区| 理论电影国产精品| 亚洲精品国产品国语在线app| 亚洲精品在线观看网站| 色婷婷久久久亚洲一区二区三区| 麻豆精品视频在线观看免费| 亚洲视频资源在线| 26uuu精品一区二区 | 奇米888四色在线精品| 亚洲视频 欧洲视频| 久久噜噜亚洲综合| 欧美日韩国产高清一区二区三区| 成人永久aaa| 国内精品嫩模私拍在线| 秋霞午夜鲁丝一区二区老狼| 亚洲精品视频在线| 国产精品成人一区二区艾草 | 国产精品自拍网站| 日本大胆欧美人术艺术动态| 亚洲精品欧美在线| 国产精品毛片高清在线完整版| 日韩美女在线视频| 欧美日本国产一区| 欧美自拍偷拍一区| 色婷婷亚洲一区二区三区| 成人久久视频在线观看| 国产成人免费在线观看| 精品亚洲国内自在自线福利| 日韩国产精品91| 亚洲国产欧美在线人成| 亚洲精品乱码久久久久久黑人| 国产日韩影视精品| 欧美国产一区二区| 国产人成一区二区三区影院| 久久综合久久综合九色| 精品国产91乱码一区二区三区 | 激情伊人五月天久久综合| 美腿丝袜亚洲三区| 麻豆精品视频在线观看| 蜜桃精品在线观看| 国产露脸91国语对白| 国产成人在线视频免费播放| 国产91丝袜在线播放| eeuss鲁片一区二区三区在线观看| 成人h动漫精品一区二| 91影院在线观看| 日本道精品一区二区三区| 在线观看日产精品| 欧美日韩大陆一区二区| 日韩欧美不卡一区| 精品国产乱码久久久久久蜜臀| 久久蜜桃av一区精品变态类天堂| 国产午夜精品福利| 亚洲精品老司机| 捆绑调教美女网站视频一区| 激情五月激情综合网| 菠萝蜜视频在线观看一区| 色婷婷av一区二区三区大白胸| 91久久精品一区二区三区| 欧美精品一二三| 国产色综合久久| 亚洲国产精品一区二区尤物区| 蓝色福利精品导航| 91丝袜高跟美女视频| 欧美一级夜夜爽| 国产精品国产三级国产三级人妇| 亚洲gay无套男同| 国内精品国产成人| 色一区在线观看| 精品日韩一区二区| 亚洲人亚洲人成电影网站色| 石原莉奈在线亚洲三区| 成人午夜视频网站| 在线不卡a资源高清| 久久久国际精品| 亚洲成人免费观看| 成人免费精品视频| 欧美一区二区三区免费视频| 中文子幕无线码一区tr| 奇米精品一区二区三区四区| 99久久伊人久久99| 亚洲精品一线二线三线| 亚洲成a人片在线不卡一二三区|