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
8b39f75b
Commit
8b39f75b
authored
Apr 20, 2005
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify
Originally committed as revision 4144 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
ee572c54
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
21 deletions
+11
-21
indeo2.c
libavcodec/indeo2.c
+11
-21
No files found.
libavcodec/indeo2.c
View file @
8b39f75b
...
@@ -40,18 +40,8 @@ static VLC ir2_vlc;
...
@@ -40,18 +40,8 @@ static VLC ir2_vlc;
/* Indeo 2 codes are in range 0x01..0x7F and 0x81..0x90 */
/* Indeo 2 codes are in range 0x01..0x7F and 0x81..0x90 */
static
inline
int
ir2_get_code
(
GetBitContext
*
gb
)
static
inline
int
ir2_get_code
(
GetBitContext
*
gb
)
{
{
int
code
;
return
get_vlc2
(
gb
,
ir2_vlc
.
table
,
CODE_VLC_BITS
,
1
)
+
1
;
code
=
get_vlc2
(
gb
,
ir2_vlc
.
table
,
CODE_VLC_BITS
,
1
)
+
1
;
if
(
code
>=
0x80
)
return
(
code
+
1
);
return
code
;
}
}
#define CLAMP_TO_BYTE(value) \
if (value > 255) \
value = 255; \
else if (value < 0) \
value = 0; \
static
int
ir2_decode_plane
(
Ir2Context
*
ctx
,
int
width
,
int
height
,
uint8_t
*
dst
,
int
stride
,
static
int
ir2_decode_plane
(
Ir2Context
*
ctx
,
int
width
,
int
height
,
uint8_t
*
dst
,
int
stride
,
const
uint8_t
*
table
)
const
uint8_t
*
table
)
...
@@ -68,8 +58,8 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
...
@@ -68,8 +58,8 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
/* first line contain absolute values, other lines contain deltas */
/* first line contain absolute values, other lines contain deltas */
while
(
out
<
width
){
while
(
out
<
width
){
c
=
ir2_get_code
(
&
ctx
->
gb
);
c
=
ir2_get_code
(
&
ctx
->
gb
);
if
(
c
>
0x80
)
{
/* we have a run */
if
(
c
>
=
0x80
)
{
/* we have a run */
c
-=
0x
80
;
c
-=
0x
7F
;
if
(
out
+
c
*
2
>
width
)
if
(
out
+
c
*
2
>
width
)
return
-
1
;
return
-
1
;
for
(
i
=
0
;
i
<
c
*
2
;
i
++
)
for
(
i
=
0
;
i
<
c
*
2
;
i
++
)
...
@@ -85,8 +75,8 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
...
@@ -85,8 +75,8 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
out
=
0
;
out
=
0
;
while
(
out
<
width
){
while
(
out
<
width
){
c
=
ir2_get_code
(
&
ctx
->
gb
);
c
=
ir2_get_code
(
&
ctx
->
gb
);
if
(
c
>
0x80
)
{
/* we have a skip */
if
(
c
>
=
0x80
)
{
/* we have a skip */
c
-=
0x
80
;
c
-=
0x
7F
;
if
(
out
+
c
*
2
>
width
)
if
(
out
+
c
*
2
>
width
)
return
-
1
;
return
-
1
;
for
(
i
=
0
;
i
<
c
*
2
;
i
++
)
{
for
(
i
=
0
;
i
<
c
*
2
;
i
++
)
{
...
@@ -95,11 +85,11 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
...
@@ -95,11 +85,11 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
}
}
}
else
{
/* add two deltas from table */
}
else
{
/* add two deltas from table */
t
=
dst
[
out
-
stride
]
+
(
table
[
c
*
2
]
-
128
);
t
=
dst
[
out
-
stride
]
+
(
table
[
c
*
2
]
-
128
);
CLAMP_TO_BYTE
(
t
);
t
=
clip_uint8
(
t
);
dst
[
out
]
=
t
;
dst
[
out
]
=
t
;
out
++
;
out
++
;
t
=
dst
[
out
-
stride
]
+
(
table
[(
c
*
2
)
+
1
]
-
128
);
t
=
dst
[
out
-
stride
]
+
(
table
[(
c
*
2
)
+
1
]
-
128
);
CLAMP_TO_BYTE
(
t
);
t
=
clip_uint8
(
t
);
dst
[
out
]
=
t
;
dst
[
out
]
=
t
;
out
++
;
out
++
;
}
}
...
@@ -124,16 +114,16 @@ static int ir2_decode_plane_inter(Ir2Context *ctx, int width, int height, uint8_
...
@@ -124,16 +114,16 @@ static int ir2_decode_plane_inter(Ir2Context *ctx, int width, int height, uint8_
out
=
0
;
out
=
0
;
while
(
out
<
width
){
while
(
out
<
width
){
c
=
ir2_get_code
(
&
ctx
->
gb
);
c
=
ir2_get_code
(
&
ctx
->
gb
);
if
(
c
>
0x80
)
{
/* we have a skip */
if
(
c
>
=
0x80
)
{
/* we have a skip */
c
-=
0x
80
;
c
-=
0x
7F
;
out
+=
c
*
2
;
out
+=
c
*
2
;
}
else
{
/* add two deltas from table */
}
else
{
/* add two deltas from table */
t
=
dst
[
out
]
+
(
table
[
c
*
2
]
-
128
);
t
=
dst
[
out
]
+
(
table
[
c
*
2
]
-
128
);
CLAMP_TO_BYTE
(
t
);
t
=
clip_uint8
(
t
);
dst
[
out
]
=
t
;
dst
[
out
]
=
t
;
out
++
;
out
++
;
t
=
dst
[
out
]
+
(
table
[(
c
*
2
)
+
1
]
-
128
);
t
=
dst
[
out
]
+
(
table
[(
c
*
2
)
+
1
]
-
128
);
CLAMP_TO_BYTE
(
t
);
t
=
clip_uint8
(
t
);
dst
[
out
]
=
t
;
dst
[
out
]
=
t
;
out
++
;
out
++
;
}
}
...
...
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