This commit is contained in:
niksedk 2021-11-23 20:16:25 +01:00
commit f45f3b3c32
4 changed files with 5 additions and 5 deletions

View File

@ -19,7 +19,7 @@ namespace Nikse.SubtitleEdit.Core.NetflixQualityCheck
}
double twoFramesGap = 1000.0 / controller.FrameRate * 2.0;
int halfSecGap = (int)Math.Round(controller.FrameRate / 2);
int halfSecGap = (int)Math.Round(controller.FrameRate / 2, MidpointRounding.AwayFromZero);
for (int index = 0; index < subtitle.Paragraphs.Count; index++)
{

View File

@ -25,7 +25,7 @@ namespace Nikse.SubtitleEdit.Core.NetflixQualityCheck
return;
}
int halfSecGapInFrames = (int)Math.Round(controller.FrameRate / 2);
int halfSecGapInFrames = (int)Math.Round(controller.FrameRate / 2, MidpointRounding.AwayFromZero);
double twoFramesGap = 1000.0 / controller.FrameRate * 2.0;
foreach (Paragraph p in subtitle.Paragraphs)
@ -54,7 +54,7 @@ namespace Nikse.SubtitleEdit.Core.NetflixQualityCheck
{
double nearestStartNextSceneChange = nextStartSceneChanges.Aggregate((x, y) => Math.Abs(x - p.StartTime.TotalSeconds) < Math.Abs(y - p.StartTime.TotalSeconds) ? x : y);
var gapToSceneChange = SubtitleFormat.MillisecondsToFrames(nearestStartNextSceneChange * 1000 - p.StartTime.TotalMilliseconds);
var threshold = (int)Math.Round(halfSecGapInFrames * 0.75);
var threshold = (int)Math.Round(halfSecGapInFrames * 0.75, MidpointRounding.AwayFromZero);
if (gapToSceneChange < halfSecGapInFrames)
{
if (gapToSceneChange < threshold)

View File

@ -448,7 +448,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
public static int MillisecondsToFramesMaxFrameRate(double milliseconds)
{
int frames = (int)Math.Round(milliseconds / (TimeCode.BaseUnit / GetFrameForCalculation(Configuration.Settings.General.CurrentFrameRate)));
int frames = (int)Math.Round(milliseconds / (TimeCode.BaseUnit / GetFrameForCalculation(Configuration.Settings.General.CurrentFrameRate)), MidpointRounding.AwayFromZero);
if (frames >= Configuration.Settings.General.CurrentFrameRate)
{
frames = (int)(Configuration.Settings.General.CurrentFrameRate - 0.01);

View File

@ -65,7 +65,7 @@ namespace Nikse.SubtitleEdit.Forms
checkBoxNoItalics.Checked = !_netflixQualityController.AllowItalics;
checkBoxNoItalics.Enabled = !_netflixQualityController.AllowItalics;
int halfSecGapInFrames = (int)Math.Round(_frameRate / 2);
int halfSecGapInFrames = (int)Math.Round(_frameRate / 2, MidpointRounding.AwayFromZero);
checkBoxGapBridge.Text = $"Frame gap: 3 to {halfSecGapInFrames - 1} frames => 2 frames";
var sceneChangesExist = false;