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
dc78696e
Commit
dc78696e
authored
Feb 27, 2017
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/qdrw: fix decoding odd size images for 2bpp and 4bpp
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
05aa53dc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
36 deletions
+24
-36
qdrw.c
libavcodec/qdrw.c
+24
-36
No files found.
libavcodec/qdrw.c
View file @
dc78696e
...
@@ -91,31 +91,27 @@ static int decode_rle_bpp2(AVCodecContext *avctx, AVFrame *p, GetByteContext *gb
...
@@ -91,31 +91,27 @@ static int decode_rle_bpp2(AVCodecContext *avctx, AVFrame *p, GetByteContext *gb
if
(
code
&
0x80
)
{
/* run */
if
(
code
&
0x80
)
{
/* run */
pix
=
bytestream2_get_byte
(
gbc
);
pix
=
bytestream2_get_byte
(
gbc
);
for
(
j
=
0
;
j
<
257
-
code
;
j
++
)
{
for
(
j
=
0
;
j
<
257
-
code
;
j
++
)
{
if
(
pos
<
offset
)
out
[
pos
++
]
=
(
pix
&
0xC0
)
>>
6
;
out
[
pos
++
]
=
(
pix
&
0xC0
)
>>
6
;
if
(
pos
<
offset
)
out
[
pos
++
]
=
(
pix
&
0x30
)
>>
4
;
out
[
pos
++
]
=
(
pix
&
0x30
)
>>
4
;
if
(
pos
<
offset
)
out
[
pos
++
]
=
(
pix
&
0x0C
)
>>
2
;
out
[
pos
++
]
=
(
pix
&
0x0C
)
>>
2
;
if
(
pos
<
offset
)
out
[
pos
++
]
=
(
pix
&
0x03
);
out
[
pos
++
]
=
(
pix
&
0x03
);
if
(
pos
>=
offset
)
{
pos
-=
offset
;
pos
++
;
}
if
(
pos
>=
offset
)
return
AVERROR_INVALIDDATA
;
}
}
left
-=
2
;
left
-=
2
;
}
else
{
/* copy */
}
else
{
/* copy */
for
(
j
=
0
;
j
<
code
+
1
;
j
++
)
{
for
(
j
=
0
;
j
<
code
+
1
;
j
++
)
{
pix
=
bytestream2_get_byte
(
gbc
);
pix
=
bytestream2_get_byte
(
gbc
);
if
(
pos
<
offset
)
out
[
pos
++
]
=
(
pix
&
0xC0
)
>>
6
;
out
[
pos
++
]
=
(
pix
&
0xC0
)
>>
6
;
if
(
pos
<
offset
)
out
[
pos
++
]
=
(
pix
&
0x30
)
>>
4
;
out
[
pos
++
]
=
(
pix
&
0x30
)
>>
4
;
if
(
pos
<
offset
)
out
[
pos
++
]
=
(
pix
&
0x0C
)
>>
2
;
out
[
pos
++
]
=
(
pix
&
0x0C
)
>>
2
;
if
(
pos
<
offset
)
out
[
pos
++
]
=
(
pix
&
0x03
);
out
[
pos
++
]
=
(
pix
&
0x03
);
if
(
pos
>=
offset
)
{
pos
-=
offset
;
pos
++
;
}
if
(
pos
>=
offset
)
return
AVERROR_INVALIDDATA
;
}
}
left
-=
1
+
(
code
+
1
);
left
-=
1
+
(
code
+
1
);
}
}
...
@@ -147,27 +143,19 @@ static int decode_rle_bpp4(AVCodecContext *avctx, AVFrame *p, GetByteContext *gb
...
@@ -147,27 +143,19 @@ static int decode_rle_bpp4(AVCodecContext *avctx, AVFrame *p, GetByteContext *gb
if
(
code
&
0x80
)
{
/* run */
if
(
code
&
0x80
)
{
/* run */
pix
=
bytestream2_get_byte
(
gbc
);
pix
=
bytestream2_get_byte
(
gbc
);
for
(
j
=
0
;
j
<
257
-
code
;
j
++
)
{
for
(
j
=
0
;
j
<
257
-
code
;
j
++
)
{
if
(
pos
<
offset
)
out
[
pos
++
]
=
(
pix
&
0xF0
)
>>
4
;
out
[
pos
++
]
=
(
pix
&
0xF0
)
>>
4
;
if
(
pos
<
offset
)
out
[
pos
++
]
=
pix
&
0xF
;
out
[
pos
++
]
=
pix
&
0xF
;
if
(
pos
>=
offset
)
{
pos
-=
offset
;
pos
++
;
}
if
(
pos
>=
offset
)
return
AVERROR_INVALIDDATA
;
}
}
left
-=
2
;
left
-=
2
;
}
else
{
/* copy */
}
else
{
/* copy */
for
(
j
=
0
;
j
<
code
+
1
;
j
++
)
{
for
(
j
=
0
;
j
<
code
+
1
;
j
++
)
{
pix
=
bytestream2_get_byte
(
gbc
);
pix
=
bytestream2_get_byte
(
gbc
);
if
(
pos
<
offset
)
out
[
pos
++
]
=
(
pix
&
0xF0
)
>>
4
;
out
[
pos
++
]
=
(
pix
&
0xF0
)
>>
4
;
if
(
pos
<
offset
)
out
[
pos
++
]
=
pix
&
0xF
;
out
[
pos
++
]
=
pix
&
0xF
;
if
(
pos
>=
offset
)
{
pos
-=
offset
;
pos
++
;
}
if
(
pos
>=
offset
)
return
AVERROR_INVALIDDATA
;
}
}
left
-=
1
+
(
code
+
1
);
left
-=
1
+
(
code
+
1
);
}
}
...
...
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