Exemplo n.º 1
0
        public static DcCategoryEncodedPair CalculateDifferenceDc(ColorChannel channel, int i)
        {
            int result = (int)channel.GetBlock(i)[0, 0];

            if (i != 0)
            {
                result = (int)channel.GetBlock(i)[0, 0] - (int)channel.GetBlock(i - 1)[0, 0];
            }

            return(new DcCategoryEncodedPair(AbstractCategoryEncodedPair.CalculateCategory(result),
                                             AbstractCategoryEncodedPair.EncodeCategory(result)));
        }
Exemplo n.º 2
0
        public static List <AcCategoryEncodedPair> EncodeCategoriesAc(
            IEnumerable <AcRunlengthEncodedPair> acRunLengthEncodedPairs)
        {
            List <AcCategoryEncodedPair> resultList = new List <AcCategoryEncodedPair>();

            foreach (AcRunlengthEncodedPair acRunLengthEncodedPair in acRunLengthEncodedPairs)
            {
                int category = AbstractCategoryEncodedPair.CalculateCategory(acRunLengthEncodedPair.GetEntry());
                int pair     = (acRunLengthEncodedPair.GetZeroCount() << 4) +
                               category;
                int categoryEncoded = AbstractCategoryEncodedPair.EncodeCategory(acRunLengthEncodedPair.GetEntry());
                resultList.Add(new AcCategoryEncodedPair(pair, categoryEncoded));
            }

            return(resultList);
        }