diff --git a/build.bat b/build.bat index 87fddc5ab..3adcb3e7d 100644 --- a/build.bat +++ b/build.bat @@ -207,14 +207,6 @@ COPY /Y /V "Newtonsoft.Json.dll" "temp_zip\" COPY /Y /V "System.Net.Http.Primitives.dll" "temp_zip\" COPY /Y /V "NAudio.Core.dll" "temp_zip\" COPY /Y /V "NAudio.WinMM.dll" "temp_zip\" -COPY /Y /V "cpuid.dll" "temp_zip\" -COPY /Y /V "iTin.Core.dll" "temp_zip\" -COPY /Y /V "iTin.Core.Hardware.Common.dll" "temp_zip\" -COPY /Y /V "iTin.Core.Hardware.CrossPlatform.Cpuid.dll" "temp_zip\" -COPY /Y /V "iTin.Core.Interop.CrossPlatform.Cpuid.dll" "temp_zip\" -COPY /Y /V "iTin.Core.Interop.Shared.dll" "temp_zip\" -COPY /Y /V "iTin.Hardware.Specification.Cpuid.dll" "temp_zip\" -COPY /Y /V "iTin.Logging.dll" "temp_zip\" COPY /Y /V "Microsoft.Win32.Registry.dll" "temp_zip\" COPY /Y /V "SubtitleEdit.exe" "temp_zip\" COPY /Y /V "Languages\*.xml" "temp_zip\Languages\" diff --git a/build_beta.bat b/build_beta.bat index 72e22f2b8..afe7fdd7d 100644 --- a/build_beta.bat +++ b/build_beta.bat @@ -181,14 +181,6 @@ COPY /Y /V "Newtonsoft.Json.dll" "temp_zip\" COPY /Y /V "System.Net.Http.Primitives.dll" "temp_zip\" COPY /Y /V "NAudio.Core.dll" "temp_zip\" COPY /Y /V "NAudio.WinMM.dll" "temp_zip\" -COPY /Y /V "cpuid.dll" "temp_zip\" -COPY /Y /V "iTin.Core.dll" "temp_zip\" -COPY /Y /V "iTin.Core.Hardware.Common.dll" "temp_zip\" -COPY /Y /V "iTin.Core.Hardware.CrossPlatform.Cpuid.dll" "temp_zip\" -COPY /Y /V "iTin.Core.Interop.CrossPlatform.Cpuid.dll" "temp_zip\" -COPY /Y /V "iTin.Core.Interop.Shared.dll" "temp_zip\" -COPY /Y /V "iTin.Hardware.Specification.Cpuid.dll" "temp_zip\" -COPY /Y /V "iTin.Logging.dll" "temp_zip\" COPY /Y /V "Microsoft.Win32.Registry.dll" "temp_zip\" COPY /Y /V "SubtitleEdit.exe" "temp_zip\" COPY /Y /V "Languages\*.xml" "temp_zip\Languages\" diff --git a/installer/Subtitle_Edit_Installer.iss b/installer/Subtitle_Edit_Installer.iss index ef0d58cad..7206d539e 100644 --- a/installer/Subtitle_Edit_Installer.iss +++ b/installer/Subtitle_Edit_Installer.iss @@ -326,14 +326,6 @@ Source: {#bindir}\System.Net.Http.Extensions.dll; DestDir: {app}; Source: {#bindir}\System.Net.Http.Primitives.dll; DestDir: {app}; Flags: ignoreversion; Components: main Source: {#bindir}\NAudio.Core.dll; DestDir: {app}; Flags: ignoreversion; Components: main Source: {#bindir}\NAudio.WinMM.dll; DestDir: {app}; Flags: ignoreversion; Components: main -Source: {#bindir}\cpuid.dll; DestDir: {app}; Flags: ignoreversion; Components: main -Source: {#bindir}\iTin.Core.dll; DestDir: {app}; Flags: ignoreversion; Components: main -Source: {#bindir}\iTin.Core.Hardware.Common.dll; DestDir: {app}; Flags: ignoreversion; Components: main -Source: {#bindir}\iTin.Core.Hardware.CrossPlatform.Cpuid.dll; DestDir: {app}; Flags: ignoreversion; Components: main -Source: {#bindir}\iTin.Core.Interop.CrossPlatform.Cpuid.dll; DestDir: {app}; Flags: ignoreversion; Components: main -Source: {#bindir}\iTin.Core.Interop.Shared.dll; DestDir: {app}; Flags: ignoreversion; Components: main -Source: {#bindir}\iTin.Hardware.Specification.Cpuid.dll; DestDir: {app}; Flags: ignoreversion; Components: main -Source: {#bindir}\iTin.Logging.dll; DestDir: {app}; Flags: ignoreversion; Components: main Source: {#bindir}\Microsoft.Win32.Registry.dll; DestDir: {app}; Flags: ignoreversion; Components: main Source: ..\Changelog.txt; DestDir: {app}; Flags: ignoreversion; Components: main Source: ..\LICENSE.txt; DestDir: {app}; Flags: ignoreversion; Components: main @@ -376,14 +368,6 @@ Type: files; Name: {app}\System.Net.Http.Extensions.dll; Check: IsU Type: files; Name: {app}\System.Net.Http.Primitives.dll; Check: IsUpgrade() Type: files; Name: {app}\NAudio.Core.dll; Check: IsUpgrade() Type: files; Name: {app}\NAudio.WinMM.dll; Check: IsUpgrade() -Type: files; Name: {app}\cpuid.dll; Check: IsUpgrade() -Type: files; Name: {app}\iTin.Core.dll; Check: IsUpgrade() -Type: files; Name: {app}\iTin.Core.Hardware.Common.dll; Check: IsUpgrade() -Type: files; Name: {app}\iTin.Core.Hardware.CrossPlatform.Cpuid.dll; Check: IsUpgrade() -Type: files; Name: {app}\iTin.Core.Interop.CrossPlatform.Cpuid.dll; Check: IsUpgrade() -Type: files; Name: {app}\iTin.Core.Interop.Shared.dll; Check: IsUpgrade() -Type: files; Name: {app}\iTin.Hardware.Specification.Cpuid.dll; Check: IsUpgrade() -Type: files; Name: {app}\iTin.Logging.dll; Check: IsUpgrade() Type: files; Name: {app}\Microsoft.Win32.Registry.dll; Check: IsUpgrade() diff --git a/src/libse/AudioToText/WhisperHelper.cs b/src/libse/AudioToText/WhisperHelper.cs index 9d0f39471..d554c092c 100644 --- a/src/libse/AudioToText/WhisperHelper.cs +++ b/src/libse/AudioToText/WhisperHelper.cs @@ -108,7 +108,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText if (Configuration.Settings.Tools.WhisperChoice == WhisperChoice.ConstMe) { - var path = Path.Combine(Configuration.DataDirectory, "Whisper", "ConstMe"); + var path = Path.Combine(Configuration.DataDirectory, "Whisper", "Const-me"); return Directory.Exists(path) ? path : null; } diff --git a/src/ui/Forms/AudioToText/WhisperAudioToText.Designer.cs b/src/ui/Forms/AudioToText/WhisperAudioToText.Designer.cs index 791537ee1..48865913e 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToText.Designer.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToText.Designer.cs @@ -387,7 +387,7 @@ this.toolStripSeparator1, this.removeTemporaryFilesToolStripMenuItem}); this.contextMenuStripWhisperAdvanced.Name = "contextMenuStripWhisperAdvanced"; - this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(210, 98); + this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(210, 120); // // whisperPhpOriginalToolStripMenuItem // @@ -407,7 +407,7 @@ // this.whisperConstMeToolStripMenuItem.Name = "whisperConstMeToolStripMenuItem"; this.whisperConstMeToolStripMenuItem.Size = new System.Drawing.Size(209, 22); - this.whisperConstMeToolStripMenuItem.Text = "Whisper ConstMe (GPU)"; + this.whisperConstMeToolStripMenuItem.Text = "Whisper Const-me (GPU)"; this.whisperConstMeToolStripMenuItem.Click += new System.EventHandler(this.whisperConstMeToolStripMenuItem_Click); // // toolStripSeparator1 diff --git a/src/ui/Forms/AudioToText/WhisperAudioToText.cs b/src/ui/Forms/AudioToText/WhisperAudioToText.cs index b6beaca25..cc32eab93 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToText.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToText.cs @@ -559,6 +559,10 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText public static bool GetResultFromSrt(string waveFileName, out List resultTexts, ConcurrentBag outputText, List filesToDelete) { var srtFileName = waveFileName + ".srt"; + if (!File.Exists(srtFileName) && waveFileName.EndsWith(".wav")) + { + srtFileName = waveFileName.Remove(waveFileName.Length - 4) + ".srt"; + } var whisperFolder = WhisperHelper.GetWhisperFolder() ?? string.Empty; var vttFileName = Path.Combine(whisperFolder, Path.GetFileName(waveFileName) + ".vtt"); diff --git a/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.Designer.cs b/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.Designer.cs index 69da4148a..fcc9363df 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.Designer.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.Designer.cs @@ -54,6 +54,7 @@ this.contextMenuStripWhisperAdvanced = new System.Windows.Forms.ContextMenuStrip(this.components); this.whisperPhpOriginalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.whisperCppCToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.whisperConstMeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.removeTemporaryFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.groupBoxModels.SuspendLayout(); @@ -301,10 +302,11 @@ this.contextMenuStripWhisperAdvanced.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.whisperPhpOriginalToolStripMenuItem, this.whisperCppCToolStripMenuItem, + this.whisperConstMeToolStripMenuItem, this.toolStripSeparator1, this.removeTemporaryFilesToolStripMenuItem}); this.contextMenuStripWhisperAdvanced.Name = "contextMenuStripWhisperAdvanced"; - this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(210, 76); + this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(210, 120); // // whisperPhpOriginalToolStripMenuItem // @@ -320,6 +322,13 @@ this.whisperCppCToolStripMenuItem.Text = "Whisper cpp (C++)"; this.whisperCppCToolStripMenuItem.Click += new System.EventHandler(this.whisperCppCToolStripMenuItem_Click); // + // whisperConstMeToolStripMenuItem + // + this.whisperConstMeToolStripMenuItem.Name = "whisperConstMeToolStripMenuItem"; + this.whisperConstMeToolStripMenuItem.Size = new System.Drawing.Size(209, 22); + this.whisperConstMeToolStripMenuItem.Text = "Whisper Const-me (GPU)"; + this.whisperConstMeToolStripMenuItem.Click += new System.EventHandler(this.whisperConstMeGPUToolStripMenuItem_Click); + // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; @@ -400,5 +409,6 @@ private System.Windows.Forms.ToolStripMenuItem whisperCppCToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem removeTemporaryFilesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem whisperConstMeToolStripMenuItem; } } \ No newline at end of file diff --git a/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.cs b/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.cs index 66743fccd..e9ad67bbe 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.cs @@ -81,6 +81,8 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText whisperCppCToolStripMenuItem.Checked = Configuration.Settings.Tools.WhisperChoice == WhisperChoice.Cpp; whisperPhpOriginalToolStripMenuItem.Checked = Configuration.Settings.Tools.WhisperChoice == WhisperChoice.OpenAI; removeTemporaryFilesToolStripMenuItem.Checked = Configuration.Settings.Tools.WhisperDeleteTempFiles; + whisperConstMeToolStripMenuItem.Checked = Configuration.Settings.Tools.WhisperChoice == WhisperChoice.ConstMe; + whisperConstMeToolStripMenuItem.Visible = Configuration.IsRunningOnWindows; ContextMenuStrip = contextMenuStripWhisperAdvanced; } @@ -474,5 +476,37 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText { contextMenuStripWhisperAdvanced.Show(MousePosition); } + + private void whisperConstMeGPUToolStripMenuItem_Click(object sender, EventArgs e) + { + var oldChoice = Configuration.Settings.Tools.WhisperChoice; + Configuration.Settings.Tools.WhisperChoice = WhisperChoice.ConstMe; + var fileName = WhisperHelper.GetWhisperPathAndFileName(); + if (!File.Exists(fileName) || + WhisperDownload.IsOld(fileName, WhisperChoice.ConstMe)) + { + Configuration.Settings.Tools.WhisperChoice = oldChoice; + if (MessageBox.Show(string.Format(LanguageSettings.Current.Settings.DownloadX, "whisper ConstMe (GPU)"), "Subtitle Edit", MessageBoxButtons.YesNoCancel) == DialogResult.Yes) + { + using (var downloadForm = new WhisperDownload(WhisperChoice.ConstMe)) + { + if (downloadForm.ShowDialog(this) == DialogResult.OK) + { + Configuration.Settings.Tools.WhisperChoice = WhisperChoice.ConstMe; + } + else + { + return; + } + } + } + else + { + return; + } + } + + Init(); + } } } diff --git a/src/ui/Forms/AudioToText/WhisperDownload.Designer.cs b/src/ui/Forms/AudioToText/WhisperDownload.Designer.cs index a9ef9124b..37a934c97 100644 --- a/src/ui/Forms/AudioToText/WhisperDownload.Designer.cs +++ b/src/ui/Forms/AudioToText/WhisperDownload.Designer.cs @@ -30,7 +30,7 @@ { this.labelDescription1 = new System.Windows.Forms.Label(); this.labelPleaseWait = new System.Windows.Forms.Label(); - this.labelAVX2 = new System.Windows.Forms.Label(); + this.labelWhisperChoice = new System.Windows.Forms.Label(); this.SuspendLayout(); // // labelDescription1 @@ -53,21 +53,21 @@ // // labelAVX2 // - this.labelAVX2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.labelAVX2.AutoSize = true; - this.labelAVX2.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.labelAVX2.Location = new System.Drawing.Point(274, 9); - this.labelAVX2.Name = "labelAVX2"; - this.labelAVX2.Size = new System.Drawing.Size(34, 13); - this.labelAVX2.TabIndex = 30; - this.labelAVX2.Text = "AVX2"; + this.labelWhisperChoice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.labelWhisperChoice.AutoSize = true; + this.labelWhisperChoice.ForeColor = System.Drawing.SystemColors.ControlDarkDark; + this.labelWhisperChoice.Location = new System.Drawing.Point(274, 9); + this.labelWhisperChoice.Name = "labelWhisperChoice"; + this.labelWhisperChoice.Size = new System.Drawing.Size(34, 13); + this.labelWhisperChoice.TabIndex = 30; + this.labelWhisperChoice.Text = "AVX2"; // // WhisperDownload // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(320, 93); - this.Controls.Add(this.labelAVX2); + this.Controls.Add(this.labelWhisperChoice); this.Controls.Add(this.labelDescription1); this.Controls.Add(this.labelPleaseWait); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; @@ -87,6 +87,6 @@ private System.Windows.Forms.Label labelDescription1; private System.Windows.Forms.Label labelPleaseWait; - private System.Windows.Forms.Label labelAVX2; + private System.Windows.Forms.Label labelWhisperChoice; } } \ No newline at end of file diff --git a/src/ui/Forms/AudioToText/WhisperDownload.cs b/src/ui/Forms/AudioToText/WhisperDownload.cs index 8c68caef6..50910a029 100644 --- a/src/ui/Forms/AudioToText/WhisperDownload.cs +++ b/src/ui/Forms/AudioToText/WhisperDownload.cs @@ -11,10 +11,8 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText { public sealed partial class WhisperDownload : Form { - private const string DownloadUrlAvx2 = "https://github.com/ggerganov/whisper.cpp/releases/download/v1.2.0/whisper-blas-bin-x64.zip"; - private const string DownloadUrlSse2 = "https://github.com/ggerganov/whisper.cpp/releases/download/v1.2.0/whisper-blas-bin-x64.zip"; - private const string DownloadUrl32BitAvx2 = "https://github.com/ggerganov/whisper.cpp/releases/download/v1.2.0/whisper-blas-bin-Win32.zip"; - private const string DownloadUrl32BitSse2 = "https://github.com/ggerganov/whisper.cpp/releases/download/v1.2.0/whisper-blas-bin-Win32.zip"; + private const string DownloadUrl64Cpp = "https://github.com/ggerganov/whisper.cpp/releases/download/v1.2.0/whisper-blas-bin-x64.zip"; + private const string DownloadUrl32Cpp = "https://github.com/ggerganov/whisper.cpp/releases/download/v1.2.0/whisper-blas-bin-Win32.zip"; private readonly CancellationTokenSource _cancellationTokenSource; private readonly string _whisperChoice; @@ -66,15 +64,11 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText private void WhisperDownload_Shown(object sender, EventArgs e) { - var avx2 = CpuInfo.HasAvx2(); - labelAVX2.Visible = avx2; - var downloadUrl = avx2 ? DownloadUrlAvx2 : DownloadUrlSse2; - - if (IntPtr.Size * 8 == 32) - { - downloadUrl = avx2 ? DownloadUrl32BitAvx2 : DownloadUrl32BitSse2; - } + labelWhisperChoice.Visible = true; + labelWhisperChoice.Text = _whisperChoice; + labelWhisperChoice.Left = Width - labelWhisperChoice.Width - 20; + var downloadUrl = IntPtr.Size * 8 == 32 ? DownloadUrl32Cpp : DownloadUrl64Cpp; if (_whisperChoice == WhisperChoice.ConstMe) { downloadUrl = DownloadUrlConstMe; @@ -141,7 +135,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText if (_whisperChoice == WhisperChoice.ConstMe) { - folder = Path.Combine(folder, "ConstMe"); + folder = Path.Combine(folder, "Const-me"); if (!Directory.Exists(folder)) { diff --git a/src/ui/Logic/CpuInfo.cs b/src/ui/Logic/CpuInfo.cs deleted file mode 100644 index 5bc1bd1f8..000000000 --- a/src/ui/Logic/CpuInfo.cs +++ /dev/null @@ -1,21 +0,0 @@ -using iTin.Hardware.Specification.Cpuid; -using iTin.Hardware.Specification; - -namespace Nikse.SubtitleEdit.Logic -{ - public static class CpuInfo - { - public static bool HasAvx2() - { - try - { - var avx2 = CPUID.Instance.Leafs.GetProperty(LeafProperty.ExtendedFeatures.AVX2); - return avx2.Success && (bool)avx2.Result.Value; - } - catch - { - return false; - } - } - } -} diff --git a/src/ui/SubtitleEdit.csproj b/src/ui/SubtitleEdit.csproj index e3de5ee63..0624e7793 100644 --- a/src/ui/SubtitleEdit.csproj +++ b/src/ui/SubtitleEdit.csproj @@ -61,27 +61,6 @@ DLLs\Interop.QuartzTypeLib.dll False - - ..\..\packages\iCPUID.1.0.5\lib\net461\iTin.Core.dll - - - ..\..\packages\iCPUID.1.0.5\lib\net461\iTin.Core.Hardware.Common.dll - - - ..\..\packages\iCPUID.1.0.5\lib\net461\iTin.Core.Hardware.CrossPlatform.Cpuid.dll - - - ..\..\packages\iCPUID.1.0.5\lib\net461\iTin.Core.Interop.CrossPlatform.Cpuid.dll - - - ..\..\packages\iCPUID.1.0.5\lib\net461\iTin.Core.Interop.Shared.dll - - - ..\..\packages\iCPUID.1.0.5\lib\net461\iTin.Hardware.Specification.Cpuid.dll - - - ..\..\packages\iCPUID.1.0.5\lib\net461\iTin.Logging.dll - ..\..\packages\Microsoft.Win32.Registry.5.0.0\lib\net461\Microsoft.Win32.Registry.dll @@ -1401,7 +1380,6 @@ - @@ -2452,8 +2430,6 @@ - - \ No newline at end of file diff --git a/src/ui/packages.config b/src/ui/packages.config index 0039be016..64c5d8181 100644 --- a/src/ui/packages.config +++ b/src/ui/packages.config @@ -1,6 +1,5 @@  -