[vorbis-dev] Question re: vorbis_block_clear()

Jeff Squyres jsquyres at lsc.nd.edu
Wed Jan 10 05:57:23 PST 2001



On Tue, 9 Jan 2001, Monty wrote:

> > Does this fact effectively mean that you can't have multiple vorbis_block
> > instances outstanding?  i.e., can you only reliably vorbis_block_clear()
> > the *last* vorbis_block that went through vorbis_analysis()?
>
> If that's the way it is, it's a bug and I'll fix it.  Your basic
> strategy is right, haven't seen the code to see if there are any
> mistakes.

Bugs?  In my code?  Surely you must be joking.  :-)

The specific code that I'm referring to is in vorbis/lib/block.c:

-----
int vorbis_block_clear(vorbis_block *vb){
  if(vb->vd)
    if(vb->vd->analysisp)>
      oggpack_writeclear(&vb->opb);
-----

>From my reading of vorbis/lib/block.c::_vds_shared_init(), it *appears*
that vd->analysisp will always be 1 for vorbis_dsp_states that are
encoding.  Is that right?

If that is so, then my fears are unfounded and all I need to do is cache
the vorbis_dsp_state along with the vorbis_blocks and ogg_packets.

(my initial understanding was that analysisp may get set/reset depending
on input processing, but further checking with some greps in vorbis/lib
show that it's only set once during vorbis_analysis_init())

Woof; that gets a little complicated, because it's a many-to-one
relationship, meaning that some kind of mechanism has to be put into place
to monitor when the vorbis_dsp_state can finally be cleared/freed...
hmmm...

> > Monty: will the thread-safety stuff that you're working on fix this?
> > i.e., will vorbis_blocks no longer reference/depend on the
> > vorbis_dsp_state?  How far off is that stuff?
>
> It still has to reference the vorbis_dsp_state to get to configuration
> information, but that's a read-only reference.

Ok; so regardless of the thread-safety stuff, I need to cache the
vorbis_dsp_state along with the vorbis_block and ogg_packets as well.
This is doable.

How are those struct interdependency docs coming along?  ;-)

{+} Jeff Squyres
{+} squyres at cse.nd.edu
{+} Perpetual Obsessive Notre Dame Student Craving Utter Madness
{+} "I came to ND for 4 years and ended up staying for a decade"

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list