From: Sergey Matveev Date: Thu, 11 Apr 2024 17:51:00 +0000 (+0300) Subject: Ability to use complex Opus decoder X-Git-Tag: v1.0.0~9 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=3b2c17bc7e65be2c7bc8bd62b3cf04c79022f9e25a6da36dea4f51fcd2680cdd;p=vors.git Ability to use complex Opus decoder --- diff --git a/cmd/client/dec.go b/cmd/client/dec.go new file mode 100644 index 0000000..f94b000 --- /dev/null +++ b/cmd/client/dec.go @@ -0,0 +1,9 @@ +//go:build !decodersetcomplexity + +package main + +import "gopkg.in/hraban/opus.v2" + +func DecoderSetComplexity(dec *opus.Decoder, complexity int) error { + return nil +} diff --git a/cmd/client/dec_complex.go b/cmd/client/dec_complex.go new file mode 100644 index 0000000..49aad0d --- /dev/null +++ b/cmd/client/dec_complex.go @@ -0,0 +1,9 @@ +//go:build decodersetcomplexity + +package main + +import "gopkg.in/hraban/opus.v2" + +func DecoderSetComplexity(dec *opus.Decoder, complexity int) error { + return dec.SetComplexity(complexity) +} diff --git a/cmd/client/main.go b/cmd/client/main.go index 118a7fe..1cb65bf 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -318,6 +318,9 @@ func main() { if err != nil { log.Fatal(err) } + if err = DecoderSetComplexity(dec, 10); err != nil { + log.Fatal(err) + } var player io.WriteCloser var cmd *exec.Cmd diff --git a/doc/index.texi b/doc/index.texi index f576f9d..f87061a 100644 --- a/doc/index.texi +++ b/doc/index.texi @@ -56,6 +56,7 @@ appropriate and satisfiable as fast and secure encryption solution. @include install.texi @include usage.texi @include vad.texi +@include libopus.texi @include proto.texi @bye diff --git a/doc/libopus.texi b/doc/libopus.texi new file mode 100644 index 0000000..7a3c589 --- /dev/null +++ b/doc/libopus.texi @@ -0,0 +1,26 @@ +@node libopus +@unnumbered libopus + +It is @strong{strongly} advisable to use the latest and much more +advanced version of @code{libopus}. +@url{https://wiki.hydrogenaud.io/index.php?title=Opus, Look} how many +features and optimisations it gains from version to version. + +Current latest version @url{https://opus-codec.org/demo/opus-1.5/, brings} +various ML-related enhancements for the decoder. Unfortunately Opus +wrapper library does not provide @code{Decoder.SetComplexity} call. +There is @url{git://git.stargrave.org/go-opus.git, fork} fork including +it. Clone it somewhere, add Go module replacement in your current's +@file{go.mod} file and build client with @code{decodersetcomplexity} tag +specified: + +@example +$ git clone git://git.stargrave.org/go-opus.git +$ realpath go-opus | read pth +$ echo "replace gopkg.in/hraban/opus.v2 => $pth" >> go.mod +$ ./mk-bin decodersetcomplexity +@end example + +Do not forget, that @code{libopus} must be built with +@code{--enable-deep-plc} and @code{--enable-osce} to enable use of those +advanced techniques. diff --git a/mk-bin b/mk-bin index 094a853..a3f54bc 100755 --- a/mk-bin +++ b/mk-bin @@ -3,7 +3,9 @@ mkdir -p bin [ -d vendor ] && $vendor="-mod=vendor" strip=-ldflags=-s -go build -C cmd/vad $strip $vendor $@ -o ../../bin/vors-vad -go build -C cmd/keygen $strip $vendor $@ -o ../../bin/vors-keygen -go build -C cmd/server $strip $vendor $@ -o ../../bin/vors-server -go build -C cmd/client -tags nolibopusfile $strip $vendor $@ -o ../../bin/vors-client +tags="nolibopusfile" +[ -z "$1" ] || tags="$tags,$1" +go build -C cmd/vad $strip $vendor -o ../../bin/vors-vad +go build -C cmd/keygen $strip $vendor -o ../../bin/vors-keygen +go build -C cmd/server $strip $vendor -o ../../bin/vors-server +go build -C cmd/client -tags $tags $strip $vendor -o ../../bin/vors-client