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

Reimar Döffinger Reimar.Doeffinger
Wed Jan 27 21:32:16 CET 2010


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpcsimpl.diff
Type: text/x-diff
Size: 3202 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100127/c38b5cfc/attachment.diff>



More information about the ffmpeg-devel mailing list