[flac-dev] --ogg progress info

lvqcl lvqcl.mail at gmail.com
Mon Jun 23 17:56:16 PDT 2014


Martijn van Beurden wrote:

> Furthermore, I discovered
> another bug checking the OGG seektable bug that is mentioned in
> documentation_bugs.html, when encoding to OGG (with flac --ogg
> somefile.wav) the progress indication is broken. I can't
> remember this was the case with FLAC 1.2.1

Yes, flac.exe 1.2.1b writes progress info as expected. But I downloaded the
sources of flac 1.2.1, built it with MSVS2013 and it fails just as flac 1.3.0.
So probably that's because of changes in libogg (I use libogg 1.3.2).

There's a code in encoder_progress_callback() in src/flac/encode.c:

	if(e->total_samples_to_encode > 0 && !((frames_written-1) & e->stats_mask))
		print_stats(e);

e->stats_mask is 0x7 or 0xf or 0x3f. So every 8 or 16 or 64 of frames_written
flac prints progress stats (imho the values of stats_mask should be updated:
they're too small for current processors).

But with --ogg option, frames_written variable updates differently, so
"!((frames_written-1) & e->stats_mask)" is much more rarely equal to true.


A possible solution is to replace e->stats_mask with e->old_frames_written
and e->stats_frames_interval:

	if(e->total_samples_to_encode > 0
	   && frames_written - e->old_frames_written > e->stats_frames_interval) {
		print_stats(e);
		e->old_frames_written = frames_written;
	}


Also, encoder_progress_callback() calculates e->compression_ratio
even when e->progress == 0.0, so it becomes 1.#INF.


More information about the flac-dev mailing list