[Flac-dev] Problems when using libFLAC to encode 24 bit content

Justin Frankel justin at blorp.com
Fri Jul 14 19:09:06 PDT 2006


We are calling libFLAC. Here is the the initialization code:

          m_enc=FLAC__file_encoder_new ();
          FLAC__file_encoder_set_client_data(m_enc, this);
          FLAC__file_encoder_set_progress_callback(m_enc,progressCB);
          FLAC__file_encoder_set_channels (m_enc, m_nch);
          FLAC__file_encoder_set_bits_per_sample (m_enc, m_bps);
          FLAC__file_encoder_set_sample_rate (m_enc, m_srate);
          FLAC__file_encoder_set_filename (m_enc, fn);

	int ems=0, ec=0, ms=0, lms=0, qlp=0, minr=2, maxr=2, rice=0, lpc=0;
	// this is what we do for "level 5" but all of them don't work in 24 bit
            ems = false;
	    ec = false;
	    ms = true;
	    lms = false;
	    qlp = 0;
	    minr = 0;
            maxr = 3;
	    rice = 0;
	    lpc = 8;            


          if(m_nch == 1)
          {
            ms = false; lms = false;
          }


          FLAC__file_encoder_set_do_exhaustive_model_search(m_enc, ems);
          FLAC__file_encoder_set_do_escape_coding(m_enc, ec);
          FLAC__file_encoder_set_do_mid_side_stereo(m_enc, ms);
          FLAC__file_encoder_set_loose_mid_side_stereo(m_enc, lms);
          FLAC__file_encoder_set_qlp_coeff_precision(m_enc, qlp);
          FLAC__file_encoder_set_min_residual_partition_order(m_enc, minr);
          FLAC__file_encoder_set_max_residual_partition_order(m_enc, maxr);
          FLAC__file_encoder_set_rice_parameter_search_dist(m_enc, rice);
          FLAC__file_encoder_set_max_lpc_order(m_enc, lpc);


          FLAC__file_encoder_init (m_enc);


and yes, flac -a results in all VERBATIM. and using this exact code in 16 bit 
mode works fine, too.


Thanks,

Justin

On Fri, Jul 14, 2006 at 05:52:57PM -0700, Josh Coalson wrote:
> --- Justin Frankel <justin at blorp.com> wrote:
> > Hi everybody,
> > 
> > We have FLAC supported for input/output in REAPER
> > (http://www.reaper.fm), and the problem is that
> > when writing 24 bit FLAC files, the data isn't compressed (i.e. the
> > FLAC is slightly larger than
> > if it was writing to .WAV). The files play back fine, however, and 16
> > bit mode works great.
> > 
> > We're using flac-1.1.2, built on win32 with MSVC6 w/ SP5 + VCPP, and
> > NASM version 0.98.39
> 
> hmm... on the encoding side there are quite a few things that could
> affect that, so first I'll ask:
> 
> - are you calling the flac binary or calling into libFLAC?
>   - if flac, what is the command-line string?
>   - if libFLAC, can you post the calls you are using to set up
>     the encoder before initialization?
> - if you do 'flac -a some24bitfile.flac' that you made, are most/all
> of the subframe types VERBATIM?
> 
> Josh
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 


More information about the Flac-dev mailing list