Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
03bffb68
Commit
03bffb68
authored
Feb 21, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swscale: Use av_clip_uintp2()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
b2042639
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
output.c
libswscale/output.c
+12
-12
swscale.c
libswscale/swscale.c
+6
-6
No files found.
libswscale/output.c
View file @
03bffb68
...
@@ -1549,16 +1549,16 @@ static av_always_inline void yuv2rgb_write_full(SwsContext *c,
...
@@ -1549,16 +1549,16 @@ static av_always_inline void yuv2rgb_write_full(SwsContext *c,
r
=
(((
R
>>
19
)
+
A_DITHER
(
i
,
y
)
-
96
)
>>
8
);
r
=
(((
R
>>
19
)
+
A_DITHER
(
i
,
y
)
-
96
)
>>
8
);
g
=
(((
G
>>
19
)
+
A_DITHER
(
i
+
17
,
y
)
-
96
)
>>
8
);
g
=
(((
G
>>
19
)
+
A_DITHER
(
i
+
17
,
y
)
-
96
)
>>
8
);
b
=
(((
B
>>
20
)
+
A_DITHER
(
i
+
17
*
2
,
y
)
-
96
)
>>
8
);
b
=
(((
B
>>
20
)
+
A_DITHER
(
i
+
17
*
2
,
y
)
-
96
)
>>
8
);
r
=
av_clip
(
r
,
0
,
7
);
r
=
av_clip
_uintp2
(
r
,
3
);
g
=
av_clip
(
g
,
0
,
7
);
g
=
av_clip
_uintp2
(
g
,
3
);
b
=
av_clip
(
b
,
0
,
3
);
b
=
av_clip
_uintp2
(
b
,
2
);
}
else
{
}
else
{
r
=
(((
R
>>
21
)
+
A_DITHER
(
i
,
y
)
-
256
)
>>
8
);
r
=
(((
R
>>
21
)
+
A_DITHER
(
i
,
y
)
-
256
)
>>
8
);
g
=
(((
G
>>
19
)
+
A_DITHER
(
i
+
17
,
y
)
-
256
)
>>
8
);
g
=
(((
G
>>
19
)
+
A_DITHER
(
i
+
17
,
y
)
-
256
)
>>
8
);
b
=
(((
B
>>
21
)
+
A_DITHER
(
i
+
17
*
2
,
y
)
-
256
)
>>
8
);
b
=
(((
B
>>
21
)
+
A_DITHER
(
i
+
17
*
2
,
y
)
-
256
)
>>
8
);
r
=
av_clip
(
r
,
0
,
1
);
r
=
av_clip
_uintp2
(
r
,
1
);
g
=
av_clip
(
g
,
0
,
3
);
g
=
av_clip
_uintp2
(
g
,
2
);
b
=
av_clip
(
b
,
0
,
1
);
b
=
av_clip
_uintp2
(
b
,
1
);
}
}
break
;
break
;
case
SWS_DITHER_X_DITHER
:
case
SWS_DITHER_X_DITHER
:
...
@@ -1568,16 +1568,16 @@ static av_always_inline void yuv2rgb_write_full(SwsContext *c,
...
@@ -1568,16 +1568,16 @@ static av_always_inline void yuv2rgb_write_full(SwsContext *c,
r
=
(((
R
>>
19
)
+
X_DITHER
(
i
,
y
)
-
96
)
>>
8
);
r
=
(((
R
>>
19
)
+
X_DITHER
(
i
,
y
)
-
96
)
>>
8
);
g
=
(((
G
>>
19
)
+
X_DITHER
(
i
+
17
,
y
)
-
96
)
>>
8
);
g
=
(((
G
>>
19
)
+
X_DITHER
(
i
+
17
,
y
)
-
96
)
>>
8
);
b
=
(((
B
>>
20
)
+
X_DITHER
(
i
+
17
*
2
,
y
)
-
96
)
>>
8
);
b
=
(((
B
>>
20
)
+
X_DITHER
(
i
+
17
*
2
,
y
)
-
96
)
>>
8
);
r
=
av_clip
(
r
,
0
,
7
);
r
=
av_clip
_uintp2
(
r
,
3
);
g
=
av_clip
(
g
,
0
,
7
);
g
=
av_clip
_uintp2
(
g
,
3
);
b
=
av_clip
(
b
,
0
,
3
);
b
=
av_clip
_uintp2
(
b
,
2
);
}
else
{
}
else
{
r
=
(((
R
>>
21
)
+
X_DITHER
(
i
,
y
)
-
256
)
>>
8
);
r
=
(((
R
>>
21
)
+
X_DITHER
(
i
,
y
)
-
256
)
>>
8
);
g
=
(((
G
>>
19
)
+
X_DITHER
(
i
+
17
,
y
)
-
256
)
>>
8
);
g
=
(((
G
>>
19
)
+
X_DITHER
(
i
+
17
,
y
)
-
256
)
>>
8
);
b
=
(((
B
>>
21
)
+
X_DITHER
(
i
+
17
*
2
,
y
)
-
256
)
>>
8
);
b
=
(((
B
>>
21
)
+
X_DITHER
(
i
+
17
*
2
,
y
)
-
256
)
>>
8
);
r
=
av_clip
(
r
,
0
,
1
);
r
=
av_clip
_uintp2
(
r
,
1
);
g
=
av_clip
(
g
,
0
,
3
);
g
=
av_clip
_uintp2
(
g
,
2
);
b
=
av_clip
(
b
,
0
,
1
);
b
=
av_clip
_uintp2
(
b
,
1
);
}
}
break
;
break
;
...
...
libswscale/swscale.c
View file @
03bffb68
...
@@ -805,9 +805,9 @@ static void xyz12Torgb48(struct SwsContext *c, uint16_t *dst,
...
@@ -805,9 +805,9 @@ static void xyz12Torgb48(struct SwsContext *c, uint16_t *dst,
c
->
xyz2rgb_matrix
[
2
][
2
]
*
z
>>
12
;
c
->
xyz2rgb_matrix
[
2
][
2
]
*
z
>>
12
;
// limit values to 12-bit depth
// limit values to 12-bit depth
r
=
av_clip
(
r
,
0
,
4095
);
r
=
av_clip
_uintp2
(
r
,
12
);
g
=
av_clip
(
g
,
0
,
4095
);
g
=
av_clip
_uintp2
(
g
,
12
);
b
=
av_clip
(
b
,
0
,
4095
);
b
=
av_clip
_uintp2
(
b
,
12
);
// convert from sRGBlinear to RGB and scale from 12bit to 16bit
// convert from sRGBlinear to RGB and scale from 12bit to 16bit
if
(
desc
->
flags
&
AV_PIX_FMT_FLAG_BE
)
{
if
(
desc
->
flags
&
AV_PIX_FMT_FLAG_BE
)
{
...
@@ -861,9 +861,9 @@ static void rgb48Toxyz12(struct SwsContext *c, uint16_t *dst,
...
@@ -861,9 +861,9 @@ static void rgb48Toxyz12(struct SwsContext *c, uint16_t *dst,
c
->
rgb2xyz_matrix
[
2
][
2
]
*
b
>>
12
;
c
->
rgb2xyz_matrix
[
2
][
2
]
*
b
>>
12
;
// limit values to 12-bit depth
// limit values to 12-bit depth
x
=
av_clip
(
x
,
0
,
4095
);
x
=
av_clip
_uintp2
(
x
,
12
);
y
=
av_clip
(
y
,
0
,
4095
);
y
=
av_clip
_uintp2
(
y
,
12
);
z
=
av_clip
(
z
,
0
,
4095
);
z
=
av_clip
_uintp2
(
z
,
12
);
// convert from XYZlinear to X'Y'Z' and scale from 12bit to 16bit
// convert from XYZlinear to X'Y'Z' and scale from 12bit to 16bit
if
(
desc
->
flags
&
AV_PIX_FMT_FLAG_BE
)
{
if
(
desc
->
flags
&
AV_PIX_FMT_FLAG_BE
)
{
...
...
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