コード例 #1
0
ファイル: HDPhotoDecoder.cs プロジェクト: faorg/wwt-website
		private void FormatQuantizer(ref CWMIQuantizer pQuantizer)
		{
			RemapQP(ref pQuantizer, Constant.SHIFTZERO);
		}
コード例 #2
0
ファイル: HDPhotoDecoder.cs プロジェクト: faorg/wwt-website
		/*************************************************************************
			QPRemapping
		*************************************************************************/
		private void RemapQP(ref CWMIQuantizer pQP, int iShift)
		{
			byte uiQPIndex = pQP.iIndex;

			if(uiQPIndex == 0) 
			{
				throw new ArgumentOutOfRangeException("pQP", "uiQPIndex = " + uiQPIndex);
			}
			else if (!bScaledArith)
			{
				throw new ArgumentOutOfRangeException("pQP", "bScaledArith = " + bScaledArith);
			}
			else
			{
		        int man = 0, exp = 0;

				if (pQP.iIndex < 16)
				{
					man = pQP.iIndex;
					exp = iShift;
				}
				else
				{
					man = 16 + (pQP.iIndex & 0xf);
					exp = ((pQP.iIndex >> 4) - 1) + iShift;
				}
		        
				pQP.iQP = man << exp;
				pQP.iMan = Constant.gs_QPRecipTable[man].iMan;
				pQP.iExp = Constant.gs_QPRecipTable[man].iExp + exp;
				pQP.iOffset = ((pQP.iQP * 3 + 1) >> 3);
			}
		}
コード例 #3
0
ファイル: HDPhotoDecoder.cs プロジェクト: faorg/wwt-website
		private void StrDecInit()
		{
			AllocatePredInfo();

			if ((uQPMode & 1) == 0)
			{ // DC frame uniform quantization
				pQuantizerDC = new CWMIQuantizer();
				pQuantizerDC.iIndex = uiQPIndexDC;
				FormatQuantizer(ref pQuantizerDC);
			}
			if (sbSubband != SUBBAND.SB_DC_ONLY)
			{
				if ((uQPMode & 2) == 0)
				{ // LP frame uniform quantization
					pQuantizerLP = new CWMIQuantizer();
					if ((uQPMode & 0x200) == 0) // use DC quantizer
					{
						throw new ArgumentOutOfRangeException("StrDecInit 1");
					}
					else
					{
						pQuantizerLP.iIndex = uiQPIndexLP;
						FormatQuantizer(ref pQuantizerLP);
					}
				}

				if (sbSubband != SUBBAND.SB_NO_HIGHPASS)
				{
					if ((uQPMode & 4) == 0)
					{ // HP frame uniform quantization
						pQuantizerHP = new CWMIQuantizer();

						if ((uQPMode & 0x400) == 0) // use LP quantizer
						{
							throw new ArgumentOutOfRangeException("StrDecInit 2");
						}
						else
						{
							pQuantizerHP.iIndex = uiQPIndexHP;
							FormatQuantizer(ref pQuantizerHP);
						}
					}
				}
			}

			AllocateCodingContextDec();
		}