Restored recommendations based on acoustic similarities (using musicnn), fixes #301
This commit is contained in:
@@ -18,14 +18,38 @@
|
||||
*/
|
||||
|
||||
#include "core/XxHash3.hpp"
|
||||
#include "core/Exception.hpp"
|
||||
|
||||
#define XXH_INLINE_ALL
|
||||
#include <xxhash.h>
|
||||
|
||||
namespace lms::core
|
||||
{
|
||||
std::uint64_t xxHash3_64(std::span<const std::byte> buf)
|
||||
std::uint64_t XxHash3_64::hash(std::span<const std::byte> buf)
|
||||
{
|
||||
return XXH3_64bits(buf.data(), buf.size());
|
||||
}
|
||||
|
||||
XxHash3_64::XxHash3_64()
|
||||
: _state{ XXH3_createState() }
|
||||
{
|
||||
if (!_state)
|
||||
throw LmsException{ "XXH3_createState failed: out of memory" };
|
||||
XXH3_64bits_reset(static_cast<XXH3_state_t*>(_state));
|
||||
}
|
||||
|
||||
XxHash3_64::~XxHash3_64()
|
||||
{
|
||||
XXH3_freeState(static_cast<XXH3_state_t*>(_state));
|
||||
}
|
||||
|
||||
void XxHash3_64::update(std::span<const std::byte> buf)
|
||||
{
|
||||
XXH3_64bits_update(static_cast<XXH3_state_t*>(_state), buf.data(), buf.size());
|
||||
}
|
||||
|
||||
std::uint64_t XxHash3_64::digest() const
|
||||
{
|
||||
return XXH3_64bits_digest(static_cast<const XXH3_state_t*>(_state));
|
||||
}
|
||||
} // namespace lms::core
|
||||
Reference in New Issue
Block a user