Merge "vpx_mem/: apply clang-format" into nextgenv2
This commit is contained in:
@@ -8,7 +8,6 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef VPX_MEM_INCLUDE_VPX_MEM_INTRNL_H_
|
#ifndef VPX_MEM_INCLUDE_VPX_MEM_INTRNL_H_
|
||||||
#define VPX_MEM_INCLUDE_VPX_MEM_INTRNL_H_
|
#define VPX_MEM_INCLUDE_VPX_MEM_INTRNL_H_
|
||||||
#include "./vpx_config.h"
|
#include "./vpx_config.h"
|
||||||
@@ -17,15 +16,16 @@
|
|||||||
|
|
||||||
#ifndef DEFAULT_ALIGNMENT
|
#ifndef DEFAULT_ALIGNMENT
|
||||||
#if defined(VXWORKS)
|
#if defined(VXWORKS)
|
||||||
# define DEFAULT_ALIGNMENT 32 /*default addr alignment to use in
|
/*default addr alignment to use in calls to vpx_* functions other than
|
||||||
calls to vpx_* functions other
|
* vpx_memalign*/
|
||||||
than vpx_memalign*/
|
#define DEFAULT_ALIGNMENT 32
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_ALIGNMENT (2 * sizeof(void *)) /* NOLINT */
|
#define DEFAULT_ALIGNMENT (2 * sizeof(void *)) /* NOLINT */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*returns an addr aligned to the byte boundary specified by align*/
|
/*returns an addr aligned to the byte boundary specified by align*/
|
||||||
#define align_addr(addr,align) (void*)(((size_t)(addr) + ((align) - 1)) & (size_t)-(align))
|
#define align_addr(addr, align) \
|
||||||
|
(void *)(((size_t)(addr) + ((align)-1)) & (size_t) - (align))
|
||||||
|
|
||||||
#endif // VPX_MEM_INCLUDE_VPX_MEM_INTRNL_H_
|
#endif // VPX_MEM_INCLUDE_VPX_MEM_INTRNL_H_
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "vpx_mem.h"
|
#include "vpx_mem.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -17,8 +16,7 @@
|
|||||||
#include "vpx/vpx_integer.h"
|
#include "vpx/vpx_integer.h"
|
||||||
|
|
||||||
void *vpx_memalign(size_t align, size_t size) {
|
void *vpx_memalign(size_t align, size_t size) {
|
||||||
void *addr,
|
void *addr, *x = NULL;
|
||||||
* x = NULL;
|
|
||||||
|
|
||||||
addr = malloc(size + align - 1 + ADDRESS_STORAGE_SIZE);
|
addr = malloc(size + align - 1 + ADDRESS_STORAGE_SIZE);
|
||||||
|
|
||||||
@@ -31,24 +29,20 @@ void *vpx_memalign(size_t align, size_t size) {
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *vpx_malloc(size_t size) {
|
void *vpx_malloc(size_t size) { return vpx_memalign(DEFAULT_ALIGNMENT, size); }
|
||||||
return vpx_memalign(DEFAULT_ALIGNMENT, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *vpx_calloc(size_t num, size_t size) {
|
void *vpx_calloc(size_t num, size_t size) {
|
||||||
void *x;
|
void *x;
|
||||||
|
|
||||||
x = vpx_memalign(DEFAULT_ALIGNMENT, num * size);
|
x = vpx_memalign(DEFAULT_ALIGNMENT, num * size);
|
||||||
|
|
||||||
if (x)
|
if (x) memset(x, 0, num * size);
|
||||||
memset(x, 0, num * size);
|
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *vpx_realloc(void *memblk, size_t size) {
|
void *vpx_realloc(void *memblk, size_t size) {
|
||||||
void *addr,
|
void *addr, *new_addr = NULL;
|
||||||
* new_addr = NULL;
|
|
||||||
int align = DEFAULT_ALIGNMENT;
|
int align = DEFAULT_ALIGNMENT;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -71,8 +65,9 @@ void *vpx_realloc(void *memblk, size_t size) {
|
|||||||
|
|
||||||
if (new_addr) {
|
if (new_addr) {
|
||||||
addr = new_addr;
|
addr = new_addr;
|
||||||
new_addr = (void *)(((size_t)
|
new_addr =
|
||||||
((unsigned char *)new_addr + ADDRESS_STORAGE_SIZE) + (align - 1)) &
|
(void *)(((size_t)((unsigned char *)new_addr + ADDRESS_STORAGE_SIZE) +
|
||||||
|
(align - 1)) &
|
||||||
(size_t)-align);
|
(size_t)-align);
|
||||||
/* save the actual malloc address */
|
/* save the actual malloc address */
|
||||||
((size_t *)new_addr)[-1] = (size_t)addr;
|
((size_t *)new_addr)[-1] = (size_t)addr;
|
||||||
@@ -93,8 +88,7 @@ void vpx_free(void *memblk) {
|
|||||||
void *vpx_memset16(void *dest, int val, size_t length) {
|
void *vpx_memset16(void *dest, int val, size_t length) {
|
||||||
size_t i;
|
size_t i;
|
||||||
uint16_t *dest16 = (uint16_t *)dest;
|
uint16_t *dest16 = (uint16_t *)dest;
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length; i++) *dest16++ = val;
|
||||||
*dest16++ = val;
|
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef VPX_MEM_VPX_MEM_H_
|
#ifndef VPX_MEM_VPX_MEM_H_
|
||||||
#define VPX_MEM_VPX_MEM_H_
|
#define VPX_MEM_VPX_MEM_H_
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,8 @@ int arm_cpu_caps(void) {
|
|||||||
* All of these instructions should be essentially nops.
|
* All of these instructions should be essentially nops.
|
||||||
*/
|
*/
|
||||||
#if HAVE_MEDIA
|
#if HAVE_MEDIA
|
||||||
if (mask & HAS_MEDIA) __try {
|
if (mask & HAS_MEDIA) {
|
||||||
|
__try {
|
||||||
/*SHADD8 r3,r3,r3*/
|
/*SHADD8 r3,r3,r3*/
|
||||||
__emit(0xE6333F93);
|
__emit(0xE6333F93);
|
||||||
flags |= HAS_MEDIA;
|
flags |= HAS_MEDIA;
|
||||||
|
|||||||
@@ -102,10 +102,17 @@ typedef enum {
|
|||||||
} while (0)
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
/* clang-format off */
|
||||||
#define cpuid(func, func2, a, b, c, d) \
|
#define cpuid(func, func2, a, b, c, d) \
|
||||||
__asm mov eax, func __asm mov ecx, func2 __asm cpuid __asm mov a, \
|
__asm mov eax, func \
|
||||||
eax __asm mov b, ebx __asm mov c, ecx __asm mov d, edx
|
__asm mov ecx, func2 \
|
||||||
|
__asm cpuid \
|
||||||
|
__asm mov a, eax \
|
||||||
|
__asm mov b, ebx \
|
||||||
|
__asm mov c, ecx \
|
||||||
|
__asm mov d, edx
|
||||||
#endif
|
#endif
|
||||||
|
/* clang-format on */
|
||||||
#endif /* end others */
|
#endif /* end others */
|
||||||
|
|
||||||
// NaCl has no support for xgetbv or the raw opcode.
|
// NaCl has no support for xgetbv or the raw opcode.
|
||||||
|
|||||||
Reference in New Issue
Block a user