Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
404410a5
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,发现更多精彩内容 >>
提交
404410a5
编写于
5月 12, 2012
作者:
R
Ronald S. Bultje
提交者:
Anton Khirnov
6月 12, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sws: fix planar RGB input conversions for 9/10/16 bpp.
Fixes bug 282. Signed-off-by:
N
Anton Khirnov
<
anton@khirnov.net
>
上级
65a80ee1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
97 addition
and
41 deletion
+97
-41
libswscale/input.c
libswscale/input.c
+97
-41
未找到文件。
libswscale/input.c
浏览文件 @
404410a5
...
...
@@ -553,80 +553,120 @@ static void planar_rgb_to_y(uint8_t *dst, const uint8_t *src[4], int width)
}
}
static
void
planar_rgb
16le_to_y
(
uint8_t
*
_dst
,
const
uint8_t
*
_
src
[
4
],
int
width
)
static
void
planar_rgb
_to_uv
(
uint8_t
*
dstU
,
uint8_t
*
dstV
,
const
uint8_t
*
src
[
4
],
int
width
)
{
int
i
;
const
uint16_t
**
src
=
(
const
uint16_t
**
)
_src
;
uint16_t
*
dst
=
(
uint16_t
*
)
_dst
;
for
(
i
=
0
;
i
<
width
;
i
++
)
{
int
g
=
AV_RL16
(
src
[
0
]
+
i
)
;
int
b
=
AV_RL16
(
src
[
1
]
+
i
)
;
int
r
=
AV_RL16
(
src
[
2
]
+
i
)
;
int
g
=
src
[
0
][
i
]
;
int
b
=
src
[
1
][
i
]
;
int
r
=
src
[
2
][
i
]
;
dst
[
i
]
=
((
RY
*
r
+
GY
*
g
+
BY
*
b
+
(
33
<<
(
RGB2YUV_SHIFT
-
1
)))
>>
RGB2YUV_SHIFT
);
dstU
[
i
]
=
(
RU
*
r
+
GU
*
g
+
BU
*
b
+
(
257
<<
(
RGB2YUV_SHIFT
-
1
)))
>>
RGB2YUV_SHIFT
;
dstV
[
i
]
=
(
RV
*
r
+
GV
*
g
+
BV
*
b
+
(
257
<<
(
RGB2YUV_SHIFT
-
1
)))
>>
RGB2YUV_SHIFT
;
}
}
static
void
planar_rgb16be_to_y
(
uint8_t
*
_dst
,
const
uint8_t
*
_src
[
4
],
int
width
)
#define rdpx(src) \
is_be ? AV_RB16(src) : AV_RL16(src)
static
av_always_inline
void
planar_rgb16_to_y
(
uint8_t
*
_dst
,
const
uint8_t
*
_src
[
4
],
int
width
,
int
bpc
,
int
is_be
)
{
int
i
;
const
uint16_t
**
src
=
(
const
uint16_t
**
)
_src
;
uint16_t
*
dst
=
(
uint16_t
*
)
_dst
;
for
(
i
=
0
;
i
<
width
;
i
++
)
{
int
g
=
AV_RB16
(
src
[
0
]
+
i
);
int
b
=
AV_RB16
(
src
[
1
]
+
i
);
int
r
=
AV_RB16
(
src
[
2
]
+
i
);
int
g
=
rdpx
(
src
[
0
]
+
i
);
int
b
=
rdpx
(
src
[
1
]
+
i
);
int
r
=
rdpx
(
src
[
2
]
+
i
);
dst
[
i
]
=
((
RY
*
r
+
GY
*
g
+
BY
*
b
+
(
33
<<
(
RGB2YUV_SHIFT
-
1
)))
>>
RGB2YUV_SHIFT
);
dst
[
i
]
=
((
RY
*
r
+
GY
*
g
+
BY
*
b
+
(
33
<<
(
RGB2YUV_SHIFT
+
bpc
-
9
)))
>>
RGB2YUV_SHIFT
);
}
}
static
void
planar_rgb
_to_uv
(
uint8_t
*
dstU
,
uint8_t
*
dstV
,
const
uint8_t
*
src
[
4
],
int
width
)
static
void
planar_rgb
9le_to_y
(
uint8_t
*
dst
,
const
uint8_t
*
src
[
4
],
int
w
)
{
int
i
;
for
(
i
=
0
;
i
<
width
;
i
++
)
{
int
g
=
src
[
0
][
i
];
int
b
=
src
[
1
][
i
];
int
r
=
src
[
2
][
i
];
planar_rgb16_to_y
(
dst
,
src
,
w
,
9
,
0
);
}
dstU
[
i
]
=
(
RU
*
r
+
GU
*
g
+
BU
*
b
+
(
257
<<
RGB2YUV_SHIFT
))
>>
(
RGB2YUV_SHIFT
+
1
);
dstV
[
i
]
=
(
RV
*
r
+
GV
*
g
+
BV
*
b
+
(
257
<<
RGB2YUV_SHIFT
))
>>
(
RGB2YUV_SHIFT
+
1
);
}
static
void
planar_rgb9be_to_y
(
uint8_t
*
dst
,
const
uint8_t
*
src
[
4
],
int
w
)
{
planar_rgb16_to_y
(
dst
,
src
,
w
,
9
,
1
);
}
static
void
planar_rgb16le_to_uv
(
uint8_t
*
_dstU
,
uint8_t
*
_dstV
,
const
uint8_t
*
_src
[
4
],
int
width
)
static
void
planar_rgb10le_to_y
(
uint8_t
*
dst
,
const
uint8_t
*
src
[
4
],
int
w
)
{
int
i
;
const
uint16_t
**
src
=
(
const
uint16_t
**
)
_src
;
uint16_t
*
dstU
=
(
uint16_t
*
)
_dstU
;
uint16_t
*
dstV
=
(
uint16_t
*
)
_dstV
;
for
(
i
=
0
;
i
<
width
;
i
++
)
{
int
g
=
AV_RL16
(
src
[
0
]
+
i
);
int
b
=
AV_RL16
(
src
[
1
]
+
i
);
int
r
=
AV_RL16
(
src
[
2
]
+
i
);
planar_rgb16_to_y
(
dst
,
src
,
w
,
10
,
0
);
}
dstU
[
i
]
=
(
RU
*
r
+
GU
*
g
+
BU
*
b
+
(
257
<<
RGB2YUV_SHIFT
))
>>
(
RGB2YUV_SHIFT
+
1
);
dstV
[
i
]
=
(
RV
*
r
+
GV
*
g
+
BV
*
b
+
(
257
<<
RGB2YUV_SHIFT
))
>>
(
RGB2YUV_SHIFT
+
1
);
}
static
void
planar_rgb10be_to_y
(
uint8_t
*
dst
,
const
uint8_t
*
src
[
4
],
int
w
)
{
planar_rgb16_to_y
(
dst
,
src
,
w
,
10
,
1
);
}
static
void
planar_rgb16be_to_uv
(
uint8_t
*
_dstU
,
uint8_t
*
_dstV
,
const
uint8_t
*
_src
[
4
],
int
width
)
static
void
planar_rgb16le_to_y
(
uint8_t
*
dst
,
const
uint8_t
*
src
[
4
],
int
w
)
{
planar_rgb16_to_y
(
dst
,
src
,
w
,
16
,
0
);
}
static
void
planar_rgb16be_to_y
(
uint8_t
*
dst
,
const
uint8_t
*
src
[
4
],
int
w
)
{
planar_rgb16_to_y
(
dst
,
src
,
w
,
16
,
1
);
}
static
av_always_inline
void
planar_rgb16_to_uv
(
uint8_t
*
_dstU
,
uint8_t
*
_dstV
,
const
uint8_t
*
_src
[
4
],
int
width
,
int
bpc
,
int
is_be
)
{
int
i
;
const
uint16_t
**
src
=
(
const
uint16_t
**
)
_src
;
uint16_t
*
dstU
=
(
uint16_t
*
)
_dstU
;
uint16_t
*
dstV
=
(
uint16_t
*
)
_dstV
;
for
(
i
=
0
;
i
<
width
;
i
++
)
{
int
g
=
AV_RB16
(
src
[
0
]
+
i
);
int
b
=
AV_RB16
(
src
[
1
]
+
i
);
int
r
=
AV_RB16
(
src
[
2
]
+
i
);
int
g
=
rdpx
(
src
[
0
]
+
i
);
int
b
=
rdpx
(
src
[
1
]
+
i
);
int
r
=
rdpx
(
src
[
2
]
+
i
);
dstU
[
i
]
=
(
RU
*
r
+
GU
*
g
+
BU
*
b
+
(
257
<<
RGB2YUV_SHIFT
))
>>
(
RGB2YUV_SHIFT
+
1
)
;
dstV
[
i
]
=
(
RV
*
r
+
GV
*
g
+
BV
*
b
+
(
257
<<
RGB2YUV_SHIFT
))
>>
(
RGB2YUV_SHIFT
+
1
)
;
dstU
[
i
]
=
(
RU
*
r
+
GU
*
g
+
BU
*
b
+
(
257
<<
(
RGB2YUV_SHIFT
+
bpc
-
9
)))
>>
RGB2YUV_SHIFT
;
dstV
[
i
]
=
(
RV
*
r
+
GV
*
g
+
BV
*
b
+
(
257
<<
(
RGB2YUV_SHIFT
+
bpc
-
9
)))
>>
RGB2YUV_SHIFT
;
}
}
#undef rdpx
static
void
planar_rgb9le_to_uv
(
uint8_t
*
dstU
,
uint8_t
*
dstV
,
const
uint8_t
*
src
[
4
],
int
w
)
{
planar_rgb16_to_uv
(
dstU
,
dstV
,
src
,
w
,
9
,
0
);
}
static
void
planar_rgb9be_to_uv
(
uint8_t
*
dstU
,
uint8_t
*
dstV
,
const
uint8_t
*
src
[
4
],
int
w
)
{
planar_rgb16_to_uv
(
dstU
,
dstV
,
src
,
w
,
9
,
1
);
}
static
void
planar_rgb10le_to_uv
(
uint8_t
*
dstU
,
uint8_t
*
dstV
,
const
uint8_t
*
src
[
4
],
int
w
)
{
planar_rgb16_to_uv
(
dstU
,
dstV
,
src
,
w
,
10
,
0
);
}
static
void
planar_rgb10be_to_uv
(
uint8_t
*
dstU
,
uint8_t
*
dstV
,
const
uint8_t
*
src
[
4
],
int
w
)
{
planar_rgb16_to_uv
(
dstU
,
dstV
,
src
,
w
,
10
,
1
);
}
static
void
planar_rgb16le_to_uv
(
uint8_t
*
dstU
,
uint8_t
*
dstV
,
const
uint8_t
*
src
[
4
],
int
w
)
{
planar_rgb16_to_uv
(
dstU
,
dstV
,
src
,
w
,
16
,
0
);
}
static
void
planar_rgb16be_to_uv
(
uint8_t
*
dstU
,
uint8_t
*
dstV
,
const
uint8_t
*
src
[
4
],
int
w
)
{
planar_rgb16_to_uv
(
dstU
,
dstV
,
src
,
w
,
16
,
1
);
}
av_cold
void
ff_sws_init_input_funcs
(
SwsContext
*
c
)
{
...
...
@@ -654,12 +694,20 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
c
->
chrToYV12
=
palToUV_c
;
break
;
case
PIX_FMT_GBRP9LE
:
c
->
readChrPlanar
=
planar_rgb9le_to_uv
;
break
;
case
PIX_FMT_GBRP10LE
:
c
->
readChrPlanar
=
planar_rgb10le_to_uv
;
break
;
case
PIX_FMT_GBRP16LE
:
c
->
readChrPlanar
=
planar_rgb16le_to_uv
;
break
;
case
PIX_FMT_GBRP9BE
:
c
->
readChrPlanar
=
planar_rgb9be_to_uv
;
break
;
case
PIX_FMT_GBRP10BE
:
c
->
readChrPlanar
=
planar_rgb10be_to_uv
;
break
;
case
PIX_FMT_GBRP16BE
:
c
->
readChrPlanar
=
planar_rgb16be_to_uv
;
break
;
...
...
@@ -836,12 +884,20 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
c
->
alpToYV12
=
NULL
;
switch
(
srcFormat
)
{
case
PIX_FMT_GBRP9LE
:
c
->
readLumPlanar
=
planar_rgb9le_to_y
;
break
;
case
PIX_FMT_GBRP10LE
:
c
->
readLumPlanar
=
planar_rgb10le_to_y
;
break
;
case
PIX_FMT_GBRP16LE
:
c
->
readLumPlanar
=
planar_rgb16le_to_y
;
break
;
case
PIX_FMT_GBRP9BE
:
c
->
readLumPlanar
=
planar_rgb9be_to_y
;
break
;
case
PIX_FMT_GBRP10BE
:
c
->
readLumPlanar
=
planar_rgb10be_to_y
;
break
;
case
PIX_FMT_GBRP16BE
:
c
->
readLumPlanar
=
planar_rgb16be_to_y
;
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录