[FFmpeg-devel] [PATCH] h264: hl_decode_mb_internal optimisation

Michael Niedermayer michaelni
Thu Jul 31 12:56:06 CEST 2008

On Thu, Jul 31, 2008 at 06:10:37PM +1200, Paul Kendall wrote:
> On Thursday 31 July 2008 01:09:38 Michael Niedermayer wrote:
> > On Mon, Jul 28, 2008 at 05:51:47PM +1200, Paul Kendall wrote:
> > > In the hl_decode_mb_internal function, the access pattern for h->mb is
> > > seqential, so we can simplify the code to get the value into a local and
> > > use *mb++ pattern.
> > >
> > > Also, we can simplify the copy destination logic by calculating values at
> > > various parts of the loop rather then for each store action.
> >
> > PCM macroblocks should occur VERY rarely thus i dont think this will have
> > any effect on speed not even if the code would be 10 times faster.
> > If not speed then its just readability and i think old and new variants
> > are rather similar readability wise.
> >
> > [...]
> I see you have committed a change for PCM stuff in revision 14476.
> I think you need to revisit it! The memcpy in the first part of the commit is 
> cannot work as h->mb is of type DCTELEM[] (short) and desty is uint8_t!
> The same goes for the final section. Also, the other sections are not copying 
> the data in the same order as was there previously! I copied the code there 
> to a small C file with then printed the indexes from the calculations and it 
> is certainly not sequential!

My code is correct, my code is always correct ;)
And yes the data is now stored in a different order internally, thats plain
because it leads to simpler code, it may be faster as well but thats
irrelevant due to rareity of these blocks.

And yes i did test it with files containing PCM blocks and they are binary

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080731/fd048b0c/attachment.pgp>

More information about the ffmpeg-devel mailing list