]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/sha.c
dxva2_hevc: fix 32x32 scaling lists
[ffmpeg] / libavutil / sha.c
index cbe1608a26a25e90bf9fb1bc471137e2152d413f..2d9b58cda65502f63fc15b09164ad87f6345b9b6 100644 (file)
  */
 
 #include <string.h>
+
+#include "attributes.h"
 #include "avutil.h"
 #include "bswap.h"
 #include "sha.h"
 #include "intreadwrite.h"
+#include "mem.h"
 
 /** hash context */
 typedef struct AVSHA {
@@ -37,7 +40,14 @@ typedef struct AVSHA {
     void     (*transform)(uint32_t *state, const uint8_t buffer[64]);
 } AVSHA;
 
+#if FF_API_CONTEXT_SIZE
 const int av_sha_size = sizeof(AVSHA);
+#endif
+
+struct AVSHA *av_sha_alloc(void)
+{
+    return av_mallocz(sizeof(struct AVSHA));
+}
 
 #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
 
@@ -243,7 +253,7 @@ static void sha256_transform(uint32_t *state, const uint8_t buffer[64])
 }
 
 
-int av_sha_init(AVSHA* ctx, int bits)
+av_cold int av_sha_init(AVSHA *ctx, int bits)
 {
     ctx->digest_len = bits >> 5;
     switch (bits) {
@@ -326,7 +336,6 @@ void av_sha_final(AVSHA* ctx, uint8_t *digest)
 
 #ifdef TEST
 #include <stdio.h>
-#undef printf
 
 int main(void)
 {