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
72b95764
Commit
72b95764
authored
Feb 15, 2012
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swscale: variable declaration and placement cosmetics
parent
5d42ac7f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
117 deletions
+90
-117
rgb2rgb.c
libswscale/rgb2rgb.c
+28
-40
rgb2rgb_template.c
libswscale/rgb2rgb_template.c
+62
-77
No files found.
libswscale/rgb2rgb.c
View file @
72b95764
...
@@ -125,8 +125,8 @@ void sws_rgb2rgb_init(void)
...
@@ -125,8 +125,8 @@ void sws_rgb2rgb_init(void)
void
rgb32to24
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
void
rgb32to24
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
{
{
int
i
;
int
i
,
num_pixels
=
src_size
>>
2
;
int
num_pixels
=
src_size
>>
2
;
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
#if HAVE_BIGENDIAN
#if HAVE_BIGENDIAN
/* RGB32 (= A,B,G,R) -> BGR24 (= B,G,R) */
/* RGB32 (= A,B,G,R) -> BGR24 (= B,G,R) */
...
@@ -162,13 +162,12 @@ void rgb24to32(const uint8_t *src, uint8_t *dst, int src_size)
...
@@ -162,13 +162,12 @@ void rgb24to32(const uint8_t *src, uint8_t *dst, int src_size)
void
rgb16tobgr32
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
void
rgb16tobgr32
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
{
{
const
uint16_t
*
end
;
uint8_t
*
d
=
dst
;
uint8_t
*
d
=
dst
;
const
uint16_t
*
s
=
(
const
uint16_t
*
)
src
;
const
uint16_t
*
s
=
(
const
uint16_t
*
)
src
;
end
=
s
+
src_size
/
2
;
const
uint16_t
*
end
=
s
+
src_size
/
2
;
while
(
s
<
end
)
{
while
(
s
<
end
)
{
register
uint16_t
bgr
;
register
uint16_t
bgr
=
*
s
++
;
bgr
=
*
s
++
;
#if HAVE_BIGENDIAN
#if HAVE_BIGENDIAN
*
d
++
=
255
;
*
d
++
=
255
;
*
d
++
=
(
bgr
&
0x1F
)
<<
3
;
*
d
++
=
(
bgr
&
0x1F
)
<<
3
;
...
@@ -185,11 +184,11 @@ void rgb16tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
...
@@ -185,11 +184,11 @@ void rgb16tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
void
rgb12to15
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
void
rgb12to15
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
{
{
const
uint16_t
*
end
;
uint16_t
*
d
=
(
uint16_t
*
)
dst
;
uint16_t
*
d
=
(
uint16_t
*
)
dst
;
const
uint16_t
*
s
=
(
const
uint16_t
*
)
src
;
const
uint16_t
*
s
=
(
const
uint16_t
*
)
src
;
uint16_t
rgb
,
r
,
g
,
b
;
uint16_t
rgb
,
r
,
g
,
b
;
end
=
s
+
src_size
/
2
;
const
uint16_t
*
end
=
s
+
src_size
/
2
;
while
(
s
<
end
)
{
while
(
s
<
end
)
{
rgb
=
*
s
++
;
rgb
=
*
s
++
;
r
=
rgb
&
0xF00
;
r
=
rgb
&
0xF00
;
...
@@ -204,13 +203,12 @@ void rgb12to15(const uint8_t *src, uint8_t *dst, int src_size)
...
@@ -204,13 +203,12 @@ void rgb12to15(const uint8_t *src, uint8_t *dst, int src_size)
void
rgb16to24
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
void
rgb16to24
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
{
{
const
uint16_t
*
end
;
uint8_t
*
d
=
dst
;
uint8_t
*
d
=
dst
;
const
uint16_t
*
s
=
(
const
uint16_t
*
)
src
;
const
uint16_t
*
s
=
(
const
uint16_t
*
)
src
;
end
=
s
+
src_size
/
2
;
const
uint16_t
*
end
=
s
+
src_size
/
2
;
while
(
s
<
end
)
{
while
(
s
<
end
)
{
register
uint16_t
bgr
;
register
uint16_t
bgr
=
*
s
++
;
bgr
=
*
s
++
;
*
d
++
=
(
bgr
&
0xF800
)
>>
8
;
*
d
++
=
(
bgr
&
0xF800
)
>>
8
;
*
d
++
=
(
bgr
&
0x7E0
)
>>
3
;
*
d
++
=
(
bgr
&
0x7E0
)
>>
3
;
*
d
++
=
(
bgr
&
0x1F
)
<<
3
;
*
d
++
=
(
bgr
&
0x1F
)
<<
3
;
...
@@ -219,8 +217,7 @@ void rgb16to24(const uint8_t *src, uint8_t *dst, int src_size)
...
@@ -219,8 +217,7 @@ void rgb16to24(const uint8_t *src, uint8_t *dst, int src_size)
void
rgb16tobgr16
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
void
rgb16tobgr16
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
{
{
int
i
;
int
i
,
num_pixels
=
src_size
>>
1
;
int
num_pixels
=
src_size
>>
1
;
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
unsigned
rgb
=
((
const
uint16_t
*
)
src
)[
i
];
unsigned
rgb
=
((
const
uint16_t
*
)
src
)[
i
];
...
@@ -230,8 +227,7 @@ void rgb16tobgr16(const uint8_t *src, uint8_t *dst, int src_size)
...
@@ -230,8 +227,7 @@ void rgb16tobgr16(const uint8_t *src, uint8_t *dst, int src_size)
void
rgb16tobgr15
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
void
rgb16tobgr15
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
{
{
int
i
;
int
i
,
num_pixels
=
src_size
>>
1
;
int
num_pixels
=
src_size
>>
1
;
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
unsigned
rgb
=
((
const
uint16_t
*
)
src
)[
i
];
unsigned
rgb
=
((
const
uint16_t
*
)
src
)[
i
];
...
@@ -241,13 +237,12 @@ void rgb16tobgr15(const uint8_t *src, uint8_t *dst, int src_size)
...
@@ -241,13 +237,12 @@ void rgb16tobgr15(const uint8_t *src, uint8_t *dst, int src_size)
void
rgb15tobgr32
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
void
rgb15tobgr32
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
{
{
const
uint16_t
*
end
;
uint8_t
*
d
=
dst
;
uint8_t
*
d
=
dst
;
const
uint16_t
*
s
=
(
const
uint16_t
*
)
src
;
const
uint16_t
*
s
=
(
const
uint16_t
*
)
src
;
end
=
s
+
src_size
/
2
;
const
uint16_t
*
end
=
s
+
src_size
/
2
;
while
(
s
<
end
)
{
while
(
s
<
end
)
{
register
uint16_t
bgr
;
register
uint16_t
bgr
=
*
s
++
;
bgr
=
*
s
++
;
#if HAVE_BIGENDIAN
#if HAVE_BIGENDIAN
*
d
++
=
255
;
*
d
++
=
255
;
*
d
++
=
(
bgr
&
0x1F
)
<<
3
;
*
d
++
=
(
bgr
&
0x1F
)
<<
3
;
...
@@ -264,13 +259,12 @@ void rgb15tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
...
@@ -264,13 +259,12 @@ void rgb15tobgr32(const uint8_t *src, uint8_t *dst, int src_size)
void
rgb15to24
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
void
rgb15to24
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
{
{
const
uint16_t
*
end
;
uint8_t
*
d
=
dst
;
uint8_t
*
d
=
dst
;
const
uint16_t
*
s
=
(
const
uint16_t
*
)
src
;
const
uint16_t
*
s
=
(
const
uint16_t
*
)
src
;
end
=
s
+
src_size
/
2
;
const
uint16_t
*
end
=
s
+
src_size
/
2
;
while
(
s
<
end
)
{
while
(
s
<
end
)
{
register
uint16_t
bgr
;
register
uint16_t
bgr
=
*
s
++
;
bgr
=
*
s
++
;
*
d
++
=
(
bgr
&
0x7C00
)
>>
7
;
*
d
++
=
(
bgr
&
0x7C00
)
>>
7
;
*
d
++
=
(
bgr
&
0x3E0
)
>>
2
;
*
d
++
=
(
bgr
&
0x3E0
)
>>
2
;
*
d
++
=
(
bgr
&
0x1F
)
<<
3
;
*
d
++
=
(
bgr
&
0x1F
)
<<
3
;
...
@@ -279,8 +273,7 @@ void rgb15to24(const uint8_t *src, uint8_t *dst, int src_size)
...
@@ -279,8 +273,7 @@ void rgb15to24(const uint8_t *src, uint8_t *dst, int src_size)
void
rgb15tobgr16
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
void
rgb15tobgr16
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
{
{
int
i
;
int
i
,
num_pixels
=
src_size
>>
1
;
int
num_pixels
=
src_size
>>
1
;
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
unsigned
rgb
=
((
const
uint16_t
*
)
src
)[
i
];
unsigned
rgb
=
((
const
uint16_t
*
)
src
)[
i
];
...
@@ -290,13 +283,11 @@ void rgb15tobgr16(const uint8_t *src, uint8_t *dst, int src_size)
...
@@ -290,13 +283,11 @@ void rgb15tobgr16(const uint8_t *src, uint8_t *dst, int src_size)
void
rgb15tobgr15
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
void
rgb15tobgr15
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
{
{
int
i
;
int
i
,
num_pixels
=
src_size
>>
1
;
int
num_pixels
=
src_size
>>
1
;
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
unsigned
br
;
unsigned
rgb
=
((
const
uint16_t
*
)
src
)[
i
];
unsigned
rgb
=
((
const
uint16_t
*
)
src
)[
i
];
br
=
rgb
&
0x7c
1F
;
unsigned
br
=
rgb
&
0x7C
1F
;
((
uint16_t
*
)
dst
)[
i
]
=
(
br
>>
10
)
|
(
rgb
&
0x3E0
)
|
(
br
<<
10
);
((
uint16_t
*
)
dst
)[
i
]
=
(
br
>>
10
)
|
(
rgb
&
0x3E0
)
|
(
br
<<
10
);
}
}
}
}
...
@@ -305,8 +296,7 @@ void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size)
...
@@ -305,8 +296,7 @@ void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size)
{
{
uint16_t
*
d
=
(
uint16_t
*
)
dst
;
uint16_t
*
d
=
(
uint16_t
*
)
dst
;
uint16_t
*
s
=
(
uint16_t
*
)
src
;
uint16_t
*
s
=
(
uint16_t
*
)
src
;
int
i
;
int
i
,
num_pixels
=
src_size
>>
1
;
int
num_pixels
=
src_size
>>
1
;
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
unsigned
rgb
=
s
[
i
];
unsigned
rgb
=
s
[
i
];
...
@@ -316,15 +306,13 @@ void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size)
...
@@ -316,15 +306,13 @@ void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size)
void
bgr8torgb8
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
void
bgr8torgb8
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
)
{
{
int
i
;
int
i
,
num_pixels
=
src_size
;
int
num_pixels
=
src_size
;
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
unsigned
b
,
g
,
r
;
register
uint8_t
rgb
=
src
[
i
];
register
uint8_t
rgb
;
unsigned
r
=
(
rgb
&
0x07
);
rgb
=
src
[
i
];
unsigned
g
=
(
rgb
&
0x38
)
>>
3
;
r
=
(
rgb
&
0x07
);
unsigned
b
=
(
rgb
&
0xC0
)
>>
6
;
g
=
(
rgb
&
0x38
)
>>
3
;
b
=
(
rgb
&
0xC0
)
>>
6
;
dst
[
i
]
=
((
b
<<
1
)
&
0x07
)
|
((
g
&
0x07
)
<<
3
)
|
((
r
&
0x03
)
<<
6
);
dst
[
i
]
=
((
b
<<
1
)
&
0x07
)
|
((
g
&
0x07
)
<<
3
)
|
((
r
&
0x03
)
<<
6
);
}
}
}
}
...
...
libswscale/rgb2rgb_template.c
View file @
72b95764
This diff is collapsed.
Click to expand it.
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