[FFmpeg-devel] [PATCH] Arithmetic decoding in ALS

Thilo Borgmann thilo.borgmann
Tue Jan 26 01:44:46 CET 2010

Am 25.01.10 12:16, schrieb Michael Niedermayer:
> On Tue, Jan 19, 2010 at 11:54:50PM +0100, Thilo Borgmann wrote:
>> Am 19.01.10 19:37, schrieb Michael Niedermayer:
>>> On Thu, Jan 14, 2010 at 03:20:04PM +0100, Thilo Borgmann wrote:
>>> [...]
>>>> The size of the luts might be further reduced if the shifted symbol
>>>> would be stored and use a smaller type than uint for the luts. Then, the
>>>> stored symbol would have to be shifted back before usage, but this again
>>>> costs many << operations (one for each sample in the file). Useful?
>>> I think this is a good idea, the luts look a little large to me
>> 3509969 dezicycles in bgmc NO shift & unsigned int, 512 runs, 0 skips
>> ->
>> 3738521 dezicycles in bgmc DO shift & uint8_t, 512 runs, 0 skips
> that seems like a quite big speedloss :/
> have you checked that the code work? (same number of iterations in
> the loop?)

Yes, identical.

>> Also I made the luts non-static what should make them thread safe,
>> doesn't it?
> no, if you write from 2 threads different data into a common place you
> need thread synchronization.
> What works is writing the same data or writing from just one thread.
> In practice that means each byte in each lut can only be in one of 2
> states, uninitialized and a single constant value. Another way to see
> it is that all static and global tables must be constant or you need
> thread sync / only a single thread writing

Ok yes, I deserved being remembered of the basics.

So I made them reside in the user/thread domain - hopefully. Although,
this also costs a little. Having some buffers fixed/global and one for
big delta values would be possible, but I doubt that the corresponding
complication would be worth it regarding a speed loss of ~2%:

1194966 dezicycles in GLOBAL LUT, 2047 runs, 1 skips
1191424 dezicycles in GLOBAL LUT, 2048 runs, 0 skips


1229276 dezicycles in USR LUT, 2046 runs, 2 skips
1239760 dezicycles in USR LUT, 2048 runs, 0 skips

Revision 5 attached.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: als_bgmc.rev5.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100126/d627cad4/attachment.asc>

More information about the ffmpeg-devel mailing list