Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  Version bump to v10.3.1
  Simplifying the code with an equivalent implementation.
  • Loading branch information
AddictedCS committed May 17, 2024
2 parents 24a58d9 + ccee26d commit fe4dbc1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 37 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ else
TARGET=$1
fi

dotnet test src/SoundFingerprinting.Tests/SoundFingerprinting.Tests.csproj -c $TARGET
dotnet test src/SoundFingerprinting.Tests/SoundFingerprinting.Tests.csproj -c $TARGET -v n

if [ "$?" != "0" ]; then
echo Tests failed. Check logs for details.
Expand Down
4 changes: 2 additions & 2 deletions src/SoundFingerprinting.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("4cac962e-ebc5-4006-a1e0-7ffb3e2483c2")]
[assembly: AssemblyVersion("10.3.0.100")]
[assembly: AssemblyInformationalVersion("10.3.0.100")]
[assembly: AssemblyVersion("10.3.1.100")]
[assembly: AssemblyInformationalVersion("10.3.1.100")]
53 changes: 22 additions & 31 deletions src/SoundFingerprinting/LCS/QueryPathReconstructionStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ private IEnumerable<IEnumerable<MatchedWith>> GetIncreasingSequences(IEnumerable
return bestPaths.OrderByDescending(_ => _.Count());
}



private MaxAt[] MaxIncreasingQuerySequenceOptimal(IReadOnlyList<MatchedWith> matches, double maxGap, out int max, out int maxIndex)
{
var maxs = matches.Select(_ => new MaxAt(1, _)).ToArray();
Expand Down Expand Up @@ -111,41 +109,34 @@ private LongestIncreasingSequence GetLongestIncreasingSequence(IEnumerable<Match

while (maxs.TryPop(out var candidate))
{
if (candidate!.Length != max)
if (!IsSameSequence(candidate!, lastPicked, maxGap))
{
// check if the candidate is part of the same decreasing sequence
if (IsSameSequence(candidate, lastPicked, maxGap))
{
// check if we previously picked a sequence with the same length, if yes we should try picking the best one
if (candidate.Length > max)
{
TryUpdateResultSelection(result, candidate, excluded);
}
else
{
// start of a shorter sequence, we should exclude it
excluded.Add(candidate);
}
}

continue;
}

max--;

do
if (candidate!.Length > max)
{
// check if we previously picked a sequence with the same length, if yes we should try picking the best one based on the distance to the diagonal
lastPicked = TryUpdateResultSelection(result, candidate, excluded);
continue;
}

if (candidate.Length < max)
{
switch (IsQuerySequenceDecreasing(candidate, lastPicked))
{
case true when IsSameSequence(candidate, lastPicked, maxGap):
lastPicked = TryUpdateResultSelection(result, candidate, excluded);
break;
case false when IsSameSequence(candidate, lastPicked, maxGap):
excluded.Add(candidate);
break;
}
// start of a shorter sequence, we should exclude it
excluded.Add(candidate);
continue;
}
while (maxs.TryPeek(out var lookAhead) && EqualMaxLength(candidate!, lookAhead!) && maxs.TryPop(out candidate!));

if (!IsQuerySequenceDecreasing(candidate, lastPicked))
{
// the candidate is part of a different decreasing sequence
excluded.Add(candidate);
continue;
}

max--;
lastPicked = TryUpdateResultSelection(result, candidate, excluded);
}

return new LongestIncreasingSequence(result.OrderBy(_ => _.Key).Select(_ => _.Value.MatchedWith), excluded.Select(_ => _.MatchedWith));
Expand Down
4 changes: 2 additions & 2 deletions src/SoundFingerprinting/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
[assembly: InternalsVisibleTo("SoundFingerprinting.FFT.FFTW")]
[assembly: InternalsVisibleTo("SoundFingerprinting.FFT.FFTW.Tests")]

[assembly: AssemblyVersion("10.3.0.100")]
[assembly: AssemblyInformationalVersion("10.3.0.100")]
[assembly: AssemblyVersion("10.3.1.100")]
[assembly: AssemblyInformationalVersion("10.3.1.100")]
2 changes: 1 addition & 1 deletion src/SoundFingerprinting/SoundFingerprinting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Nullable>enable</Nullable>
<PackageVersion>10.3.0</PackageVersion>
<PackageVersion>10.3.1</PackageVersion>
<Authors>Sergiu Ciumac</Authors>
<PackageDescription>SoundFingerprinting is a C# framework that implements an efficient algorithm of audio fingerprinting and identification. Designed for developers, enthusiasts, researchers in the fields of audio processing, data mining, digital signal processing.</PackageDescription>
<PackageProjectUrl>https://github.com/addictedcs/soundfingerprinting</PackageProjectUrl>
Expand Down

0 comments on commit fe4dbc1

Please sign in to comment.