Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented Int32_To_UInt8_Dither #841

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ngoiyaeric
Copy link

Implemented a method to convert data from int32_To_UnInt8_Dither. Port audio did not offer 32bitTriangularDither so I used the available 16bitTriangularDither. Would like to know how to test this code and how to check if it is implemented correctly. The build for port audio works with these changes.

Implemented a method to convert data from int32_To_UnInt8_Dither.
Port audio did not offer 32bitTriangularDither so I used the available 16bitTriangularDither. Would like to know how to test this code and how to check if it is implemented correctly. The build for port audio works with these changes.
@RossBencina
Copy link
Collaborator

RossBencina commented Sep 22, 2023

Thanks for this. I'm not sure that you have the dither scaling factor correct, could you provide a rationale please? Looking at the docs for PaUtil_Generate16BitTriangularDither we think maybe:

PaInt32 result = ((*src >> 1) +  (dither << 8));
result = (result >> 23) + 128;

But please could you check this for yourself.

The following tests are present, not sure whether they are sufficient:

Fixed dither scaling factor
@ngoiyaeric
Copy link
Author

Hi, thanks for the corrections. I made the code changes you have suggested. What dynamic range code should I expect after running test/patest_converters for the i32 to ui8 conversions, what logic should I use to generalize this indicator across various conversion tests.

Copy link
Collaborator

@philburk philburk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new math looks good.
But the CI found some trailing whitespace:

error: src/common/pa_converters.c(1016) trailing whitespace:
b' unsigned char dest = (unsigned char)destinationBuffer; '
error: src/common/pa_converters.c(1021) trailing whitespace:
b' '
error: src/common/pa_converters.c(1028) trailing whitespace:
b' dest += destinationStride; '

@RossBencina
Copy link
Collaborator

What dynamic range code should I expect after running test/patest_converters for the i32 to ui8 conversions

Same as other ui8 conversions I guess.

Could you paste the output of this test here please and we'll scratch our heads about it:

https://github.com/PortAudio/portaudio/blob/master/test/patest_converters.c

@ngoiyaeric
Copy link
Author

What dynamic range code should I expect after running test/patest_converters for the i32 to ui8 conversions

Same as other ui8 conversions I guess.

Could you paste the output of this test here please and we'll scratch our heads about it:

https://github.com/PortAudio/portaudio/blob/master/test/patest_converters.c

Hi,
When I run this command
gcc -l/portaudio/src/common/ patest_converters.c -o your_output_executable -lm -lportaudio
to test the module, I get this error.
patest_converters.c:53:10: fatal error: 'pa_converters.h' file not found
#include "pa_converters.h"
^~~~~~~~~~~~~~~~~
1 error generated.

Any Ideas how I could fix it?

@dmitrykos
Copy link
Collaborator

@ngoiyaeric it depends on how src/common folder is related to the path from which you are running GCC build command. If you are running GCC build from inside portaudio folder then it would be -Isrc/common, if from outside but portaudio folder is not in the root of the storage then -Iportaudio/src/common and so on.

@ngoiyaeric
Copy link
Author

@ngoiyaeric it depends on how src/common folder is related to the path from which you are running GCC build command. If you are running GCC build from inside portaudio folder then it would be -Isrc/common, if from outside but portaudio folder is not in the root of the storage then -Iportaudio/src/common and so on.

hi, this does not remedy the issue, the same error is still thrown.

@dmitrykos
Copy link
Collaborator

@ngoiyaeric in any case GCC is struggling to locate pa_converters.h in your build configuration, it is the only reason. To avoid dealing with compiler configuration directly you could try building patest_converters via CMake generated build project.

@dmitrykos
Copy link
Collaborator

@ngoiyaeric have you managed to test your implementation? Also this commit (273c991) has to be removed from PR.

@RossBencina RossBencina added the P2 Priority: High label Oct 18, 2024
@RossBencina RossBencina added this to the V19.8 milestone Oct 18, 2024
@philburk philburk removed this from the V19.8 milestone Nov 25, 2024
@RossBencina RossBencina added P3 Priority: Normal and removed P2 Priority: High labels Nov 25, 2024
@RossBencina
Copy link
Collaborator

We'd like to see this tested and finalised but given the lack of input, we're not going to hold up the next milestone release for this. We can revisit if someone steps up to fix it.

@@ -0,0 +1,23 @@
# This workflow was added by CodeSee. Learn more at https://codesee.io/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be removed from this PR.
It is unrelated to the purpose of the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Priority: Normal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants