diff --git a/VideoUpsampling_WPF.sln b/VideoUpsampling_WPF.sln
new file mode 100644
index 0000000..03f21cc
--- /dev/null
+++ b/VideoUpsampling_WPF.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoUpsampling_WPF", "VideoUpsampling_WPF\VideoUpsampling_WPF.csproj", "{00121D18-0EBF-402E-A8E0-4D6D095FA4DF}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {00121D18-0EBF-402E-A8E0-4D6D095FA4DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {00121D18-0EBF-402E-A8E0-4D6D095FA4DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {00121D18-0EBF-402E-A8E0-4D6D095FA4DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {00121D18-0EBF-402E-A8E0-4D6D095FA4DF}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {63278D1D-BCE9-4CD0-8D6E-DA13FA84F8A4}
+ EndGlobalSection
+EndGlobal
diff --git a/VideoUpsampling_WPF/App.config b/VideoUpsampling_WPF/App.config
new file mode 100644
index 0000000..731f6de
--- /dev/null
+++ b/VideoUpsampling_WPF/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VideoUpsampling_WPF/App.xaml b/VideoUpsampling_WPF/App.xaml
new file mode 100644
index 0000000..b1c0496
--- /dev/null
+++ b/VideoUpsampling_WPF/App.xaml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VideoUpsampling_WPF/App.xaml.cs b/VideoUpsampling_WPF/App.xaml.cs
new file mode 100644
index 0000000..4ad6d79
--- /dev/null
+++ b/VideoUpsampling_WPF/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace VideoUpsampling_WPF
+{
+ ///
+ /// App.xaml 的交互逻辑
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/VideoUpsampling_WPF/MainWindow.xaml b/VideoUpsampling_WPF/MainWindow.xaml
new file mode 100644
index 0000000..dfc95d5
--- /dev/null
+++ b/VideoUpsampling_WPF/MainWindow.xaml
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VideoUpsampling_WPF/MainWindow.xaml.cs b/VideoUpsampling_WPF/MainWindow.xaml.cs
new file mode 100644
index 0000000..16c465b
--- /dev/null
+++ b/VideoUpsampling_WPF/MainWindow.xaml.cs
@@ -0,0 +1,330 @@
+using Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using MahApps.Metro.Controls;
+using System.ComponentModel;
+using System.Windows.Threading;
+
+namespace VideoUpsampling_WPF
+{
+ ///
+ /// MainWindow.xaml 的交互逻辑
+ ///
+ public partial class MainWindow : MetroWindow
+ {
+ //打开文件、保存文件窗体
+ Microsoft.Win32.OpenFileDialog opendialog;
+ SaveFileDialog savedialog;
+ //原视频地址
+ public String originalPath;
+ //目的视频地址
+ public String outputPath;
+ //分辨率
+ int px = 0;
+ //上采样算法
+ String algorithm = null;
+ //是否添加其他滤镜算法
+ bool Switch;
+
+ int time = 100;
+ int timeUnit;
+
+
+ Process proc = new Process();
+
+
+ public MainWindow()
+ {
+ InitializeComponent();
+
+ }
+
+ /**
+ * 导入原视频按钮的事件响应操作
+ *
+ **/
+ private void importButton_Click(object sender, RoutedEventArgs e)
+ {
+ opendialog = new Microsoft.Win32.OpenFileDialog();
+ opendialog.Filter = "视频文件|*.mp4;*.mkv";
+ if(opendialog.ShowDialog() == true)
+ {
+ importTextBox.Text = opendialog.FileName;
+ }
+ originalPath = opendialog.FileName;
+ }
+
+ /**
+ * 输出视频地址的按钮事件响应操作
+ * */
+ private void exportButton_Click(object sender, RoutedEventArgs e)
+ {
+ savedialog = new SaveFileDialog();
+ savedialog.RestoreDirectory = true;
+ savedialog.Filter = "视频文件|*.mp4";
+
+ if(savedialog.ShowDialog() == true)
+ {
+ outputPath = savedialog.FileName.ToString();
+
+ exportTextBox.Text = outputPath;
+ }
+ }
+
+ /**
+ * 对比视频按钮响应机制
+ * */
+ private void compareButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (originalPath == null || outputPath == null || new FileInfo(outputPath) == null || !new FileInfo(outputPath).Exists)
+ {
+ MessageBox.Show("请压制完成再对比","381鱼雷警告!",MessageBoxButton.OK,MessageBoxImage.Warning);
+ return;
+ }
+ MediaPlayer mp = new MediaPlayer(this);
+ mp.ShowDialog();
+ }
+
+ /**
+ * 上采样按钮响应机制
+ **/
+ private void upsampleButton_Click(object sender, RoutedEventArgs e)
+ {
+
+ if(IsUesd.IsChecked == true)
+ {
+ Switch = true;
+ }
+ if (originalPath == null || originalPath.Equals(""))
+ {
+ MessageBox.Show("请您输入原视频地址再压制","381鱼雷警告!",MessageBoxButton.OK,MessageBoxImage.Warning);
+ return;
+ }
+
+ //输入文件后缀校验
+ String postfix = originalPath.Substring(originalPath.Length - 3, 3);
+ if (!postfix.Equals("mp4"))
+ {
+ MessageBox.Show("请您输入正确的视频地址", "381鱼雷警告!", MessageBoxButton.OK, MessageBoxImage.Warning);
+ return;
+ }
+
+
+ if (outputPath == null || outputPath.Equals(""))
+ {
+ MessageBox.Show("请您输入目的视频地址再压制", "请正确操作,小心460糊脸", MessageBoxButton.OK, MessageBoxImage.Warning);
+ return;
+ }
+
+ if(algorithm == null || algorithm.Equals(""))
+ {
+ MessageBox.Show("请进行算法选择", "扣扣你别忘选算法了", MessageBoxButton.OK, MessageBoxImage.Warning);
+ return;
+ }
+
+ if(px != 720 && px != 1080 && px != 480)
+ {
+ MessageBox.Show("请进行分辨率选择", "扣扣您选下分辨率了", MessageBoxButton.OK, MessageBoxImage.Warning);
+ return;
+ }
+
+ UpdateFile uf = new UpdateFile();
+
+ if (algorithm.Equals("waifu"))
+ {
+
+ }
+ else if(algorithm.Equals("nnedi"))
+ {
+ uf.UpdateAvsFile_nnedi(originalPath, px);
+ }else if (algorithm.Equals("spline"))
+ {
+ uf.UpdateAvsFile_spline(originalPath, px);
+ }else if (algorithm.Equals("bilinear"))
+ {
+ uf.UpdateAvsFile_bilinear(originalPath, px);
+ }
+ else if (algorithm.Equals("bicubic"))
+ {
+ uf.UpdateAvsFile_bicubic(originalPath, px);
+ }
+ uf.UpdateBatFile(outputPath, originalPath, algorithm);
+ if(IsUesd.IsChecked == true)
+ {
+ uf.UpdateOther(algorithm);
+ }
+
+ //调用bat可执行程序
+
+ Result.Text = "";
+ timeUnit = time / 50;
+ pb.Maximum = time;
+ pb.Value = 0;
+ try
+ {
+
+ Thread t = new Thread(new ThreadStart(setResult));
+ t.Start();
+
+
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "发生错误", MessageBoxButton.OK, MessageBoxImage.Warning);
+ }
+ }
+ private void OnExited(object sender, EventArgs e)
+ {
+ Dispatcher.Invoke(() =>
+ {
+ upsampleButton.IsEnabled = true;
+ tbmsg.Text = "上采样完成。";
+ pb.Value = pb.Maximum;
+ });
+ Process targetProcess = sender as Process;
+ targetProcess.Exited -= OnExited;
+ }
+
+
+ private void setResult()
+ {
+
+ Process proc = new Process();
+ proc.StartInfo.FileName = "start.bat";
+ proc.StartInfo.UseShellExecute = false;//不使用系统外壳程序启动
+ proc.StartInfo.RedirectStandardInput = true;//不重定向输入
+ proc.StartInfo.RedirectStandardOutput = true; //重定向输出
+ proc.EnableRaisingEvents = true; //必须为true
+ proc.StartInfo.CreateNoWindow = true;
+ proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;//这里设置DOS窗口不显示,经实践可行
+
+ //proc.OutputDataReceived += new DataReceivedEventHandler(OnDataReceived);
+ proc.Exited += OnExited;
+ proc.Start();
+ tbmsg.Dispatcher.BeginInvoke(new Action(() =>
+ {
+ tbmsg.Text = "上采样中...";
+ }));
+ int tmp = timeUnit;
+ StreamReader sr = proc.StandardOutput;//获取返回值
+ string line = "";
+ string lastLine = "";
+ Thread.Sleep(800);
+ while (!proc.HasExited)
+ {
+ line = sr.ReadLine();
+ if (line != "" && line != null)
+ {
+ if (line.Equals(lastLine) || line == lastLine) continue;
+ Result.Dispatcher.BeginInvoke(new Action(() =>
+ {
+ Result.AppendText(line + "\n");
+ Result.ScrollToEnd();
+ }));
+ lastLine = line;
+ }
+ pb.Dispatcher.BeginInvoke(new Action(() =>
+ {
+ if (tmp != time - timeUnit)
+ {
+ pb.Value = tmp;
+ tmp += tmp ;
+ }
+ }));
+ }
+ pb.Dispatcher.BeginInvoke(new Action(() =>
+ {
+ pb.Value = time;
+ }));
+ //proc.WaitForExit();
+
+
+ }
+
+
+ /**
+ *
+ * 分辨率选择:480P
+ * */
+ private void Checked480(object sender, RoutedEventArgs e)
+ {
+ px = 480;
+ }
+ /**
+ *
+ * 分辨率选择:720P
+ * */
+ private void Checked720(object sender, RoutedEventArgs e)
+ {
+ px = 720;
+ }
+
+ /**
+ *
+ * 分辨率选择:1080P
+ * */
+ private void Checked1080(object sender, RoutedEventArgs e)
+ {
+ px = 1080;
+ }
+
+ /**
+ * importTextBox_PreviewDragOver和importTextBox_PreviewDrop均为
+ * 添加拖拽文件显示原视频地址功能
+ * */
+ private void importTextBox_PreviewDragOver(object sender, DragEventArgs e)
+ {
+ e.Effects = DragDropEffects.Copy;
+ e.Handled = true;
+ }
+
+ private void importTextBox_PreviewDrop(object sender, DragEventArgs e)
+ {
+ foreach (string f in (string[])e.Data.GetData(DataFormats.FileDrop))
+ {
+ importTextBox.Text = f;
+ originalPath = f;
+ }
+ }
+
+ /**
+ *
+ * 上采样算法选择
+ * */
+ private void Nnedi_Checked(object sender, RoutedEventArgs e)
+ {
+ algorithm = "nnedi";
+ }
+ private void Spline_Checked(object sender, RoutedEventArgs e)
+ {
+ algorithm = "spline";
+ }
+ private void Bilinear_Checked(object sender, RoutedEventArgs e)
+ {
+ algorithm = "bilinear";
+ }
+ private void Bicubic_Cheched(object sender, RoutedEventArgs e)
+ {
+ algorithm = "bicubic";
+ }
+
+
+
+ }
+
+}
diff --git a/VideoUpsampling_WPF/MediaPlayer.xaml b/VideoUpsampling_WPF/MediaPlayer.xaml
new file mode 100644
index 0000000..593da9b
--- /dev/null
+++ b/VideoUpsampling_WPF/MediaPlayer.xaml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VideoUpsampling_WPF/MediaPlayer.xaml.cs b/VideoUpsampling_WPF/MediaPlayer.xaml.cs
new file mode 100644
index 0000000..89b9361
--- /dev/null
+++ b/VideoUpsampling_WPF/MediaPlayer.xaml.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using MahApps.Metro.Controls;
+
+namespace VideoUpsampling_WPF
+{
+ ///
+ /// MediaPlayer.xaml 的交互逻辑
+ ///
+ public partial class MediaPlayer : MetroWindow
+ {
+
+ public MediaPlayer(MainWindow main)
+ {
+ InitializeComponent();
+
+ Source.Source = new Uri(main.outputPath);
+ Output.Source = new Uri(main.originalPath);
+ //Source.Height = Source.NaturalVideoHeight;
+ //Source.Width = Source.NaturalVideoWidth;
+ //Output.Height = Output.NaturalVideoHeight;
+ //Output.Width = Output.NaturalVideoWidth;
+
+ new Thread(MyInputThread).Start();
+ new Thread(MyOutputThread).Start();
+
+ }
+
+ private void MyInputThread()
+ {
+ Source.Dispatcher.BeginInvoke(new Action(() =>
+ {
+ //Thread.Sleep(10);
+ Source.Play();
+ }));
+ }
+ private void MyOutputThread()
+ {
+ Output.Dispatcher.BeginInvoke(new Action(() =>
+ {
+ Thread.Sleep(780);
+ Output.Play();
+ }));
+ }
+
+ private void Output_MediaEnded(object sender, RoutedEventArgs e)
+ {
+ (sender as MediaElement).Stop();
+ (sender as MediaElement).Play();
+ }
+
+ private void Source_MediaEnded(object sender, RoutedEventArgs e)
+ {
+ (sender as MediaElement).Stop();
+ (sender as MediaElement).Play();
+ }
+
+ private void Play(object sender, RoutedEventArgs e)
+ {
+ Source.Play();
+ Output.Play();
+ }
+
+ private void Pause(object sender, RoutedEventArgs e)
+ {
+ Source.Pause();
+ Output.Pause();
+ }
+ }
+
+}
diff --git a/VideoUpsampling_WPF/Properties/AssemblyInfo.cs b/VideoUpsampling_WPF/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..ddeb95d
--- /dev/null
+++ b/VideoUpsampling_WPF/Properties/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("VideoUpsampling_WPF")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("VideoUpsampling_WPF")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2018")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+//若要开始生成可本地化的应用程序,请设置
+//.csproj 文件中的 CultureYouAreCodingWith
+//例如,如果您在源文件中使用的是美国英语,
+//使用的是美国英语,请将 设置为 en-US。 然后取消
+//对以下 NeutralResourceLanguage 特性的注释。 更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+ //(未在页面中找到资源时使用,
+ //或应用程序资源字典中找到时使用)
+ ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+ //(未在页面中找到资源时使用,
+ //、应用程序或任何主题专用资源字典中找到时使用)
+)]
+
+
+// 程序集的版本信息由下列四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/VideoUpsampling_WPF/Properties/Resources.Designer.cs b/VideoUpsampling_WPF/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..75274ac
--- /dev/null
+++ b/VideoUpsampling_WPF/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本: 4.0.30319.42000
+//
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
+//
+//------------------------------------------------------------------------------
+
+namespace VideoUpsampling_WPF.Properties
+{
+
+
+ ///
+ /// 强类型资源类,用于查找本地化字符串等。
+ ///
+ // 此类是由 StronglyTypedResourceBuilder
+ // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+ // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ // (以 /str 作为命令选项),或重新生成 VS 项目。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ ///
+ /// 返回此类使用的缓存 ResourceManager 实例。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VideoUpsampling_WPF.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// 覆盖当前线程的 CurrentUICulture 属性
+ /// 使用此强类型的资源类的资源查找。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/VideoUpsampling_WPF/Properties/Resources.resx b/VideoUpsampling_WPF/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/VideoUpsampling_WPF/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/VideoUpsampling_WPF/Properties/Settings.Designer.cs b/VideoUpsampling_WPF/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..b041b98
--- /dev/null
+++ b/VideoUpsampling_WPF/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace VideoUpsampling_WPF.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/VideoUpsampling_WPF/Properties/Settings.settings b/VideoUpsampling_WPF/Properties/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/VideoUpsampling_WPF/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VideoUpsampling_WPF/Themes/Generic.xaml b/VideoUpsampling_WPF/Themes/Generic.xaml
new file mode 100644
index 0000000..5badf17
--- /dev/null
+++ b/VideoUpsampling_WPF/Themes/Generic.xaml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/VideoUpsampling_WPF/UpdateFile.cs b/VideoUpsampling_WPF/UpdateFile.cs
new file mode 100644
index 0000000..a55a665
--- /dev/null
+++ b/VideoUpsampling_WPF/UpdateFile.cs
@@ -0,0 +1,296 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VideoUpsampling_WPF
+{
+ class UpdateFile
+ {
+
+ String others = "LoadPlugin(\"FFT3dGPU.dll\") \n"
+ + "FFT3dGPU(mode= 1, precision= 2, sigma= 3)\n"
+ + "LoadPlugin(\"flash3kyuu_deband.dll\")\n"
+ + "flash3kyuu_deband(Y= 70, Cb= 40, Cr= 40, grainY= 0, grainC= 0)\n"
+ + "Import(\"LimitedSharpenFaster.avsi\")\n"
+ + "LoadPlugin(\"RgTools.dll\")\n"
+ + "LoadPlugin(\"masktools2.dll\")\n"
+ + "LimitedSharpenFaster()\n";
+
+ /**
+ * 修改AVS脚本文件中,源地址的路径(nnedi3算法
+ *
+ * */
+ public String UpdateAvsFile_nnedi(String originalPath,int px)
+ {
+ String result;
+ try
+ {
+ StreamReader sr = new StreamReader(@"avs\nnedi.avs", true);
+ StringBuilder context = new StringBuilder();
+
+
+ int length = 12;
+ for (int i = 0; i < length; i++)
+ {
+ if (i == 10)
+ {
+ sr.ReadLine();
+ context.Append("FFVideoSource(\"" + originalPath + "\")\n");
+ }else if(i == 11){
+ if(px == 720)
+ {
+ sr.ReadLine();
+ context.Append("nnedi3_resize16(1280,720)\n");
+ }else if(px == 1080)
+ {
+ sr.ReadLine();
+ context.Append("nnedi3_resize16(1920,1080)\n");
+ }
+ else if (px == 480)
+ {
+ sr.ReadLine();
+ context.Append("nnedi3_resize16(720,480)\n");
+ }
+ }
+ else
+ {
+ context.Append(sr.ReadLine() + "\n");
+ }
+
+ }
+ sr.Close();
+ StreamWriter sw = new StreamWriter(@"avs\nnedi.avs", false);
+ sw.Write(context);
+ sw.Close();
+ result = "avs脚本修改视频地址成功。";
+ return result;
+ }
+ catch(Exception e)
+ {
+ result = "avs脚本修改视频地址失败。" + e.Message;
+ return result;
+ }
+ }
+
+ /**
+ * 修改AVS脚本文件中,源地址的路径(bilinear算法
+ *
+ * */
+ public String UpdateAvsFile_bilinear(string originalPath, int px)
+ {
+ String result;
+ StreamReader sr = new StreamReader(@"avs\bilinear.avs", true);
+ StringBuilder context = new StringBuilder();
+
+
+ int length = 11;
+ for (int i = 0; i < length; i++)
+ {
+ if (i == 10)
+ {
+ if (px == 720)
+ {
+ sr.ReadLine();
+ context.Append("FFVideoSource(\"" + originalPath + "\").ConvertToYV12.BilinearResize(1280,720)");
+ context.Append("\n");
+ }
+ else if (px == 1080)
+ {
+ sr.ReadLine();
+ context.Append("FFVideoSource(\"" + originalPath + "\").ConvertToYV12.BilinearResize(1920,1080)");
+ context.Append("\n");
+ }
+ else if(px == 480)
+ {
+ sr.ReadLine();
+ context.Append("FFVideoSource(\"" + originalPath + "\").ConvertToYV12.BilinearResize(720,480)");
+ context.Append("\n");
+ }
+ }
+ else
+ {
+ context.Append(sr.ReadLine() + "\n");
+ }
+
+ }
+ sr.Close();
+ StreamWriter sw = new StreamWriter(@"avs\bilinear.avs", false);
+ sw.Write(context);
+ sw.Close();
+ result = "avs脚本修改视频地址成功。";
+ return result;
+ }
+
+
+
+ /**
+ * 修改AVS脚本文件中,源地址的路径(spline算法
+ *
+ * */
+ public String UpdateAvsFile_spline(String originalPath, int px)
+ {
+ String result;
+ try
+ {
+ StreamReader sr = new StreamReader(@"avs\spline.avs", true);
+ StringBuilder context = new StringBuilder();
+
+
+ int length = 11;
+ for (int i = 0; i < length; i++)
+ {
+ if (i == 10)
+ {
+ if (px == 720)
+ {
+ sr.ReadLine();
+ context.Append("FFVideoSource(\"" + originalPath + "\").ConvertToYV12.Spline64Resize(1280,720)");
+ context.Append("\n");
+ }
+ else if (px == 1080)
+ {
+ sr.ReadLine();
+ context.Append("FFVideoSource(\"" + originalPath + "\").ConvertToYV12.Spline64Resize(1920,1080)");
+ context.Append("\n");
+ }
+ else if (px == 480)
+ {
+ sr.ReadLine();
+ context.Append("FFVideoSource(\"" + originalPath + "\").ConvertToYV12.Spline64Resize(720,480)");
+ context.Append("\n");
+ }
+ }
+ else
+ {
+ context.Append(sr.ReadLine() + "\n");
+ }
+
+ }
+ sr.Close();
+ StreamWriter sw = new StreamWriter(@"avs\spline.avs", false);
+ sw.Write(context);
+ sw.Close();
+ result = "avs脚本修改视频地址成功。";
+ return result;
+ }
+ catch (Exception e)
+ {
+ result = "avs脚本修改视频地址失败。" + e.Message;
+ return result;
+ }
+ }
+
+
+ /**
+ * 修改AVS脚本文件中,源地址的路径(bicubic算法
+ *
+ * */
+ public String UpdateAvsFile_bicubic(string originalPath, int px)
+ {
+ String result;
+ StreamReader sr = new StreamReader(@"avs\bicubic.avs", true);
+ StringBuilder context = new StringBuilder();
+
+
+ int length = 11;
+ for (int i = 0; i < length; i++)
+ {
+ if (i == 10)
+ {
+ if (px == 720)
+ {
+ sr.ReadLine();
+ context.Append("FFVideoSource(\"" + originalPath + "\").ConvertToYV12.BicubicResize(1280,720)");
+ context.Append("\n");
+ }
+ else if (px == 1080)
+ {
+ sr.ReadLine();
+ context.Append("FFVideoSource(\"" + originalPath + "\").ConvertToYV12.BicubicResize(1920,1080)");
+ context.Append("\n");
+ }
+ else if (px == 480)
+ {
+ sr.ReadLine();
+ context.Append("FFVideoSource(\"" + originalPath + "\").ConvertToYV12.BicubicResize(720,480)");
+ context.Append("\n");
+ }
+ }
+ else
+ {
+ context.Append(sr.ReadLine() + "\n");
+ }
+
+ }
+ sr.Close();
+ StreamWriter sw = new StreamWriter(@"avs\bicubic.avs", false);
+ sw.Write(context);
+ sw.Close();
+ result = "avs脚本修改视频地址成功。";
+ return result;
+ }
+
+ /**
+ * 修改bat文件中的,目的地址路径,原视频路径和算法
+ * */
+ public String UpdateBatFile(string outputPath, string originalPath,string algorithm)
+ {
+ String result;
+
+ try
+ {
+ StreamReader sr = new StreamReader(@"start.bat", true);
+ StringBuilder sb = new StringBuilder();
+
+ int length = 5;
+ for (int i = 0; i < length; i++)
+ {
+ if (i == 0)
+ {
+ sb.Append("avs\\X264 -o avs\\temp.mp4 avs\\" + algorithm + ".avs\n");
+ sr.ReadLine();
+ }
+ else if (i == 1)
+ {
+ sr.ReadLine();
+ sb.Append("avs\\ffmpeg.exe -i \"" + originalPath + "\" -y -f wav avs\\temp.wav\n");
+ }
+ else if (i == 4)
+ {
+ sr.ReadLine();
+ sb.Append("avs\\mp4box.exe -new \"" + outputPath + "\" -add avs\\temp.mp4 -add avs\\temp.aac\n");
+ }
+ else
+ {
+ sb.Append(sr.ReadLine() + "\n");
+ }
+
+ }
+ sr.Close();
+ StreamWriter sw = new StreamWriter(@"start.bat", false);
+ sw.Write(sb);
+ sw.Close();
+
+ result = "bat文件修改成功。";
+ return result;
+ }
+ catch (Exception e)
+ {
+
+ result = "bat文件修改失败。" + e.Message;
+ return result;
+ }
+ }
+
+ //添加其他算法滤镜
+ public void UpdateOther(String algorithm)
+ {
+ StreamWriter sw = new StreamWriter(@"avs\" + algorithm + ".avs", true);
+ sw.Write(others);
+ sw.Close();
+ }
+ }
+}
diff --git a/VideoUpsampling_WPF/VideoUpsampling_WPF.csproj b/VideoUpsampling_WPF/VideoUpsampling_WPF.csproj
new file mode 100644
index 0000000..4ce2068
--- /dev/null
+++ b/VideoUpsampling_WPF/VideoUpsampling_WPF.csproj
@@ -0,0 +1,130 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {00121D18-0EBF-402E-A8E0-4D6D095FA4DF}
+ WinExe
+ VideoUpsampling_WPF
+ VideoUpsampling_WPF
+ v4.6.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+ icon.ico
+
+
+
+ ..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll
+
+
+ ..\packages\MahApps.Metro.1.6.4\lib\net46\MahApps.Metro.dll
+ True
+
+
+
+
+
+
+ ..\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MediaPlayer.xaml
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ App.xaml
+ Code
+
+
+ MainWindow.xaml
+ Code
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VideoUpsampling_WPF/icon.ico b/VideoUpsampling_WPF/icon.ico
new file mode 100644
index 0000000..ed9032b
Binary files /dev/null and b/VideoUpsampling_WPF/icon.ico differ
diff --git a/VideoUpsampling_WPF/packages.config b/VideoUpsampling_WPF/packages.config
new file mode 100644
index 0000000..9038a92
--- /dev/null
+++ b/VideoUpsampling_WPF/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file