]> Sergey Matveev's repositories - vors.git/commitdiff
Ability to use complex Opus decoder
authorSergey Matveev <stargrave@stargrave.org>
Thu, 11 Apr 2024 17:51:00 +0000 (20:51 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 11 Apr 2024 17:51:00 +0000 (20:51 +0300)
cmd/client/dec.go [new file with mode: 0644]
cmd/client/dec_complex.go [new file with mode: 0644]
cmd/client/main.go
doc/index.texi
doc/libopus.texi [new file with mode: 0644]
mk-bin

diff --git a/cmd/client/dec.go b/cmd/client/dec.go
new file mode 100644 (file)
index 0000000..f94b000
--- /dev/null
@@ -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 (file)
index 0000000..49aad0d
--- /dev/null
@@ -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)
+}
index 118a7fed55b076517fd8339680307bfa1ad0c03d59dc976006d5903715de0d1e..1cb65bfcc71e362dd577d73a251b181e23aaba930c05e185d6dee548f2c89438 100644 (file)
@@ -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
index f576f9db0e03ec2bca7b4d6b1c88e26e52d1acfcb1a1aef61a3a6d8e5d636735..f87061a6156ca8b32a9b268c8ff19d42c1b6a152e78b91d1fedd02575d7829b1 100644 (file)
@@ -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 (file)
index 0000000..7a3c589
--- /dev/null
@@ -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 094a8539a295d64a2ba6a90e075589b54227de64db7d97bfd82d0c01c22e0a24..a3f54bcc2f92f914639a97c7ebb5f4e341f44da28c6b8f03ca9796e6e61cf253 100755 (executable)
--- 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