Пример #1
0
        /// <summary>
        /// Create an instance from the given DWT data
        /// </summary>
        /// <param name="data">The linearization DWT data</param>
        /// <param name="useReduceExtrapolate">Indicates if Reduce-Extrapolate method used in DWT</param>
        /// <returns>A DWTBands instance</returns>
        public static DwtBands GetFromLinearizationResult(short[] data, bool useReduceExtrapolate)
        {
            int      curIdx = 0;
            DwtBands bDwt   = new DwtBands();

            bDwt.HL1 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.HL1, useReduceExtrapolate)];
            bDwt.LH1 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.LH1, useReduceExtrapolate)];
            bDwt.HH1 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.HH1, useReduceExtrapolate)];
            bDwt.HL2 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.HL2, useReduceExtrapolate)];
            bDwt.LH2 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.LH2, useReduceExtrapolate)];
            bDwt.HH2 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.HH2, useReduceExtrapolate)];
            bDwt.HL3 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.HL3, useReduceExtrapolate)];
            bDwt.LH3 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.LH3, useReduceExtrapolate)];
            bDwt.HH3 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.HH3, useReduceExtrapolate)];
            bDwt.LL3 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.LL3, useReduceExtrapolate)];


            Array.Copy(data, curIdx, bDwt.HL1, 0, bDwt.HL1.Length); curIdx += bDwt.HL1.Length;
            Array.Copy(data, curIdx, bDwt.LH1, 0, bDwt.LH1.Length); curIdx += bDwt.LH1.Length;
            Array.Copy(data, curIdx, bDwt.HH1, 0, bDwt.HH1.Length); curIdx += bDwt.HH1.Length;
            Array.Copy(data, curIdx, bDwt.HL2, 0, bDwt.HL2.Length); curIdx += bDwt.HL2.Length;
            Array.Copy(data, curIdx, bDwt.LH2, 0, bDwt.LH2.Length); curIdx += bDwt.LH2.Length;
            Array.Copy(data, curIdx, bDwt.HH2, 0, bDwt.HH2.Length); curIdx += bDwt.HH2.Length;
            Array.Copy(data, curIdx, bDwt.HL3, 0, bDwt.HL3.Length); curIdx += bDwt.HL3.Length;
            Array.Copy(data, curIdx, bDwt.LH3, 0, bDwt.LH3.Length); curIdx += bDwt.LH3.Length;
            Array.Copy(data, curIdx, bDwt.HH3, 0, bDwt.HH3.Length); curIdx += bDwt.HH3.Length;
            Array.Copy(data, curIdx, bDwt.LL3, 0, bDwt.LL3.Length); curIdx += bDwt.LL3.Length;

            return(bDwt);
        }
Пример #2
0
 protected static void DTS_Component(DwtBands dwt, TileComponents component, RFX_PROGRESSIVE_CODEC_QUANT quants)
 {
     //HL1, LH1, HH1, HL2, LH2, HH2, HL3, LH3, HH3, and LL3
     DTS_Band(dwt.HL1, BandType_Values.HL1, component, quants);
     DTS_Band(dwt.LH1, BandType_Values.LH1, component, quants);
     DTS_Band(dwt.HH1, BandType_Values.HH1, component, quants);
     DTS_Band(dwt.HL2, BandType_Values.HL2, component, quants);
     DTS_Band(dwt.LH2, BandType_Values.LH2, component, quants);
     DTS_Band(dwt.HH2, BandType_Values.HH2, component, quants);
     DTS_Band(dwt.HL3, BandType_Values.HL3, component, quants);
     DTS_Band(dwt.LH3, BandType_Values.LH3, component, quants);
     DTS_Band(dwt.HH3, BandType_Values.HH3, component, quants);
     DTS_Band(dwt.LL3, BandType_Values.LL3, component, quants);
 }
Пример #3
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);
 }
Пример #4
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);
        }
