Skip to content

Commit

Permalink
Merge branch 'release/1.0.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
tautcony committed Jan 19, 2023
2 parents c450846 + 55e4258 commit 1e1612b
Show file tree
Hide file tree
Showing 14 changed files with 287 additions and 124 deletions.
4 changes: 4 additions & 0 deletions RPChecker/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
49 changes: 37 additions & 12 deletions RPChecker/Forms/Form1.Designer.cs

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

95 changes: 85 additions & 10 deletions RPChecker/Forms/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Collections.Generic;
using RPChecker.Util.FilterProcess;
using System.Text.RegularExpressions;
using Jil;

namespace RPChecker.Forms
{
Expand Down Expand Up @@ -124,14 +125,27 @@ void LoadRPCFile(IEnumerable<string> rpcCollection)
foreach (var rpc in rpcCollection)
{
var json = File.ReadAllText(rpc);

_fullData.AddRange(Jil.JSON.Deserialize<IEnumerable<ReSulT>>(json));
try
{
_fullData.AddRange(Jil.JSON.Deserialize<IEnumerable<ReSulT>>(json));
}
catch (Jil.DeserializationException)
{
try
{
_fullData.AddRange(Jil.JSON.Deserialize<IEnumerable<ResultV1>>(json).Select(x => (ReSulT)x));
}
catch (Jil.DeserializationException)
{
_fullData.AddRange(Jil.JSON.Deserialize<IEnumerable<ResultV2>>(json).Select(x => (ReSulT)x));
}
}
}

_fullData.ForEach(item =>
{
cbFileList.Items.Add(Path.GetFileName(item.FileNamePair.src) ?? "");
item.Data.Sort(delegate((int, double) lhs, (int, double) rhs)
item.Data.Sort(delegate((int, double, double, double) lhs, (int, double, double, double) rhs)
{
if (Math.Abs(lhs.Item2 - rhs.Item2) > 1e-5)
{
Expand Down Expand Up @@ -322,11 +336,11 @@ private void UpdateGridView(ReSulT info, double frameRate)
dataGridView1.Rows.Clear();
foreach (var item in info.Data)
{
if ((item.value > _threshold && dataGridView1.RowCount > 450) || dataGridView1.RowCount > 2048) break;
if ((item.value_y > _threshold && dataGridView1.RowCount > 450) || dataGridView1.RowCount > 2048) break;
var newRow = new DataGridViewRow {Tag = item};
var temp = ToolKits.Second2Time(item.index / frameRate);
newRow.CreateCells(dataGridView1, item.index, Math.Round(item.value, 4), temp.Time2String());
newRow.DefaultCellStyle.BackColor = item.value < _threshold
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);
dataGridView1.Rows.Add(newRow);
}
Expand All @@ -336,7 +350,7 @@ private void UpdateGridView(ReSulT info, double frameRate)

private bool _errorDialogShowed;
private LogBuffer _currentBuffer;
private List<(int index, double value)> _data;
private List<(int index, double value_y, double value_u, double value_v)> _data;

private void btnAnalyze_Click(object sender, EventArgs e)
{
Expand All @@ -348,10 +362,10 @@ private void btnAnalyze_Click(object sender, EventArgs e)
{
_errorDialogShowed = false;
_currentBuffer = new LogBuffer();
_data = new List<(int index, double value)>();
_data = new List<(int index, double value_y, double value_u, double value_v)>();

AnalyzeClipLink(item);
var data = _data.OrderBy(a => a.value).ThenBy(a => a.index).ToList();
var data = _data.OrderBy(a => a.value_y).ThenBy(a => a.index).ToList();
_fullData.Add(new ReSulT {FileNamePair = item, Data = data, Logs = _currentBuffer});
if (_currentBuffer.Inf) continue;
if (!(_coreProcess is VsPipePSNRProcess) || _remainFile || !UseOriginPath) continue;
Expand Down Expand Up @@ -380,7 +394,7 @@ private void btnAnalyze_Click(object sender, EventArgs e)
}
}

private bool _useOriginPath;
private bool _useOriginPath = true;

private bool UseOriginPath => _useOriginPath || !(_coreProcess is VsPipePSNRProcess);

Expand Down Expand Up @@ -694,12 +708,73 @@ private void cbVpyFile_SelectedIndexChanged(object sender, EventArgs e)
_threshold = ((ComboBox) sender).SelectedIndex == 1 ? 80 : 30;
numericUpDown1.Value = _threshold;
}

private void Form1_DragDrop(object sender, DragEventArgs e)
{
string[] fileList = (string[])e.Data.GetData(DataFormats.FileDrop, false);
LoadRPCFile(fileList);
}

private void Form1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
}
}


public struct ReSulT
{
public List<(int index, double value_y, double value_u, double value_v)> Data { get; set; }
public (string src, string opt) FileNamePair { get; set; }
[JilDirective(Ignore = true)]
public LogBuffer Logs { get; set; }

public static implicit operator ReSulT(ResultV1 result)
{
return new ReSulT
{
Data = result.Data.Select(item => (item.index, item.value, 0.0, 0.0)).ToList(),
FileNamePair = result.FileNamePair,
Logs = result.Logs
};
}

public static implicit operator ReSulT(ResultV2 result)
{
var data = new List<(int index, double value_y, double value_u, double value_v)>();
foreach (var item in result.Data)
{
if (item.Count == 3)
{
data.Add((item[0].index, item[0].value, item[1].value, item[2].value));
}
else
{
data.Add((item[0].index, item[0].value, 0, 0));
}
}
return new ReSulT
{
Data = data,
FileNamePair = result.FileNamePair,
Logs = result.Logs
};
}
}

public struct ResultV1
{
public List<(int index, double value)> Data { get; set; }
public (string src, string opt) FileNamePair { get; set; }
[JilDirective(Ignore = true)]
public LogBuffer Logs { get; set; }
}

public struct ResultV2
{
public List<List<(int index, double value)>> Data { get; set; }
public (string src, string opt) FileNamePair { get; set; }
[JilDirective(Ignore = true)]
public LogBuffer Logs { get; set; }
}
}
8 changes: 7 additions & 1 deletion RPChecker/Forms/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@
<metadata name="frams.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PSNR.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="value_y.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="value_u.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="value_v.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Time.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
Expand Down
50 changes: 43 additions & 7 deletions RPChecker/Forms/FrmChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,25 @@ private void FrmChart_Load(object sender, EventArgs e)
private void DrawChart()
{
chart1.Series.Clear();
var series1 = new Series(_type)
var series_y = new Series(_type)
{
Color = Color.FromArgb(078, 079, 251),
Color = Color.FromArgb(35, 25, 85),
ChartType = SeriesChartType.Line,
IsValueShownAsLabel = false
};
var series_u = new Series("U Series")
{
Color = Color.FromArgb(31, 70, 144),
ChartType = SeriesChartType.Line,
IsValueShownAsLabel = false
};
var series_v = new Series("V Series")
{
Color = Color.FromArgb(232, 170, 66),
ChartType = SeriesChartType.Line,
IsValueShownAsLabel = false
};

var series2 = new Series("frame")
{
Color = Color.FromArgb(255, 010, 050),
Expand All @@ -63,17 +76,40 @@ void AddLabel(int position, TimeSpan time) => chart1.ChartAreas[0].AxisX.CustomL

new Task(() =>
{
foreach(var frame in _info.Data.OrderBy(item => item.index))
bool valid_u = false, valid_v = false;
foreach(var (index, value_y, value_u, value_v) in _info.Data.OrderBy(item => item.index))
{
series1.Points.AddXY(frame.index, frame.value);
if (frame.value < _threshold)
series_y.Points.AddXY(index, value_y);
if (value_y < _threshold)
{
series2.Points.AddXY(index, value_y);
}
if (value_u > 1e-5)
{
valid_u = true;
series_u.Points.AddXY(index, value_u);
if (value_u < _threshold)
{
series2.Points.AddXY(index, value_u);
}
}
if (value_v > 1e-5)
{
series2.Points.AddXY(frame.index, frame.value);
valid_v = true;
series_v.Points.AddXY(index, value_v);
if (value_v < _threshold)
{
series2.Points.AddXY(index, value_v);
}
}
}
Invoke(new Action(() =>
{
chart1.Series.Add(series1);
chart1.Series.Add(series_y);
if (valid_u) chart1.Series.Add(series_u);
if (valid_v) chart1.Series.Add(series_v);
chart1.Series.Add(series2);
}));
}).Start();
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.6.6")]
[assembly: AssemblyFileVersion("1.0.6.6")]
[assembly: AssemblyVersion("1.0.7.0")]
[assembly: AssemblyFileVersion("1.0.7.0")]
Loading

0 comments on commit 1e1612b

Please sign in to comment.