[FFmpeg-devel] [PATCH] h264 CAVLC coeff_token decoder based on CLZ

Pascal Massimino pascal.massimino
Tue Jan 26 08:28:55 CET 2010


On Sat, Jan 23, 2010 at 4:15 PM, Jason Garrett-Glaser <darkshikari at gmail.com
> wrote:

> On Sat, Jan 23, 2010 at 11:03 AM, Pascal Massimino
> <pascal.massimino at gmail.com> wrote:
> > On Sat, Jan 23, 2010 at 10:18 AM, Michael Niedermayer <michaelni at gmx.at
> >wrote:
> >
> >> On Sat, Jan 23, 2010 at 03:28:53AM +0300, Anatoliy Nenashev wrote:
> >> > Hi all!
> >> > I have made some investigations in H264 CAVLC coeff_token decoder.
> >> > In attached patch you can see special implementation of VLC decoder
> for
> >> > coeff_token which is based on CLZ (count leading zeros).
> >> > This method reduce size of VLC decoding tables for coeff_token from
> >> > (520+332+280+256)*2 = 2776 byte to (2*4*16 + 64 + 67 + 63 + 63) = 385
> >> byte.
> >>
> >
> > FWIW: these table are not called that often,
>
> ~8-24 times per MB isn't that often?
>
> > and the code you search for is
> > often at the beginning of the table if you sort it by increasing code
> > length.
> > My point, FWIW: try a simple linear search on the sorted table.
>
> Ugh, that seems nasty.  In my experience coeff_token is not so
> lopsidedly distributed that this would work very well...
>

c'mon it's doesn't look as bad as you seem to imply. At worst, same speed,
i'd say
(but smaller code/data).
patch attached, just for coding's sake.

skal


example (in no way representative, i guess)
before (x64_64):
4903 dezicycles in decode_residual, 32759 runs, 9 skips
4864 dezicycles in decode_residual, 65519 runs, 17 skips
4873 dezicycles in decode_residual, 131031 runs, 41 skips
4857 dezicycles in decode_residual, 262071 runs, 73 skips
4818 dezicycles in decode_residual, 524150 runs, 138 skips
4802 dezicycles in decode_residual, 1048308 runs, 268 skips
4761 dezicycles in decode_residual, 2096680 runs, 472 skips

after:
4920 dezicycles in decode_residual, 32762 runs, 6 skips
4886 dezicycles in decode_residual, 65526 runs, 10 skips
4869 dezicycles in decode_residual, 131040 runs, 32 skips
4831 dezicycles in decode_residual, 262095 runs, 49 skips
4803 dezicycles in decode_residual, 524188 runs, 100 skips
4785 dezicycles in decode_residual, 1048369 runs, 207 skips
4752 dezicycles in decode_residual, 2096731 runs, 421 skips


>
> Dark Shikari
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: coeff_token_linear_search.diff
Type: application/octet-stream
Size: 9850 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100125/22603e6b/attachment.obj>



More information about the ffmpeg-devel mailing list