Re: Datahandle State API changes
- From: Stefan Westerfeld <stefan space twc de>
- To: Tim Janik <timj imendio com>
- Cc: Beast Liste <beast beast gtk org>
- Subject: Re: Datahandle State API changes
- Date: Mon, 27 Nov 2006 20:47:23 +0100
Hi!
On Mon, Nov 27, 2006 at 06:35:51PM +0100, Tim Janik wrote:
> >>>+ * Often the state is symmetric, so that the number of output samples
> >>>affected
> >>>+ * before and after the "corresponding" output sample is the same. Then
> >>>the
> >>>+ * function returns this number. If the state is asymmetric, this
> >>>function
> >>>+ * shall return the maximum of the two numbers.
> >>>+ *
> >>>+ * If multiple data handles are cascaded (for instance when resampling a
> >>
> >>hm, "cascaded"? i'd rather say "nested" (or "chained") here.
> >
> >Ok: I'll use cascaded.
>
> i don't think "cascaded" is accurate here. cascaded handles could mean
> using handles in parallel (e.g. you could line up 6 handles in a
> specifically
> ordered cascade to produce a 5.1 dolby handle ;)
> only "nested" and to some extend "chained" carry across the sequential
> ordering of the handles.
Well, "nested" then (it was in the nek patch alteady, just the remark in
md mail was wrong). Btw. your mono -> 5.1 transform will have to
implement get_state, too.
> >>>Index: bse/bsedatahandle-resample.cc
> >>>===================================================================
> >>>--- bse/bsedatahandle-resample.cc (revision 4068)
> >>>+++ bse/bsedatahandle-resample.cc (working copy)
> >>>@@ -136,7 +136,7 @@ protected:
> >>> }
> >>>
> >>> /* implemented by upsampling and downsampling datahandle */
> >>>- virtual BseResampler2Mode mode () = 0;
> >>>+ virtual BseResampler2Mode mode () const = 0;
> >>> virtual int64 read_frame (int64 frame) = 0;
> >>>
> >>>public:
> >>>@@ -222,18 +222,38 @@ public:
> >>>
> >>> return n_values;
> >>> }
> >>>+ GslDataHandle*
> >>>+ get_source() const
> >>>+ {
> >>>+ return gsl_data_handle_get_source (m_src_handle);
> >>>+ }
> >>>+ int64
> >>>+ get_state_length() const
> >>>+ {
> >>>+ int64 source_state_length = gsl_data_handle_get_state_length
> >>>(m_src_handle);
> >>>+ if (source_state_length < 0)
> >>>+ return source_state_length;
> >>
> >>huh? why should a datahandle every return a negative state?
> >
> >Well, I thought of that line as a similar error propagation as I do in
> >read - that is, if the source handle does something strange, I pass it
> >on.
> >
> >What if the source handle had infinite state (like an IIR filter)?
>
> then we return that, the best approximation would be G_MAXINT64.
When we introduce it, we will have to specialcase every computation with
states, as 2 * G_MAXINT64 and G_MAXINT64 + 31 is not G_MAXINT64. Such
computations can be found in the resampler already (and will probably
occur elsewhere).
So for now the code doesn't give G_MAXINT64 a special meaning.
> >Here is the new patch:
>
> just pasting the changed portions would have been enough, it's not like the
> patch needed a major overhaul here. provided the above stuff is fixed it
> should be ready to go in i think.
Committed.
Cu... Stefan
--
Stefan Westerfeld, Hamburg/Germany, http://space.twc.de/~stefan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]