[FFmpeg-devel] [PATCH] simplify some mpc7 code

Reimar Döffinger Reimar.Doeffinger
Wed Jan 27 21:29:41 CET 2010

On Wed, Jan 27, 2010 at 10:13:51PM +0200, Kostya wrote:
> On Wed, Jan 27, 2010 at 09:08:01PM +0100, Reimar D?ffinger wrote:
> > Hello,
> > there is the same code duplicated 5 times, which IMO obfuscates the algorithm
> > a lot, attached patch extracts it into a function.
> > It also reworks a similar but different piece of code so it is IMO simple and
> > gcc no longer complains about "t" possibly being used uninitialized.
> Idea look OK but I see get_bits(8) in function and get_bits(6) in later
> code. Have you tested it? And maybe add inline qualifier to that
> function?

Tested now. I didn't try to benchmark if there's a point in the "inline".
There is another simplification possible, but I think that definitely
needs bechmarking, namely instead of the switch do
int scfi = bands[i].scfi[ch];
bands[i].scf_idx[ch][1] = scfi & 1 ? bands[i].scf_idx[ch][0] : get_scale_idx(&gb, bands[i].scf_idx[ch][0]);
bands[i].scf_idx[ch][2] = scfi & 2 ? bands[i].scf_idx[ch][1] : get_scale_idx(&gb, bands[i].scf_idx[ch][1]);
There might even be another simplification step possible after this, not sure.

More information about the ffmpeg-devel mailing list