/// <summary> /// Get the bit-pos from a codec quantity for a specified band /// </summary> /// <param name="quant">codec quantity</param> /// <param name="band">a band tye</param> /// <returns>The bit-pos of the given band</returns> public static int GetBitPosFromQuant(RFX_COMPONMENT_CODEC_QUANT quant, BandType_Values band) { switch (band) { case BandType_Values.HL1: return((quant.HH2_HL1 & 0xf0) >> 4); case BandType_Values.LH1: return(quant.LH1_HH1 & 0x0f); case BandType_Values.HH1: return((quant.LH1_HH1 & 0xf0) >> 4); case BandType_Values.HL2: return(quant.HL2_LH2 & 0x0f); case BandType_Values.LH2: return((quant.HL2_LH2 & 0xf0) >> 4); case BandType_Values.HH2: return(quant.HH2_HL1 & 0x0f); case BandType_Values.HL3: return((quant.LL3_HL3 & 0xf0) >> 4); case BandType_Values.LH3: return(quant.LH3_HH3 & 0x0f); case BandType_Values.HH3: return((quant.LH3_HH3 & 0xf0) >> 4); case BandType_Values.LL3: return(quant.LL3_HL3 & 0x0f); default: return(0); } }
protected static void ProgressiveDeQuantization_Component(short[] data, RFX_COMPONMENT_CODEC_QUANT quant, bool useReduceExtrapolate) { int bitPos = 0; for (int i = 0; i < RdpegfxTileUtils.ComponentElementCount; i++) { BandType_Values band = RdpegfxTileUtils.GetBandByIndex(i, useReduceExtrapolate); bitPos = RdpegfxTileUtils.GetBitPosFromQuant(quant, band); data[i] = FunProgDeQ(data[i], bitPos, band); } }
/// <summary> /// Get the bit-pos for a given chunk /// </summary> /// <param name="chunk">The chunk</param> /// <param name="component">The compoent</param> /// <param name="band">The band</param> /// <returns>The bit-pos of the given band for the given chunk</returns> public static int GetBitPosForQuant(RFX_PROGRESSIVE_CODEC_QUANT quants, TileComponents component, BandType_Values band) { RFX_COMPONMENT_CODEC_QUANT quantsComponet = quants.yQuantValues; switch (component) { case TileComponents.Y: quantsComponet = quants.yQuantValues; break; case TileComponents.Cb: quantsComponet = quants.cbQuantValues; break; case TileComponents.Cr: quantsComponet = quants.crQuantValues; break; } switch (band) { case BandType_Values.LL3: return(quantsComponet.LL3_HL3 & 0x0F); case BandType_Values.HL3: return(quantsComponet.LL3_HL3 >> 4); case BandType_Values.LH3: return(quantsComponet.LH3_HH3 & 0x0F); case BandType_Values.HH3: return(quantsComponet.LH3_HH3 >> 4); case BandType_Values.HL2: return(quantsComponet.HL2_LH2 & 0x0F); case BandType_Values.LH2: return(quantsComponet.HL2_LH2 >> 4); case BandType_Values.HH2: return(quantsComponet.HH2_HL1 & 0x0F); case BandType_Values.HL1: return(quantsComponet.HH2_HL1 >> 4); case BandType_Values.LH1: return(quantsComponet.LH1_HH1 & 0x0F); case BandType_Values.HH1: return(quantsComponet.LH1_HH1 >> 4); default: return(0); } }
/// <summary> /// Get the bit-pos from a codec quantity for a specified band /// </summary> /// <param name="quant">codec quantity</param> /// <param name="band">a band tye</param> /// <returns>The bit-pos of the given band</returns> public static int GetBitPosFromQuant(RFX_COMPONMENT_CODEC_QUANT quant, BandType_Values band) { switch (band) { case BandType_Values.HL1: return (quant.HH2_HL1 & 0xf0) >> 4; case BandType_Values.LH1: return (quant.LH1_HH1 & 0x0f); case BandType_Values.HH1: return (quant.LH1_HH1 & 0xf0) >> 4; case BandType_Values.HL2: return (quant.HL2_LH2 & 0x0f); case BandType_Values.LH2: return (quant.HL2_LH2 & 0xf0) >> 4; case BandType_Values.HH2: return (quant.HH2_HL1 & 0x0f); case BandType_Values.HL3: return (quant.LL3_HL3 & 0xf0) >> 4; case BandType_Values.LH3: return (quant.LH3_HH3 & 0x0f); case BandType_Values.HH3: return (quant.LH3_HH3 & 0xf0) >> 4; case BandType_Values.LL3: return (quant.LL3_HL3 & 0x0f); default: return 0; } }