[Flac-dev] Getting subframe type=verbatim on 16 bit files

Josh Coalson xflac at yahoo.com
Wed Sep 6 18:28:12 PDT 2006


looks fine, I would suspect how the PCM sample are formatted
and sent to process(), could you show that part of the code?

Josh


--- James Smith <jsmith at landmarkdigital.com> wrote:

> 
> I'm using libFLACC++ and libFLAC and I think that I'm using the calls
> in the
> typical order (see code below).  But every monoe or stereo file that
> I send
> thru I get files that are the same sze as the orginal wave files.
> 
> Doing a flac -a on the flac files I see that I get:
> 
> frame=9 blocksize=4608  sample_rate=8000        channels=1
> channel_assignment=INDEPENDENT
>         subframe=0      wasted_bits=0   type=VERBATIM
>  .......
> 
> Any idea why/ where I have goofed?
> 
> Thanks,
> 
> James
> 
> 
> Code snippet:
> ===================================================
>     FlacEncoder     flacCompressor;
>     bool            setValue = false;
>     
>     // set up regular parameters
>     setValue = flacCompressor.set_channels (numChannels);
>     setValue = flacCompressor.set_bits_per_sample (bitsPerSample);
>     setValue = flacCompressor.set_sample_rate (sampleRate);
>     setValue = flacCompressor.set_blocksize(4608);
>     setValue = flacCompressor.set_qlp_coeff_precision (0);
>     setValue = flacCompressor.set_min_residual_partition_order (3);
>     setValue = flacCompressor.set_max_residual_partition_order (3);
>     setValue = flacCompressor.set_max_lpc_order (8);
>     setValue = flacCompressor.set_rice_parameter_search_dist(0);
>     setValue = flacCompressor.set_do_exhaustive_model_search(false);
>     setValue = flacCompressor.set_do_escape_coding(false);
>     
>     
>     if (numChannels > 1)
>     {
>         setValue = flacCompressor.set_do_mid_side_stereo(true);
>         setValue = flacCompressor.set_loose_mid_side_stereo(true);
>     }    
>     
>     if (!flacCompressor.SetupInboundBuffer(pcmData))   return false;
> 
>     
>     FLAC__StreamMetadata            padding;
>     FLAC__StreamMetadata            *metadata [1];
> 
>     // stuff some pading for metadata
>     padding.type        = FLAC__METADATA_TYPE_PADDING;
>     padding.is_last        = 0;
>     padding.length        = 40;
>     metadata[0]            = &padding;
>     setValue = flacCompressor.set_metadata(metadata, 1);
>     
>     FlacEncoder::Stream::State flacState = flacCompressor.init();
>     
>     /*
>     // verify that the values are correct...they are fine, why still
> verbatim?
>     int i;
>     i = flacCompressor.get_channels ();
>     i = flacCompressor.get_bits_per_sample ();
>     i = flacCompressor.get_sample_rate ();
>     i = flacCompressor.get_blocksize();
>     i = flacCompressor.get_qlp_coeff_precision ();  // default=0 so
> encoding
> software picks the best
>     i = flacCompressor.get_min_residual_partition_order ();
>     i = flacCompressor.get_max_residual_partition_order ();     //
> Had tried
> 0,6  now try 3,3
>     i = flacCompressor.get_max_lpc_order ();
>     setValue = flacCompressor.get_do_mid_side_stereo();
>     setValue = flacCompressor.get_loose_mid_side_stereo();
>     */
>     
>     // is this state okay?
>     if (flacState  != FLAC__STREAM_ENCODER_OK)
>         return false; // bad settings for doing this compression so
> quit...
>     
>     // shoot the final data buffer to the encoder....
>     // we would have called process_interleaved if we had not created
> an
> array per channel above...
>     if (!flacCompressor.DoProcess())
>     {
>         flacState = flacCompressor.get_state();
>         return false;
>     }
>     
>     flacState = flacCompressor.get_state();
>     flacCompressor.finish();
>     
>      flacCompressor.Release();
>     
>     return true;
> }

__________________________________________________
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