[FFmpeg-devel] [PATCH] Rename ffadler to ffhash and expand it using the generic hash API

James Almer jamrial at gmail.com
Tue May 14 10:41:05 CEST 2013

On 14/05/13 3:54 AM, James Almer wrote:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavutil/Makefile            |  2 +-
>  tools/{ffadler.c => ffhash.c} | 63 +++++++++++++++++++++++++++++++++++--------
>  2 files changed, 53 insertions(+), 12 deletions(-)
>  rename tools/{ffadler.c => ffhash.c} (55%)

I should mention a few things.
Adler32 is giving different results now because it's initialized with 0 
in hash.c instead of 1 as it used to be in ffadler. Also, AV_WL32() in 
av_hash_final() is making it print in reverse.

CRC32 gives different results than other crc tools i checked, be 
it compression tools, other command line hash tools, etc.
This again is due to how hash.c initializes and finalizes the checksum.
After some tests i found out that initializing ctx->crc with UINT32_MAX, 
using AV_CRC_32_IEEE_LE instead of AV_CRC_32_IEEE and xoring the final 
value with UINT32_MAX makes hash.c give the same results as other tools.
The thing with AV_WL32() happens here as well.

More information about the ffmpeg-devel mailing list