Esempio n. 1
0
        void DecodePostBlock(byte[] ptrDst, int iDst, uint nSamples)
        {
            int  nWeightCode  = m_ptrWeightCode[m_ptrNextWeight++];
            int  nCoefficient = m_ptrCoefficient[m_ptrNextCoefficient++];
            uint i;
            uint nHalfDegree = (uint)m_nDegreeNum / 2;

            for (i = 0; i < nHalfDegree; i++)
            {
                m_ptrBuffer1[i * 2]     = 0;
                m_ptrBuffer1[i * 2 + 1] = m_ptrBuffer2[m_ptrNextSource++];
            }
            IQuantumize(m_ptrMatrixBuf, 0, m_ptrBuffer1, 0, m_nDegreeNum, nWeightCode, nCoefficient);
            Erisa.OddGivensInverseMatrix(m_ptrMatrixBuf, 0, m_pRevolveParam, m_nSubbandDegree);

            for (i = 0; i < m_nDegreeNum; i += 2)
            {
                m_ptrMatrixBuf[i] = -m_ptrMatrixBuf[i + 1];
            }

            Erisa.FastIPLOT(m_ptrMatrixBuf, 0, m_nSubbandDegree);
            Erisa.FastILOT(m_ptrWorkBuf, m_ptrLastDCT, m_ptrLastDCTBuf, m_ptrMatrixBuf, 0, m_nSubbandDegree);

            Array.Copy(m_ptrWorkBuf, 0, m_ptrMatrixBuf, 0, m_nDegreeNum);

            Erisa.FastIDCT(m_ptrInternalBuf, m_ptrMatrixBuf, 0, 1, m_ptrWorkBuf, m_nSubbandDegree);
            if (nSamples != 0)
            {
                Erisa.RoundR32ToWordArray(ptrDst, iDst, m_mioih.ChannelCount, m_ptrInternalBuf, (int)nSamples);
            }
        }
Esempio n. 2
0
        void DecodePostBlock_MSS(byte[] ptrDst, int iDst, uint nSamples)
        {
            int ptrLapBuf = 0; // m_ptrLastDCT;
            int ptrSrcBuf = 0; // m_ptrMatrixBuf;

            int  i, j;
            uint nHalfDegree  = (uint)m_nDegreeNum / 2u;
            int  nWeightCode  = m_ptrWeightCode[m_ptrNextWeight++];
            int  nCoefficient = m_ptrCoefficient[m_ptrNextCoefficient++];

            for (i = 0; i < 2; i++)
            {
                for (j = 0; j < nHalfDegree; j++)
                {
                    m_ptrBuffer1[j * 2]     = 0;
                    m_ptrBuffer1[j * 2 + 1] = m_ptrBuffer2[m_ptrNextSource++];
                }
                IQuantumize(m_ptrMatrixBuf, ptrSrcBuf, m_ptrBuffer1, 0, m_nDegreeNum, nWeightCode, nCoefficient);
                ptrSrcBuf += m_nDegreeNum;
            }
            float rSin, rCos;
            int   nRevCode = m_ptrRevolveCode[m_ptrNextRevCode++];

            int ptrSrcBuf1 = 0;            // m_ptrMatrixBuf;
            int ptrSrcBuf2 = m_nDegreeNum; // m_ptrMatrixBuf + m_nDegreeNum;

            rSin = (float)Math.Sin(nRevCode * Math.PI / 8);
            rCos = (float)Math.Cos(nRevCode * Math.PI / 8);
            Erisa.Revolve2x2(m_ptrMatrixBuf, ptrSrcBuf1, m_ptrMatrixBuf, ptrSrcBuf2, rSin, rCos, 1, m_nDegreeNum);

            ptrSrcBuf = 0; // m_ptrMatrixBuf;

            for (i = 0; i < 2; i++)
            {
                Erisa.OddGivensInverseMatrix(m_ptrMatrixBuf, ptrSrcBuf, m_pRevolveParam, m_nSubbandDegree);

                for (j = 0; j < m_nDegreeNum; j += 2)
                {
                    m_ptrMatrixBuf[ptrSrcBuf + j] = -m_ptrMatrixBuf[ptrSrcBuf + j + 1];
                }
                Erisa.FastIPLOT(m_ptrMatrixBuf, ptrSrcBuf, m_nSubbandDegree);
                Erisa.FastILOT(m_ptrWorkBuf, m_ptrLastDCT, ptrLapBuf, m_ptrMatrixBuf, ptrSrcBuf, m_nSubbandDegree);

                Array.Copy(m_ptrWorkBuf, 0, m_ptrMatrixBuf, ptrSrcBuf, m_nDegreeNum);

                Erisa.FastIDCT(m_ptrInternalBuf, m_ptrMatrixBuf, ptrSrcBuf, 1, m_ptrWorkBuf, m_nSubbandDegree);
                if (nSamples != 0)
                {
                    Erisa.RoundR32ToWordArray(ptrDst, iDst + (int)i * 2, 2, m_ptrInternalBuf, (int)nSamples);
                }
                ptrLapBuf += m_nDegreeNum;
                ptrSrcBuf += m_nDegreeNum;
            }
        }
