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
70b10db2
Commit
70b10db2
authored
May 09, 2011
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iff: remove get_image_data() and get_image_size() wrappers
Remove one level of indirection, simplify code.
parent
8b1171e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
29 deletions
+8
-29
iff.c
libavcodec/iff.c
+8
-29
No files found.
libavcodec/iff.c
View file @
70b10db2
...
...
@@ -38,29 +38,6 @@ typedef enum {
MASK_LASSO
}
mask_type
;
/**
* Gets the actual raw image data after video properties which
* contains the raw image data beyond the IFF extra context.
*
* @param avpkt the AVPacket where to extract raw image data from
* @return pointer to raw image data
*/
static
av_always_inline
uint8_t
*
get_image_data
(
const
AVPacket
*
const
avpkt
)
{
return
avpkt
->
data
+
AV_RB16
(
avpkt
->
data
);
}
/**
* Gets the size of raw image data beyond the IFF extra context.
* Please note that any value < 2 of either IFF extra context
* or raw image data is considered as an illegal packet.
*
* @param avpkt the AVPacket where to extract image data size from
* @return size of raw image data in bytes
*/
static
av_always_inline
int
get_image_size
(
const
AVPacket
*
const
avpkt
)
{
return
avpkt
->
size
-
AV_RB16
(
avpkt
->
data
);
}
typedef
struct
{
AVFrame
frame
;
int
planesize
;
...
...
@@ -202,14 +179,16 @@ static int extract_header(AVCodecContext *const avctx,
int
palette_size
=
avctx
->
extradata_size
-
AV_RB16
(
avctx
->
extradata
);
if
(
avpkt
)
{
int
image_size
;
if
(
avpkt
->
size
<
2
)
return
AVERROR_INVALIDDATA
;
image_size
=
avpkt
->
size
-
AV_RB16
(
avpkt
->
data
);
buf
=
avpkt
->
data
;
buf_size
=
bytestream_get_be16
(
&
buf
);
if
(
buf_size
<=
1
||
get_image_size
(
avpkt
)
<=
1
)
{
if
(
buf_size
<=
1
||
image_size
<=
1
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid image size received: %u -> image data offset: %d
\n
"
,
buf_size
,
get_image_size
(
avpkt
)
);
buf_size
,
image_size
);
return
AVERROR_INVALIDDATA
;
}
}
else
{
...
...
@@ -439,8 +418,8 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
AVPacket
*
avpkt
)
{
IffContext
*
s
=
avctx
->
priv_data
;
const
uint8_t
*
buf
=
avpkt
->
size
>=
2
?
get_image_data
(
avpkt
)
:
NULL
;
const
int
buf_size
=
avpkt
->
size
>=
2
?
get_image_size
(
avpkt
)
:
0
;
const
uint8_t
*
buf
=
avpkt
->
size
>=
2
?
avpkt
->
data
+
AV_RB16
(
avpkt
->
data
)
:
NULL
;
const
int
buf_size
=
avpkt
->
size
>=
2
?
avpkt
->
size
-
AV_RB16
(
avpkt
->
data
)
:
0
;
const
uint8_t
*
buf_end
=
buf
+
buf_size
;
int
y
,
plane
,
res
;
...
...
@@ -516,8 +495,8 @@ static int decode_frame_byterun1(AVCodecContext *avctx,
AVPacket
*
avpkt
)
{
IffContext
*
s
=
avctx
->
priv_data
;
const
uint8_t
*
buf
=
avpkt
->
size
>=
2
?
get_image_data
(
avpkt
)
:
NULL
;
const
int
buf_size
=
avpkt
->
size
>=
2
?
get_image_size
(
avpkt
)
:
0
;
const
uint8_t
*
buf
=
avpkt
->
size
>=
2
?
avpkt
->
data
+
AV_RB16
(
avpkt
->
data
)
:
NULL
;
const
int
buf_size
=
avpkt
->
size
>=
2
?
avpkt
->
size
-
AV_RB16
(
avpkt
->
data
)
:
0
;
const
uint8_t
*
buf_end
=
buf
+
buf_size
;
int
y
,
plane
,
res
;
...
...
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