Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
e9f7c7ae
Commit
e9f7c7ae
authored
Jul 19, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sws: Move fast bilinear C code into seperate file
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
76899be1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
37 deletions
+65
-37
Makefile
libswscale/Makefile
+2
-1
hscale_fast_bilinear.c
libswscale/hscale_fast_bilinear.c
+55
-0
swscale.c
libswscale/swscale.c
+2
-36
swscale_internal.h
libswscale/swscale_internal.h
+6
-0
No files found.
libswscale/Makefile
View file @
e9f7c7ae
...
...
@@ -5,7 +5,8 @@ NAME = swscale
HEADERS
=
swscale.h
\
version.h
\
OBJS
=
input.o
\
OBJS
=
hscale_fast_bilinear.o
\
input.o
\
options.o
\
output.o
\
rgb2rgb.o
\
...
...
libswscale/hscale_fast_bilinear.c
0 → 100644
View file @
e9f7c7ae
/*
* Copyright (C) 2001-2011 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "swscale_internal.h"
void
ff_hyscale_fast_c
(
SwsContext
*
c
,
int16_t
*
dst
,
int
dstWidth
,
const
uint8_t
*
src
,
int
srcW
,
int
xInc
)
{
int
i
;
unsigned
int
xpos
=
0
;
for
(
i
=
0
;
i
<
dstWidth
;
i
++
)
{
register
unsigned
int
xx
=
xpos
>>
16
;
register
unsigned
int
xalpha
=
(
xpos
&
0xFFFF
)
>>
9
;
dst
[
i
]
=
(
src
[
xx
]
<<
7
)
+
(
src
[
xx
+
1
]
-
src
[
xx
])
*
xalpha
;
xpos
+=
xInc
;
}
for
(
i
=
dstWidth
-
1
;
(
i
*
xInc
)
>>
16
>=
srcW
-
1
;
i
--
)
dst
[
i
]
=
src
[
srcW
-
1
]
*
128
;
}
void
ff_hcscale_fast_c
(
SwsContext
*
c
,
int16_t
*
dst1
,
int16_t
*
dst2
,
int
dstWidth
,
const
uint8_t
*
src1
,
const
uint8_t
*
src2
,
int
srcW
,
int
xInc
)
{
int
i
;
unsigned
int
xpos
=
0
;
for
(
i
=
0
;
i
<
dstWidth
;
i
++
)
{
register
unsigned
int
xx
=
xpos
>>
16
;
register
unsigned
int
xalpha
=
(
xpos
&
0xFFFF
)
>>
9
;
dst1
[
i
]
=
(
src1
[
xx
]
*
(
xalpha
^
127
)
+
src1
[
xx
+
1
]
*
xalpha
);
dst2
[
i
]
=
(
src2
[
xx
]
*
(
xalpha
^
127
)
+
src2
[
xx
+
1
]
*
xalpha
);
xpos
+=
xInc
;
}
for
(
i
=
dstWidth
-
1
;
(
i
*
xInc
)
>>
16
>=
srcW
-
1
;
i
--
)
{
dst1
[
i
]
=
src1
[
srcW
-
1
]
*
128
;
dst2
[
i
]
=
src2
[
srcW
-
1
]
*
128
;
}
}
libswscale/swscale.c
View file @
e9f7c7ae
...
...
@@ -221,21 +221,6 @@ static void lumRangeFromJpeg16_c(int16_t *_dst, int width)
dst
[
i
]
=
(
dst
[
i
]
*
(
14071
/
4
)
+
(
33561947
<<
4
)
/
4
)
>>
12
;
}
static
void
hyscale_fast_c
(
SwsContext
*
c
,
int16_t
*
dst
,
int
dstWidth
,
const
uint8_t
*
src
,
int
srcW
,
int
xInc
)
{
int
i
;
unsigned
int
xpos
=
0
;
for
(
i
=
0
;
i
<
dstWidth
;
i
++
)
{
register
unsigned
int
xx
=
xpos
>>
16
;
register
unsigned
int
xalpha
=
(
xpos
&
0xFFFF
)
>>
9
;
dst
[
i
]
=
(
src
[
xx
]
<<
7
)
+
(
src
[
xx
+
1
]
-
src
[
xx
])
*
xalpha
;
xpos
+=
xInc
;
}
for
(
i
=
dstWidth
-
1
;
(
i
*
xInc
)
>>
16
>=
srcW
-
1
;
i
--
)
dst
[
i
]
=
src
[
srcW
-
1
]
*
128
;
}
// *** horizontal scale Y line to temp buffer
static
av_always_inline
void
hyscale
(
SwsContext
*
c
,
int16_t
*
dst
,
int
dstWidth
,
const
uint8_t
*
src_in
[
4
],
...
...
@@ -273,25 +258,6 @@ static av_always_inline void hyscale(SwsContext *c, int16_t *dst, int dstWidth,
convertRange
(
dst
,
dstWidth
);
}
static
void
hcscale_fast_c
(
SwsContext
*
c
,
int16_t
*
dst1
,
int16_t
*
dst2
,
int
dstWidth
,
const
uint8_t
*
src1
,
const
uint8_t
*
src2
,
int
srcW
,
int
xInc
)
{
int
i
;
unsigned
int
xpos
=
0
;
for
(
i
=
0
;
i
<
dstWidth
;
i
++
)
{
register
unsigned
int
xx
=
xpos
>>
16
;
register
unsigned
int
xalpha
=
(
xpos
&
0xFFFF
)
>>
9
;
dst1
[
i
]
=
(
src1
[
xx
]
*
(
xalpha
^
127
)
+
src1
[
xx
+
1
]
*
xalpha
);
dst2
[
i
]
=
(
src2
[
xx
]
*
(
xalpha
^
127
)
+
src2
[
xx
+
1
]
*
xalpha
);
xpos
+=
xInc
;
}
for
(
i
=
dstWidth
-
1
;
(
i
*
xInc
)
>>
16
>=
srcW
-
1
;
i
--
)
{
dst1
[
i
]
=
src1
[
srcW
-
1
]
*
128
;
dst2
[
i
]
=
src2
[
srcW
-
1
]
*
128
;
}
}
static
av_always_inline
void
hcscale
(
SwsContext
*
c
,
int16_t
*
dst1
,
int16_t
*
dst2
,
int
dstWidth
,
const
uint8_t
*
src_in
[
4
],
...
...
@@ -745,8 +711,8 @@ static av_cold void sws_init_swscale(SwsContext *c)
if
(
c
->
dstBpc
<=
14
)
{
c
->
hyScale
=
c
->
hcScale
=
hScale8To15_c
;
if
(
c
->
flags
&
SWS_FAST_BILINEAR
)
{
c
->
hyscale_fast
=
hyscale_fast_c
;
c
->
hcscale_fast
=
hcscale_fast_c
;
c
->
hyscale_fast
=
ff_
hyscale_fast_c
;
c
->
hcscale_fast
=
ff_
hcscale_fast_c
;
}
}
else
{
c
->
hyScale
=
c
->
hcScale
=
hScale8To19_c
;
...
...
libswscale/swscale_internal.h
View file @
e9f7c7ae
...
...
@@ -859,6 +859,12 @@ void ff_sws_init_output_funcs(SwsContext *c,
void
ff_sws_init_swscale_ppc
(
SwsContext
*
c
);
void
ff_sws_init_swscale_x86
(
SwsContext
*
c
);
void
ff_hyscale_fast_c
(
SwsContext
*
c
,
int16_t
*
dst
,
int
dstWidth
,
const
uint8_t
*
src
,
int
srcW
,
int
xInc
);
void
ff_hcscale_fast_c
(
SwsContext
*
c
,
int16_t
*
dst1
,
int16_t
*
dst2
,
int
dstWidth
,
const
uint8_t
*
src1
,
const
uint8_t
*
src2
,
int
srcW
,
int
xInc
);
static
inline
void
fillPlane16
(
uint8_t
*
plane
,
int
stride
,
int
width
,
int
height
,
int
y
,
int
alpha
,
int
bits
,
const
int
big_endian
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment