Esempio n. 1
0
        private void FilterRow(int rown)
        {
            // warning: filters operation rely on: "previos row" (rowbprev) is
            // initialized to 0 the first time
            if (filterStrat.shouldTestAll(rown))
            {
                FilterRowNone();
                ReportResultsForFilter(rown, FilterType.FILTER_NONE, true);
                FilterRowSub();
                ReportResultsForFilter(rown, FilterType.FILTER_SUB, true);
                FilterRowUp();
                ReportResultsForFilter(rown, FilterType.FILTER_UP, true);
                FilterRowAverage();
                ReportResultsForFilter(rown, FilterType.FILTER_AVERAGE, true);
                FilterRowPaeth();
                ReportResultsForFilter(rown, FilterType.FILTER_PAETH, true);
            }

            FilterType filterType = filterStrat.gimmeFilterType(rown, true);

            rowbfilter[0] = (byte)(int)filterType;

            switch (filterType)
            {
            case Hjg.Pngcs.FilterType.FILTER_NONE:
                FilterRowNone();
                break;

            case Hjg.Pngcs.FilterType.FILTER_SUB:
                FilterRowSub();
                break;

            case Hjg.Pngcs.FilterType.FILTER_UP:
                FilterRowUp();
                break;

            case Hjg.Pngcs.FilterType.FILTER_AVERAGE:
                FilterRowAverage();
                break;

            case Hjg.Pngcs.FilterType.FILTER_PAETH:
                FilterRowPaeth();
                break;

            default:
                throw new PngjOutputException("Filter type " + filterType + " not implemented");
            }
            ReportResultsForFilter(rown, filterType, false);
        }
Esempio n. 2
0
        public void FilterRow(int rown)
        {
            if (filterStrat.shouldTestAll(rown))
            {
                FilterRowNone();
                reportResultsForFilter(rown, FilterType.FILTER_NONE, tentative: true);
                FilterRowSub();
                reportResultsForFilter(rown, FilterType.FILTER_SUB, tentative: true);
                FilterRowUp();
                reportResultsForFilter(rown, FilterType.FILTER_UP, tentative: true);
                FilterRowAverage();
                reportResultsForFilter(rown, FilterType.FILTER_AVERAGE, tentative: true);
                FilterRowPaeth();
                reportResultsForFilter(rown, FilterType.FILTER_PAETH, tentative: true);
            }
            FilterType filterType = filterStrat.gimmeFilterType(rown, useEntropy: true);

            rowbfilter[0] = (byte)filterType;
            switch (filterType)
            {
            case FilterType.FILTER_NONE:
                FilterRowNone();
                break;

            case FilterType.FILTER_SUB:
                FilterRowSub();
                break;

            case FilterType.FILTER_UP:
                FilterRowUp();
                break;

            case FilterType.FILTER_AVERAGE:
                FilterRowAverage();
                break;

            case FilterType.FILTER_PAETH:
                FilterRowPaeth();
                break;

            default:
                throw new PngjOutputException("Filter type " + filterType.ToString() + " not implemented");
            }
            reportResultsForFilter(rown, filterType, tentative: false);
        }