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

James Almer jamrial at gmail.com
Wed May 15 21:05:35 CEST 2013


On 15/05/13 2:37 PM, Reimar Döffinger wrote:
> As he mentioned earlier, this is because hash.c isn't really
> behaving well for adler32/CRC.
> If I understood right at the very least this should be done,
> but I did not test:
> --- a/libavutil/hash.c
> +++ b/libavutil/hash.c
> @@ -97,7 +97,7 @@ int av_hash_alloc(AVHashContext **ctx, const char *name)
>      case SHA224:
>      case SHA256:  res->ctx = av_sha_alloc(); break;
>      case CRC32:   res->crctab = av_crc_get_table(AV_CRC_32_IEEE); break;
> -    case ADLER32: break;
> +    case ADLER32: res->crc = 1; break;
>      }
>      if (i != ADLER32 && i != CRC32 && !res->ctx) {
>          av_free(res);

The value is set in av_hash_init(). It needs to be changed from "ctx->crc = 0" 
to "ctx->crc = 1".
If you make this change in alloc() it will be overwritten by init() afterwards.

Regards.


More information about the ffmpeg-devel mailing list