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
|
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -49,8 +48,12 @@ enum {
|
||||||
const static int kSupportedColorFormats = NELEMENTS(supportedColorFormats);
|
const static int kSupportedColorFormats = NELEMENTS(supportedColorFormats);
|
||||||
const static int kMaxCores = 4;
|
const static int kMaxCores = 4;
|
||||||
void *iv_aligned_malloc(void *ctxt, WORD32 alignment, WORD32 size) {
|
void *iv_aligned_malloc(void *ctxt, WORD32 alignment, WORD32 size) {
|
||||||
|
void *buf = NULL;
|
||||||
(void)ctxt;
|
(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) {
|
void iv_aligned_free(void *ctxt, void *buf) {
|
||||||
|
|
@ -217,7 +220,7 @@ void Codec::allocFrame() {
|
||||||
mOutBufHandle.u4_num_bufs = num_bufs;
|
mOutBufHandle.u4_num_bufs = num_bufs;
|
||||||
for (int i = 0; i < num_bufs; i++) {
|
for (int i = 0; i < num_bufs; i++) {
|
||||||
mOutBufHandle.u4_min_out_buf_size[i] = sizes[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) {
|
void Codec::decodeHeader(const uint8_t *data, size_t size) {
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,6 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IOS
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
#ifdef IOS_DISPLAY
|
#ifdef IOS_DISPLAY
|
||||||
#include "cast_types.h"
|
#include "cast_types.h"
|
||||||
#else
|
#else
|
||||||
|
|
@ -447,8 +444,13 @@ void ih264a_aligned_free(void *pv_ctxt, void *pv_buf)
|
||||||
#if (!defined(IOS)) && (!defined(_WIN32))
|
#if (!defined(IOS)) && (!defined(_WIN32))
|
||||||
void * ih264a_aligned_malloc(void *pv_ctxt, WORD32 alignment, WORD32 i4_size)
|
void * ih264a_aligned_malloc(void *pv_ctxt, WORD32 alignment, WORD32 i4_size)
|
||||||
{
|
{
|
||||||
(void)pv_ctxt;
|
void *buf = NULL;
|
||||||
return memalign(alignment, i4_size);
|
(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)
|
void ih264a_aligned_free(void *pv_ctxt, void *pv_buf)
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,6 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef IOS
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WINDOWS_TIMER
|
#ifdef WINDOWS_TIMER
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#else
|
#else
|
||||||
|
|
@ -277,7 +273,12 @@ void ih264a_aligned_free(void *pv_buf)
|
||||||
|
|
||||||
void * ih264a_aligned_malloc(WORD32 alignment, WORD32 size)
|
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)
|
void ih264a_aligned_free(void *pv_buf)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue