aboutsummaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMike Melanson2004-03-14 04:04:08 +0000
committerMike Melanson2004-03-14 04:04:08 +0000
commit3a278992bdd8138eeefc9df06878703480f27b1b (patch)
tree6891b1a6c885f6c5dd68843695739c53c8741c9b /libavcodec
parent9eef2b77b29189606148e1fdf5d6c8d7b52b08b0 (diff)
remove numerous definitions of BE_*/LE_* macros; convert FOURCC_TAG ->
MKTAG/MKBETAG Originally committed as revision 2886 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/adpcm.c7
-rw-r--r--libavcodec/avcodec.h12
-rw-r--r--libavcodec/cinepak.c6
-rw-r--r--libavcodec/dpcm.c5
-rw-r--r--libavcodec/flicvideo.c6
-rw-r--r--libavcodec/msvideo1.c1
-rw-r--r--libavcodec/qtrle.c6
-rw-r--r--libavcodec/rpza.c6
-rw-r--r--libavcodec/smc.c5
-rw-r--r--libavcodec/svq3.c4
-rw-r--r--libavcodec/truemotion1.c2
-rw-r--r--libavcodec/vqavideo.c27
-rw-r--r--libavcodec/xan.c7
13 files changed, 22 insertions, 72 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 5933ffe992..2ce7dc87f5 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -45,13 +45,6 @@
#define BLKSIZE 1024
-#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
-#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
-#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \
- (((uint8_t*)(x))[2] << 16) | \
- (((uint8_t*)(x))[1] << 8) | \
- ((uint8_t*)(x))[0])
-
#define CLAMP_TO_SHORT(value) \
if (value > 32767) \
value = 32767; \
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index cbc65dfc6a..53307882e6 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2118,6 +2118,18 @@ extern int av_log_get_level(void);
extern void av_log_set_level(int);
extern void av_log_set_callback(void (*)(void*, int, const char*, va_list));
+/* endian macros */
+#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
+#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
+ (((uint8_t*)(x))[1] << 16) | \
+ (((uint8_t*)(x))[2] << 8) | \
+ ((uint8_t*)(x))[3])
+#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
+#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \
+ (((uint8_t*)(x))[2] << 16) | \
+ (((uint8_t*)(x))[1] << 8) | \
+ ((uint8_t*)(x))[0])
+
#ifdef __cplusplus
}
#endif
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c
index e8d3efc3c0..412db7f7e5 100644
--- a/libavcodec/cinepak.c
+++ b/libavcodec/cinepak.c
@@ -37,12 +37,6 @@
#define PALETTE_COUNT 256
-#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
-#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
- (((uint8_t*)(x))[1] << 16) | \
- (((uint8_t*)(x))[2] << 8) | \
- ((uint8_t*)(x))[3])
-
typedef struct {
uint8_t y0, y1, y2, y3;
uint8_t u, v;
diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c
index b59a9cd6b8..b80604e5f4 100644
--- a/libavcodec/dpcm.c
+++ b/libavcodec/dpcm.c
@@ -44,11 +44,6 @@ typedef struct DPCMContext {
#define SATURATE_S16(x) if (x < -32768) x = -32768; \
else if (x > 32767) x = 32767;
#define SE_16BIT(x) if (x & 0x8000) x -= 0x10000;
-#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
-#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \
- (((uint8_t*)(x))[2] << 16) | \
- (((uint8_t*)(x))[1] << 8) | \
- ((uint8_t*)(x))[0])
static int interplay_delta_table[] = {
0, 1, 2, 3, 4, 5, 6, 7,
diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
index 248fc843a3..99825cebc2 100644
--- a/libavcodec/flicvideo.c
+++ b/libavcodec/flicvideo.c
@@ -51,12 +51,6 @@
#define FLI_COPY 16
#define FLI_MINI 18
-#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
-#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \
- (((uint8_t*)(x))[2] << 16) | \
- (((uint8_t*)(x))[1] << 8) | \
- ((uint8_t*)(x))[0])
-
typedef struct FlicDecodeContext {
AVCodecContext *avctx;
AVFrame frame;
diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c
index 3190efb9ef..b88bdab5de 100644
--- a/libavcodec/msvideo1.c
+++ b/libavcodec/msvideo1.c
@@ -39,7 +39,6 @@
#include "dsputil.h"
#define PALETTE_COUNT 256
-#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
#define CHECK_STREAM_PTR(n) \
if ((stream_ptr + n) > s->size ) { \
av_log(s->avctx, AV_LOG_ERROR, " MS Video-1 warning: stream_ptr out of bounds (%d >= %d)\n", \
diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
index 29e777b31f..55fa98663d 100644
--- a/libavcodec/qtrle.c
+++ b/libavcodec/qtrle.c
@@ -26,8 +26,8 @@
*
* The QT RLE decoder has seven modes of operation:
* 1, 2, 4, 8, 16, 24, and 32 bits per pixel. For modes 1, 2, 4, and 8
- * the decoder outputs PAL8 colorspace data. 16-bit data yields RGB24
- * data. 24-bit data is RGB888 and 32-bit data is RGBA32.
+ * the decoder outputs PAL8 colorspace data. 16-bit data yields RGB555
+ * data. 24-bit data is RGB24 and 32-bit data is RGBA32.
*/
#include <stdio.h>
@@ -50,8 +50,6 @@ typedef struct QtrleContext {
} QtrleContext;
-#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
-
#define CHECK_STREAM_PTR(n) \
if ((stream_ptr + n) > s->size) { \
av_log (s->avctx, AV_LOG_INFO, "Problem: stream_ptr out of bounds (%d >= %d)\n", \
diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c
index 965fb729b0..1c429f6244 100644
--- a/libavcodec/rpza.c
+++ b/libavcodec/rpza.c
@@ -53,12 +53,6 @@ typedef struct RpzaContext {
} RpzaContext;
-#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
-#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
- (((uint8_t*)(x))[1] << 16) | \
- (((uint8_t*)(x))[2] << 8) | \
- ((uint8_t*)(x))[3])
-
#define ADVANCE_BLOCK() \
{ \
pixel_ptr += 4; \
diff --git a/libavcodec/smc.c b/libavcodec/smc.c
index 2f6f3850a2..87db500053 100644
--- a/libavcodec/smc.c
+++ b/libavcodec/smc.c
@@ -61,11 +61,6 @@ typedef struct SmcContext {
} SmcContext;
-#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
-#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
- (((uint8_t*)(x))[1] << 16) | \
- (((uint8_t*)(x))[2] << 8) | \
- ((uint8_t*)(x))[3])
#define GET_BLOCK_COUNT() \
(opcode & 0x10) ? (1 + s->buf[stream_ptr++]) : 1 + (opcode & 0x0F);
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 1e73a3ff12..34ae368881 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -799,9 +799,7 @@ static int svq3_decode_frame (AVCodecContext *avctx,
break;
extradata++;
}
-
- size = (extradata[4] << 24) | (extradata[5] << 16) |
- (extradata[6] << 8) | extradata[7];
+ size = BE_32(&extradata[4]);
/* if a match was found, parse the extra data */
if (!memcmp (extradata, "SEQH", 4)) {
diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index b0a8562ad7..35bf3a788b 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -41,8 +41,6 @@
#include "truemotion1data.h"
-#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
-
typedef struct TrueMotion1Context {
AVCodecContext *avctx;
AVFrame frame;
diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c
index 97cbbd6d93..ea86fb1086 100644
--- a/libavcodec/vqavideo.c
+++ b/libavcodec/vqavideo.c
@@ -82,26 +82,13 @@
#define MAX_VECTORS (MAX_CODEBOOK_VECTORS + SOLID_PIXEL_VECTORS)
#define MAX_CODEBOOK_SIZE (MAX_VECTORS * 4 * 4)
-#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
-#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
-#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
- (((uint8_t*)(x))[1] << 16) | \
- (((uint8_t*)(x))[2] << 8) | \
- ((uint8_t*)(x))[3])
-
-#define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \
- ( (long)(unsigned char)(ch3) | \
- ( (long)(unsigned char)(ch2) << 8 ) | \
- ( (long)(unsigned char)(ch1) << 16 ) | \
- ( (long)(unsigned char)(ch0) << 24 ) )
-
-#define CBF0_TAG FOURCC_TAG('C', 'B', 'F', '0')
-#define CBFZ_TAG FOURCC_TAG('C', 'B', 'F', 'Z')
-#define CBP0_TAG FOURCC_TAG('C', 'B', 'P', '0')
-#define CBPZ_TAG FOURCC_TAG('C', 'B', 'P', 'Z')
-#define CPL0_TAG FOURCC_TAG('C', 'P', 'L', '0')
-#define CPLZ_TAG FOURCC_TAG('C', 'P', 'L', 'Z')
-#define VPTZ_TAG FOURCC_TAG('V', 'P', 'T', 'Z')
+#define CBF0_TAG MKBETAG('C', 'B', 'F', '0')
+#define CBFZ_TAG MKBETAG('C', 'B', 'F', 'Z')
+#define CBP0_TAG MKBETAG('C', 'B', 'P', '0')
+#define CBPZ_TAG MKBETAG('C', 'B', 'P', 'Z')
+#define CPL0_TAG MKBETAG('C', 'P', 'L', '0')
+#define CPLZ_TAG MKBETAG('C', 'P', 'L', 'Z')
+#define VPTZ_TAG MKBETAG('V', 'P', 'T', 'Z')
#define VQA_DEBUG 0
diff --git a/libavcodec/xan.c b/libavcodec/xan.c
index 4dad2e2141..f98a06bca9 100644
--- a/libavcodec/xan.c
+++ b/libavcodec/xan.c
@@ -58,13 +58,6 @@ typedef struct XanContext {
} XanContext;
-#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
-#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0])
-#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \
- (((uint8_t*)(x))[2] << 16) | \
- (((uint8_t*)(x))[1] << 8) | \
- ((uint8_t*)(x))[0])
-
/* RGB -> YUV conversion stuff */
#define SCALEFACTOR 65536
#define CENTERSAMPLE 128