Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
1c910d2f
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,发现更多精彩内容 >>
提交
1c910d2f
编写于
1月 22, 2012
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sws: Fix RGB0->alpha containing formats.
Fixes Ticket869 Signed-off-by:
N
Michael Niedermayer
<
michaelni@gmx.at
>
上级
fa94f8a8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
40 addition
and
7 deletion
+40
-7
libswscale/swscale_internal.h
libswscale/swscale_internal.h
+2
-0
libswscale/swscale_unscaled.c
libswscale/swscale_unscaled.c
+21
-3
libswscale/utils.c
libswscale/utils.c
+17
-4
未找到文件。
libswscale/swscale_internal.h
浏览文件 @
1c910d2f
...
...
@@ -330,6 +330,8 @@ typedef struct SwsContext {
int
dstColorspaceTable
[
4
];
int
srcRange
;
///< 0 = MPG YUV range, 1 = JPG YUV range (source image).
int
dstRange
;
///< 0 = MPG YUV range, 1 = JPG YUV range (destination image).
int
src0Alpha
;
int
dst0Alpha
;
int
yuv2rgb_y_offset
;
int
yuv2rgb_y_coeff
;
int
yuv2rgb_v2r_coeff
;
...
...
libswscale/swscale_unscaled.c
浏览文件 @
1c910d2f
...
...
@@ -909,9 +909,10 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
int
srcSliceH
,
uint8_t
*
const
dst
[],
const
int
dstStride
[])
{
int
i
;
int
i
,
ret
;
const
uint8_t
*
src2
[
4
]
=
{
srcSlice
[
0
],
srcSlice
[
1
],
srcSlice
[
2
],
srcSlice
[
3
]
};
uint8_t
*
dst2
[
4
]
=
{
dst
[
0
],
dst
[
1
],
dst
[
2
],
dst
[
3
]
};
uint8_t
*
rgb0_tmp
=
NULL
;
// do not mess up sliceDir if we have a "trailing" 0-size slice
if
(
srcSliceH
==
0
)
...
...
@@ -997,6 +998,20 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
}
}
if
(
c
->
src0Alpha
&&
!
c
->
dst0Alpha
&&
isALPHA
(
c
->
dstFormat
))
{
uint8_t
*
base
;
int
x
,
y
;
rgb0_tmp
=
av_malloc
(
FFABS
(
srcStride
[
0
])
*
srcSliceH
+
32
);
base
=
srcStride
[
0
]
<
0
?
rgb0_tmp
-
srcStride
[
0
]
*
(
srcSliceH
-
1
)
:
rgb0_tmp
;
for
(
y
=
0
;
y
<
srcSliceH
;
y
++
){
memcpy
(
base
+
srcStride
[
0
]
*
y
,
src2
[
0
]
+
srcStride
[
0
]
*
y
,
4
*
c
->
srcW
);
for
(
x
=
c
->
src0Alpha
-
1
;
x
<
4
*
c
->
srcW
;
x
+=
4
)
{
base
[
srcStride
[
0
]
*
y
+
x
]
=
0xFF
;
}
}
src2
[
0
]
=
base
;
}
// copy strides, so they can safely be modified
if
(
c
->
sliceDir
==
1
)
{
// slices go from top to bottom
...
...
@@ -1012,7 +1027,7 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
if
(
srcSliceY
+
srcSliceH
==
c
->
srcH
)
c
->
sliceDir
=
0
;
ret
urn
c
->
swScale
(
c
,
src2
,
srcStride2
,
srcSliceY
,
srcSliceH
,
dst2
,
ret
=
c
->
swScale
(
c
,
src2
,
srcStride2
,
srcSliceY
,
srcSliceH
,
dst2
,
dstStride2
);
}
else
{
// slices go from bottom to top => we flip the image internally
...
...
@@ -1038,9 +1053,12 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
if
(
!
srcSliceY
)
c
->
sliceDir
=
0
;
ret
urn
c
->
swScale
(
c
,
src2
,
srcStride2
,
c
->
srcH
-
srcSliceY
-
srcSliceH
,
ret
=
c
->
swScale
(
c
,
src2
,
srcStride2
,
c
->
srcH
-
srcSliceY
-
srcSliceH
,
srcSliceH
,
dst2
,
dstStride2
);
}
av_free
(
rgb0_tmp
);
return
ret
;
}
/* Convert the palette to the same packed 32-bit format as the palette */
...
...
libswscale/utils.c
浏览文件 @
1c910d2f
...
...
@@ -748,10 +748,17 @@ static int handle_jpeg(enum PixelFormat *format)
case
PIX_FMT_YUVJ422P
:
*
format
=
PIX_FMT_YUV422P
;
return
1
;
case
PIX_FMT_YUVJ444P
:
*
format
=
PIX_FMT_YUV444P
;
return
1
;
case
PIX_FMT_YUVJ440P
:
*
format
=
PIX_FMT_YUV440P
;
return
1
;
case
PIX_FMT_0BGR
:
*
format
=
PIX_FMT_ABGR
;
return
0
;
case
PIX_FMT_BGR0
:
*
format
=
PIX_FMT_BGRA
;
return
0
;
case
PIX_FMT_0RGB
:
*
format
=
PIX_FMT_ARGB
;
return
0
;
case
PIX_FMT_RGB0
:
*
format
=
PIX_FMT_RGBA
;
return
0
;
default:
return
0
;
}
}
static
int
handle_0alpha
(
enum
PixelFormat
*
format
)
{
switch
(
*
format
)
{
case
PIX_FMT_0BGR
:
*
format
=
PIX_FMT_ABGR
;
return
1
;
case
PIX_FMT_BGR0
:
*
format
=
PIX_FMT_BGRA
;
return
4
;
case
PIX_FMT_0RGB
:
*
format
=
PIX_FMT_ARGB
;
return
1
;
case
PIX_FMT_RGB0
:
*
format
=
PIX_FMT_RGBA
;
return
4
;
default:
return
0
;
}
}
...
...
@@ -790,6 +797,8 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
handle_jpeg
(
&
srcFormat
);
handle_jpeg
(
&
dstFormat
);
handle_0alpha
(
&
srcFormat
);
handle_0alpha
(
&
dstFormat
);
if
(
srcFormat
!=
c
->
srcFormat
||
dstFormat
!=
c
->
dstFormat
){
av_log
(
c
,
AV_LOG_WARNING
,
"deprecated pixel format used, make sure you did set range correctly
\n
"
);
...
...
@@ -1147,6 +1156,8 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
c
->
dstH
=
dstH
;
c
->
srcRange
=
handle_jpeg
(
&
srcFormat
);
c
->
dstRange
=
handle_jpeg
(
&
dstFormat
);
c
->
src0Alpha
=
handle_0alpha
(
&
srcFormat
);
c
->
dst0Alpha
=
handle_0alpha
(
&
dstFormat
);
c
->
srcFormat
=
srcFormat
;
c
->
dstFormat
=
dstFormat
;
...
...
@@ -1545,10 +1556,12 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context,
context
->
srcW
=
srcW
;
context
->
srcH
=
srcH
;
context
->
srcRange
=
handle_jpeg
(
&
srcFormat
);
context
->
src0Alpha
=
handle_0alpha
(
&
srcFormat
);
context
->
srcFormat
=
srcFormat
;
context
->
dstW
=
dstW
;
context
->
dstH
=
dstH
;
context
->
dstRange
=
handle_jpeg
(
&
dstFormat
);
context
->
dst0Alpha
=
handle_0alpha
(
&
dstFormat
);
context
->
dstFormat
=
dstFormat
;
context
->
flags
=
flags
;
context
->
param
[
0
]
=
param
[
0
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录