Example #1
0
        // Retrieves the timings for a certain image and technique
        private bool getTimingsFor(ImageSourceBinding _binding, TechniqueID _id, out double _loadingTime, out double _computationTime)
        {
            // Local variables
            HashDataTimings timings = null;

            // Check parameter
            if (_binding == null || _binding.getComparisonDataFor(_id) == null || _binding.getComparisonDataFor(_id).HashData.getTimings() == null)
            {
                _loadingTime = _computationTime = 0.0;
                return(false);
            }
            timings = _binding.getComparisonDataFor(_id).HashData.getTimings();

            // Set data
            _loadingTime     = timings.ImageLoadingTimeMS;
            _computationTime = timings.HashComputationTimeMS;

            return(true);
        }
Example #2
0
        // Sets the timings for a certain technique
        private void setTimingsFor(TechniqueID _id, ImageSourceBinding _b0, ImageSourceBinding _b1)
        {
            // Local variables
            Label  loadingLabel       = null;
            Label  computationLabel   = null;
            Label  totalLabel         = null;
            bool   validData          = false;
            string loadingString0     = "-";
            string computationString0 = "-";
            string totalString0       = "-";
            string loadingString1     = "-";
            string computationString1 = "-";
            string totalString1       = "-";

            // Get label references
            if (_id == TechniqueID.RADISH)
            {
                // Set references
                loadingLabel     = CC_Label_Loading_RADISH;
                computationLabel = CC_Label_Computation_RADISH;
                totalLabel       = CC_Label_Total_RADISH;
            }
            else if (_id == TechniqueID.DCT)
            {
                // Set references
                loadingLabel     = CC_Label_Loading_DCT;
                computationLabel = CC_Label_Computation_DCT;
                totalLabel       = CC_Label_Total_DCT;
            }
            else if (_id == TechniqueID.WAVELET)
            {
                // Set references
                loadingLabel     = CC_Label_Loading_Wavelet;
                computationLabel = CC_Label_Computation_Wavelet;
                totalLabel       = CC_Label_Total_Wavelet;
            }
            else
            {
                // Set references
                loadingLabel     = CC_Label_Loading_BMB;
                computationLabel = CC_Label_Computation_BMB;
                totalLabel       = CC_Label_Total_BMB;
            }

            // Get timings for the first image
            if (_b0.getComparisonDataFor(_id) != null && _b0.getComparisonDataFor(_id).HashData.getTimings() != null)
            {
                loadingString0     = _b0.getComparisonDataFor(_id).HashData.getTimings().getFormattedLoadingTime();
                computationString0 = _b0.getComparisonDataFor(_id).HashData.getTimings().getFormattedComputationTime();
                totalString0       = _b0.getComparisonDataFor(_id).HashData.getTimings().getFormattedTotalTime();
                validData          = true;
            }

            // Get timings for the second image
            if (_b1.getComparisonDataFor(_id) != null && _b1.getComparisonDataFor(_id).HashData.getTimings() != null)
            {
                loadingString1     = _b1.getComparisonDataFor(_id).HashData.getTimings().getFormattedLoadingTime();
                computationString1 = _b1.getComparisonDataFor(_id).HashData.getTimings().getFormattedComputationTime();
                totalString1       = _b1.getComparisonDataFor(_id).HashData.getTimings().getFormattedTotalTime();
                validData          = true;
            }

            // Set timings
            if (loadingLabel != null)
            {
                if (validData == true)
                {
                    loadingLabel.Text     = string.Format(TEXT_TEMPLATE_TIMING, loadingString0, loadingString1);
                    computationLabel.Text = string.Format(TEXT_TEMPLATE_TIMING, computationString0, computationString1);
                    totalLabel.Text       = string.Format(TEXT_TEMPLATE_TIMING, totalString0, totalString1);
                }
                else
                {
                    loadingLabel.Text     = "-";
                    computationLabel.Text = "-";
                    totalLabel.Text       = "-";
                }
            }
        }