Beispiel #1
0
        public static QuantizationFactorsArray GetProgQuantizationFactorsForChunk(ProgressiveChunk chunk)
        {
            RFX_PROGRESSIVE_CODEC_QUANT quant   = RdpegfxTileUtils.GetProgCodecQuant((ProgressiveChunk_Values)chunk);
            QuantizationFactorsArray    factors = ConvertProgQuant(quant);

            return(factors);
        }
Beispiel #2
0
        public static QuantizationFactorsArray ConvertProgQuant(RFX_PROGRESSIVE_CODEC_QUANT quant)
        {
            var fators = new QuantizationFactorsArray();

            fators.quants = new QuantizationFactors[3];

            fators.quants[0]     = new QuantizationFactors();
            fators.quants[0].LL3 = (byte)(quant.yQuantValues.LL3_HL3 & 0x0F);
            fators.quants[0].HL3 = (byte)(quant.yQuantValues.LL3_HL3 >> 4);
            fators.quants[0].LH3 = (byte)(quant.yQuantValues.LH3_HH3 & 0x0F);
            fators.quants[0].HH3 = (byte)(quant.yQuantValues.LH3_HH3 >> 4);
            fators.quants[0].HL2 = (byte)(quant.yQuantValues.HL2_LH2 & 0x0F);
            fators.quants[0].LH2 = (byte)(quant.yQuantValues.HL2_LH2 >> 4);
            fators.quants[0].HH2 = (byte)(quant.yQuantValues.HH2_HL1 & 0x0F);
            fators.quants[0].HL1 = (byte)(quant.yQuantValues.HH2_HL1 >> 4);
            fators.quants[0].LH1 = (byte)(quant.yQuantValues.LH1_HH1 & 0x0F);
            fators.quants[0].HH1 = (byte)(quant.yQuantValues.LH1_HH1 >> 4);

            fators.quants[1]     = new QuantizationFactors();
            fators.quants[1].LL3 = (byte)(quant.cbQuantValues.LL3_HL3 & 0x0F);
            fators.quants[1].HL3 = (byte)(quant.cbQuantValues.LL3_HL3 >> 4);
            fators.quants[1].LH3 = (byte)(quant.cbQuantValues.LH3_HH3 & 0x0F);
            fators.quants[1].HH3 = (byte)(quant.cbQuantValues.LH3_HH3 >> 4);
            fators.quants[1].HL2 = (byte)(quant.cbQuantValues.HL2_LH2 & 0x0F);
            fators.quants[1].LH2 = (byte)(quant.cbQuantValues.HL2_LH2 >> 4);
            fators.quants[1].HH2 = (byte)(quant.cbQuantValues.HH2_HL1 & 0x0F);
            fators.quants[1].HL1 = (byte)(quant.cbQuantValues.HH2_HL1 >> 4);
            fators.quants[1].LH1 = (byte)(quant.cbQuantValues.LH1_HH1 & 0x0F);
            fators.quants[1].HH1 = (byte)(quant.cbQuantValues.LH1_HH1 >> 4);

            fators.quants[2]     = new QuantizationFactors();
            fators.quants[2].LL3 = (byte)(quant.crQuantValues.LL3_HL3 & 0x0F);
            fators.quants[2].HL3 = (byte)(quant.crQuantValues.LL3_HL3 >> 4);
            fators.quants[2].LH3 = (byte)(quant.crQuantValues.LH3_HH3 & 0x0F);
            fators.quants[2].HH3 = (byte)(quant.crQuantValues.LH3_HH3 >> 4);
            fators.quants[2].HL2 = (byte)(quant.crQuantValues.HL2_LH2 & 0x0F);
            fators.quants[2].LH2 = (byte)(quant.crQuantValues.HL2_LH2 >> 4);
            fators.quants[2].HH2 = (byte)(quant.crQuantValues.HH2_HL1 & 0x0F);
            fators.quants[2].HL1 = (byte)(quant.crQuantValues.HH2_HL1 >> 4);
            fators.quants[2].LH1 = (byte)(quant.crQuantValues.LH1_HH1 & 0x0F);
            fators.quants[2].HH1 = (byte)(quant.crQuantValues.LH1_HH1 >> 4);

            return(fators);
        }
Beispiel #3
0
        public static RFX_PROGRESSIVE_CODEC_QUANT ConvertProgQuant(QuantizationFactorsArray quants)
        {
            var RFXQuants = new RFX_PROGRESSIVE_CODEC_QUANT();
            var quantList = new List <RFX_COMPONMENT_CODEC_QUANT>();

            foreach (var quant in quants.quants)
            {
                var rfxQuant = new RFX_COMPONMENT_CODEC_QUANT
                {
                    LL3_HL3 = (byte)((quant.HL3 << 4) | quant.LL3),
                    LH3_HH3 = (byte)((quant.HH3 << 4) | quant.LH3),
                    HL2_LH2 = (byte)((quant.LH2 << 4) | quant.HL2),
                    HH2_HL1 = (byte)((quant.HL1 << 4) | quant.HH2),
                    LH1_HH1 = (byte)((quant.HH1 << 4) | quant.LH1)
                };
                quantList.Add(rfxQuant);
            }
            RFXQuants.yQuantValues  = quantList[0];
            RFXQuants.cbQuantValues = quantList[1];
            RFXQuants.crQuantValues = quantList[2];

            return(RFXQuants);
        }