⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 precinctsizespec.cpp

📁 jpeg 2000 压缩算法源代码 核心ebcot
💻 CPP
字号:
return true;
            }
            // Adjust cT for last byte
            CT = 8;
        }

        // 5) Now we can calculate the number 'k' of bits having error
        // resilience information, which is the number of bits left to
        // normalization in the C register, minus 1.
        k = CT-1;

        // 6) The predictable termination policy is as if an LPS interval was
        // coded that caused a renormalization of 'k' bits, before the
        // termination marker started

        // We first check if an LPS is decoded, that causes a renormalization
        // of 'k' bits. Worst case is smallest LPS probability 'q' that causes
        // a renormalization of 'k' bits.
        q = 0x8000>>k;

        // Check that we can decode an LPS interval of probability 'q'
        A -= q;
        if ((C>>16) <A)
		{
            // Error: MPS interval decoded
            return true;
        }
        // OK: LPS interval decoded
        C -= (A<<16);
        // -- LPS Exchange
        // Here 'a' can not be smaller than 'q' because the minimum value
        // for 'a' is 0x8000-0x4000=0x4000 and 'q' is set to a value equal
        // to or smaller than that.
        A = q;
        // -- Renormalize
        do{
            if(CT==0)
				ByteIn();
            A<<=1;
            C<<=1;
            CT--;
        } while (A< 0x8000);
        // -- End renormalization
        // -- End LPS Exchange

        // 7) Everything seems OK, we have checked the C register for the LPS
        // symbols and ensured that it is followed by bits synthetized by the
        // termination marker.
        return false;


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -