private QuantizationFactorsArray GetProgQuantizationFactorsForChunk(ProgressiveChunk_Values chunk)
        {
            RFX_PROGRESSIVE_CODEC_QUANT quant   = RdpegfxTileUtils.GetProgCodecQuant(chunk);
            QuantizationFactorsArray    factors = ConvertQuant(quant);

            return(factors);
        }
        /// <summary>
        /// Get the progressive codec quantity for the specified chunk
        /// </summary>
        /// <param name="chunk">the chunk type</param>
        /// <returns>The progressive codec quant for the specified chunk</returns>
        public static RFX_PROGRESSIVE_CODEC_QUANT GetProgCodecQuant(ProgressiveChunk_Values chunk)
        {
            RFX_PROGRESSIVE_CODEC_QUANT progQuant = new RFX_PROGRESSIVE_CODEC_QUANT();

            progQuant.yQuantValues  = new RFX_COMPONMENT_CODEC_QUANT();
            progQuant.cbQuantValues = new RFX_COMPONMENT_CODEC_QUANT();
            progQuant.crQuantValues = new RFX_COMPONMENT_CODEC_QUANT();

            //Y
            progQuant.yQuantValues.LL3_HL3 = (byte)(GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.LL3) | (GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.HL3) << 4));
            progQuant.yQuantValues.LH3_HH3 = (byte)(GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.LH3) | (GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.HH3) << 4));
            progQuant.yQuantValues.HL2_LH2 = (byte)(GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.HL2) | (GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.LH2) << 4));
            progQuant.yQuantValues.HH2_HL1 = (byte)(GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.HH2) | (GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.HL1) << 4));
            progQuant.yQuantValues.LH1_HH1 = (byte)(GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.LH1) | (GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.HH1) << 4));

            //Cb
            progQuant.cbQuantValues.LL3_HL3 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.LL3) | (GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.HL3) << 4));
            progQuant.cbQuantValues.LH3_HH3 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.LH3) | (GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.HH3) << 4));
            progQuant.cbQuantValues.HL2_LH2 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.HL2) | (GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.LH2) << 4));
            progQuant.cbQuantValues.HH2_HL1 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.HH2) | (GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.HL1) << 4));
            progQuant.cbQuantValues.LH1_HH1 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.LH1) | (GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.HH1) << 4));

            //Cr
            progQuant.crQuantValues.LL3_HL3 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.LL3) | (GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.HL3) << 4));
            progQuant.crQuantValues.LH3_HH3 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.LH3) | (GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.HH3) << 4));
            progQuant.crQuantValues.HL2_LH2 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.HL2) | (GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.LH2) << 4));
            progQuant.crQuantValues.HH2_HL1 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.HH2) | (GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.HL1) << 4));
            progQuant.crQuantValues.LH1_HH1 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.LH1) | (GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.HH1) << 4));

            return(progQuant);
        }
 /// <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 GetBitPosForChunk(ProgressiveChunk_Values chunk, TileComponents component, BandType_Values band)
 {
     if (chunk == ProgressiveChunk_Values.kChunk_None)
     {
         return(15);                                              // no matter what the band or the component
     }
     else if (chunk == ProgressiveChunk_Values.kChunk_100)
     {
         return(0);
     }
     return(gProgressiveBitPosArray[(int)component, (int)chunk, (int)band]);
 }
Esempio n. 4
0
 protected static void DTS_Component(DwtBands dwt, TileComponents component, ProgressiveChunk_Values chunk)
 {
     //HL1, LH1, HH1, HL2, LH2, HH2, HL3, LH3, HH3, and LL3
     DTS_Band(dwt.HL1, BandType_Values.HL1, component, chunk);
     DTS_Band(dwt.LH1, BandType_Values.LH1, component, chunk);
     DTS_Band(dwt.HH1, BandType_Values.HH1, component, chunk);
     DTS_Band(dwt.HL2, BandType_Values.HL2, component, chunk);
     DTS_Band(dwt.LH2, BandType_Values.LH2, component, chunk);
     DTS_Band(dwt.HH2, BandType_Values.HH2, component, chunk);
     DTS_Band(dwt.HL3, BandType_Values.HL3, component, chunk);
     DTS_Band(dwt.LH3, BandType_Values.LH3, component, chunk);
     DTS_Band(dwt.HH3, BandType_Values.HH3, component, chunk);
     DTS_Band(dwt.LL3, BandType_Values.LL3, component, chunk);
 }
Esempio n. 5
0
        static DwtTile GetDTS(RfxProgressiveCodecContext encodingContext, ProgressiveChunk_Values chunk)
        {
            DwtBands yBD  = DwtBands.GetFromLinearizationResult(encodingContext.DRS.Y_DwtQ, encodingContext.UseReduceExtrapolate);
            DwtBands cbBD = DwtBands.GetFromLinearizationResult(encodingContext.DRS.Cb_DwtQ, encodingContext.UseReduceExtrapolate);
            DwtBands crBD = DwtBands.GetFromLinearizationResult(encodingContext.DRS.Cr_DwtQ, encodingContext.UseReduceExtrapolate);

            DTS_Component(yBD, TileComponents.Y, chunk);
            DTS_Component(cbBD, TileComponents.Cb, chunk);
            DTS_Component(crBD, TileComponents.Cr, chunk);

            DwtTile dwtDts = new DwtTile(yBD.GetLinearizationData(), cbBD.GetLinearizationData(), crBD.GetLinearizationData());

            return(dwtDts);
        }
 static void ProgressiveQuantization_Band(short[] bandData, BandType_Values band, TileComponents component, ProgressiveChunk_Values chunk)
 {
     int bitPos = RdpegfxTileUtils.GetBitPosForChunk(chunk, component, band);
     for (int i = 0; i < bandData.Length; i++)
     {
         bandData[i] = FunProgQ(bandData[i], bitPos, band);
     }
 }
        static DwtTile GetDTS(RfxProgressiveCodecContext encodingContext, ProgressiveChunk_Values chunk)
        {
            DwtBands yBD = DwtBands.GetFromLinearizationResult(encodingContext.DRS.Y_DwtQ, encodingContext.UseReduceExtrapolate);
            DwtBands cbBD = DwtBands.GetFromLinearizationResult(encodingContext.DRS.Cb_DwtQ, encodingContext.UseReduceExtrapolate);
            DwtBands crBD = DwtBands.GetFromLinearizationResult(encodingContext.DRS.Cr_DwtQ, encodingContext.UseReduceExtrapolate);

            DTS_Component(yBD, TileComponents.Y, chunk);
            DTS_Component(cbBD, TileComponents.Cb, chunk);
            DTS_Component(crBD, TileComponents.Cr, chunk);

            DwtTile dwtDts = new DwtTile(yBD.GetLinearizationData(), cbBD.GetLinearizationData(), crBD.GetLinearizationData());
            return dwtDts;
        }
 protected static void ProgressiveQuantization_Component(DwtBands dwt, TileComponents component, ProgressiveChunk_Values chunk)
 {
     //HL1, LH1, HH1, HL2, LH2, HH2, HL3, LH3, HH3, and LL3
     ProgressiveQuantization_Band(dwt.HL1, BandType_Values.HL1, component, chunk);
     ProgressiveQuantization_Band(dwt.LH1, BandType_Values.LH1, component, chunk);
     ProgressiveQuantization_Band(dwt.HH1, BandType_Values.HH1, component, chunk);
     ProgressiveQuantization_Band(dwt.HL2, BandType_Values.HL2, component, chunk);
     ProgressiveQuantization_Band(dwt.LH2, BandType_Values.LH2, component, chunk);
     ProgressiveQuantization_Band(dwt.HH2, BandType_Values.HH2, component, chunk);
     ProgressiveQuantization_Band(dwt.HL3, BandType_Values.HL3, component, chunk);
     ProgressiveQuantization_Band(dwt.LH3, BandType_Values.LH3, component, chunk);
     ProgressiveQuantization_Band(dwt.HH3, BandType_Values.HH3, component, chunk);
     ProgressiveQuantization_Band(dwt.LL3, BandType_Values.LL3, component, chunk);
 }
        public static void ProgressiveQuantization(RfxProgressiveCodecContext encodingContext, ProgressiveChunk_Values chunk)
        {
            DwtBands yBD = DwtBands.GetFromLinearizationResult(encodingContext.DRS.Y_DwtQ, encodingContext.UseReduceExtrapolate);
            DwtBands cbBD = DwtBands.GetFromLinearizationResult(encodingContext.DRS.Cb_DwtQ, encodingContext.UseReduceExtrapolate);
            DwtBands crBD = DwtBands.GetFromLinearizationResult(encodingContext.DRS.Cr_DwtQ, encodingContext.UseReduceExtrapolate);

            ProgressiveQuantization_Component(yBD, TileComponents.Y, chunk);
            ProgressiveQuantization_Component(cbBD, TileComponents.Cb, chunk);
            ProgressiveQuantization_Component(crBD, TileComponents.Cr, chunk);

            DwtTile dwtDts = new DwtTile(yBD.GetLinearizationData(), cbBD.GetLinearizationData(), crBD.GetLinearizationData());
            encodingContext.ProgQ = dwtDts;

            //Compute DTS
            encodingContext.DTS = GetDTS(encodingContext, chunk);
        }
        /// <summary>
        /// Get the progressive codec quantity for the specified chunk
        /// </summary>
        /// <param name="chunk">the chunk type</param>
        /// <returns>The progressive codec quant for the specified chunk</returns>
        public static RFX_PROGRESSIVE_CODEC_QUANT GetProgCodecQuant(ProgressiveChunk_Values chunk)
        {
            RFX_PROGRESSIVE_CODEC_QUANT progQuant = new RFX_PROGRESSIVE_CODEC_QUANT();
            progQuant.yQuantValues = new RFX_COMPONMENT_CODEC_QUANT();
            progQuant.cbQuantValues = new RFX_COMPONMENT_CODEC_QUANT();
            progQuant.crQuantValues = new RFX_COMPONMENT_CODEC_QUANT();

            //Y
            progQuant.yQuantValues.LL3_HL3 = (byte)(GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.LL3) | (GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.HL3) << 4));
            progQuant.yQuantValues.LH3_HH3 = (byte)(GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.LH3) | (GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.HH3) << 4));
            progQuant.yQuantValues.HL2_LH2 = (byte)(GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.HL2) | (GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.LH2) << 4));
            progQuant.yQuantValues.HH2_HL1 = (byte)(GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.HH2) | (GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.HL1) << 4));
            progQuant.yQuantValues.LH1_HH1 = (byte)(GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.LH1) | (GetBitPosForChunk(chunk, TileComponents.Y, BandType_Values.HH1) << 4));

            //Cb
            progQuant.cbQuantValues.LL3_HL3 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.LL3) | (GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.HL3) << 4));
            progQuant.cbQuantValues.LH3_HH3 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.LH3) | (GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.HH3) << 4));
            progQuant.cbQuantValues.HL2_LH2 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.HL2) | (GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.LH2) << 4));
            progQuant.cbQuantValues.HH2_HL1 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.HH2) | (GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.HL1) << 4));
            progQuant.cbQuantValues.LH1_HH1 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.LH1) | (GetBitPosForChunk(chunk, TileComponents.Cb, BandType_Values.HH1) << 4));

            //Cr
            progQuant.crQuantValues.LL3_HL3 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.LL3) | (GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.HL3) << 4));
            progQuant.crQuantValues.LH3_HH3 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.LH3) | (GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.HH3) << 4));
            progQuant.crQuantValues.HL2_LH2 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.HL2) | (GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.LH2) << 4));
            progQuant.crQuantValues.HH2_HL1 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.HH2) | (GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.HL1) << 4));
            progQuant.crQuantValues.LH1_HH1 = (byte)(GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.LH1) | (GetBitPosForChunk(chunk, TileComponents.Cr, BandType_Values.HH1) << 4));

            return progQuant;
        }
 /// <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 GetBitPosForChunk(ProgressiveChunk_Values chunk, TileComponents component, BandType_Values band)
 {
     if (chunk == ProgressiveChunk_Values.kChunk_None) return 15; // no matter what the band or the component
     else if (chunk == ProgressiveChunk_Values.kChunk_100) return 0;
     return gProgressiveBitPosArray[(int)component, (int)chunk, (int)band];
 }
Esempio n. 12
0
        static void DTS_Band(short[] bandData, BandType_Values band, TileComponents component, ProgressiveChunk_Values chunk)
        {
            int bitPos = RdpegfxTileUtils.GetBitPosForChunk(chunk, component, band);

            for (int i = 0; i < bandData.Length; i++)
            {
                bandData[i] = FunDTS(bandData[i], bitPos, band);
            }
        }
Esempio n. 13
0
        public static void ProgressiveQuantization(RfxProgressiveCodecContext encodingContext, ProgressiveChunk_Values chunk)
        {
            DwtBands yBD  = DwtBands.GetFromLinearizationResult(encodingContext.DRS.Y_DwtQ, encodingContext.UseReduceExtrapolate);
            DwtBands cbBD = DwtBands.GetFromLinearizationResult(encodingContext.DRS.Cb_DwtQ, encodingContext.UseReduceExtrapolate);
            DwtBands crBD = DwtBands.GetFromLinearizationResult(encodingContext.DRS.Cr_DwtQ, encodingContext.UseReduceExtrapolate);

            ProgressiveQuantization_Component(yBD, TileComponents.Y, chunk);
            ProgressiveQuantization_Component(cbBD, TileComponents.Cb, chunk);
            ProgressiveQuantization_Component(crBD, TileComponents.Cr, chunk);

            DwtTile dwtDts = new DwtTile(yBD.GetLinearizationData(), cbBD.GetLinearizationData(), crBD.GetLinearizationData());

            encodingContext.ProgQ = dwtDts;

            //Compute DTS
            encodingContext.DTS = GetDTS(encodingContext, chunk);
        }