]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/s3tc.c
eacdata: fix a memleak, return partial packets and use proper return values.
[ffmpeg] / libavcodec / s3tc.c
index 544ee42b2555a1bfc968cda962a5dc0e8b26c433..546ee2156f548d83cc2392e380e079df19710e89 100644 (file)
@@ -2,6 +2,8 @@
  * S3 Texture Compression (S3TC) decoding functions
  * Copyright (c) 2007 by Ivo van Poorten
  *
+ * see also: http://wiki.multimedia.cx/index.php?title=S3TC
+ *
  * This file is part of FFmpeg.
  *
  * FFmpeg is free software; you can redistribute it and/or
  * You should have received a copy of the GNU Lesser General Public
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * See also: http://wiki.multimedia.cx/index.php?title=S3TC
  */
 
+#include "libavutil/intreadwrite.h"
 #include "avcodec.h"
 #include "s3tc.h"
 
@@ -31,8 +32,8 @@ static inline void dxt1_decode_pixels(const uint8_t *s, uint32_t *d,
     unsigned int rb0, rb1, rb2, rb3, g0, g1, g2, g3;
     uint32_t colors[4], pixels;
 
-    c0 = le2me_16(*(uint16_t *)(s));
-    c1 = le2me_16(*(uint16_t *)(s+2));
+    c0 = AV_RL16(s);
+    c1 = AV_RL16(s+2);
 
     rb0  = (c0<<3 | c0<<8) & 0xf800f8;
     rb1  = (c1<<3 | c1<<8) & 0xf800f8;
@@ -60,7 +61,7 @@ static inline void dxt1_decode_pixels(const uint8_t *s, uint32_t *d,
 
     colors[2] = rb2 + g2 + a;
 
-    pixels = le2me_32(*(uint32_t *)(s+4));
+    pixels = AV_RL32(s+4);
     for (y=0; y<4; y++) {
         for (x=0; x<4; x++) {
             a        = (alpha & 0x0f) << 28;