private static void ComputeOriginalLL3FromDeltas(short[] input, bool useReduceExtrapolate)
        {
            int ll3Len = RdpegfxTileUtils.GetBandSize(BandType_Values.LL3, useReduceExtrapolate);
            int ll3Idx = RdpegfxTileUtils.ComponentElementCount - ll3Len;

            for (int i = ll3Idx + 1; i < RdpegfxTileUtils.ComponentElementCount; i++)
            {
                input[i] = (short)(input[i] + input[i - 1]);
            }
        }
        private static void ComputeLL3Deltas(Triplet <short[]> input, bool UseReduceExtrapolate)
        {
            int ll3Len = RdpegfxTileUtils.GetBandSize(BandType_Values.LL3, UseReduceExtrapolate);
            int ll3Idx = RdpegfxTileUtils.ComponentElementCount - ll3Len;

            //for (int i = ll3Idx + 1; i < TileUtils.ComponentElementCount; i++)
            for (int i = RdpegfxTileUtils.ComponentElementCount - 1; i >= ll3Idx + 1; i--)
            {
                foreach (var component in input)
                {
                    component[i] = (short)(component[i] - component[i - 1]);
                }
            }
        }
 // Should maintain a LastFrame
 public static void SubBandDiffing(Triplet <short[]> input, Triplet <short[]> lastFrame, bool UseReduceExtrapolate, out Triplet <short[]> output, out bool useDiffing)
 {
     // According to TD SubBandDiffing step is mandatory and in SubBandDiffing decide whether or not use diffing
     short[] x, y, z;
     output = null;
     if (lastFrame == null)
     {
         x = new short[input.X.Length];
         Array.Copy(input.X, x, input.X.Length);
         y = new short[input.Y.Length];
         Array.Copy(input.Y, y, input.Y.Length);
         z = new short[input.Z.Length];
         Array.Copy(input.Z, z, input.Z.Length);
         output     = new Triplet <short[]>(x, y, z);
         useDiffing = false;
     }
     else
     {
         short[] yDiffDwt, cbDiffDwt, crDiffDwt;
         int     lenOfNonLL3Band = (RdpegfxTileUtils.ComponentElementCount - RdpegfxTileUtils.GetBandSize(BandType_Values.LL3, UseReduceExtrapolate));// ? 81 : 64;
         int     yNewZeroCount, cbNewZeroCount, crNewZeroCount;
         int     yDiffZeroCount, cbDiffZeroCount, crDiffZeroCount;
         yDiffDwt  = RdpegfxTileUtils.SubDiffingDwt(input.X, lastFrame.X, lenOfNonLL3Band, out yNewZeroCount, out yDiffZeroCount);
         cbDiffDwt = RdpegfxTileUtils.SubDiffingDwt(input.Y, lastFrame.Y, lenOfNonLL3Band, out cbNewZeroCount, out cbDiffZeroCount);
         crDiffDwt = RdpegfxTileUtils.SubDiffingDwt(input.Z, lastFrame.Z, lenOfNonLL3Band, out crNewZeroCount, out crDiffZeroCount);
         // According to TD we should only compare the zeros in Luma (Y) component
         // Need to be confirmed
         if ((yDiffDwt != null && cbDiffDwt != null && crDiffDwt != null) && yNewZeroCount < yDiffZeroCount)
         {
             //use difference tile
             output     = new Triplet <short[]>(yDiffDwt, cbDiffDwt, crDiffDwt);
             useDiffing = true;
         }
         else
         {
             // don't use difference tile
             x = new short[input.X.Length];
             Array.Copy(input.X, x, input.X.Length);
             y = new short[input.Y.Length];
             Array.Copy(input.Y, y, input.Y.Length);
             z = new short[input.Z.Length];
             Array.Copy(input.Z, z, input.Z.Length);
             output     = new Triplet <short[]>(x, y, z);
             useDiffing = false;
         }
     }
 }