Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
cce3e0a4
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cce3e0a4
编写于
10月 27, 2013
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move av_fast_{m,re}alloc from lavc to lavu.
上级
aa241229
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
71 addition
and
48 deletion
+71
-48
doc/APIchanges
doc/APIchanges
+3
-0
libavcodec/avcodec.h
libavcodec/avcodec.h
+4
-21
libavcodec/utils.c
libavcodec/utils.c
+6
-26
libavcodec/version.h
libavcodec/version.h
+3
-0
libavutil/mem.c
libavutil/mem.c
+33
-0
libavutil/mem.h
libavutil/mem.h
+21
-0
libavutil/version.h
libavutil/version.h
+1
-1
未找到文件。
doc/APIchanges
浏览文件 @
cce3e0a4
...
...
@@ -13,6 +13,9 @@ libavutil: 2012-10-22
API changes, most recent first:
2013-11-xx - xxxxxxx - lavu 52.18.0 - mem.h
Move av_fast_malloc() and av_fast_realloc() for libavcodec to libavutil.
2013-10-xx - xxxxxxx - lavc 55.27.0 - avcodec.h
Deprecate AVCodecContext.error_rate, it is replaced by the 'error_rate'
private option of the mpegvideo encoder family.
...
...
libavcodec/avcodec.h
浏览文件 @
cce3e0a4
...
...
@@ -36,6 +36,10 @@
#include "libavutil/dict.h"
#include "libavutil/frame.h"
#include "libavutil/log.h"
#if FF_API_FAST_MALLOC
// to provide fast_*alloc
#include "libavutil/mem.h"
#endif
#include "libavutil/pixfmt.h"
#include "libavutil/rational.h"
...
...
@@ -4197,27 +4201,6 @@ AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f);
/* memory */
/**
* Reallocate the given block if it is not large enough, otherwise do nothing.
*
* @see av_realloc
*/
void
*
av_fast_realloc
(
void
*
ptr
,
unsigned
int
*
size
,
size_t
min_size
);
/**
* Allocate a buffer, reusing the given one if large enough.
*
* Contrary to av_fast_realloc the current buffer contents might not be
* preserved and on error the old buffer is freed, thus no special
* handling to avoid memleaks is necessary.
*
* @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
* @param size size of the buffer *ptr points to
* @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
* *size 0 if an error occurred.
*/
void
av_fast_malloc
(
void
*
ptr
,
unsigned
int
*
size
,
size_t
min_size
);
/**
* Allocate a buffer with padding, reusing the given one if large enough.
*
...
...
libavcodec/utils.c
浏览文件 @
cce3e0a4
...
...
@@ -55,37 +55,17 @@ static int (*lockmgr_cb)(void **mutex, enum AVLockOp op);
static
void
*
codec_mutex
;
static
void
*
avformat_mutex
;
void
*
av_fast_realloc
(
void
*
ptr
,
unsigned
int
*
size
,
size_t
min_size
)
#if FF_API_FAST_MALLOC && CONFIG_SHARED && HAVE_SYMVER
FF_SYMVER
(
void
*
,
av_fast_realloc
,
(
void
*
ptr
,
unsigned
int
*
size
,
size_t
min_size
),
"LIBAVCODEC_55"
)
{
if
(
min_size
<
*
size
)
return
ptr
;
min_size
=
FFMAX
(
17
*
min_size
/
16
+
32
,
min_size
);
ptr
=
av_realloc
(
ptr
,
min_size
);
/* we could set this to the unmodified min_size but this is safer
* if the user lost the ptr and uses NULL now
*/
if
(
!
ptr
)
min_size
=
0
;
*
size
=
min_size
;
return
ptr
;
return
av_fast_realloc
(
ptr
,
size
,
min_size
);
}
void
av_fast_malloc
(
void
*
ptr
,
unsigned
int
*
size
,
size_t
min_size
)
FF_SYMVER
(
void
,
av_fast_malloc
,
(
void
*
ptr
,
unsigned
int
*
size
,
size_t
min_size
),
"LIBAVCODEC_55"
)
{
void
**
p
=
ptr
;
if
(
min_size
<
*
size
)
return
;
min_size
=
FFMAX
(
17
*
min_size
/
16
+
32
,
min_size
);
av_free
(
*
p
);
*
p
=
av_malloc
(
min_size
);
if
(
!*
p
)
min_size
=
0
;
*
size
=
min_size
;
av_fast_malloc
(
ptr
,
size
,
min_size
);
}
#endif
void
av_fast_padded_malloc
(
void
*
ptr
,
unsigned
int
*
size
,
size_t
min_size
)
{
...
...
libavcodec/version.h
浏览文件 @
cce3e0a4
...
...
@@ -112,5 +112,8 @@
#ifndef FF_API_MAX_BFRAMES
#define FF_API_MAX_BFRAMES (LIBAVCODEC_VERSION_MAJOR < 56)
#endif
#ifndef FF_API_FAST_MALLOC
#define FF_API_FAST_MALLOC (LIBAVCODEC_VERSION_MAJOR < 56)
#endif
#endif
/* AVCODEC_VERSION_H */
libavutil/mem.c
浏览文件 @
cce3e0a4
...
...
@@ -35,6 +35,7 @@
#endif
#include "avutil.h"
#include "common.h"
#include "intreadwrite.h"
#include "mem.h"
...
...
@@ -344,3 +345,35 @@ void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
*
dst
=
*
src
;
}
}
void
*
av_fast_realloc
(
void
*
ptr
,
unsigned
int
*
size
,
size_t
min_size
)
{
if
(
min_size
<
*
size
)
return
ptr
;
min_size
=
FFMAX
(
17
*
min_size
/
16
+
32
,
min_size
);
ptr
=
av_realloc
(
ptr
,
min_size
);
/* we could set this to the unmodified min_size but this is safer
* if the user lost the ptr and uses NULL now
*/
if
(
!
ptr
)
min_size
=
0
;
*
size
=
min_size
;
return
ptr
;
}
void
av_fast_malloc
(
void
*
ptr
,
unsigned
int
*
size
,
size_t
min_size
)
{
void
**
p
=
ptr
;
if
(
min_size
<
*
size
)
return
;
min_size
=
FFMAX
(
17
*
min_size
/
16
+
32
,
min_size
);
av_free
(
*
p
);
*
p
=
av_malloc
(
min_size
);
if
(
!*
p
)
min_size
=
0
;
*
size
=
min_size
;
}
libavutil/mem.h
浏览文件 @
cce3e0a4
...
...
@@ -237,6 +237,27 @@ void av_freep(void *ptr);
*/
void
av_memcpy_backptr
(
uint8_t
*
dst
,
int
back
,
int
cnt
);
/**
* Reallocate the given block if it is not large enough, otherwise do nothing.
*
* @see av_realloc
*/
void
*
av_fast_realloc
(
void
*
ptr
,
unsigned
int
*
size
,
size_t
min_size
);
/**
* Allocate a buffer, reusing the given one if large enough.
*
* Contrary to av_fast_realloc the current buffer contents might not be
* preserved and on error the old buffer is freed, thus no special
* handling to avoid memleaks is necessary.
*
* @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
* @param size size of the buffer *ptr points to
* @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
* *size 0 if an error occurred.
*/
void
av_fast_malloc
(
void
*
ptr
,
unsigned
int
*
size
,
size_t
min_size
);
/**
* @}
*/
...
...
libavutil/version.h
浏览文件 @
cce3e0a4
...
...
@@ -37,7 +37,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 52
#define LIBAVUTIL_VERSION_MINOR 1
7
#define LIBAVUTIL_VERSION_MINOR 1
8
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录