Пример #5
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);
        }
 protected static void ProgressiveQuantization_Component(DwtBands dwt, TileComponents component, RFX_PROGRESSIVE_CODEC_QUANT quants)
 {
     //HL1, LH1, HH1, HL2, LH2, HH2, HL3, LH3, HH3, and LL3
     ProgressiveQuantization_Band(dwt.HL1, BandType_Values.HL1, component, quants);
     ProgressiveQuantization_Band(dwt.LH1, BandType_Values.LH1, component, quants);
     ProgressiveQuantization_Band(dwt.HH1, BandType_Values.HH1, component, quants);
     ProgressiveQuantization_Band(dwt.HL2, BandType_Values.HL2, component, quants);
     ProgressiveQuantization_Band(dwt.LH2, BandType_Values.LH2, component, quants);
     ProgressiveQuantization_Band(dwt.HH2, BandType_Values.HH2, component, quants);
     ProgressiveQuantization_Band(dwt.HL3, BandType_Values.HL3, component, quants);
     ProgressiveQuantization_Band(dwt.LH3, BandType_Values.LH3, component, quants);
     ProgressiveQuantization_Band(dwt.HH3, BandType_Values.HH3, component, quants);
     ProgressiveQuantization_Band(dwt.LL3, BandType_Values.LL3, component, quants);
 }
 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);
 }
        /// <summary>
        /// Create an instance from the given DWT data
        /// </summary>
        /// <param name="data">The linearization DWT data</param>
        /// <param name="useReduceExtrapolate">Indicates if Reduce-Extrapolate method used in DWT</param>
        /// <returns>A DWTBands instance</returns>
        public static DwtBands GetFromLinearizationResult(short[] data, bool useReduceExtrapolate)
        {
            int curIdx = 0;
            DwtBands bDwt = new DwtBands();
            bDwt.HL1 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.HL1, useReduceExtrapolate)];
            bDwt.LH1 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.LH1, useReduceExtrapolate)];
            bDwt.HH1 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.HH1, useReduceExtrapolate)];
            bDwt.HL2 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.HL2, useReduceExtrapolate)];
            bDwt.LH2 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.LH2, useReduceExtrapolate)];
            bDwt.HH2 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.HH2, useReduceExtrapolate)];
            bDwt.HL3 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.HL3, useReduceExtrapolate)];
            bDwt.LH3 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.LH3, useReduceExtrapolate)];
            bDwt.HH3 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.HH3, useReduceExtrapolate)];
            bDwt.LL3 = new short[RdpegfxTileUtils.GetBandSize(BandType_Values.LL3, useReduceExtrapolate)];

            Array.Copy(data, curIdx, bDwt.HL1, 0, bDwt.HL1.Length); curIdx += bDwt.HL1.Length;
            Array.Copy(data, curIdx, bDwt.LH1, 0, bDwt.LH1.Length); curIdx += bDwt.LH1.Length;
            Array.Copy(data, curIdx, bDwt.HH1, 0, bDwt.HH1.Length); curIdx += bDwt.HH1.Length;
            Array.Copy(data, curIdx, bDwt.HL2, 0, bDwt.HL2.Length); curIdx += bDwt.HL2.Length;
            Array.Copy(data, curIdx, bDwt.LH2, 0, bDwt.LH2.Length); curIdx += bDwt.LH2.Length;
            Array.Copy(data, curIdx, bDwt.HH2, 0, bDwt.HH2.Length); curIdx += bDwt.HH2.Length;
            Array.Copy(data, curIdx, bDwt.HL3, 0, bDwt.HL3.Length); curIdx += bDwt.HL3.Length;
            Array.Copy(data, curIdx, bDwt.LH3, 0, bDwt.LH3.Length); curIdx += bDwt.LH3.Length;
            Array.Copy(data, curIdx, bDwt.HH3, 0, bDwt.HH3.Length); curIdx += bDwt.HH3.Length;
            Array.Copy(data, curIdx, bDwt.LL3, 0, bDwt.LL3.Length); curIdx += bDwt.LL3.Length;

            return bDwt;
        }