protected static void dequantization_Component(short[,] compontent, TS_RFX_CODEC_QUANT tsRfxCodecQuant, bool useReduceExtrapolate) { // Quantization factor: HL1, LH1, HH1, HL2, LH2, HH2, HL3, LH3, HH3, LL3 Hashtable scaleValueTable = new Hashtable(); int HL1_Factor = tsRfxCodecQuant.HL1_HH1 & 0x0f; int LH1_Factor = (tsRfxCodecQuant.HH2_LH1 & 0xf0) >> 4; int HH1_Factor = (tsRfxCodecQuant.HL1_HH1 & 0xf0) >> 4; int HL2_Factor = (tsRfxCodecQuant.LH2_HL2 & 0xf0) >> 4; int LH2_Factor = tsRfxCodecQuant.LH2_HL2 & 0x0f; int HH2_Factor = tsRfxCodecQuant.HH2_LH1 & 0x0f; int HL3_Factor = tsRfxCodecQuant.HL3_HH3 & 0x0f; int LH3_Factor = (tsRfxCodecQuant.LL3_LH3 & 0xf0) >> 4; int HH3_Factor = (tsRfxCodecQuant.HL3_HH3 & 0xf0) >> 4; int LL3_Factor = tsRfxCodecQuant.LL3_LH3 & 0x0f; int[] HL_Factor = { HL1_Factor, HL2_Factor, HL3_Factor }; int[] LH_Factor = { LH1_Factor, LH2_Factor, LH3_Factor }; int[] HH_Factor = { HH1_Factor, HH2_Factor, HH3_Factor }; BandType_Values[] bandArr = new BandType_Values[] { BandType_Values.HL1, BandType_Values.LH1, BandType_Values.HH1, BandType_Values.HL2, BandType_Values.LH2, BandType_Values.HH2, BandType_Values.HL3, BandType_Values.LH3, BandType_Values.HH3, BandType_Values.LL3 }; int[] bandFactor = new int[] { HL1_Factor, LH1_Factor, HH1_Factor, HL2_Factor, LH2_Factor, HH2_Factor, HL3_Factor, LH3_Factor, HH3_Factor, LL3_Factor }; for (int i = 0; i < bandArr.Length; i++) { BandRect br = RdpegfxTileUtils.GetBandRect(bandArr[i], useReduceExtrapolate); doDequantization_Subband(compontent, br.left, br.top, br.right, br.bottom, bandFactor[i]); } }
public static void reconstruction_Component(short[] component1D, out short[,] compontent2D, bool useReduceExtrapolate) { //sequence: HL1, LH1, HH1, HL2, LH2, HH2, HL3, LH3, HH3, and LL3 //lineOutput = new short[TileSize * TileSize]; compontent2D = new short[RdpegfxTileUtils.TileSize, RdpegfxTileUtils.TileSize]; BandType_Values[] bandArr = new BandType_Values[] { BandType_Values.HL1, BandType_Values.LH1, BandType_Values.HH1, BandType_Values.HL2, BandType_Values.LH2, BandType_Values.HH2, BandType_Values.HL3, BandType_Values.LH3, BandType_Values.HH3, BandType_Values.LL3 }; int offset = 0; BandRect curBand; for (int i = 0; i < bandArr.Length; i++) { curBand = RdpegfxTileUtils.GetBandRect(bandArr[i], useReduceExtrapolate); reconstruction_SubBand(compontent2D, curBand.left, curBand.top, curBand.right, curBand.bottom, component1D, ref offset); } }
protected static void linearization_Compontent(short[,] compontent, bool useReduceExtrapolate, out short[] lineOutput) { //sequence: HL1, LH1, HH1, HL2, LH2, HH2, HL3, LH3, HH3, and LL3 lineOutput = new short[TileSize * TileSize]; int curIdx = 0; BandType_Values[] bandArr = new BandType_Values[] { BandType_Values.HL1, BandType_Values.LH1, BandType_Values.HH1, BandType_Values.HL2, BandType_Values.LH2, BandType_Values.HH2, BandType_Values.HL3, BandType_Values.LH3, BandType_Values.HH3, BandType_Values.LL3 }; short[] bandOutput; BandRect curBand; for (int i = 0; i < bandArr.Length; i++) { curBand = RdpegfxTileUtils.GetBandRect(bandArr[i], useReduceExtrapolate); linearization_SubBand(compontent, curBand.left, curBand.top, curBand.right, curBand.bottom, out bandOutput); Array.Copy(bandOutput, 0, lineOutput, curIdx, bandOutput.Length); curIdx += bandOutput.Length; } }