Esempio n. 3
0
 void InitializeWithDegree(int nSubbandDegree)
 {
     m_pRevolveParam = Erisa.CreateRevolveParameter(nSubbandDegree);
     for (int i = 0, j = 0; i < 7; i++)
     {
         int nFrequencyWidth = 1 << (nSubbandDegree + FreqWidth[i]);
         m_nFrequencyPoint[i] = j + (nFrequencyWidth / 2);
         j += nFrequencyWidth;
     }
     m_nSubbandDegree = nSubbandDegree;
     m_nDegreeNum     = 1 << nSubbandDegree;
 }
Esempio n. 4
0
        void DecodeInternalBlock_MSS(byte[] ptrDst, int iDst, uint nSamples)
        {
            int ptrSrcBuf = 0; // m_ptrMatrixBuf;
            int ptrLapBuf = 0; // m_ptrLastDCT;

            int nWeightCode  = m_ptrWeightCode[m_ptrNextWeight++];
            int nCoefficient = m_ptrCoefficient[m_ptrNextCoefficient++];

            for (int i = 0; i < 2; i++)
            {
                IQuantumize(m_ptrMatrixBuf, ptrSrcBuf, m_ptrBuffer2, m_ptrNextSource, m_nDegreeNum, nWeightCode, nCoefficient);
                m_ptrNextSource += m_nDegreeNum;
                ptrSrcBuf       += m_nDegreeNum;
            }
            int nRevCode  = m_ptrRevolveCode[m_ptrNextRevCode++];
            int nRevCode1 = (nRevCode >> 2) & 0x03;
            int nRevCode2 = (nRevCode & 0x03);

            int ptrSrcBuf1 = 0;            // m_ptrMatrixBuf;
            int ptrSrcBuf2 = m_nDegreeNum; // m_ptrMatrixBuf + m_nDegreeNum;

            float rSin = (float)Math.Sin(nRevCode1 * Math.PI / 8);
            float rCos = (float)Math.Cos(nRevCode1 * Math.PI / 8);

            Erisa.Revolve2x2(m_ptrMatrixBuf, ptrSrcBuf1, m_ptrMatrixBuf, ptrSrcBuf2, rSin, rCos, 2, m_nDegreeNum / 2);

            rSin = (float)Math.Sin(nRevCode2 * Math.PI / 8);
            rCos = (float)Math.Cos(nRevCode2 * Math.PI / 8);
            Erisa.Revolve2x2(m_ptrMatrixBuf, ptrSrcBuf1 + 1, m_ptrMatrixBuf, ptrSrcBuf2 + 1, rSin, rCos, 2, m_nDegreeNum / 2);

            ptrSrcBuf = 0; // m_ptrMatrixBuf;

            for (int i = 0; i < 2; i++)
            {
                Erisa.OddGivensInverseMatrix(m_ptrMatrixBuf, ptrSrcBuf, m_pRevolveParam, m_nSubbandDegree);
                Erisa.FastIPLOT(m_ptrMatrixBuf, ptrSrcBuf, m_nSubbandDegree);
                Erisa.FastILOT(m_ptrWorkBuf, m_ptrLastDCT, ptrLapBuf, m_ptrMatrixBuf, ptrSrcBuf, m_nSubbandDegree);

                Array.Copy(m_ptrMatrixBuf, ptrSrcBuf, m_ptrLastDCT, ptrLapBuf, m_nDegreeNum);
                Array.Copy(m_ptrWorkBuf, 0, m_ptrMatrixBuf, ptrSrcBuf, m_nDegreeNum);

                Erisa.FastIDCT(m_ptrInternalBuf, m_ptrMatrixBuf, ptrSrcBuf, 1, m_ptrWorkBuf, m_nSubbandDegree);
                if (nSamples != 0)
                {
                    Erisa.RoundR32ToWordArray(ptrDst, iDst + (int)i * 2, 2, m_ptrInternalBuf, (int)nSamples);
                }
                ptrSrcBuf += m_nDegreeNum;
                ptrLapBuf += m_nDegreeNum;
            }
        }
