}
}
-void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, analysis_options aopts, FILE *fout)
+void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, unsigned frame_bytes, analysis_options aopts, FILE *fout)
{
const unsigned channels = frame->header.channels;
char outfilename[1024];
unsigned i, channel;
/* do the human-readable part first */
- fprintf(fout, "frame=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, frame->header.blocksize, frame->header.sample_rate, channels, FLAC__ChannelAssignmentString[frame->header.channel_assignment]);
+ fprintf(fout, "frame=%u\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, frame_bytes*8, frame->header.blocksize, frame->header.sample_rate, channels, FLAC__ChannelAssignmentString[frame->header.channel_assignment]);
for(channel = 0; channel < channels; channel++) {
const FLAC__Subframe *subframe = frame->subframes+channel;
fprintf(fout, "\tsubframe=%u\twasted_bits=%u\ttype=%s", channel, subframe->wasted_bits, FLAC__SubframeTypeString[subframe->type]);
FLAC__ASSERT(subframe->data.lpc.entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE);
fprintf(fout, "\torder=%u\tpartition_order=%u\tqlp_coeff_precision=%u\tquantization_level=%d\n", subframe->data.lpc.order, subframe->data.lpc.entropy_coding_method.data.partitioned_rice.order, subframe->data.lpc.qlp_coeff_precision, subframe->data.lpc.quantization_level);
for(i = 0; i < subframe->data.lpc.order; i++)
+ fprintf(fout, "\t\tqlp_coeff[%u]=%d\n", i, subframe->data.lpc.qlp_coeff[i]);
+ for(i = 0; i < subframe->data.lpc.order; i++)
fprintf(fout, "\t\twarmup[%u]=%d\n", i, subframe->data.lpc.warmup[i]);
if(aopts.do_residual_text) {
const unsigned partitions = (1u << subframe->data.lpc.entropy_coding_method.data.partitioned_rice.order);
} analysis_options;
void flac__analyze_init(analysis_options aopts);
-void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, analysis_options aopts, FILE *fout);
+void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, unsigned frame_bytes, analysis_options aopts, FILE *fout);
void flac__analyze_finish(analysis_options aopts);
#endif
unsigned sample_rate;
FLAC__uint32 channel_mask;
+ /* these are used only in analyze mode */
+ FLAC__uint64 decode_position;
+
FLAC__StreamDecoder *decoder;
FILE *fout;
d->sample_rate = 0;
d->channel_mask = 0;
+ d->decode_position = 0;
+
d->decoder = 0;
d->fout = 0; /* initialized with an open file later if necessary */
print_stats(decoder_session);
if(decoder_session->analysis_mode) {
- flac__analyze_frame(frame, decoder_session->frame_counter-1, decoder_session->aopts, fout);
+ FLAC__uint64 dpos;
+ FLAC__stream_decoder_get_decode_position(decoder_session->decoder, &dpos);
+ flac__analyze_frame(frame, decoder_session->frame_counter-1, (unsigned)(dpos-decoder_session->decode_position), decoder_session->aopts, fout);
+ decoder_session->decode_position = dpos;
}
else if(!decoder_session->test_only) {
if(shift && !decoder_session->replaygain.apply) {