Added vp8_update_zbin_extra
[libvpx.git] / vpx_mem / ti_c6x / vpx_mem_ti_6cx.c
blobd55b7d92c381ec9e4b1eac5eb4ab1a05b0c4ef45
1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
12 #define __VPX_MEM_C__
14 #include "..\include\vpx_mem.h"
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <string.h>
18 #include "..\include\vpx_mem_intrnl.h"
20 void *vpx_mem_alloc(int id, size_t size, size_t align)
22 #if defined CHIP_DM642 || defined __uClinux__
23 void *mem = (void *)mem_alloc(id, size, align);
25 if (!mem)
27 _P(fprintf(stderr,
28 "\n"
29 "*********************************************************\n"
30 "WARNING: mem_alloc returned 0 for id=%p size=%u align=%u.\n"
31 "*********************************************************\n",
32 mem, size, align));
33 // should no longer need this. Softier says it's fixed. 2005-01-21 tjf
34 //#if defined __uClinux__
35 //while(1)usleep(1000000);
36 //#endif
39 #if defined __uClinux__
40 else if (mem == (void *)0xFFFFFFFF)
42 // out of memory/error
43 mem = (void *)0;
45 _P(fprintf(stderr,
46 "\n"
47 "******************************************************\n"
48 "ERROR: mem_alloc id=%p size=%u align=%u OUT OF MEMORY.\n"
49 "******************************************************\n",
50 mem, size, align));
53 #endif // __uClinux__
55 return mem;
56 #else
57 (void)id;
58 (void)size;
59 (void)align;
60 return (void *)0;
61 #endif
64 void vpx_mem_free(int id, void *mem, size_t size)
66 #if defined CHIP_DM642 || defined __uClinux__
68 if (!mem)
70 _P(fprintf(stderr,
71 "\n"
72 "**************************************\n"
73 "WARNING: 0 being free'd id=%p size=%u.\n"
74 "**************************************\n",
75 id, size));
77 // should no longer need this. Softier says it's fixed. 2005-01-21 tjf
78 //#if defined __uClinux__
79 //while(1)usleep(1000000);
80 //#endif
83 mem_free(id, mem, size);
84 #else
85 (void)id;
86 (void)mem;
87 (void)size;
88 #endif
91 #if CONFIG_MEM_TRACKER
92 void *xvpx_mem_alloc(int id, size_t size, size_t align, char *file, int line)
94 void *mem = vpx_mem_alloc(id, size, align);
96 vpx_memory_tracker_add((size_t)mem, size, file, line, 0);
98 return mem;
101 void xvpx_mem_free(int id, void *mem, size_t size, char *file, int line)
103 if (vpx_memory_tracker_remove((size_t)mem) == -2)
105 #if REMOVE_PRINTFS
106 (void)file;
107 (void)line;
108 #endif
109 _P(fprintf(stderr, "[vpx_mem][xvpx_mem_free] addr: %p (id=%p size=%u) "
110 "not found in list; freed from file:%s"
111 " line:%d\n", mem, id, size, file, line));
114 vpx_mem_free(id, mem, size);
116 #endif /*CONFIG_MEM_TRACKER*/