aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/iff.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-05-09 23:58:20 +0200
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2011-05-11 00:01:05 +0200
commit70b10db24cb4e65e3b7a97e7f9bedbf67a6c4373 (patch)
tree8064e162344db5693cc99feb95f4e7805170a22f /libavcodec/iff.c
parent8b1171e93efaf60b24e209e64ea11bd9cbdeeb2e (diff)
downloadffmpeg-70b10db24cb4e65e3b7a97e7f9bedbf67a6c4373.tar.gz
iff: remove get_image_data() and get_image_size() wrappers
Remove one level of indirection, simplify code.
Diffstat (limited to 'libavcodec/iff.c')
-rw-r--r--libavcodec/iff.c37
1 files changed, 8 insertions, 29 deletions
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 3ca8233281..195ef10ac7 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -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;