From: David Henningsson <david.henningsson@canonical.com>
To: "Alexander E. Patrakov" <patrakov@gmail.com>,
Clemens Ladisch <clemens@ladisch.de>,
alsa-devel@alsa-project.org
Subject: Re: On non-rewindability of resamplers
Date: Fri, 25 Apr 2014 08:19:30 +0200 [thread overview]
Message-ID: <5359FE72.8050605@canonical.com> (raw)
In-Reply-To: <53597BA2.8080201@gmail.com>
On 2014-04-24 23:01, Alexander E. Patrakov wrote:
> +++++
>
> And now let's return to that fundamental problem with state. Inside the
> speculation block, I have suggested that the problem is that we don't
> have ops in snd_pcm_rate_ops_t that forward rewinds to the resampler
> implementation, so that it can restore its state to the one
> corresponding to an earlier moment in time. The real big problem (and
> the one I really meant in the original trolling attempt) is that even if
> you define new ops in snd_pcm_rate_ops_t, one can't implement them using
> existing open-source resamplers. Their APIs just don't have a function
> to rewind and to restore the prior magic samples.
>
> =====
First, thanks for doing this research. As you can see, nobody really
went into the rewinding business in depth...
I understand that you have a mathematically perfect approach to this, as
well as other algorithms. This would indeed be the best goal, but given
an imperfect world, where we're forced to choose between
1) no rewinding at all
2) imperfect rewinding in the sense that it sometimes can produce
hearable artifacts
...I'm not sure 1) is always the right choice...
> int snd_pcm_hw_params_is_seekable(const snd_pcm_hw_params_t *params);
>
> Check if the device fully supports rewinds and forwards.
>
> Parameters:
> params Configuration space
>
> Return values:
> 0 The whole plugin chain is not guaranteed to support arbitrary
> rewinds and forwards.
> 1 The whole plugin chain is guaranteed, under all remaining
> configurations in the configuration space, to support any rewinds and
> forwards that don't move the application pointer through the hardware
> pointer.
>
> If this function is called when there is more than one configuration
> exists in the configuration set (e.g. when the rate is not fixed), it
> may return pessimistic results.
I wonder if this is flexible enough. I think it would be not too
uncommon for hardware drivers to e g transfer data to the hardware one
period at a time. Hence what would make sense to rewind could be
everything but the current period. A similar approach could potentially
be done with resamplers (save state data every period so you can rewind
correctly to exactly those points but nowhere else).
This would be good to indicate somehow. I e, I'd like to see
snd_pcm_rewindable take into account how much actually makes sense to
rewind, taking DMA buffer sizes and other things into account where
appropriate. Today, we add our own margin of 1.33 ms in PulseAudio
because (if my understanding is correct) "some DMAs don't like us
writing exactly the block it's busy transferring", but it would be
better if this was indicated by ALSA.
--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
next prev parent reply other threads:[~2014-04-25 6:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-22 17:41 Testing rewindability of a pcm Alexander E. Patrakov
2014-04-24 12:00 ` Clemens Ladisch
2014-04-24 21:01 ` On non-rewindability of resamplers (was: Testing rewindability of a pcm) Alexander E. Patrakov
2014-04-25 6:19 ` David Henningsson [this message]
2014-04-25 14:09 ` On non-rewindability of resamplers Alexander E. Patrakov
2014-04-26 1:32 ` Raymond Yau
2014-04-26 10:01 ` Alexander E. Patrakov
2014-04-28 6:57 ` Raymond Yau
2014-04-28 17:31 ` Alexander E. Patrakov
2014-04-29 16:01 ` Raymond Yau
2014-04-29 17:17 ` Alexander E. Patrakov
2014-04-29 17:33 ` Alexander E. Patrakov
2014-05-02 5:39 ` Raymond Yau
2014-05-03 11:09 ` Alexander E. Patrakov
2014-05-10 0:46 ` Raymond Yau
2014-05-10 13:16 ` Alexander E. Patrakov
2014-05-12 3:11 ` Raymond Yau
2014-05-12 4:52 ` Alexander E. Patrakov
2014-05-13 17:21 ` Alexander E. Patrakov
2014-05-23 2:03 ` Raymond Yau
2014-05-23 18:59 ` Alexander E. Patrakov
2014-05-24 5:10 ` Raymond Yau
2014-05-24 7:31 ` Alexander E. Patrakov
2014-05-30 0:59 ` Raymond Yau
2014-05-28 7:58 ` Raymond Yau
2014-05-28 15:38 ` Alexander E. Patrakov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5359FE72.8050605@canonical.com \
--to=david.henningsson@canonical.com \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=patrakov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).