Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: source/libvpx/vpx/src/vpx_image.c

Issue 484923003: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/vpx/src/vpx_encoder.c ('k') | source/libvpx/vpx_ports/vpx_timer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/vpx/src/vpx_image.c
===================================================================
--- source/libvpx/vpx/src/vpx_image.c (revision 291087)
+++ source/libvpx/vpx/src/vpx_image.c (working copy)
@@ -8,39 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-
#include <stdlib.h>
#include <string.h>
+
#include "vpx/vpx_image.h"
#include "vpx/vpx_integer.h"
+#include "vpx_mem/vpx_mem.h"
-#define ADDRESS_STORAGE_SIZE sizeof(size_t)
-/*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))
-
-/* Memalign code is copied from vpx_mem.c */
-static void *img_buf_memalign(size_t align, size_t size) {
- void *addr,
- * x = NULL;
-
- addr = malloc(size + align - 1 + ADDRESS_STORAGE_SIZE);
-
- if (addr) {
- x = align_addr((unsigned char *)addr + ADDRESS_STORAGE_SIZE, (int)align);
- /* save the actual malloc address */
- ((size_t *)x)[-1] = (size_t)addr;
- }
-
- return x;
-}
-
-static void img_buf_free(void *memblk) {
- if (memblk) {
- void *addr = (void *)(((size_t *)memblk)[-1]);
- free(addr);
- }
-}
-
static vpx_image_t *img_alloc_helper(vpx_image_t *img,
vpx_img_fmt_t fmt,
unsigned int d_w,
@@ -172,7 +146,7 @@
if (alloc_size != (size_t)alloc_size)
goto fail;
- img->img_data = img_buf_memalign(buf_align, (size_t)alloc_size);
+ img->img_data = (uint8_t *)vpx_memalign(buf_align, (size_t)alloc_size);
img->img_data_owner = 1;
}
@@ -296,7 +270,7 @@
void vpx_img_free(vpx_image_t *img) {
if (img) {
if (img->img_data && img->img_data_owner)
- img_buf_free(img->img_data);
+ vpx_free(img->img_data);
if (img->self_allocd)
free(img);
« no previous file with comments | « source/libvpx/vpx/src/vpx_encoder.c ('k') | source/libvpx/vpx_ports/vpx_timer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698