Use new Hibiki, use different Panako instance with smaller fingerprints

This commit is contained in:
DataHoarder 2022-02-05 21:50:40 +01:00
parent 8635605d22
commit f686903698
5 changed files with 25 additions and 21 deletions

View file

@ -8,7 +8,7 @@ import (
"errors"
"flag"
"fmt"
"git.gammaspectra.live/S.O.N.G/Hibiki/strategy/panako"
"git.gammaspectra.live/S.O.N.G/Hibiki/panako"
"git.gammaspectra.live/S.O.N.G/Hibiki/utilities/audio"
"git.gammaspectra.live/S.O.N.G/Hibiki/utilities/audio/format/flac"
"git.gammaspectra.live/S.O.N.G/Hibiki/utilities/audio/format/mp3"
@ -34,6 +34,7 @@ import (
)
var printDb *store.AppendStore
var panakoInstance *panako.Instance
var printStrategy *panako.Strategy
var db *database.Database
var resourceCreationMutex sync.Mutex
@ -259,17 +260,17 @@ func AddAudioToDatabase(release *database.Release, tx *PendingTransaction, size
case "audio/flac":
//TODO: add CRC32 scan
flacFormat := flac.NewFormat()
stream, err = flacFormat.Open(f)
stream, err = flacFormat.Open(f, panakoInstance.BlockSize)
case "audio/mpeg;codecs=mp3":
mp3Format := mp3.NewFormat()
stream, err = mp3Format.Open(f)
stream, err = mp3Format.Open(f, panakoInstance.BlockSize)
case "audio/ogg":
fallthrough
case "audio/opus":
opusFormat := opus.NewFormat()
stream, err = opusFormat.Open(f)
stream, err = opusFormat.Open(f, panakoInstance.BlockSize)
}
if err != nil { //cannot decode
@ -329,7 +330,10 @@ func main() {
defer printDb.Close()
//TODO: check if mutex is correct!
printStrategy = panako.NewStrategy(printDb, true)
panakoInstance = panako.NewDefaultPackedInstance()
printStrategy = panakoInstance.GetStrategy(printDb)
if *cmdOption == "add" {
var release *database.Release
@ -373,17 +377,17 @@ func main() {
case "audio/flac":
//TODO: add CRC32 scan
flacFormat := flac.NewFormat()
stream, err = flacFormat.Open(f)
stream, err = flacFormat.Open(f, panakoInstance.BlockSize)
case "audio/mpeg;codecs=mp3":
mp3Format := mp3.NewFormat()
stream, err = mp3Format.Open(f)
stream, err = mp3Format.Open(f, panakoInstance.BlockSize)
case "audio/ogg":
fallthrough
case "audio/opus":
opusFormat := opus.NewFormat()
stream, err = opusFormat.Open(f)
stream, err = opusFormat.Open(f, panakoInstance.BlockSize)
}
if err != nil { //cannot decode
@ -496,11 +500,11 @@ func main() {
FileName: path.Base(string(resource.GetPath())),
FileSize: int(resource.GetSize()),
MatchStart: m.ReferenceStart,
MatchEnd: m.ReferenceStop,
MatchStart: m.ReferenceStart.Seconds(),
MatchEnd: m.ReferenceStop.Seconds(),
QueryStart: m.QueryStart,
QueryEnd: m.QueryStop,
QueryStart: m.QueryStart.Seconds(),
QueryEnd: m.QueryStop.Seconds(),
Segment: -1,
Score: m.Score,
@ -542,11 +546,11 @@ func main() {
FileName: path.Base(string(resource.GetPath())),
FileSize: int(resource.GetSize()),
MatchStart: m.ReferenceStart,
MatchEnd: m.ReferenceStop,
MatchStart: m.ReferenceStart.Seconds(),
MatchEnd: m.ReferenceStop.Seconds(),
QueryStart: m.QueryStart,
QueryEnd: m.QueryStop,
QueryStart: m.QueryStart.Seconds(),
QueryEnd: m.QueryStop.Seconds(),
Segment: i,
Score: m.Score,

2
go.mod
View file

@ -3,7 +3,7 @@ module git.gammaspectra.live/S.O.N.G/METANOIA
go 1.17
require (
git.gammaspectra.live/S.O.N.G/Hibiki v0.0.0-20220202010005-937357cefaf1
git.gammaspectra.live/S.O.N.G/Hibiki v0.0.0-20220205204252-6751ae57c67c
git.gammaspectra.live/S.O.N.G/MakyuuIchaival v0.0.0-20220131114831-c08c7d9b4153
github.com/dhowden/tag v0.0.0-20201120070457-d52dcb253c63
github.com/ipfs/go-cid v0.1.0

4
go.sum
View file

@ -7,8 +7,8 @@ dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBr
dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
git.gammaspectra.live/S.O.N.G/Hibiki v0.0.0-20220202010005-937357cefaf1 h1:f2cwAGCU3/XTgmf0NDp71Z7e89vBTa6hKhDeF5C0dFw=
git.gammaspectra.live/S.O.N.G/Hibiki v0.0.0-20220202010005-937357cefaf1/go.mod h1:UUsQ9RF9Jd9pBMvkvw+nY0NTPqu6rG7ulOZsTqNmSXU=
git.gammaspectra.live/S.O.N.G/Hibiki v0.0.0-20220205204252-6751ae57c67c h1:spM6IL8dTcB+HT9kA0fFE09eVbNNvfNKuoV7VRMSn2E=
git.gammaspectra.live/S.O.N.G/Hibiki v0.0.0-20220205204252-6751ae57c67c/go.mod h1:UUsQ9RF9Jd9pBMvkvw+nY0NTPqu6rG7ulOZsTqNmSXU=
git.gammaspectra.live/S.O.N.G/MakyuuIchaival v0.0.0-20220131114831-c08c7d9b4153 h1:RMDA05IEOytScNSiE2ms98x/CVMHSlA+eVBC0VCq4po=
git.gammaspectra.live/S.O.N.G/MakyuuIchaival v0.0.0-20220131114831-c08c7d9b4153/go.mod h1:z6KcP5RPhMxDJaVU48sBhiYRCJ6ZJBbx1iIhkUrrhfY=
git.gammaspectra.live/S.O.N.G/go-pus v0.0.0-20220130003320-c9b07c6bec7a h1:LxrTp9gf4w5KnFHRPFLXYfoxC58GCSEmZrHI6Ogtrm0=

View file

@ -3,7 +3,7 @@ package store
import (
"bytes"
"encoding/binary"
"git.gammaspectra.live/S.O.N.G/Hibiki/strategy/panako"
"git.gammaspectra.live/S.O.N.G/Hibiki/panako"
"log"
"os"
"sort"

View file

@ -3,7 +3,7 @@ package store
import (
"bytes"
"encoding/binary"
"git.gammaspectra.live/S.O.N.G/Hibiki/strategy/panako"
"git.gammaspectra.live/S.O.N.G/Hibiki/panako"
"git.gammaspectra.live/S.O.N.G/Hibiki/utilities/specializedstore"
"io"
"log"