[flac-dev] Undefined behaviour

lvqcl lvqcl.mail at gmail.com
Sat Aug 29 09:03:57 PDT 2015


Erik de Castro Lopo wrote:

> Yes, but the code in FLAC__fixed_restore_signal() is (ignoring identifier
> name differences) identical to FLAC__fixed_compute_residual(),

My point was: I think that almost anyone uses x86 CPUs to *en*code to FLAC,
but *de*coding is performed on various devices with various processors. So it
would be nice to test decoding performance on various CPU architectures.

(But I doubt that in reality it matters much: FLAC__lpc_restore_signal
performs noticeably heavier calculations to get sample values)


-----
And about shifts: maybe it also makes sense to use casts in
FLAC__bitreader_read_raw_int32 ? Something like this:

	if(!FLAC__bitreader_read_raw_uint32(br, (FLAC__uint32*)val, bits))
		return false;
	/* sign-extend: */
	*val = (FLAC__uint32)*val << (32-bits);
	*val >>= (32-bits);


More information about the flac-dev mailing list