Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VSs > VSs__H264__App
diff libavcodec/utils.c @ 2:897f711a7157
rearrange to work with autoconf
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Tue, 25 Sep 2012 15:55:33 +0200 |
| parents | |
| children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libavcodec/utils.c Tue Sep 25 15:55:33 2012 +0200 1.3 @@ -0,0 +1,68 @@ 1.4 +/* 1.5 + * utils for libavcodec 1.6 + * Copyright (c) 2001 Fabrice Bellard 1.7 + * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> 1.8 + * 1.9 + * This file is part of FFmpeg. 1.10 + * 1.11 + * FFmpeg is free software; you can redistribute it and/or 1.12 + * modify it under the terms of the GNU Lesser General Public 1.13 + * License as published by the Free Software Foundation; either 1.14 + * version 2.1 of the License, or (at your option) any later version. 1.15 + * 1.16 + * FFmpeg is distributed in the hope that it will be useful, 1.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 1.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1.19 + * Lesser General Public License for more details. 1.20 + * 1.21 + * You should have received a copy of the GNU Lesser General Public 1.22 + * License along with FFmpeg; if not, write to the Free Software 1.23 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 1.24 + */ 1.25 + 1.26 +/** 1.27 + * @file 1.28 + * utils. 1.29 + */ 1.30 + 1.31 +/* needed for mkstemp() */ 1.32 +#define _XOPEN_SOURCE 600 1.33 + 1.34 +#include "avcodec.h" 1.35 +#include "dsputil.h" 1.36 + 1.37 +#include <stdlib.h> 1.38 +#include <stdarg.h> 1.39 +#include <limits.h> 1.40 +#include <float.h> 1.41 +//#undef NDEBUG 1.42 +#include <assert.h> 1.43 + 1.44 +#include <fcntl.h> 1.45 + 1.46 +void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) 1.47 +{ 1.48 + if(min_size < *size) 1.49 + return ptr; 1.50 + 1.51 + *size= FFMAX(17*min_size/16 + 32, min_size); 1.52 + 1.53 + ptr= av_realloc(ptr, *size); 1.54 + if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now 1.55 + *size= 0; 1.56 + 1.57 + return ptr; 1.58 +} 1.59 + 1.60 +void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size) 1.61 +{ 1.62 + void **p = ptr; 1.63 + if (min_size < *size) 1.64 + return; 1.65 + *size= FFMAX(17*min_size/16 + 32, min_size); 1.66 + av_free(*p); 1.67 + *p = av_malloc(*size); 1.68 + if (!*p) *size = 0; 1.69 +} 1.70 + 1.71 +
