#33 Encoder C API: Non-obvious need to reset enc_buf

v1.0 (example)

When using the C API for the encoder, the enc_buf structure in the
encoder handle needs to be set prior to every call to
dirac_encoder_output, even if the previous call to
dirac_encoder_output didn't return encoded data (eg. it returns

Although the API docs mention that the enc_buf structure should be
set up prior to such calls, the above requirement is not explicit. The
reasoning given in the docs can be read to imply that you only need
to set it up once, until the next time ENC_STATE_AVAIL is returned.

Either the docs could be more explicit, or the API could be changed
to not corrupt enc_buf if ENC_STATE_BUFFER is returned.


  • Matt Hammond

    Matt Hammond - 2005-09-15
    • priority: 5 --> 3
  • Anuradha Suraparaju

    • assigned_to: nobody --> asuraparaju
  • Anuradha Suraparaju

    Logged In: YES

    The enc_buf remains unchanged when a status other than
    ENC_STATE_AVAIL is returned. So the enc_buf needs to be set
    up before the first call to dirac_encoder_output and
    subsequently after every time the function returns
    ENC_STATE_AVAIL. Need to modify the docs to make this obvious.

  • Matt Hammond

    Matt Hammond - 2005-09-27

    Logged In: YES

    The observed behaviour did not seem to match this behaviour: if a state
    other than ENC_STATE_AVAIL is returned, then enc_buf->size did seem to
    get corrupted.

    dirac_encoder.cpp, lines 872-880 implies this observed behaviour: it looks
    possible for compressor->getEncodedData() to set enc_buf.size to zero. In
    which case ENC_STATE_AVAIL is not set, and yet enc_buf.size has been

  • Anuradha Suraparaju

    Logged In: YES

    Your observations are true for the dirac_encoder.cpp v1.8
    and v1.9. I based my comments on dirac_encoder.cpp v1.10
    which fixed bug #1291478. I tested it for resetting the
    enc_buf only after processing ENC_STATE_AVAIL and it works.
    I guess I should have mentioned this in the comment.

    Modified Files:
    old version: 1.9 new version: 1.10

  • Anuradha Suraparaju

    Logged In: YES

    Fixed in release 0.5.4

  • Anuradha Suraparaju

    • status: open --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks