1)
lpc.c, FLAC__lpc_quantize_coefficients():

This function declares "const int nshift = -(*shift)" variable
when *shift is less than 0. Then nshift is used in the loop:

    for(i = 0; i < order; i++) {
        error += lp_coeff[i] / (1 << nshift);

This patch adds "const int pshift = *shift" variable.

Pros:
* more symmetry for two branches
* compiler doesn't know that lp_coeff[] and *shift
don't alias, so the code for
    error += lp_coeff[i] * (1 << *shift);
is less efficient than for
    error += lp_coeff[i] * (1 << pshift);

Cons:
* the speed increase is probably negligible



2)
There's the following code in stream_decoder.c:

    if(order <= 8)
        decoder->private_->local_lpc_restore_signal_16bit_order8( ... );
    else
        decoder->private_->local_lpc_restore_signal_16bit( ... );

but local_lpc_restore_signal_16bit is equal to ..._order8 for all
architectures except powerpc/altivec.

The patch hides local_lpc_restore_signal_16bit_order8 under
#ifdef FLAC__CPU_PPC / #endif directives.


Pros:
* one branch less

Cons:
* the same as for the 1st patch: the speed increase is probably negligible

Attachment: lpc_shift.patch
Description: Binary data

Attachment: ppc_order8.patch
Description: Binary data

_______________________________________________
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev

Reply via email to