Esempio n. 1
0
 //Compute the difference tile dwt
 public static void SubBandDiffing_DT(RfxProgressiveCodecContext encodingContext, TileState enTileInfo)
 {
     if (encodingContext.UseDifferenceTile)
     {
         DwtTile oldDwt = enTileInfo.GetOldDwt();
         if (oldDwt != null)
         {
             short[] yDiffDwt, cbDiffDwt, crDiffDwt;
             int     lenOfNonLL3Band = (RdpegfxTileUtils.ComponentElementCount - RdpegfxTileUtils.GetBandSize(BandType_Values.LL3, encodingContext.UseReduceExtrapolate));// ? 81 : 64;
             int     yNewZeroCount, cbNewZeroCount, crNewZeroCount;
             int     yDiffZeroCount, cbDiffZeroCount, crDiffZeroCount;
             yDiffDwt  = RdpegfxTileUtils.SubDiffingDwt(encodingContext.YComponent, oldDwt.Y_DwtQ, lenOfNonLL3Band, out yNewZeroCount, out yDiffZeroCount);
             cbDiffDwt = RdpegfxTileUtils.SubDiffingDwt(encodingContext.CbComponent, oldDwt.Cb_DwtQ, lenOfNonLL3Band, out cbNewZeroCount, out cbDiffZeroCount);
             crDiffDwt = RdpegfxTileUtils.SubDiffingDwt(encodingContext.CrComponent, oldDwt.Cr_DwtQ, lenOfNonLL3Band, out crNewZeroCount, out crDiffZeroCount);
             if ((yDiffDwt != null && cbDiffDwt != null && crDiffDwt != null) &&
                 (yNewZeroCount + cbNewZeroCount + crNewZeroCount < yDiffZeroCount + cbDiffZeroCount + crDiffZeroCount))
             {//use difference tile
                 encodingContext.YComponent  = yDiffDwt;
                 encodingContext.CbComponent = cbDiffDwt;
                 encodingContext.CrComponent = crDiffDwt;
                 return;
             }
         }
     }
     encodingContext.UseDifferenceTile = false;//use orginal tile
 }
 //Compute the difference tile dwt
 public static void SubBandDiffing_DT(RfxProgressiveCodecContext encodingContext, TileState enTileInfo)
 {
     if (encodingContext.UseDifferenceTile)
     {
         DwtTile oldDwt = enTileInfo.GetOldDwt();
         if (oldDwt != null)
         {
             short[] yDiffDwt, cbDiffDwt, crDiffDwt;
             int lenOfNonLL3Band = (RdpegfxTileUtils.ComponentElementCount - RdpegfxTileUtils.GetBandSize(BandType_Values.LL3, encodingContext.UseReduceExtrapolate));// ? 81 : 64;
             int yNewZeroCount, cbNewZeroCount, crNewZeroCount;
             int yDiffZeroCount, cbDiffZeroCount, crDiffZeroCount;
             yDiffDwt = RdpegfxTileUtils.SubDiffingDwt(encodingContext.YComponent, oldDwt.Y_DwtQ, lenOfNonLL3Band, out yNewZeroCount, out yDiffZeroCount);
             cbDiffDwt = RdpegfxTileUtils.SubDiffingDwt(encodingContext.CbComponent, oldDwt.Cb_DwtQ, lenOfNonLL3Band, out cbNewZeroCount, out cbDiffZeroCount);
             crDiffDwt = RdpegfxTileUtils.SubDiffingDwt(encodingContext.CrComponent, oldDwt.Cr_DwtQ, lenOfNonLL3Band, out crNewZeroCount, out crDiffZeroCount);
             if ((yDiffDwt != null && cbDiffDwt != null && crDiffDwt != null) &&
                 (yNewZeroCount + cbNewZeroCount + crNewZeroCount < yDiffZeroCount + cbDiffZeroCount + crDiffZeroCount))
             {//use difference tile
                 encodingContext.YComponent = yDiffDwt;
                 encodingContext.CbComponent = cbDiffDwt;
                 encodingContext.CrComponent = crDiffDwt;
                 return;
             }
         }
     }
     encodingContext.UseDifferenceTile = false;//use orginal tile
 }