Exemplo n.º 1
0
		private void DecodeIndex(out int pIndex, out int pSign, int iLoc, CAdaptiveHuffman pAHexpt)
		{
			if (iLoc < 15)
			{
				pIndex = pAHexpt.GetHuffShort(bitIO);
				pAHexpt.m_iDiscriminant  += pAHexpt.m_pDelta[(uint)pIndex];
				pAHexpt.m_iDiscriminant1 += pAHexpt.m_pDelta1[(uint)pIndex];
				pSign = -bitIO.GetBit16(1);
			}
			else 
				if (iLoc == 15)
				{
					if (!bitIO.GetBool16())
					{
						pIndex = 0;
					}
					else
						if (!bitIO.GetBool16())
						{
							pIndex = 2;
						}
						else
						{
							pIndex = 1 + 2 * bitIO.GetBit16(1);
						}
					pSign = -bitIO.GetBit16(1);
				}
			else { //if (iLoc == 16) { /* deterministic */
				int iSL = bitIO.GetBit16(1 + 1);
				pIndex = iSL >> 1;
				pSign = -(iSL & 1);
			}
		}
Exemplo n.º 2
0
		/*************************************************************************
			Experimental code -- decodeBlock
			SR = <0 1 2> == <last, nonsignificant, significant run>
			alphabet 12:
				pAHexpt[0] == <SR', SL, SR | first symbol>
			alphabet 6:
				pAHexpt[1] == <SR', SL | continuous>
				pAHexpt[2] == <SR', SL | continuous>
			alphabet 4:
				pAHexpt[3] == <SR', SL | 2 free slots> (SR may be last or insignificant only)
			alphabet f(run) (this can be extended to 6 contexts - SL and SR')
				pAHexpt[4] == <run | continuous>
			alphabet f(lev) (this can be extended to 9 contexts)
				pAHexpt[5-6] == <lev | continuous> first symbol
				pAHexpt[7-8] == <lev | continuous> condition on SRn no use
		*************************************************************************/
		private int DecodeSignificantRun(int iMaxRun, CAdaptiveHuffman pAHexpt)
		{
			if (iMaxRun < 5)
			{
				if (iMaxRun == 1 || bitIO.GetBool16())
				{
					return 1;
				}
				else
					if (iMaxRun == 2 || bitIO.GetBool16())
					{
						return 2;
					}
					else
						if (iMaxRun == 3 || bitIO.GetBool16())
						{
							return 3;
						}
				return 4;
			}

			int iIndex = pAHexpt.GetHuffShort(bitIO);
			//this always uses table 0
			iIndex += (int)Constant.gSignificantRunBin[iMaxRun] * 5;
			int iRun = Constant.aRemap2[iIndex];
			uint iFLC = Constant.gSignificantRunFixedLength[iIndex];
			if (iFLC != 0)
			{
				iRun += bitIO.GetBit16(iFLC);
			}
			
			return iRun;
		}