/// <summary>
 /// this method is available only for jpeg images
 /// </summary>
 /// <param name="jpegImage"> represents the jpegImage</param>
 /// <param name="quantizationTableType"></param>
 /// <returns></returns>
 public static Double[,] GetQuantizationTable(Bitmap jpegImage, QuantizationTableType quantizationTableType)
 {
     switch (quantizationTableType)
     {
         case QuantizationTableType.Luminance:
             //if (jpegImage.PropertyIdList.Contains(ImagePropertiesConstants.PropertyTagLuminanceTable))
             //{
             //    var luminanceProperty = jpegImage.GetPropertyItem(ImagePropertiesConstants.PropertyTagLuminanceTable);
             //    var value = luminanceProperty.Value;
             //    var ret = new DoubleMatrix(8);
             //    var acccessor = ZigZagAccessorFactory.Access(ret);
             //    for (int index = 0; index < 64; index++)
             //    {
             //        acccessor[index] = BitConverter.ToUInt16(value, index * 2);
             //    }
             //    return ret;
             //}
             return ImagePropertiesConstants.LuminanceQuantizationTable;
         case QuantizationTableType.Chrominance:
             //if (jpegImage.PropertyIdList.Contains(ImagePropertiesConstants.PropertyTagChrominanceTable))
             //{
             //    var chrominanceProperty = jpegImage.GetPropertyItem(ImagePropertiesConstants.PropertyTagChrominanceTable);
             //    var value = chrominanceProperty.Value;
             //    var ret = new DoubleMatrix(8);
             //    var acccessor = ZigZagAccessorFactory.Access(ret);
             //    for (int index = 0; index < 64; index++)
             //    {
             //        acccessor[index] = BitConverter.ToUInt16(value, index * 2);
             //    }
             //    return ret;
             //}
             return ImagePropertiesConstants.ChrominanceQuantizationTable;
     }
     return null;
 }
        /// <summary>
        /// returns the jpeg quantization tables in an  short array with 64 items
        /// </summary>
        /// <param name="jpegImage"></param>
        /// <param name="quantizationTableType"></param>
        /// <returns></returns>
        public static short[] GetQuantizationTableArray(Bitmap jpegImage, QuantizationTableType quantizationTableType)
        {
            Accessor<double> accessor;
            var ret = new short[64];
            var j = 0;
            switch (quantizationTableType)
            {
                case QuantizationTableType.Luminance:
                    //if (jpegImage.PropertyIdList.Contains(ImagePropertiesConstants.PropertyTagLuminanceTable))
                    //{
                    //    var luminanceProperty = jpegImage.GetPropertyItem(ImagePropertiesConstants.PropertyTagLuminanceTable);
                    //    var value = luminanceProperty.Value;
                    //    for (int index = 0; index < 64; index++)
                    //    {
                    //        ret[index] = BitConverter.ToInt16(value, index * 2);
                    //    }
                    //    return ret;
                    //}
                    accessor = ZigZagAccessorFactory.Access(ImagePropertiesConstants.LuminanceQuantizationTable);
                    for (int index = 0; index < 64; index++)
                    {
                        ret[j] = Convert.ToInt16(accessor[index]);
                    }
                    return ret;
                case QuantizationTableType.Chrominance:
                    //if (jpegImage.PropertyIdList.Contains(ImagePropertiesConstants.PropertyTagChrominanceTable))
                    //{
                    //    var chrominanceProperty = jpegImage.GetPropertyItem(ImagePropertiesConstants.PropertyTagChrominanceTable);
                    //    var value = chrominanceProperty.Value;
                    //    for (int index = 0; index < 64; index++)
                    //    {
                    //        ret[index] = BitConverter.ToInt16(value, index * 2);
                    //    }
                    //    return ret;
                    //}

                    accessor = ZigZagAccessorFactory.Access(ImagePropertiesConstants.LuminanceQuantizationTable);
                    for (int index = 0; index < 64; index++)
                    {
                        ret[j] = Convert.ToInt16(accessor[index]);
                    }

                    return ret;
            }

            return null;
        }