Closed mattgwwalker closed 4 years ago
I've re-worked OpusFileStream
, it now passes the above test for both the sample file and the larger 2.2MB file.
The number of reads has gone up, as previously the get_buffer()
method was calling op_read()
a number of times. In my modified version get_buffer()
now calls op_read()
once per call. This has the benefit of reducing the time per call to get_buffer()
.
The results on the demo file:
Read 240000 samples from OpusFile (in 48.1 milliseconds).
Read 240000 samples from the OpusFileStream
(in 252 reads averaging 0.23 milliseconds each).
OpusFileStream data was identical to OpusFile data.
The results on the larger (2.2MB) file:
Read 8375296 samples from OpusFile (in 1605.3 milliseconds).
Read 8375296 samples from the OpusFileStream
(in 8726 reads averaging 0.21 milliseconds each).
OpusFileStream data was identical to OpusFile data.
My next question, however, is how to commit all this... I've done the work on the same branch that I used for Pull Request #31. Is there an easy way to select just these changes? Or do I just commit it and make the Pull Request even larger? ;o)
Cheers,
Matthew
I discovered git's cherry-pick command. There's a first time for everything :o)
If you have any problem with the pull request please let me know.
Cheers,
Matthew
Hi,
I wrote a small example of the use of
OpusFileStream
. It loads an OggOpus file using bothOpusFile
andOpusFileStream
. It then does a sample-by-sample comparison to ensure that the two techniques produce the same output.Unfortunately, it appears that the two techniques don't always produce the same result.
Running on the demo file
examples/left-right-demo-5s.opus
, everything appears to be well:However when I tried it on a much larger Opus file (2.2MB), the two techniques did not produce the same result:
I have not yet committed the example. I'll have a look into the implementation of
OpusFileStream
to see if I can resolve the issue. If you're interested, below is the example/test code I was using: