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

ActiveAE: clamp floats #3339

Merged
merged 4 commits into from Sep 29, 2013
Merged

ActiveAE: clamp floats #3339

merged 4 commits into from Sep 29, 2013

Conversation

FernetMenta
Copy link
Contributor

see title. if ffmpeg does not convert values, the may be out of -1.0 .. 1.0
This is same strategy as SoftAE.

for (int k = 0; k < nb_floats; ++k)
{
if (fabs(fbuffer[k]) > 1.0f)
needClamp = true;

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@davilla
Copy link
Contributor

davilla commented Sep 28, 2013

aside from being worried as to where this large error is coming from, ok to inject. I wonder if some of their arm asm code is buggy.

@FernetMenta
Copy link
Contributor Author

sorry, I was wrong here. this is caused by downmixing to 2.0. will check ffmpeg code if there is a change to have swresample care of this.

@fritsch
Copy link
Member

fritsch commented Sep 28, 2013

I don't fully understand the weighting, that ffmpeg does, they always scale with 1/sqrt(2) - but 2*sqrt(2) != 2 ... but gets us obviously a boost of the volume :-)

@FernetMenta
Copy link
Contributor Author

there is a two months old commit in ffmpeg which allows setting max value for rematix:
FFmpeg/FFmpeg@e2b7184

for now I would keep this pr as is because we need clamping anyway when mixing streams for paplayer.
if desired we can only apply this clamping if sink format is float.

@fritsch
Copy link
Member

fritsch commented Sep 28, 2013

paplayer mixing on song change could be handled separately or better: more carefully. Having that commit backported would save us the whole fabs on all samples.

@FernetMenta
Copy link
Contributor Author

so you rather have the fabs in ffmpeg than the fabs here? it's not only the fading of streams of paplayer but also gui sounds. you are welcome to provide a better solution :)

@fritsch
Copy link
Member

fritsch commented Sep 28, 2013

If I see that right, that ffmpeg patch does not clamp, but scale. It keeps the natural distance between the samples, which I like - but and here youre point is valid, we have no guarantee for sounds we produce ourselves and have to clamp those again alone without ffmpeg.

So doing both, should improve sound quality?

@FernetMenta
Copy link
Contributor Author

convinced. I'll backport it.

@FernetMenta
Copy link
Contributor Author

updated. now swresample does the clamping for rematrix, we do after having mixed audio

@fritsch
Copy link
Member

fritsch commented Sep 28, 2013

@FernetMenta: Thanks very much.

jenkins build this please

@davilla: Could you verify on your setup, if it is okay with FLT again?

@fredphoesh
Copy link

Hello guys,
Pardon if I should not be writing here, but I was directed to this github conversation from a person on xbmc who said my audio issue was a "known issue". I am not a coder, but am very willing to test builds to see if the audio distortion issue is fixed. I have also uploaded 7 different well known tracks which all display the distortion issue very well. They are here - https://db.tt/uSuCOsi3
Anyhow, I would be glad to help if that would be useful to you. My xbmc thread is here
http://forum.xbmc.org/showthread.php?tid=174202
Cheers guys, Mark.

@davilla
Copy link
Contributor

davilla commented Sep 29, 2013

sounds ok on arm, ok to inject from me.

fritsch added a commit that referenced this pull request Sep 29, 2013
@fritsch fritsch merged commit c0b225e into xbmc:master Sep 29, 2013
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.

None yet

6 participants