Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
e8bc6422
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,发现更多精彩内容 >>
提交
e8bc6422
编写于
1月 08, 2016
作者:
C
Clément Bœsch
提交者:
Vittorio Giovara
1月 11, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lavu: add AV_CEIL_RSHIFT and use it in various places
Signed-off-by:
N
Vittorio Giovara
<
vittorio.giovara@gmail.com
>
上级
7570c9e0
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
39 addition
and
30 deletion
+39
-30
libavcodec/ffv1dec.c
libavcodec/ffv1dec.c
+2
-2
libavcodec/ffv1enc.c
libavcodec/ffv1enc.c
+2
-2
libavcodec/mimic.c
libavcodec/mimic.c
+2
-2
libavfilter/vf_framepack.c
libavfilter/vf_framepack.c
+3
-2
libavutil/common.h
libavutil/common.h
+8
-0
libavutil/frame.c
libavutil/frame.c
+1
-1
libavutil/imgutils.c
libavutil/imgutils.c
+1
-1
libavutil/version.h
libavutil/version.h
+1
-1
libswscale/rgb2rgb_template.c
libswscale/rgb2rgb_template.c
+4
-4
libswscale/swscale.c
libswscale/swscale.c
+3
-3
libswscale/swscale_unscaled.c
libswscale/swscale_unscaled.c
+3
-3
libswscale/utils.c
libswscale/utils.c
+5
-5
libswscale/x86/rgb2rgb_template.c
libswscale/x86/rgb2rgb_template.c
+4
-4
未找到文件。
libavcodec/ffv1dec.c
浏览文件 @
e8bc6422
...
...
@@ -375,8 +375,8 @@ static int decode_slice(AVCodecContext *c, void *arg)
av_assert1
(
width
&&
height
);
if
(
f
->
colorspace
==
0
)
{
const
int
chroma_width
=
-
((
-
width
)
>>
f
->
chroma_h_shift
);
const
int
chroma_height
=
-
((
-
height
)
>>
f
->
chroma_v_shift
);
const
int
chroma_width
=
AV_CEIL_RSHIFT
(
width
,
f
->
chroma_h_shift
);
const
int
chroma_height
=
AV_CEIL_RSHIFT
(
height
,
f
->
chroma_v_shift
);
const
int
cx
=
x
>>
f
->
chroma_h_shift
;
const
int
cy
=
y
>>
f
->
chroma_v_shift
;
decode_plane
(
fs
,
p
->
data
[
0
]
+
ps
*
x
+
y
*
p
->
linesize
[
0
],
width
,
...
...
libavcodec/ffv1enc.c
浏览文件 @
e8bc6422
...
...
@@ -897,8 +897,8 @@ static int encode_slice(AVCodecContext *c, void *arg)
}
if
(
f
->
colorspace
==
0
)
{
const
int
chroma_width
=
-
((
-
width
)
>>
f
->
chroma_h_shift
);
const
int
chroma_height
=
-
((
-
height
)
>>
f
->
chroma_v_shift
);
const
int
chroma_width
=
AV_CEIL_RSHIFT
(
width
,
f
->
chroma_h_shift
);
const
int
chroma_height
=
AV_CEIL_RSHIFT
(
height
,
f
->
chroma_v_shift
);
const
int
cx
=
x
>>
f
->
chroma_h_shift
;
const
int
cy
=
y
>>
f
->
chroma_v_shift
;
...
...
libavcodec/mimic.c
浏览文件 @
e8bc6422
...
...
@@ -392,8 +392,8 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
avctx
->
height
=
height
;
avctx
->
pix_fmt
=
AV_PIX_FMT_YUV420P
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
ctx
->
num_vblocks
[
i
]
=
-
((
-
height
)
>>
(
3
+
!!
i
)
);
ctx
->
num_hblocks
[
i
]
=
width
>>
(
3
+
!!
i
);
ctx
->
num_vblocks
[
i
]
=
AV_CEIL_RSHIFT
(
height
,
3
+
!!
i
);
ctx
->
num_hblocks
[
i
]
=
width
>>
(
3
+
!!
i
);
}
}
else
if
(
width
!=
ctx
->
avctx
->
width
||
height
!=
ctx
->
avctx
->
height
)
{
avpriv_request_sample
(
avctx
,
"Resolution changing"
);
...
...
libavfilter/vf_framepack.c
浏览文件 @
e8bc6422
...
...
@@ -25,6 +25,7 @@
#include <string.h>
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
...
...
@@ -158,8 +159,8 @@ static void horizontal_frame_pack(AVFilterLink *outlink,
for
(
plane
=
0
;
plane
<
s
->
pix_desc
->
nb_components
;
plane
++
)
{
if
(
plane
==
1
||
plane
==
2
)
{
length
=
-
(
-
(
out
->
width
/
2
)
>>
s
->
pix_desc
->
log2_chroma_w
);
lines
=
-
(
-
(
out
->
height
)
>>
s
->
pix_desc
->
log2_chroma_h
);
length
=
AV_CEIL_RSHIFT
(
out
->
width
/
2
,
s
->
pix_desc
->
log2_chroma_w
);
lines
=
AV_CEIL_RSHIFT
(
out
->
height
,
s
->
pix_desc
->
log2_chroma_h
);
}
for
(
i
=
0
;
i
<
lines
;
i
++
)
{
int
j
;
...
...
libavutil/common.h
浏览文件 @
e8bc6422
...
...
@@ -50,6 +50,14 @@
#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
/* assume b>0 */
#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
/**
* Fast a / (1 << b) rounded toward +inf, assuming a >= 0 and b >= 0.
*/
#define AV_CEIL_RSHIFT(a, b) \
(av_builtin_constant_p(b) ? ((a) + (1 << (b)) - 1) >> (b) \
: -((-(a)) >> (b)))
#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
#define FFSIGN(a) ((a) > 0 ? 1 : -1)
...
...
libavutil/frame.c
浏览文件 @
e8bc6422
...
...
@@ -111,7 +111,7 @@ static int get_video_buffer(AVFrame *frame, int align)
for
(
i
=
0
;
i
<
4
&&
frame
->
linesize
[
i
];
i
++
)
{
int
h
=
frame
->
height
;
if
(
i
==
1
||
i
==
2
)
h
=
-
((
-
h
)
>>
desc
->
log2_chroma_h
);
h
=
AV_CEIL_RSHIFT
(
h
,
desc
->
log2_chroma_h
);
frame
->
buf
[
i
]
=
av_buffer_alloc
(
frame
->
linesize
[
i
]
*
h
);
if
(
!
frame
->
buf
[
i
])
...
...
libavutil/imgutils.c
浏览文件 @
e8bc6422
...
...
@@ -291,7 +291,7 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
int
h
=
height
;
int
bwidth
=
av_image_get_linesize
(
pix_fmt
,
width
,
i
);
if
(
i
==
1
||
i
==
2
)
{
h
=
-
((
-
height
)
>>
desc
->
log2_chroma_h
);
h
=
AV_CEIL_RSHIFT
(
height
,
desc
->
log2_chroma_h
);
}
av_image_copy_plane
(
dst_data
[
i
],
dst_linesizes
[
i
],
src_data
[
i
],
src_linesizes
[
i
],
...
...
libavutil/version.h
浏览文件 @
e8bc6422
...
...
@@ -54,7 +54,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 55
#define LIBAVUTIL_VERSION_MINOR
4
#define LIBAVUTIL_VERSION_MINOR
5
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...
...
libswscale/rgb2rgb_template.c
浏览文件 @
e8bc6422
...
...
@@ -856,7 +856,7 @@ static void yuyvtoyuv420_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
int
lumStride
,
int
chromStride
,
int
srcStride
)
{
int
y
;
const
int
chromWidth
=
-
((
-
width
)
>>
1
);
const
int
chromWidth
=
AV_CEIL_RSHIFT
(
width
,
1
);
for
(
y
=
0
;
y
<
height
;
y
++
)
{
extract_even_c
(
src
,
ydst
,
width
);
...
...
@@ -876,7 +876,7 @@ static void yuyvtoyuv422_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
int
lumStride
,
int
chromStride
,
int
srcStride
)
{
int
y
;
const
int
chromWidth
=
-
((
-
width
)
>>
1
);
const
int
chromWidth
=
AV_CEIL_RSHIFT
(
width
,
1
);
for
(
y
=
0
;
y
<
height
;
y
++
)
{
extract_even_c
(
src
,
ydst
,
width
);
...
...
@@ -894,7 +894,7 @@ static void uyvytoyuv420_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
int
lumStride
,
int
chromStride
,
int
srcStride
)
{
int
y
;
const
int
chromWidth
=
-
((
-
width
)
>>
1
);
const
int
chromWidth
=
AV_CEIL_RSHIFT
(
width
,
1
);
for
(
y
=
0
;
y
<
height
;
y
++
)
{
extract_even_c
(
src
+
1
,
ydst
,
width
);
...
...
@@ -914,7 +914,7 @@ static void uyvytoyuv422_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
int
lumStride
,
int
chromStride
,
int
srcStride
)
{
int
y
;
const
int
chromWidth
=
-
((
-
width
)
>>
1
);
const
int
chromWidth
=
AV_CEIL_RSHIFT
(
width
,
1
);
for
(
y
=
0
;
y
<
height
;
y
++
)
{
extract_even_c
(
src
+
1
,
ydst
,
width
);
...
...
libswscale/swscale.c
浏览文件 @
e8bc6422
...
...
@@ -384,8 +384,8 @@ static int swscale(SwsContext *c, const uint8_t *src[],
yuv2packed2_fn
yuv2packed2
=
c
->
yuv2packed2
;
yuv2packedX_fn
yuv2packedX
=
c
->
yuv2packedX
;
yuv2anyX_fn
yuv2anyX
=
c
->
yuv2anyX
;
const
int
chrSrcSliceY
=
srcSliceY
>>
c
->
chrSrcVSubSample
;
const
int
chrSrcSliceH
=
-
((
-
srcSliceH
)
>>
c
->
chrSrcVSubSample
);
const
int
chrSrcSliceY
=
srcSliceY
>>
c
->
chrSrcVSubSample
;
const
int
chrSrcSliceH
=
AV_CEIL_RSHIFT
(
srcSliceH
,
c
->
chrSrcVSubSample
);
int
should_dither
=
is9_OR_10BPS
(
c
->
srcFormat
)
||
is16BPS
(
c
->
srcFormat
);
int
lastDstY
;
...
...
@@ -484,7 +484,7 @@ static int swscale(SwsContext *c, const uint8_t *src[],
// Do we have enough lines in this slice to output the dstY line
enough_lines
=
lastLumSrcY2
<
srcSliceY
+
srcSliceH
&&
lastChrSrcY
<
-
((
-
srcSliceY
-
srcSliceH
)
>>
c
->
chrSrcVSubSample
);
lastChrSrcY
<
AV_CEIL_RSHIFT
(
srcSliceY
+
srcSliceH
,
c
->
chrSrcVSubSample
);
if
(
!
enough_lines
)
{
lastLumSrcY
=
srcSliceY
+
srcSliceH
-
1
;
...
...
libswscale/swscale_unscaled.c
浏览文件 @
e8bc6422
...
...
@@ -798,9 +798,9 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[],
const
AVPixFmtDescriptor
*
desc_dst
=
av_pix_fmt_desc_get
(
c
->
dstFormat
);
int
plane
,
i
,
j
;
for
(
plane
=
0
;
plane
<
4
;
plane
++
)
{
int
length
=
(
plane
==
0
||
plane
==
3
)
?
c
->
srcW
:
-
((
-
c
->
srcW
)
>>
c
->
chrDstHSubSample
);
int
y
=
(
plane
==
0
||
plane
==
3
)
?
srcSliceY
:
-
((
-
srcSliceY
)
>>
c
->
chrDstVSubSample
);
int
height
=
(
plane
==
0
||
plane
==
3
)
?
srcSliceH
:
-
((
-
srcSliceH
)
>>
c
->
chrDstVSubSample
);
int
length
=
(
plane
==
0
||
plane
==
3
)
?
c
->
srcW
:
AV_CEIL_RSHIFT
(
c
->
srcW
,
c
->
chrDstHSubSample
);
int
y
=
(
plane
==
0
||
plane
==
3
)
?
srcSliceY
:
AV_CEIL_RSHIFT
(
srcSliceY
,
c
->
chrDstVSubSample
);
int
height
=
(
plane
==
0
||
plane
==
3
)
?
srcSliceH
:
AV_CEIL_RSHIFT
(
srcSliceH
,
c
->
chrDstVSubSample
);
const
uint8_t
*
srcPtr
=
src
[
plane
];
uint8_t
*
dstPtr
=
dst
[
plane
]
+
dstStride
[
plane
]
*
y
;
int
shiftonly
=
plane
==
1
||
plane
==
2
||
(
!
c
->
srcRange
&&
plane
==
0
);
...
...
libswscale/utils.c
浏览文件 @
e8bc6422
...
...
@@ -1019,11 +1019,11 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
(
flags
&
SWS_FAST_BILINEAR
)))
c
->
chrSrcHSubSample
=
1
;
// Note the
-((-x)>>y)
is so that we always round toward +inf.
c
->
chrSrcW
=
-
((
-
srcW
)
>>
c
->
chrSrcHSubSample
);
c
->
chrSrcH
=
-
((
-
srcH
)
>>
c
->
chrSrcVSubSample
);
c
->
chrDstW
=
-
((
-
dstW
)
>>
c
->
chrDstHSubSample
);
c
->
chrDstH
=
-
((
-
dstH
)
>>
c
->
chrDstVSubSample
);
// Note the
AV_CEIL_RSHIFT
is so that we always round toward +inf.
c
->
chrSrcW
=
AV_CEIL_RSHIFT
(
srcW
,
c
->
chrSrcHSubSample
);
c
->
chrSrcH
=
AV_CEIL_RSHIFT
(
srcH
,
c
->
chrSrcVSubSample
);
c
->
chrDstW
=
AV_CEIL_RSHIFT
(
dstW
,
c
->
chrDstHSubSample
);
c
->
chrDstH
=
AV_CEIL_RSHIFT
(
dstH
,
c
->
chrDstVSubSample
);
/* unscaled special cases */
if
(
unscaled
&&
!
usesHFilter
&&
!
usesVFilter
&&
...
...
libswscale/x86/rgb2rgb_template.c
浏览文件 @
e8bc6422
...
...
@@ -2397,7 +2397,7 @@ static void RENAME(yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co
int
lumStride
,
int
chromStride
,
int
srcStride
)
{
int
y
;
const
int
chromWidth
=
-
((
-
width
)
>>
1
);
const
int
chromWidth
=
AV_CEIL_RSHIFT
(
width
,
1
);
for
(
y
=
0
;
y
<
height
;
y
++
)
{
RENAME
(
extract_even
)(
src
,
ydst
,
width
);
...
...
@@ -2423,7 +2423,7 @@ static void RENAME(yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co
int
lumStride
,
int
chromStride
,
int
srcStride
)
{
int
y
;
const
int
chromWidth
=
-
((
-
width
)
>>
1
);
const
int
chromWidth
=
AV_CEIL_RSHIFT
(
width
,
1
);
for
(
y
=
0
;
y
<
height
;
y
++
)
{
RENAME
(
extract_even
)(
src
,
ydst
,
width
);
...
...
@@ -2447,7 +2447,7 @@ static void RENAME(uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co
int
lumStride
,
int
chromStride
,
int
srcStride
)
{
int
y
;
const
int
chromWidth
=
-
((
-
width
)
>>
1
);
const
int
chromWidth
=
AV_CEIL_RSHIFT
(
width
,
1
);
for
(
y
=
0
;
y
<
height
;
y
++
)
{
RENAME
(
extract_even
)(
src
+
1
,
ydst
,
width
);
...
...
@@ -2473,7 +2473,7 @@ static void RENAME(uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co
int
lumStride
,
int
chromStride
,
int
srcStride
)
{
int
y
;
const
int
chromWidth
=
-
((
-
width
)
>>
1
);
const
int
chromWidth
=
AV_CEIL_RSHIFT
(
width
,
1
);
for
(
y
=
0
;
y
<
height
;
y
++
)
{
RENAME
(
extract_even
)(
src
+
1
,
ydst
,
width
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录