[FFmpeg-devel] [RFC][PATCH 1/3] lavu: Add av_crc2() and av_crc2_init()

James Almer jamrial at gmail.com
Mon Jan 28 23:29:36 CET 2013


On 28/01/13 11:38 AM, Michael Niedermayer wrote:
> On Mon, Jan 28, 2013 at 04:31:53AM -0300, James Almer wrote:
>> Functionally the same as av_crc() and av_crc_init(), but
>> supporting CRCs of up to 64 bits.
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>  libavutil/crc.c          | 75 ++++++++++++------------------------------
>>  libavutil/crc.h          |  7 ++++
>>  libavutil/crc_template.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++
>>  3 files changed, 112 insertions(+), 55 deletions(-)
>>  create mode 100644 libavutil/crc_template.c
> 
> thats a huge mess for calculating a crc once for a few bytes of a
> tta password.
> 
> something like:
> for all bytes
>     c ^= (uint64_t)*byte++ << 56;
>     for(i=0; i<8; i++)
>         c = (c << 1) ^ (poly & (((int64_t) c) >> 63));
> 
> in tta will do the samem, saving all the hundreads of lines of code
> added to crc.*

I started that way, adding the calculation in tta, but then figured i might as 
well just add support for CRCs of more than 32 bits to libavutil in case something
else needs them in the future.

I'll send a patch later today to get the calculation done within tta.

Regards.


More information about the ffmpeg-devel mailing list