Esempio n. 5
0
        void DecodeLeadBlock_MSS()
        {
            uint i, j;
            uint nHalfDegree  = (uint)m_nDegreeNum / 2;
            int  nWeightCode  = m_ptrWeightCode[m_ptrNextWeight++];
            int  nCoefficient = m_ptrCoefficient[m_ptrNextCoefficient++];
            int  ptrLapBuf    = 0; // within m_ptrLastDCT;

            for (i = 0; i < 2; i++)
            {
                int ptrSrcBuf = 0; // within (PINT) m_ptrBuffer1;
                for (j = 0; j < nHalfDegree; j++)
                {
                    m_ptrBuffer1[ptrSrcBuf + j * 2]     = 0;
                    m_ptrBuffer1[ptrSrcBuf + j * 2 + 1] = m_ptrBuffer2[m_ptrNextSource++];
                }
                IQuantumize(m_ptrLastDCT, ptrLapBuf, m_ptrBuffer1, ptrSrcBuf, m_nDegreeNum, nWeightCode, nCoefficient);
                ptrLapBuf += (int)m_nDegreeNum;
            }
            int nRevCode = m_ptrRevolveCode[m_ptrNextRevCode++];

            int ptrLapBuf1 = 0;                 // m_ptrLastDCT;
            int ptrLapBuf2 = (int)m_nDegreeNum; // m_ptrLastDCT

            float rSin = (float)Math.Sin(nRevCode * Math.PI / 8);
            float rCos = (float)Math.Cos(nRevCode * Math.PI / 8);

            Erisa.Revolve2x2(m_ptrLastDCT, ptrLapBuf1, m_ptrLastDCT, ptrLapBuf2, rSin, rCos, 1, m_nDegreeNum);

            ptrLapBuf = 0; //m_ptrLastDCT;
            for (i = 0; i < 2; i++)
            {
                Erisa.OddGivensInverseMatrix(m_ptrLastDCT, ptrLapBuf, m_pRevolveParam, m_nSubbandDegree);

                for (j = 0; j < m_nDegreeNum; j += 2)
                {
                    m_ptrLastDCT[ptrLapBuf + j] = m_ptrLastDCT[ptrLapBuf + j + 1];
                }
                Erisa.FastIPLOT(m_ptrLastDCT, ptrLapBuf, m_nSubbandDegree);
                ptrLapBuf += (int)m_nDegreeNum;
            }
        }
Esempio n. 6
0
        void DecodeLeadBlock()
        {
            int  nWeightCode  = m_ptrWeightCode[m_ptrNextWeight++];
            int  nCoefficient = m_ptrCoefficient[m_ptrNextCoefficient++];
            uint i;
            uint nHalfDegree = (uint)m_nDegreeNum / 2;

            for (i = 0; i < nHalfDegree; i++)
            {
                m_ptrBuffer1[i * 2]     = 0;
                m_ptrBuffer1[i * 2 + 1] = m_ptrBuffer2[m_ptrNextSource++];
            }
            IQuantumize(m_ptrLastDCT, m_ptrLastDCTBuf, m_ptrBuffer1, 0, m_nDegreeNum, nWeightCode, nCoefficient);
            Erisa.OddGivensInverseMatrix(m_ptrLastDCT, m_ptrLastDCTBuf, m_pRevolveParam, m_nSubbandDegree);
            for (i = 0; i < m_nDegreeNum; i += 2)
            {
                m_ptrLastDCT[m_ptrLastDCTBuf + i] = m_ptrLastDCT[m_ptrLastDCTBuf + i + 1];
            }
            Erisa.FastIPLOT(m_ptrLastDCT, m_ptrLastDCTBuf, m_nSubbandDegree);
        }
Esempio n. 7
0
        void DecodeInternalBlock(byte[] ptrDst, int iDst, uint nSamples)
        {
            int nWeightCode  = m_ptrWeightCode[m_ptrNextWeight++];
            int nCoefficient = m_ptrCoefficient[m_ptrNextCoefficient++];

            IQuantumize(m_ptrMatrixBuf, 0, m_ptrBuffer2, m_ptrNextSource, m_nDegreeNum, nWeightCode, nCoefficient);
            m_ptrNextSource += (int)m_nDegreeNum;

            Erisa.OddGivensInverseMatrix(m_ptrMatrixBuf, 0, m_pRevolveParam, m_nSubbandDegree);
            Erisa.FastIPLOT(m_ptrMatrixBuf, 0, m_nSubbandDegree);
            Erisa.FastILOT(m_ptrWorkBuf, m_ptrLastDCT, m_ptrLastDCTBuf, m_ptrMatrixBuf, 0, m_nSubbandDegree);

            Array.Copy(m_ptrMatrixBuf, 0, m_ptrLastDCT, m_ptrLastDCTBuf, m_nDegreeNum);
            Array.Copy(m_ptrWorkBuf, 0, m_ptrMatrixBuf, 0, m_nDegreeNum);

            Erisa.FastIDCT(m_ptrInternalBuf, m_ptrMatrixBuf, 0, 1, m_ptrWorkBuf, m_nSubbandDegree);
            if (nSamples != 0)
            {
                Erisa.RoundR32ToWordArray(ptrDst, iDst, m_mioih.ChannelCount, m_ptrInternalBuf, (int)nSamples);
            }
        }