Пример #1
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            invertFormAcces();
            panelDestination.BackgroundImage = null;
            Refresh();

            if (InputFile != null)
            {
                int.TryParse(textBoxThreshold.Text, out int threshold);
                int.TryParse(comboBoxDictionarySize.GetItemText(comboBoxDictionarySize.SelectedItem), out int dictionarySize);


                AvqCompression = new AVQ(InputFile);
                originalImage  = AvqCompression.StartCompression(threshold, dictionarySize);


                panelDestination.BackgroundImage = originalImage.GetBitMap();
            }
            else
            {
                MessageBox.Show("You need to choose an image!");
            }


            invertFormAcces();
        }
Пример #2
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            invertFormAcces();
            panelDestination.BackgroundImage = null;

            if (InputFile != null)
            {
                bool drawBorder           = checkBoxDrawBorder.Checked;
                bool CompressedFileFormat = checkBoxCompressedFileFormat.Checked;
                int.TryParse(textBoxThreshold.Text, out int threshold);
                int.TryParse(textBoxDictionarySize.Text, out int dictionarySize);

                AvqCompression = new AVQ(InputFile);
                originalImage  = AvqCompression.StartCompression(threshold, dictionarySize, drawBorder, CompressedFileFormat);


                panelDestination.BackgroundImage = originalImage.GetBitMap();
            }
            else
            {
                MessageBox.Show("You need to choose an image!");
            }


            invertFormAcces();
        }
Пример #3
0
        private void buttonDecode_Click(object sender, EventArgs e)
        {
            invertFormAcces();
            openFileDialog.Filter = "AVQ Files(*.AVQ)|*.AVQ|All files (*.*)|*.*";
            openFileDialog.ShowDialog();
            InputFileComp = openFileDialog.FileName;

            if (InputFileComp != null)
            {
                AvqCompression = new AVQ();

                originalImage = AvqCompression.StartDeCompression(InputFileComp);
                Bitmap bitmap = originalImage.GetBitMap();

                string[] output = InputFileComp.Split('.');
                bitmap.Save(output[0] + "-decoded.bmp");
            }
            else
            {
                MessageBox.Show("You need to choose an image!");
            }
            MessageBox.Show("Image decompressed!");
            invertFormAcces();
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            invertFormAcces();
            labelSimulationStatus.Visible = true;
            int[] thresholds      = { 15 };
            int[] dictionarySizes = { 1024, 2048, 4096, 8192, 16384, 32768, 65536 };


            if (OriginalFile != null)
            {
                List <SimulationResult> simulations = new List <SimulationResult>(thresholds.Length * dictionarySizes.Length);

                string   delimiter = ",";
                string[] parts     = OriginalFile.Split('\\');
                string   imageName = parts[parts.Length - 1].Split('.')[0];

                foreach (int threshold in thresholds)
                {
                    StringBuilder sb = new StringBuilder();

                    sb.Append("Marime dictionar" + delimiter);
                    sb.Append("Prag" + delimiter);
                    sb.Append("Timp de executie compresie" + delimiter);
                    sb.Append("Timp de executie decompresie" + delimiter);
                    sb.Append("Numar de blocuri" + delimiter);
                    sb.Append("Marime fisier comprimat" + delimiter);
                    sb.Append("Marime fisier decomprimat" + delimiter);
                    sb.AppendLine("PSNR" + delimiter);

                    foreach (int dictionarySize in dictionarySizes)
                    {
                        AvqCompression = new AVQ(OriginalFile);
                        simulations.Add(AvqCompression.StartSimulation(threshold, dictionarySize));
                        labelSimulationStatus.Text = "Simulation D_" + dictionarySize + " P_" + threshold + " finished";
                        labelSimulationStatus.Refresh();
                    }

                    string filePath = @"D:\Facultate\Licenta\Img\" + imageName + "_P_" + threshold + ".csv";

                    foreach (SimulationResult result in simulations)
                    {
                        sb.Append(result.DictionarySize + delimiter);
                        sb.Append(result.Threshold + delimiter);
                        sb.Append(result.CompressionTime + delimiter);
                        sb.Append(result.DeompressionTime + delimiter);
                        sb.Append(result.BlocksNumber.ToString() + delimiter);
                        sb.Append(result.CompressedFileSize.ToString() + delimiter);
                        sb.Append(result.DecompressedFileSize.ToString() + delimiter);
                        sb.AppendLine(result.PSNR.ToString() + delimiter);
                    }

                    File.WriteAllText(filePath, sb.ToString());
                }
            }
            else
            {
                MessageBox.Show("You need to choose an image!");
            }



            labelSimulationStatus.Visible = false;
            invertFormAcces();
            MessageBox.Show("Simulation finished!");
        }