Skip to content

Commit

Permalink
Merge branch 'release/1.0.7.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
tautcony committed Mar 1, 2023
2 parents f82ba9c + 83134e2 commit 5dc8531
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 253 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "Updater"]
path = Updater
url = https://github.com/vcb-s/updater.git
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

# RP Checker <br/> ![GitHub](https://img.shields.io/github/license/vcb-s/rp-checker) [![Build status](https://ci.appveyor.com/api/projects/status/1uifyy3wsi8fblts?svg=true&passingText=%E7%BC%96%E8%AF%91%20-%20%E7%A8%B3%20&pendingText=%E5%B0%8F%E5%9C%9F%E8%B1%86%E7%82%B8%E4%BA%86%20&failingText=%E6%88%91%E6%84%9F%E8%A7%89%E5%8D%9C%E8%A1%8C%20)](https://ci.appveyor.com/project/tautcony/rp-checker) ![GitHub all releases](https://img.shields.io/github/downloads/vcb-s/rp-checker/total)
# RP Checker <br/> ![GitHub](https://img.shields.io/github/license/vcb-s/rp-checker) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vcb-s/rp-checker/dotnet-ci.yml) ![GitHub all releases](https://img.shields.io/github/downloads/vcb-s/rp-checker/total)

A simple tool to check if a video file is corrupted by calculating [PSNR](https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio)/[SSIM](https://en.wikipedia.org/wiki/Structural_similarity)/[GMSD](https://www4.comp.polyu.edu.hk/~cslzhang/IQA/GMSD/GMSD.htm) with another reference video file.

Expand All @@ -17,7 +17,7 @@ A simple tool to check if a video file is corrupted by calculating [PSNR](https:

- You can switch these options by clicking the form icon at the top left corner, GMSD option is available in a combo box at the right panel.

- You need to install [VapourSynth R54](https://github.com/vapoursynth/vapoursynth/releases) or higher with the corresponding [python version](https://www.python.org/downloads/) to enable VapourSynth processor.
- You need to install [VapourSynth R54](https://github.com/vapoursynth/vapoursynth/releases) or higher with the corresponding [Python version](https://www.python.org/downloads/) to enable VapourSynth processor.

- PSNR(VS) requires [L-SMASH](https://github.com/AkarinVS/L-SMASH-Works) and [vs-ComparePlane](https://github.com/AmusementClub/vs-ComparePlane) to be installed.

Expand Down
14 changes: 2 additions & 12 deletions RPChecker.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.352
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RPChecker", "RPChecker\RPChecker.csproj", "{CDCAD55C-8AB6-4E56-8C8D-E53A7E523599}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{EE682A3C-2283-4C5D-806B-7DDC6774657D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -23,14 +21,6 @@ Global
{CDCAD55C-8AB6-4E56-8C8D-E53A7E523599}.Release|Any CPU.Build.0 = Release|Any CPU
{CDCAD55C-8AB6-4E56-8C8D-E53A7E523599}.Release|x64.ActiveCfg = Release|x64
{CDCAD55C-8AB6-4E56-8C8D-E53A7E523599}.Release|x64.Build.0 = Release|x64
{EE682A3C-2283-4C5D-806B-7DDC6774657D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE682A3C-2283-4C5D-806B-7DDC6774657D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE682A3C-2283-4C5D-806B-7DDC6774657D}.Debug|x64.ActiveCfg = Debug|Any CPU
{EE682A3C-2283-4C5D-806B-7DDC6774657D}.Debug|x64.Build.0 = Debug|Any CPU
{EE682A3C-2283-4C5D-806B-7DDC6774657D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE682A3C-2283-4C5D-806B-7DDC6774657D}.Release|Any CPU.Build.0 = Release|Any CPU
{EE682A3C-2283-4C5D-806B-7DDC6774657D}.Release|x64.ActiveCfg = Release|Any CPU
{EE682A3C-2283-4C5D-806B-7DDC6774657D}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
14 changes: 7 additions & 7 deletions RPChecker/App.config
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<appSettings>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<appSettings>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
Expand All @@ -22,4 +22,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>
17 changes: 10 additions & 7 deletions RPChecker/Forms/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 44 additions & 16 deletions RPChecker/Forms/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,22 @@ private void Form1_Load(object sender, EventArgs e)
cbVpyFile.Items.AddRange(current.GetFiles("*.vpy").ToArray<object>());
btnAnalyze.Enabled = false;

Updater.Utils.CheckUpdateWeekly("RPChecker");
if (_rpcCollection.Any())
{
LoadRPCFile(_rpcCollection);
}

var yThreshold = RegistryStorage.Load("threshold", "y");
var uvThreshold = RegistryStorage.Load("threshold", "uv");
if (yThreshold != null && double.TryParse(yThreshold, out var y))
{
_threshold = y;
numericUpDown1.Value = (decimal) y;
}
if (uvThreshold != null && double.TryParse(uvThreshold, out var uv))
{
_uv_threshold = uv;
}
}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
Expand All @@ -62,7 +73,9 @@ private void Form1_FormClosing(object sender, FormClosingEventArgs e)

public readonly List<(string src, string opt)> FilePathsPair = new List<(string src, string opt)>();
private readonly List<ReSulT> _fullData = new List<ReSulT>();
private int _threshold = 30;
private double _threshold = 30;

private double _uv_threshold = 40;
private readonly double[] _frameRate = { 24000 / 1001.0, 24, 25, 30000 / 1001.0, 50, 60000 / 1001.0 };
private IProcess _coreProcess = new VsPipePSNRProcess();

Expand All @@ -78,7 +91,7 @@ private void UpdateText(string value = null)
cbVpyFile.Enabled = _coreProcess is VsPipePSNRProcess;
Text = $"[VCB-Studio] RP Checker v{Assembly.GetExecutingAssembly().GetName().Version} [{_coreProcess.Title}][{(UseOriginPath ? "O" : "L")}]";
_threshold = _coreProcess.Threshold;
numericUpDown1.Value = _threshold;
numericUpDown1.Value = (decimal) _threshold;
}

void SwitchPath()
Expand Down Expand Up @@ -147,9 +160,11 @@ void LoadRPCFile(IEnumerable<string> rpcCollection)
cbFileList.Items.Add(Path.GetFileName(item.FileNamePair.src) ?? "");
item.Data.Sort(delegate((int, double, double, double) lhs, (int, double, double, double) rhs)
{
if (Math.Abs(lhs.Item2 - rhs.Item2) > 1e-5)
var lMin = Math.Min(lhs.Item2, Math.Min(lhs.Item3, lhs.Item4));
var rMin = Math.Min(rhs.Item2, Math.Min(rhs.Item3, rhs.Item4));
if (Math.Abs(lMin - rMin) > 1e-5)
{
return lhs.Item2 - rhs.Item2 < 0 ? -1 : 1;
return lMin - rMin < 0 ? -1 : 1;
}

return lhs.Item1 - rhs.Item1;
Expand All @@ -175,7 +190,6 @@ void LoadRPCFile(IEnumerable<string> rpcCollection)
private void AddCommand()
{
_systemMenu = new SystemMenu(this);
_systemMenu.AddCommand("检查更新(&U)", () => { Updater.Utils.CheckUpdate(true); }, true);
_systemMenu.AddCommand("使用 PSNR(VS)", Set2VSPSNR, true);
_systemMenu.AddCommand("使用 GMSD(VS)", Set2VSGMSD, false);
_systemMenu.AddCommand("使用 PSNR(FF)", Set2FFPSNR, false);
Expand Down Expand Up @@ -303,9 +317,9 @@ private void cbFPS_SelectedIndexChanged(object sender, EventArgs e)

private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
var threshold = Convert.ToInt32(numericUpDown1.Value);
if (threshold == _threshold) return;
_threshold = threshold;
var threshold = numericUpDown1.Value;
if (Math.Abs((double) threshold - _threshold) < 1e-5) return;
_threshold = (double) threshold;
if (_fullData == null || _fullData.Count == 0) return;
UpdateGridView(CurrentData, FrameRate);
}
Expand Down Expand Up @@ -333,19 +347,32 @@ private bool Enable
}
private void UpdateGridView(ReSulT info, double frameRate)
{
var timer = Stopwatch.StartNew();
dataGridView1.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;

dataGridView1.Rows.Clear();
foreach (var item in info.Data)
{
if ((item.value_y > _threshold && dataGridView1.RowCount > 450) || dataGridView1.RowCount > 2048) break;
var yWarningRequired = item.value_y < _threshold;
var uWarningRequired = item.value_u < _uv_threshold;
var vWarningRequired = item.value_v < _uv_threshold;
var warningRequired = yWarningRequired || uWarningRequired || vWarningRequired;
if ((!warningRequired && dataGridView1.RowCount > 1000) || dataGridView1.RowCount > 5000) break;
var newRow = new DataGridViewRow {Tag = item};
var temp = ToolKits.Second2Time(item.index / frameRate);
newRow.CreateCells(dataGridView1, item.index, Math.Round(item.value_y, 4), Math.Round(item.value_u, 4), Math.Round(item.value_v, 4), temp.Time2String());
newRow.DefaultCellStyle.BackColor = item.value_y < _threshold
? Color.FromArgb(233, 76, 60) : Color.FromArgb(46, 205, 112);
var time = ToolKits.Second2Time(item.index / frameRate);
newRow.CreateCells(dataGridView1, item.index, Math.Round(item.value_y, 4), Math.Round(item.value_u, 4), Math.Round(item.value_v, 4), time.Time2String());

newRow.Cells[1].Style.BackColor = yWarningRequired ? Color.FromArgb(233, 76, 60) : Color.FromArgb(46, 205, 112);
newRow.Cells[2].Style.BackColor = uWarningRequired ? Color.FromArgb(233, 76, 60) : Color.FromArgb(46, 205, 112);
newRow.Cells[3].Style.BackColor = vWarningRequired ? Color.FromArgb(233, 76, 60) : Color.FromArgb(46, 205, 112);

dataGridView1.Rows.Add(newRow);
}
Application.DoEvents();
Debug.WriteLine($"DataGridView with {dataGridView1.Rows.Count} lines");
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
Application.DoEvents();
timer.Stop();
Debug.WriteLine($"DataGridView with {dataGridView1.Rows.Count} lines in {timer.Elapsed.TotalSeconds}s");
}

private bool _errorDialogShowed;
Expand Down Expand Up @@ -705,8 +732,9 @@ private void toolStripProgressBar1_Click(object sender, EventArgs e)

private void cbVpyFile_SelectedIndexChanged(object sender, EventArgs e)
{
// threshold for GMSD
_threshold = ((ComboBox) sender).SelectedIndex == 1 ? 80 : 30;
numericUpDown1.Value = _threshold;
numericUpDown1.Value = (decimal) _threshold;
}

private void Form1_DragDrop(object sender, DragEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion RPChecker/Forms/FrmChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public partial class FrmChart : Form
private readonly double _threshold;
private readonly double _fps;
private readonly string _type;
public FrmChart(ReSulT info, int threshold, double fps, string type)
public FrmChart(ReSulT info, double threshold, double fps, string type)
{
InitializeComponent();
_info = info;
Expand Down
4 changes: 0 additions & 4 deletions RPChecker/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using CommandLine;
Expand Down Expand Up @@ -37,9 +36,6 @@ static void Main(string[] args)
// AttachConsole(ATTACH_PARENT_PROCESS);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Updater.Utils.SoftwareName = "RPChecker";
Updater.Utils.RepoName = "vcb-s/rp-checker";
Updater.Utils.CurrentVersion = Assembly.GetExecutingAssembly().GetName().Version;
Parser.Default.ParseArguments<Options>(args)
.WithParsed(opts => Application.Run(new Form1(opts.InputFiles.ToList())))
.WithNotParsed(errs => MessageBox.Show(errs.First().ToString(), @"RPChecker Error"));
Expand Down
4 changes: 2 additions & 2 deletions RPChecker/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.7.1")]
[assembly: AssemblyFileVersion("1.0.7.1")]
[assembly: AssemblyVersion("1.0.7.2")]
[assembly: AssemblyFileVersion("1.0.7.2")]
Loading

0 comments on commit 5dc8531

Please sign in to comment.