mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-06 07:17:30 +09:00
Update aom to v1.0.0
Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0.
This commit is contained in:
parent
bb61121b44
commit
48f6d2e034
1087 changed files with 154333 additions and 265310 deletions
18
third_party/aom/aom_mem/aom_mem.c
vendored
18
third_party/aom/aom_mem/aom_mem.c
vendored
|
|
@ -9,8 +9,6 @@
|
|||
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
|
||||
*/
|
||||
|
||||
#define __AOM_MEM_C__
|
||||
|
||||
#include "aom_mem.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -18,6 +16,17 @@
|
|||
#include "include/aom_mem_intrnl.h"
|
||||
#include "aom/aom_integer.h"
|
||||
|
||||
#if defined(AOM_MAX_ALLOCABLE_MEMORY)
|
||||
// Returns 0 in case of overflow of nmemb * size.
|
||||
static int check_size_argument_overflow(uint64_t nmemb, uint64_t size) {
|
||||
const uint64_t total_size = nmemb * size;
|
||||
if (nmemb == 0) return 1;
|
||||
if (size > AOM_MAX_ALLOCABLE_MEMORY / nmemb) return 0;
|
||||
if (total_size != (size_t)total_size) return 0;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static size_t GetAlignedMallocSize(size_t size, size_t align) {
|
||||
return size + align - 1 + ADDRESS_STORAGE_SIZE;
|
||||
}
|
||||
|
|
@ -40,6 +49,9 @@ static void *GetActualMallocAddress(void *const mem) {
|
|||
void *aom_memalign(size_t align, size_t size) {
|
||||
void *x = NULL;
|
||||
const size_t aligned_size = GetAlignedMallocSize(size, align);
|
||||
#if defined(AOM_MAX_ALLOCABLE_MEMORY)
|
||||
if (!check_size_argument_overflow(1, aligned_size)) return NULL;
|
||||
#endif
|
||||
void *const addr = malloc(aligned_size);
|
||||
if (addr) {
|
||||
x = align_addr((unsigned char *)addr + ADDRESS_STORAGE_SIZE, align);
|
||||
|
|
@ -64,11 +76,9 @@ void aom_free(void *memblk) {
|
|||
}
|
||||
}
|
||||
|
||||
#if CONFIG_HIGHBITDEPTH
|
||||
void *aom_memset16(void *dest, int val, size_t length) {
|
||||
size_t i;
|
||||
uint16_t *dest16 = (uint16_t *)dest;
|
||||
for (i = 0; i < length; i++) *dest16++ = val;
|
||||
return dest;
|
||||
}
|
||||
#endif // CONFIG_HIGHBITDEPTH
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue