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
ed27ed9f
Commit
ed27ed9f
authored
Nov 18, 2012
by
Peter Ross
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iff: DEEP RLE 32-bit decoder
Fixes ticket #1046. Signed-off-by:
Peter Ross
<
pross@xvid.org
>
parent
a74ae469
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
1 deletion
+58
-1
iff.c
libavcodec/iff.c
+57
-0
iff.c
libavformat/iff.c
+1
-1
No files found.
libavcodec/iff.c
View file @
ed27ed9f
...
@@ -598,6 +598,55 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
...
@@ -598,6 +598,55 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
return
buf_size
;
return
buf_size
;
}
}
/**
* Decode DEEP RLE 32-bit buffer
* @param[out] dst Destination buffer
* @param[in] src Source buffer
* @param src_size Source buffer size (bytes)
* @param width Width of destination buffer (pixels)
* @param height Height of destination buffer (pixels)
* @param linesize Line size of destination buffer (bytes)
*/
static
void
decode_deep_rle32
(
uint8_t
*
dst
,
const
uint8_t
*
src
,
int
src_size
,
int
width
,
int
height
,
int
linesize
)
{
const
uint8_t
*
src_end
=
src
+
src_size
;
int
x
=
0
,
y
=
0
,
i
;
while
(
src
+
5
<=
src_end
)
{
int
opcode
;
opcode
=
*
(
int8_t
*
)
src
++
;
if
(
opcode
>=
0
)
{
int
size
=
opcode
+
1
;
for
(
i
=
0
;
i
<
size
;
i
++
)
{
int
length
=
FFMIN
(
size
-
i
,
width
);
memcpy
(
dst
+
y
*
linesize
+
x
*
4
,
src
,
length
*
4
);
src
+=
length
*
4
;
x
+=
length
;
i
+=
length
;
if
(
x
>=
width
)
{
x
=
0
;
y
+=
1
;
if
(
y
>=
height
)
return
;
}
}
}
else
{
int
size
=
-
opcode
+
1
;
uint32_t
pixel
=
AV_RL32
(
src
);
for
(
i
=
0
;
i
<
size
;
i
++
)
{
*
(
uint32_t
*
)(
dst
+
y
*
linesize
+
x
*
4
)
=
pixel
;
x
+=
1
;
if
(
x
>=
width
)
{
x
=
0
;
y
+=
1
;
if
(
y
>=
height
)
return
;
}
}
src
+=
4
;
}
}
}
static
int
decode_frame_byterun1
(
AVCodecContext
*
avctx
,
static
int
decode_frame_byterun1
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
data_size
,
void
*
data
,
int
*
data_size
,
AVPacket
*
avpkt
)
AVPacket
*
avpkt
)
...
@@ -683,6 +732,14 @@ static int decode_frame_byterun1(AVCodecContext *avctx,
...
@@ -683,6 +732,14 @@ static int decode_frame_byterun1(AVCodecContext *avctx,
av_log_ask_for_sample
(
avctx
,
"unsupported bpp
\n
"
);
av_log_ask_for_sample
(
avctx
,
"unsupported bpp
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
}
else
if
(
avctx
->
codec_tag
==
MKTAG
(
'D'
,
'E'
,
'E'
,
'P'
))
{
// IFF-DEEP
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
avctx
->
pix_fmt
);
if
(
av_get_bits_per_pixel
(
desc
)
==
32
)
decode_deep_rle32
(
s
->
frame
.
data
[
0
],
buf
,
buf_size
,
avctx
->
width
,
avctx
->
height
,
s
->
frame
.
linesize
[
0
]);
else
{
av_log_ask_for_sample
(
avctx
,
"unsupported bpp
\n
"
);
return
AVERROR_INVALIDDATA
;
}
}
}
*
data_size
=
sizeof
(
AVFrame
);
*
data_size
=
sizeof
(
AVFrame
);
...
...
libavformat/iff.c
View file @
ed27ed9f
...
@@ -272,7 +272,7 @@ static int iff_read_header(AVFormatContext *s)
...
@@ -272,7 +272,7 @@ static int iff_read_header(AVFormatContext *s)
st
->
codec
->
width
=
avio_rb16
(
pb
);
st
->
codec
->
width
=
avio_rb16
(
pb
);
st
->
codec
->
height
=
avio_rb16
(
pb
);
st
->
codec
->
height
=
avio_rb16
(
pb
);
iff
->
bitmap_compression
=
avio_rb16
(
pb
);
iff
->
bitmap_compression
=
avio_rb16
(
pb
);
if
(
iff
->
bitmap_compression
!=
0
)
{
if
(
iff
->
bitmap_compression
>
1
)
{
av_log
(
s
,
AV_LOG_ERROR
,
av_log
(
s
,
AV_LOG_ERROR
,
"compression %i not supported
\n
"
,
iff
->
bitmap_compression
);
"compression %i not supported
\n
"
,
iff
->
bitmap_compression
);
return
AVERROR_PATCHWELCOME
;
return
AVERROR_PATCHWELCOME
;
...
...
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