summaryrefslogtreecommitdiff
path: root/libavcodec/targa.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2011-06-27 19:05:49 +0200
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2011-06-28 18:48:35 +0200
commitefdb198e00bf4cf21023db6f47f16aab6ee31393 (patch)
tree355dc1960ecf69dba33c70a35eeb193e01b4cb17 /libavcodec/targa.c
parent512933671409f9f88cc9fdfc8f29525d32240bab (diff)
targa: Simplify using bytestream_get functions.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavcodec/targa.c')
-rw-r--r--libavcodec/targa.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/libavcodec/targa.c b/libavcodec/targa.c
index 41741ff9c5..7418f92d1b 100644
--- a/libavcodec/targa.c
+++ b/libavcodec/targa.c
@@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
+#include "bytestream.h"
#include "targa.h"
typedef struct TargaContext {
@@ -116,13 +117,13 @@ static int decode_frame(AVCodecContext *avctx,
idlen = *buf++;
buf++; /* pal */
compr = *buf++;
- first_clr = AV_RL16(buf); buf += 2;
- colors = AV_RL16(buf); buf += 2;
+ first_clr = bytestream_get_le16(&buf);
+ colors = bytestream_get_le16(&buf);
csize = *buf++;
buf += 2; /* x */
- y = AV_RL16(buf); buf += 2;
- w = AV_RL16(buf); buf += 2;
- h = AV_RL16(buf); buf += 2;
+ y = bytestream_get_le16(&buf);
+ w = bytestream_get_le16(&buf);
+ h = bytestream_get_le16(&buf);
bpp = *buf++;
flags = *buf++;
//skip identifier if any
@@ -186,13 +187,10 @@ static int decode_frame(AVCodecContext *avctx,
if(avctx->pix_fmt != PIX_FMT_PAL8)//should not occur but skip palette anyway
buf += pal_size;
else{
- int r, g, b, t;
+ int t;
int32_t *pal = ((int32_t*)p->data[1]) + first_clr;
for(t = 0; t < colors; t++){
- b = *buf++;
- g = *buf++;
- r = *buf++;
- *pal++ = (0xff<<24) | (r << 16) | (g << 8) | b;
+ *pal++ = (0xff<<24) | bytestream_get_le24(&buf);
}
p->palette_has_changed = 1;
}