• Join/Login
  • Business Software
  • Open Source Software
  • For Vendors
  • Blog
  • About
  • More
    • Articles
    • Create
    • SourceForge Podcast
    • Site Documentation
    • Subscribe to our Newsletter
    • Support Request
SourceForge logo
For Vendors Help Create Join Login
SourceForge logo
Business Software
Open Source Software
SourceForge Podcast
Resources
  • Articles
  • Case Studies
  • Blog
Menu
  • Help
  • Create
  • Join
  • Login
  • Home
  • Browse
  • FLAC-Free Lossless Audio Codec
  • Bugs

libFLAC: default compression level is not 5 like the docs say

Brought to you by: flac-maitainer, giles, jcoalson
  • Summary
  • Files
  • Reviews
  • Support
  • Tickets ▾
    • Feature Requests
    • Bugs
    • Support Requests
    • Patches
  • Code
Menu ▾ ▴
  • Create Ticket
  • View Stats

Group

  • 1.3.0
  • 1.3.1
  • 1.3.x

Searches

  • Changes
  • Closed Tickets
  • Open Tickets

Help

  • Formatting Help

#461 libFLAC: default compression level is not 5 like the docs say

1.3.x
open
nobody
None
5
2022-03-01
2018-01-15
deewiant
No

The documentation of FLAC__stream_encoder_set_compression_level claims that the default compression level is 5. And indeed, this seems to be the case in the code: FLAC__stream_encoder_new calls set_defaults_, which calls FLAC__stream_encoder_set_compression_level with the level 5. Unfortunately this call does absolutely nothing, because the function starts with a check:

if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
    return false;

And at this point, encoder->protected_->state is zero, which corresponds to FLAC__STREAM_ENCODER_OK. This zero comes from the calloc used to initialize encoder->protected_ — state is only set to FLAC__STREAM_ENCODER_UNINITIALIZED at the very end of FLAC__stream_encoder_new, which is too late for this attempt to set the compression level.

The default compression level is thus apparently even below the normal zero compression level: all other settings are equivalent to the normal zero level except for max_residual_partition_order, which is 3 in the zero level but 0 after FLAC__stream_encoder_new.

As far as I can tell, this bug has been there "forever" — ever since the documentation stating that the default level is 5 was added, which was way back in commit 425609cb0cbbc260a43109fecebcd339e7039fc7 on 2006-11-03. The call to FLAC__stream_encoder_set_compression_level was introduced a few years later, in commit a832ef32fb2a888674659097f40c1f8efb72c1a4 on 2009-01-02, but it had no effect even then. The status quo does not seem to have changed since.

Discussion

  • Martijn van Beurden

    Martijn van Beurden - 2022-03-01

    Patch is here: https://github.com/xiph/flac/pull/294

     
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Log in to post a comment.

SourceForge
  • Create a Project
  • Open Source Software
  • Business Software
  • Top Downloaded Projects
Company
  • About
  • Team
  • SourceForge Headquarters
    1320 Columbia Street Suite 310
    San Diego, CA 92101
    +1 (858) 422-6466
Resources
  • Support
  • Site Documentation
  • Site Status
  • SourceForge Reviews
SourceForge logo
© 2026 Slashdot Media. All Rights Reserved.
Terms Privacy Opt Out Advertise
MongoDB Logo MongoDB