Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
895b6161
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,发现更多精彩内容 >>
提交
895b6161
编写于
5月 24, 2011
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
swscale: dont loose bits on planar >8bit yuv ind gray nput.
Signed-off-by:
N
Michael Niedermayer
<
michaelni@gmx.at
>
上级
8050dfdf
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
65 addition
and
37 deletion
+65
-37
libswscale/swscale.c
libswscale/swscale.c
+1
-0
libswscale/swscale_internal.h
libswscale/swscale_internal.h
+4
-0
libswscale/swscale_template.c
libswscale/swscale_template.c
+46
-23
libswscale/utils.c
libswscale/utils.c
+1
-1
tests/ref/lavfi/pixfmts_scale_le
tests/ref/lavfi/pixfmts_scale_le
+13
-13
未找到文件。
libswscale/swscale.c
浏览文件 @
895b6161
...
...
@@ -60,6 +60,7 @@ untested special converters
#include "swscale.h"
#include "swscale_internal.h"
#include "rgb2rgb.h"
#include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/x86_cpu.h"
#include "libavutil/avutil.h"
...
...
libswscale/swscale_internal.h
浏览文件 @
895b6161
...
...
@@ -303,6 +303,10 @@ typedef struct SwsContext {
int
xInc
,
const
int16_t
*
filter
,
const
int16_t
*
filterPos
,
long
filterSize
);
void
(
*
hScale16
)(
int16_t
*
dst
,
int
dstW
,
const
uint16_t
*
src
,
int
srcW
,
int
xInc
,
const
int16_t
*
filter
,
const
int16_t
*
filterPos
,
long
filterSize
,
int
shift
);
void
(
*
lumConvertRange
)(
int16_t
*
dst
,
int
width
);
///< Color range conversion function for luma plane if needed.
void
(
*
chrConvertRange
)(
int16_t
*
dst
,
int
width
);
///< Color range conversion function for chroma planes if needed.
...
...
libswscale/swscale_template.c
浏览文件 @
895b6161
...
...
@@ -2242,6 +2242,34 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, in
#endif
/* COMPILE_MMX */
}
static
inline
void
RENAME
(
hScale16
)(
int16_t
*
dst
,
int
dstW
,
const
uint16_t
*
src
,
int
srcW
,
int
xInc
,
const
int16_t
*
filter
,
const
int16_t
*
filterPos
,
long
filterSize
,
int
shift
)
{
int
i
,
j
;
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
int
srcPos
=
filterPos
[
i
];
int
val
=
0
;
for
(
j
=
0
;
j
<
filterSize
;
j
++
)
{
val
+=
((
int
)
src
[
srcPos
+
j
])
*
filter
[
filterSize
*
i
+
j
];
}
dst
[
i
]
=
FFMIN
(
val
>>
shift
,
(
1
<<
15
)
-
1
);
// the cubic equation does overflow ...
}
}
static
inline
void
RENAME
(
hScale16X
)(
int16_t
*
dst
,
int
dstW
,
const
uint16_t
*
src
,
int
srcW
,
int
xInc
,
const
int16_t
*
filter
,
const
int16_t
*
filterPos
,
long
filterSize
,
int
shift
)
{
int
i
,
j
;
for
(
i
=
0
;
i
<
dstW
;
i
++
)
{
int
srcPos
=
filterPos
[
i
];
int
val
=
0
;
for
(
j
=
0
;
j
<
filterSize
;
j
++
)
{
val
+=
((
int
)
av_bswap16
(
src
[
srcPos
+
j
]))
*
filter
[
filterSize
*
i
+
j
];
}
dst
[
i
]
=
FFMIN
(
val
>>
shift
,
(
1
<<
15
)
-
1
);
// the cubic equation does overflow ...
}
}
//FIXME all pal and rgb srcFormats could do this convertion as well
//FIXME all scalers more complex than bilinear could do half of this transform
static
void
RENAME
(
chrRangeToJpeg
)(
int16_t
*
dst
,
int
width
)
...
...
@@ -2421,7 +2449,9 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth,
src
=
formatConvBuffer
;
}
if
(
!
c
->
hyscale_fast
)
{
if
(
c
->
hScale16
)
{
c
->
hScale16
(
dst
,
dstWidth
,
(
uint16_t
*
)
src
,
srcW
,
xInc
,
hLumFilter
,
hLumFilterPos
,
hLumFilterSize
,
av_pix_fmt_descriptors
[
c
->
srcFormat
].
comp
[
0
].
depth_minus1
);
}
else
if
(
!
c
->
hyscale_fast
)
{
c
->
hScale
(
dst
,
dstWidth
,
src
,
srcW
,
xInc
,
hLumFilter
,
hLumFilterPos
,
hLumFilterSize
);
}
else
{
// fast bilinear upscale / crap downscale
c
->
hyscale_fast
(
c
,
dst
,
dstWidth
,
src
,
srcW
,
xInc
);
...
...
@@ -2569,7 +2599,10 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth,
src2
=
formatConvBuffer
+
VOFW
;
}
if
(
!
c
->
hcscale_fast
)
{
if
(
c
->
hScale16
)
{
c
->
hScale16
(
dst
,
dstWidth
,
(
uint16_t
*
)
src1
,
srcW
,
xInc
,
hChrFilter
,
hChrFilterPos
,
hChrFilterSize
,
av_pix_fmt_descriptors
[
c
->
srcFormat
].
comp
[
0
].
depth_minus1
);
c
->
hScale16
(
dst
+
VOFW
,
dstWidth
,
(
uint16_t
*
)
src2
,
srcW
,
xInc
,
hChrFilter
,
hChrFilterPos
,
hChrFilterSize
,
av_pix_fmt_descriptors
[
c
->
srcFormat
].
comp
[
0
].
depth_minus1
);
}
else
if
(
!
c
->
hcscale_fast
)
{
c
->
hScale
(
dst
,
dstWidth
,
src1
,
srcW
,
xInc
,
hChrFilter
,
hChrFilterPos
,
hChrFilterSize
);
c
->
hScale
(
dst
+
VOFW
,
dstWidth
,
src2
,
srcW
,
xInc
,
hChrFilter
,
hChrFilterPos
,
hChrFilterSize
);
}
else
{
// fast bilinear upscale / crap downscale
...
...
@@ -2984,18 +3017,20 @@ static void RENAME(sws_init_swScale)(SwsContext *c)
case
PIX_FMT_PAL8
:
case
PIX_FMT_BGR4_BYTE
:
case
PIX_FMT_RGB4_BYTE
:
c
->
chrToYV12
=
palToUV
;
break
;
case
PIX_FMT_
YUV420P9BE
:
c
->
chrToYV12
=
BE9ToUV_c
;
break
;
case
PIX_FMT_YUV420P9
LE
:
c
->
chrToYV12
=
LE9ToUV_c
;
break
;
case
PIX_FMT_
GRAY16BE
:
case
PIX_FMT_YUV420P9
BE
:
case
PIX_FMT_YUV422P10BE
:
case
PIX_FMT_YUV420P10BE
:
c
->
chrToYV12
=
BE10ToUV_c
;
break
;
case
PIX_FMT_YUV422P10LE
:
case
PIX_FMT_YUV420P10LE
:
c
->
chrToYV12
=
LE10ToUV_c
;
break
;
case
PIX_FMT_YUV420P10BE
:
case
PIX_FMT_YUV420P16BE
:
case
PIX_FMT_YUV422P16BE
:
case
PIX_FMT_YUV444P16BE
:
c
->
chrToYV12
=
RENAME
(
BEToUV
);
break
;
case
PIX_FMT_YUV444P16BE
:
c
->
hScale16
=
HAVE_BIGENDIAN
?
RENAME
(
hScale16
)
:
RENAME
(
hScale16X
);
break
;
case
PIX_FMT_GRAY16LE
:
case
PIX_FMT_YUV420P9LE
:
case
PIX_FMT_YUV422P10LE
:
case
PIX_FMT_YUV420P10LE
:
case
PIX_FMT_YUV420P16LE
:
case
PIX_FMT_YUV422P16LE
:
case
PIX_FMT_YUV444P16LE
:
c
->
chrToYV12
=
RENAME
(
LEToUV
);
break
;
case
PIX_FMT_YUV444P16LE
:
c
->
hScale16
=
HAVE_BIGENDIAN
?
RENAME
(
hScale16X
)
:
RENAME
(
hScale16
);
break
;
}
if
(
c
->
chrSrcHSubSample
)
{
switch
(
srcFormat
)
{
...
...
@@ -3036,23 +3071,11 @@ static void RENAME(sws_init_swScale)(SwsContext *c)
c
->
lumToYV12
=
NULL
;
c
->
alpToYV12
=
NULL
;
switch
(
srcFormat
)
{
case
PIX_FMT_YUV420P9BE
:
c
->
lumToYV12
=
BE9ToY_c
;
break
;
case
PIX_FMT_YUV420P9LE
:
c
->
lumToYV12
=
LE9ToY_c
;
break
;
case
PIX_FMT_YUV422P10BE
:
case
PIX_FMT_YUV420P10BE
:
c
->
lumToYV12
=
BE10ToY_c
;
break
;
case
PIX_FMT_YUV422P10LE
:
case
PIX_FMT_YUV420P10LE
:
c
->
lumToYV12
=
LE10ToY_c
;
break
;
case
PIX_FMT_YUYV422
:
case
PIX_FMT_YUV420P16BE
:
case
PIX_FMT_YUV422P16BE
:
case
PIX_FMT_YUV444P16BE
:
case
PIX_FMT_GRAY8A
:
case
PIX_FMT_GRAY16BE
:
c
->
lumToYV12
=
RENAME
(
yuy2ToY
);
break
;
c
->
lumToYV12
=
RENAME
(
yuy2ToY
);
break
;
case
PIX_FMT_UYVY422
:
case
PIX_FMT_YUV420P16LE
:
case
PIX_FMT_YUV422P16LE
:
case
PIX_FMT_YUV444P16LE
:
case
PIX_FMT_GRAY16LE
:
c
->
lumToYV12
=
RENAME
(
uyvyToY
);
break
;
c
->
lumToYV12
=
RENAME
(
uyvyToY
);
break
;
case
PIX_FMT_BGR24
:
c
->
lumToYV12
=
RENAME
(
bgr24ToY
);
break
;
case
PIX_FMT_BGR565
:
c
->
lumToYV12
=
bgr16ToY
;
break
;
case
PIX_FMT_BGR555
:
c
->
lumToYV12
=
bgr15ToY
;
break
;
...
...
libswscale/utils.c
浏览文件 @
895b6161
...
...
@@ -890,7 +890,7 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
if
(
flags
&
SWS_PRINT_INFO
)
av_log
(
c
,
AV_LOG_INFO
,
"output width is not a multiple of 32 -> no MMX2 scaler
\n
"
);
}
if
(
usesHFilter
)
c
->
canMMX2BeUsed
=
0
;
if
(
usesHFilter
||
isNBPS
(
c
->
srcFormat
)
||
is16BPS
(
c
->
srcFormat
)
)
c
->
canMMX2BeUsed
=
0
;
}
else
c
->
canMMX2BeUsed
=
0
;
...
...
tests/ref/lavfi/pixfmts_scale_le
浏览文件 @
895b6161
...
...
@@ -9,8 +9,8 @@ bgr565le 3a514a298c6161a071ddf9963c06509d
bgr8 7f007fa6c153a16e808a9c51605a4016
bgra a5e7040f9a80cccd65e5acf2ca09ace5
gray d7786a7d9d99ac74230cc045cab5632c
gray16be
af39ce3a497f6734b157c8b94544f537
gray16le
7ac1b788bcc472010df7a97e762485e0
gray16be
5ba22d4802b40ec27e62abb22ad1d1cc
gray16le
2d5e83aa875a4c3baa6fecf55e3223bf
monob 88c4c050758e64d120f50c7eff694381
monow d31772ebaa877fc2a78565937f7f9673
nv12 4676d59db43d657dc12841f6bc3ab452
...
...
@@ -27,20 +27,20 @@ uyvy422 314bd486277111a95d9369b944fa0400
yuv410p 7df8f6d69b56a8dcb6c7ee908e5018b5
yuv411p 1143e7c5cc28fe0922b051b17733bc4c
yuv420p fdad2d8df8985e3d17e73c71f713cb14
yuv420p10be
6d335e75b553da590135cf8bb999610c
yuv420p10le
d510ddbabefd03ef39ec943fcb51b709
yuv420p16be
29a0265764530070f5cd3251cc01f66a
yuv420p16le
6f3a265b084a78baec229238d9f7945f
yuv420p9be
ec4983b7a949c0472110a7a2c58e278a
yuv420p9le
c136dce5913a722eee44ab72cff664b2
yuv420p10be
c143e77e97d2f7d62c3b518857ba9f9b
yuv420p10le
72d90eccf5c34691ff057dafb7447aa2
yuv420p16be
01da53e7f4f9882d5189ec1b1165ee05
yuv420p16le
165f9aaf5332e5d088f44534d8ed2bc9
yuv420p9be
bb87fddca65d1742412c8d2b1caf96c6
yuv420p9le
828eec50014a41258a5423c1fe56ac97
yuv422p 918e37701ee7377d16a8a6c119c56a40
yuv422p10le a
eb0ef08a883f43429ca9d886d8fc095
yuv422p16be
ef3e865fc1d0c68977c735323c50af6e
yuv422p16le
428a9b96214c09cb5a983ce36d6961ff
yuv422p10le a
10c4a5837547716f13cd61918b145f9
yuv422p16be
961860aa4f229e09f1249910c687081c
yuv422p16le
7695ee42c0581279bbe68de81deb7aee
yuv440p 461503fdb9b90451020aa3b25ddf041c
yuv444p 81b2eba962d12e8d64f003ac56f6faf2
yuv444p16be
99a3738c70c8fbdc5a0e4ad4bf50648d
yuv444p16le
385d0cc5240d62da0871915be5d86f0a
yuv444p16be
5f924c2b385826106300cecc4ef4d2df
yuv444p16le
40a55a85858508138b7661c83d95223e
yuva420p 8673a9131fb47de69788863f93a50eb7
yuvj420p 30427bd6caf5bda93a173dbebe759e09
yuvj422p fc8288f64fd149573f73cf8da05d8e6d
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录