Replace memalign with posix_memalign
Bug: 140696633 Test: Build and test binaries Change-Id: I2a00a34347732eb91f2dc3514c4fa8fa5b5c51b5
This commit is contained in:
parent
724246bc74
commit
9aefe92778
3 changed files with 19 additions and 13 deletions
|
|
@ -18,7 +18,6 @@
|
|||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
|
||||
#include <malloc.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -49,8 +48,12 @@ enum {
|
|||
const static int kSupportedColorFormats = NELEMENTS(supportedColorFormats);
|
||||
const static int kMaxCores = 4;
|
||||
void *iv_aligned_malloc(void *ctxt, WORD32 alignment, WORD32 size) {
|
||||
void *buf = NULL;
|
||||
(void)ctxt;
|
||||
return memalign(alignment, size);
|
||||
if (0 != posix_memalign(&buf, alignment, size)) {
|
||||
return NULL;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
void iv_aligned_free(void *ctxt, void *buf) {
|
||||
|
|
@ -217,7 +220,7 @@ void Codec::allocFrame() {
|
|||
mOutBufHandle.u4_num_bufs = num_bufs;
|
||||
for (int i = 0; i < num_bufs; i++) {
|
||||
mOutBufHandle.u4_min_out_buf_size[i] = sizes[i];
|
||||
mOutBufHandle.pu1_bufs[i] = (UWORD8 *)memalign(16, sizes[i]);
|
||||
mOutBufHandle.pu1_bufs[i] = (UWORD8 *)iv_aligned_malloc(NULL, 16, sizes[i]);
|
||||
}
|
||||
}
|
||||
void Codec::decodeHeader(const uint8_t *data, size_t size) {
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@
|
|||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifndef IOS
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#ifdef IOS_DISPLAY
|
||||
#include "cast_types.h"
|
||||
#else
|
||||
|
|
@ -447,8 +444,13 @@ void ih264a_aligned_free(void *pv_ctxt, void *pv_buf)
|
|||
#if (!defined(IOS)) && (!defined(_WIN32))
|
||||
void * ih264a_aligned_malloc(void *pv_ctxt, WORD32 alignment, WORD32 i4_size)
|
||||
{
|
||||
(void)pv_ctxt;
|
||||
return memalign(alignment, i4_size);
|
||||
void *buf = NULL;
|
||||
(void)pv_ctxt;
|
||||
if (0 != posix_memalign(&buf, alignment, i4_size))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
void ih264a_aligned_free(void *pv_ctxt, void *pv_buf)
|
||||
|
|
|
|||
|
|
@ -29,10 +29,6 @@
|
|||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef IOS
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#ifdef WINDOWS_TIMER
|
||||
#include "windows.h"
|
||||
#else
|
||||
|
|
@ -277,7 +273,12 @@ void ih264a_aligned_free(void *pv_buf)
|
|||
|
||||
void * ih264a_aligned_malloc(WORD32 alignment, WORD32 size)
|
||||
{
|
||||
return memalign(alignment, size);
|
||||
void *buf = NULL;
|
||||
if (0 != posix_memalign(&buf, alignment, size))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
void ih264a_aligned_free(void *pv_buf)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue