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

Kostya kostya.shishkov
Thu Jan 28 07:03:58 CET 2010


On Wed, Jan 27, 2010 at 09:32:16PM +0100, Reimar D?ffinger wrote:
> On Wed, Jan 27, 2010 at 09:29:41PM +0100, Reimar D?ffinger wrote:
> > 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.
> 
> Forgot updated patch.

OK if works and triggers that condition in get_scale_idx()



More information about the ffmpeg-devel mailing list