Skip to content

Conversation

@dennwc
Copy link

@dennwc dennwc commented Mar 14, 2024

This PR adds *To method variation for ulaw. These methods avoid allocation allowing the caller to reuse the buffer.

Also, add methods that operate on int16 slices for LPCM.

(upstream changes from livekit/sip)

@dennwc
Copy link
Author

dennwc commented Nov 1, 2024

@zaf A friendly ping :)

@zaf
Copy link
Owner

zaf commented Dec 14, 2024

Hello and thank you for the suggestion. I was already working on refactoring the code and I m thinking to introduce this feature there. This is the PR: #3
And this is the change that introduces the zero allocation functions: 10be6f3

Bench results:

BenchmarkEncodeUlaw-4     	   13824	     86166 ns/op	 472.39 MB/s	   20480 B/op	       1 allocs/op
BenchmarkEncodeUlawTo-4   	   14311	     82727 ns/op	 492.03 MB/s	       0 B/op	       0 allocs/op
BenchmarkDecodeUlaw-4     	   35204	     33762 ns/op	 602.82 MB/s	   40960 B/op	       1 allocs/op
BenchmarkDecodeUlawTo-4   	   45838	     25614 ns/op	 794.58 MB/s	       0 B/op	       0 allocs/op
BenchmarkUlaw2Alaw-4      	   78462	     14701 ns/op	1384.36 MB/s	   20480 B/op	       1 allocs/op
BenchmarkUlaw2AlawTo-4    	  101139	     11891 ns/op	1711.47 MB/s	       0 B/op	       0 allocs/op

Would you mind if we close this one and continue this work on the aforementioned PR?

@dennwc
Copy link
Author

dennwc commented Dec 14, 2024

Sure! Will check that PR to see if anything is missing there. Thank you!

@dennwc dennwc closed this Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants