Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
f2651e7a
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,发现更多精彩内容 >>
提交
f2651e7a
编写于
3月 10, 2006
作者:
B
Baptiste Coudurier
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix cropping, depending on enc pix fmt
Originally committed as revision 5134 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
4c4a4e9a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
32 addition
and
14 deletion
+32
-14
ffmpeg.c
ffmpeg.c
+4
-14
libavcodec/avcodec.h
libavcodec/avcodec.h
+3
-0
libavcodec/imgconvert.c
libavcodec/imgconvert.c
+25
-0
未找到文件。
ffmpeg.c
浏览文件 @
f2651e7a
...
...
@@ -847,20 +847,10 @@ static void do_video_out(AVFormatContext *s,
}
}
}
else
if
(
ost
->
video_crop
)
{
picture_crop_temp
.
data
[
0
]
=
formatted_picture
->
data
[
0
]
+
(
ost
->
topBand
*
formatted_picture
->
linesize
[
0
])
+
ost
->
leftBand
;
picture_crop_temp
.
data
[
1
]
=
formatted_picture
->
data
[
1
]
+
((
ost
->
topBand
>>
1
)
*
formatted_picture
->
linesize
[
1
])
+
(
ost
->
leftBand
>>
1
);
picture_crop_temp
.
data
[
2
]
=
formatted_picture
->
data
[
2
]
+
((
ost
->
topBand
>>
1
)
*
formatted_picture
->
linesize
[
2
])
+
(
ost
->
leftBand
>>
1
);
picture_crop_temp
.
linesize
[
0
]
=
formatted_picture
->
linesize
[
0
];
picture_crop_temp
.
linesize
[
1
]
=
formatted_picture
->
linesize
[
1
];
picture_crop_temp
.
linesize
[
2
]
=
formatted_picture
->
linesize
[
2
];
if
(
img_crop
((
AVPicture
*
)
&
picture_crop_temp
,
(
AVPicture
*
)
formatted_picture
,
enc
->
pix_fmt
,
ost
->
topBand
,
ost
->
leftBand
)
<
0
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"error cropping picture
\n
"
);
goto
the_end
;
}
final_picture
=
&
picture_crop_temp
;
}
else
if
(
ost
->
video_pad
)
{
final_picture
=
&
ost
->
pict_tmp
;
...
...
libavcodec/avcodec.h
浏览文件 @
f2651e7a
...
...
@@ -2555,6 +2555,9 @@ int is_adx(const unsigned char *buf,size_t bufsize);
void
img_copy
(
AVPicture
*
dst
,
const
AVPicture
*
src
,
int
pix_fmt
,
int
width
,
int
height
);
int
img_crop
(
AVPicture
*
dst
,
const
AVPicture
*
src
,
int
pix_fmt
,
int
top_band
,
int
left_band
);
/* av_log API */
#include <stdarg.h>
...
...
libavcodec/imgconvert.c
浏览文件 @
f2651e7a
...
...
@@ -1951,6 +1951,31 @@ static inline int is_yuv_planar(PixFmtInfo *ps)
ps
->
pixel_type
==
FF_PIXEL_PLANAR
;
}
/**
* Crop image top and left side
*/
int
img_crop
(
AVPicture
*
dst
,
const
AVPicture
*
src
,
int
pix_fmt
,
int
top_band
,
int
left_band
)
{
int
y_shift
;
int
x_shift
;
if
(
pix_fmt
<
0
||
pix_fmt
>=
PIX_FMT_NB
||
!
is_yuv_planar
(
&
pix_fmt_info
[
pix_fmt
]))
return
-
1
;
y_shift
=
pix_fmt_info
[
pix_fmt
].
y_chroma_shift
;
x_shift
=
pix_fmt_info
[
pix_fmt
].
x_chroma_shift
;
dst
->
data
[
0
]
=
src
->
data
[
0
]
+
(
top_band
*
src
->
linesize
[
0
])
+
left_band
;
dst
->
data
[
1
]
=
src
->
data
[
1
]
+
((
top_band
>>
y_shift
)
*
src
->
linesize
[
1
])
+
(
left_band
>>
x_shift
);
dst
->
data
[
2
]
=
src
->
data
[
2
]
+
((
top_band
>>
y_shift
)
*
src
->
linesize
[
2
])
+
(
left_band
>>
x_shift
);
dst
->
linesize
[
0
]
=
src
->
linesize
[
0
];
dst
->
linesize
[
1
]
=
src
->
linesize
[
1
];
dst
->
linesize
[
2
]
=
src
->
linesize
[
2
];
return
0
;
}
/* XXX: always use linesize. Return -1 if not supported */
int
img_convert
(
AVPicture
*
dst
,
int
dst_pix_fmt
,
const
AVPicture
*
src
,
int
src_pix_fmt
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录