changeset 4364:05e932ddaaa9 libavcodec

rename BE/LE_8/16/32 to AV_RL/B_8/16/32
author alex
date Fri, 19 Jan 2007 22:12:59 +0000
parents 9b7662fa4905
children 9cebff821565
files adpcm.c alac.c avs.c bitstream_filter.c bytestream.h cinepak.c dpcm.c dsicinav.c dvbsubdec.c flicvideo.c fraps.c h264.c kmvc.c loco.c mjpeg.c mmvideo.c msvideo1.c nuv.c qdm2.c qdrw.c qtrle.c rpza.c rv10.c smacker.c smc.c svq3.c targa.c tiff.c truemotion1.c truemotion2.c truespeech.c tscc.c vc1.c vmdav.c vmnc.c vp6.c vqavideo.c wavpack.c ws-snd1.c xan.c xl.c zmbv.c
diffstat 42 files changed, 237 insertions(+), 237 deletions(-) [+]
line wrap: on
line diff
--- a/adpcm.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/adpcm.c	Fri Jan 19 22:12:59 2007 +0000
@@ -1100,19 +1100,19 @@
         }
         break;
     case CODEC_ID_ADPCM_EA:
-        samples_in_chunk = LE_32(src);
+        samples_in_chunk = AV_RL32(src);
         if (samples_in_chunk >= ((buf_size - 12) * 2)) {
             src += buf_size;
             break;
         }
         src += 4;
-        current_left_sample = (int16_t)LE_16(src);
+        current_left_sample = (int16_t)AV_RL16(src);
         src += 2;
-        previous_left_sample = (int16_t)LE_16(src);
+        previous_left_sample = (int16_t)AV_RL16(src);
         src += 2;
-        current_right_sample = (int16_t)LE_16(src);
+        current_right_sample = (int16_t)AV_RL16(src);
         src += 2;
-        previous_right_sample = (int16_t)LE_16(src);
+        previous_right_sample = (int16_t)AV_RL16(src);
         src += 2;
 
         for (count1 = 0; count1 < samples_in_chunk/28;count1++) {
--- a/alac.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/alac.c	Fri Jan 19 22:12:59 2007 +0000
@@ -110,11 +110,11 @@
     ptr += 4; /* alac */
     ptr += 4; /* 0 ? */
 
-    if(BE_32(ptr) >= UINT_MAX/4){
+    if(AV_RB32(ptr) >= UINT_MAX/4){
         av_log(alac->avctx, AV_LOG_ERROR, "setinfo_max_samples_per_frame too large\n");
         return -1;
     }
-    alac->setinfo_max_samples_per_frame = BE_32(ptr); /* buffer size / 2 ? */
+    alac->setinfo_max_samples_per_frame = AV_RB32(ptr); /* buffer size / 2 ? */
     ptr += 4;
     alac->setinfo_7a = *ptr++;
     alac->setinfo_sample_size = *ptr++;
@@ -122,13 +122,13 @@
     alac->setinfo_rice_initialhistory = *ptr++;
     alac->setinfo_rice_kmodifier = *ptr++;
     alac->setinfo_7f = *ptr++; // channels?
-    alac->setinfo_80 = BE_16(ptr);
+    alac->setinfo_80 = AV_RB16(ptr);
     ptr += 2;
-    alac->setinfo_82 = BE_32(ptr); // max coded frame size
+    alac->setinfo_82 = AV_RB32(ptr); // max coded frame size
     ptr += 4;
-    alac->setinfo_86 = BE_32(ptr); // bitrate ?
+    alac->setinfo_86 = AV_RB32(ptr); // bitrate ?
     ptr += 4;
-    alac->setinfo_8a_rate = BE_32(ptr); // samplerate
+    alac->setinfo_8a_rate = AV_RB32(ptr); // samplerate
     ptr += 4;
 
     allocate_buffers(alac);
--- a/avs.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/avs.c	Fri Jan 19 22:12:59 2007 +0000
@@ -74,8 +74,8 @@
         int first, last;
         uint32_t *pal = (uint32_t *) avs->picture.data[1];
 
-        first = LE_16(buf);
-        last = first + LE_16(buf + 2);
+        first = AV_RL16(buf);
+        last = first + AV_RL16(buf + 2);
         buf += 4;
         for (i=first; i<last; i++, buf+=3)
             pal[i] = (buf[0] << 18) | (buf[1] << 10) | (buf[2] << 2);
--- a/bitstream_filter.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/bitstream_filter.c	Fri Jan 19 22:12:59 2007 +0000
@@ -138,7 +138,7 @@
         return -1;
     }
 
-    header = BE_32(buf);
+    header = AV_RB32(buf);
     mode_extension= (header>>4)&3;
 
     if(ff_mpa_check_header(header) < 0 || (header&0x60000) != 0x20000){
@@ -160,7 +160,7 @@
         av_log(avctx, AV_LOG_ERROR, "Extradata invalid\n");
         return -1;
     }
-    extraheader = BE_32(avctx->extradata+11);
+    extraheader = AV_RB32(avctx->extradata+11);
     if((extraheader&MP3_MASK) != (header&MP3_MASK))
         goto output_unchanged;
 
@@ -192,7 +192,7 @@
     int sample_rate_index=0;
     int lsf, mpeg25, bitrate_index, frame_size;
 
-    header = BE_32(buf);
+    header = AV_RB32(buf);
     if(ff_mpa_check_header(header) >= 0){
         *poutbuf= (uint8_t *) buf;
         *poutbuf_size= buf_size;
@@ -205,7 +205,7 @@
         return -1;
     }
 
-    header= BE_32(avctx->extradata+11) & MP3_MASK;
+    header= AV_RB32(avctx->extradata+11) & MP3_MASK;
 
     lsf     = sample_rate < (24000+32000)/2;
     mpeg25  = sample_rate < (12000+16000)/2;
--- a/bytestream.h	Fri Jan 19 12:41:56 2007 +0000
+++ b/bytestream.h	Fri Jan 19 22:12:59 2007 +0000
@@ -25,13 +25,13 @@
 static av_always_inline unsigned int bytestream_get_le32(uint8_t **b)
 {
     (*b) += 4;
-    return LE_32(*b - 4);
+    return AV_RL32(*b - 4);
 }
 
 static av_always_inline unsigned int bytestream_get_le16(uint8_t **b)
 {
     (*b) += 2;
-    return LE_16(*b - 2);
+    return AV_RL16(*b - 2);
 }
 
 static av_always_inline unsigned int bytestream_get_byte(uint8_t **b)
--- a/cinepak.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/cinepak.c	Fri Jan 19 22:12:59 2007 +0000
@@ -90,7 +90,7 @@
             if ((data + 4) > eod)
                 break;
 
-            flag  = BE_32 (data);
+            flag  = AV_RB32 (data);
             data += 4;
             mask  = 0x80000000;
         }
@@ -152,7 +152,7 @@
                 if ((data + 4) > eod)
                     return -1;
 
-                flag  = BE_32 (data);
+                flag  = AV_RB32 (data);
                 data += 4;
                 mask  = 0x80000000;
             }
@@ -162,7 +162,7 @@
                     if ((data + 4) > eod)
                         return -1;
 
-                    flag  = BE_32 (data);
+                    flag  = AV_RB32 (data);
                     data += 4;
                     mask  = 0x80000000;
                 }
@@ -278,8 +278,8 @@
         return -1;
 
     while ((data + 4) <= eod) {
-        chunk_id   = BE_16 (&data[0]);
-        chunk_size = BE_16 (&data[2]) - 4;
+        chunk_id   = AV_RB16 (&data[0]);
+        chunk_size = AV_RB16 (&data[2]) - 4;
         if(chunk_size < 0)
             return -1;
 
@@ -328,8 +328,8 @@
         return -1;
 
     frame_flags = s->data[0];
-    num_strips  = BE_16 (&s->data[8]);
-    encoded_buf_size = ((s->data[1] << 16) | BE_16 (&s->data[2]));
+    num_strips  = AV_RB16 (&s->data[8]);
+    encoded_buf_size = ((s->data[1] << 16) | AV_RB16 (&s->data[2]));
 
     /* if this is the first frame, check for deviant Sega FILM data */
     if (s->sega_film_skip_bytes == -1) {
@@ -361,13 +361,13 @@
         if ((s->data + 12) > eod)
             return -1;
 
-        s->strips[i].id = BE_16 (s->data);
+        s->strips[i].id = AV_RB16 (s->data);
         s->strips[i].y1 = y0;
         s->strips[i].x1 = 0;
-        s->strips[i].y2 = y0 + BE_16 (&s->data[8]);
+        s->strips[i].y2 = y0 + AV_RB16 (&s->data[8]);
         s->strips[i].x2 = s->avctx->width;
 
-        strip_size = BE_16 (&s->data[2]) - 12;
+        strip_size = AV_RB16 (&s->data[2]) - 12;
         s->data   += 12;
         strip_size = ((s->data + strip_size) > eod) ? (eod - s->data) : strip_size;
 
--- a/dpcm.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/dpcm.c	Fri Jan 19 22:12:59 2007 +0000
@@ -179,7 +179,7 @@
 
     case CODEC_ID_ROQ_DPCM:
         if (s->channels == 1)
-            predictor[0] = LE_16(&buf[6]);
+            predictor[0] = AV_RL16(&buf[6]);
         else {
             predictor[0] = buf[7] << 8;
             predictor[1] = buf[6] << 8;
@@ -200,12 +200,12 @@
 
     case CODEC_ID_INTERPLAY_DPCM:
         in = 6;  /* skip over the stream mask and stream length */
-        predictor[0] = LE_16(&buf[in]);
+        predictor[0] = AV_RL16(&buf[in]);
         in += 2;
         SE_16BIT(predictor[0])
         output_samples[out++] = predictor[0];
         if (s->channels == 2) {
-            predictor[1] = LE_16(&buf[in]);
+            predictor[1] = AV_RL16(&buf[in]);
             in += 2;
             SE_16BIT(predictor[1])
             output_samples[out++] = predictor[1];
@@ -225,11 +225,11 @@
     case CODEC_ID_XAN_DPCM:
         in = 0;
         shift[0] = shift[1] = 4;
-        predictor[0] = LE_16(&buf[in]);
+        predictor[0] = AV_RL16(&buf[in]);
         in += 2;
         SE_16BIT(predictor[0]);
         if (s->channels == 2) {
-            predictor[1] = LE_16(&buf[in]);
+            predictor[1] = AV_RL16(&buf[in]);
             in += 2;
             SE_16BIT(predictor[1]);
         }
--- a/dsicinav.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/dsicinav.c	Fri Jan 19 22:12:59 2007 +0000
@@ -159,7 +159,7 @@
             if (code & (1 << i)) {
                 *dst++ = *src++;
             } else {
-                cmd = LE_16(src); src += 2;
+                cmd = AV_RL16(src); src += 2;
                 offset = cmd >> 4;
                 sz = (cmd & 0xF) + 2;
                 /* don't use memcpy/memmove here as the decoding routine (ab)uses */
@@ -321,7 +321,7 @@
 
     if (cin->initial_decode_frame) {
         cin->initial_decode_frame = 0;
-        cin->delta = (int16_t)LE_16(src); src += 2;
+        cin->delta = (int16_t)AV_RL16(src); src += 2;
         *samples++ = cin->delta;
         buf_size -= 2;
     }
--- a/dvbsubdec.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/dvbsubdec.c	Fri Jan 19 22:12:59 2007 +0000
@@ -851,7 +851,7 @@
 
     int coding_method, non_modifying_colour;
 
-    object_id = BE_16(buf);
+    object_id = AV_RB16(buf);
     buf += 2;
 
     object = get_object(ctx, object_id);
@@ -863,9 +863,9 @@
     non_modifying_colour = ((*buf++) >> 1) & 1;
 
     if (coding_method == 0) {
-        top_field_len = BE_16(buf);
+        top_field_len = AV_RB16(buf);
         buf += 2;
-        bottom_field_len = BE_16(buf);
+        bottom_field_len = AV_RB16(buf);
         buf += 2;
 
         if (buf + top_field_len + bottom_field_len > buf_end) {
@@ -1042,9 +1042,9 @@
 
     fill = ((*buf++) >> 3) & 1;
 
-    region->width = BE_16(buf);
+    region->width = AV_RB16(buf);
     buf += 2;
-    region->height = BE_16(buf);
+    region->height = AV_RB16(buf);
     buf += 2;
 
     if (region->width * region->height != region->buf_size) {
@@ -1086,7 +1086,7 @@
     delete_region_display_list(ctx, region);
 
     while (buf + 5 < buf_end) {
-        object_id = BE_16(buf);
+        object_id = AV_RB16(buf);
         buf += 2;
 
         object = get_object(ctx, object_id);
@@ -1106,9 +1106,9 @@
         display->object_id = object_id;
         display->region_id = region_id;
 
-        display->x_pos = BE_16(buf) & 0xfff;
+        display->x_pos = AV_RB16(buf) & 0xfff;
         buf += 2;
-        display->y_pos = BE_16(buf) & 0xfff;
+        display->y_pos = AV_RB16(buf) & 0xfff;
         buf += 2;
 
         if ((object->type == 1 || object->type == 2) && buf+1 < buf_end) {
@@ -1171,9 +1171,9 @@
 
         display->region_id = region_id;
 
-        display->x_pos = BE_16(buf);
+        display->x_pos = AV_RB16(buf);
         buf += 2;
-        display->y_pos = BE_16(buf);
+        display->y_pos = AV_RB16(buf);
         buf += 2;
 
         *tmp_ptr = display->next;
@@ -1405,9 +1405,9 @@
     {
         p += 1;
         segment_type = *p++;
-        page_id = BE_16(p);
+        page_id = AV_RB16(p);
         p += 2;
-        segment_length = BE_16(p);
+        segment_length = AV_RB16(p);
         p += 2;
 
         if (page_id == ctx->composition_id || page_id == ctx->ancillary_id) {
@@ -1576,7 +1576,7 @@
         {
             if (p + 6 <= p_end)
             {
-                len = BE_16(p + 4);
+                len = AV_RB16(p + 4);
 
                 if (p + len + 6 <= p_end)
                 {
--- a/flicvideo.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/flicvideo.c	Fri Jan 19 22:12:59 2007 +0000
@@ -87,8 +87,8 @@
     s->avctx = avctx;
     avctx->has_b_frames = 0;
 
-    s->fli_type = LE_16(&fli_header[4]); /* Might be overridden if a Magic Carpet FLC */
-    depth       = LE_16(&fli_header[12]);
+    s->fli_type = AV_RL16(&fli_header[4]); /* Might be overridden if a Magic Carpet FLC */
+    depth       = AV_RL16(&fli_header[12]);
 
     if (depth == 0) {
       depth = 8; /* Some FLC generators set depth to zero, when they mean 8Bpp. Fix up here */
@@ -172,18 +172,18 @@
     pixels = s->frame.data[0];
     pixel_limit = s->avctx->height * s->frame.linesize[0];
 
-    frame_size = LE_32(&buf[stream_ptr]);
+    frame_size = AV_RL32(&buf[stream_ptr]);
     stream_ptr += 6;  /* skip the magic number */
-    num_chunks = LE_16(&buf[stream_ptr]);
+    num_chunks = AV_RL16(&buf[stream_ptr]);
     stream_ptr += 10;  /* skip padding */
 
     frame_size -= 16;
 
     /* iterate through the chunks */
     while ((frame_size > 0) && (num_chunks > 0)) {
-        chunk_size = LE_32(&buf[stream_ptr]);
+        chunk_size = AV_RL32(&buf[stream_ptr]);
         stream_ptr += 4;
-        chunk_type = LE_16(&buf[stream_ptr]);
+        chunk_type = AV_RL16(&buf[stream_ptr]);
         stream_ptr += 2;
 
         switch (chunk_type) {
@@ -200,7 +200,7 @@
             else
                 color_shift = 2;
             /* set up the palette */
-            color_packets = LE_16(&buf[stream_ptr]);
+            color_packets = AV_RL16(&buf[stream_ptr]);
             stream_ptr += 2;
             palette_ptr = 0;
             for (i = 0; i < color_packets; i++) {
@@ -241,10 +241,10 @@
 
         case FLI_DELTA:
             y_ptr = 0;
-            compressed_lines = LE_16(&buf[stream_ptr]);
+            compressed_lines = AV_RL16(&buf[stream_ptr]);
             stream_ptr += 2;
             while (compressed_lines > 0) {
-                line_packets = LE_16(&buf[stream_ptr]);
+                line_packets = AV_RL16(&buf[stream_ptr]);
                 stream_ptr += 2;
                 if ((line_packets & 0xC000) == 0xC000) {
                     // line skip opcode
@@ -290,12 +290,12 @@
 
         case FLI_LC:
             /* line compressed */
-            starting_line = LE_16(&buf[stream_ptr]);
+            starting_line = AV_RL16(&buf[stream_ptr]);
             stream_ptr += 2;
             y_ptr = 0;
             y_ptr += starting_line * s->frame.linesize[0];
 
-            compressed_lines = LE_16(&buf[stream_ptr]);
+            compressed_lines = AV_RL16(&buf[stream_ptr]);
             stream_ptr += 2;
             while (compressed_lines > 0) {
                 pixel_ptr = y_ptr;
@@ -466,18 +466,18 @@
     pixels = s->frame.data[0];
     pixel_limit = s->avctx->height * s->frame.linesize[0];
 
-    frame_size = LE_32(&buf[stream_ptr]);
+    frame_size = AV_RL32(&buf[stream_ptr]);
     stream_ptr += 6;  /* skip the magic number */
-    num_chunks = LE_16(&buf[stream_ptr]);
+    num_chunks = AV_RL16(&buf[stream_ptr]);
     stream_ptr += 10;  /* skip padding */
 
     frame_size -= 16;
 
     /* iterate through the chunks */
     while ((frame_size > 0) && (num_chunks > 0)) {
-        chunk_size = LE_32(&buf[stream_ptr]);
+        chunk_size = AV_RL32(&buf[stream_ptr]);
         stream_ptr += 4;
-        chunk_type = LE_16(&buf[stream_ptr]);
+        chunk_type = AV_RL16(&buf[stream_ptr]);
         stream_ptr += 2;
 
         switch (chunk_type) {
@@ -492,10 +492,10 @@
         case FLI_DELTA:
         case FLI_DTA_LC:
             y_ptr = 0;
-            compressed_lines = LE_16(&buf[stream_ptr]);
+            compressed_lines = AV_RL16(&buf[stream_ptr]);
             stream_ptr += 2;
             while (compressed_lines > 0) {
-                line_packets = LE_16(&buf[stream_ptr]);
+                line_packets = AV_RL16(&buf[stream_ptr]);
                 stream_ptr += 2;
                 if (line_packets < 0) {
                     line_packets = -line_packets;
@@ -512,7 +512,7 @@
                         byte_run = (signed char)(buf[stream_ptr++]);
                         if (byte_run < 0) {
                             byte_run = -byte_run;
-                            pixel    = LE_16(&buf[stream_ptr]);
+                            pixel    = AV_RL16(&buf[stream_ptr]);
                             stream_ptr += 2;
                             CHECK_PIXEL_PTR(byte_run);
                             for (j = 0; j < byte_run; j++, pixel_countdown -= 2) {
@@ -522,7 +522,7 @@
                         } else {
                             CHECK_PIXEL_PTR(byte_run);
                             for (j = 0; j < byte_run; j++, pixel_countdown--) {
-                                *((signed short*)(&pixels[pixel_ptr])) = LE_16(&buf[stream_ptr]);
+                                *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[stream_ptr]);
                                 stream_ptr += 2;
                                 pixel_ptr += 2;
                             }
@@ -586,12 +586,12 @@
                  * a second pass over the line here, swapping the bytes.
                  */
                 pixel = 0xFF00;
-                if (0xFF00 != LE_16(&pixel)) /* Check if its not an LE Target */
+                if (0xFF00 != AV_RL16(&pixel)) /* Check if its not an LE Target */
                 {
                   pixel_ptr = y_ptr;
                   pixel_countdown = s->avctx->width;
                   while (pixel_countdown > 0) {
-                    *((signed short*)(&pixels[pixel_ptr])) = LE_16(&buf[pixel_ptr]);
+                    *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[pixel_ptr]);
                     pixel_ptr += 2;
                   }
                 }
@@ -611,7 +611,7 @@
                 while (pixel_countdown > 0) {
                     byte_run = (signed char)(buf[stream_ptr++]);
                     if (byte_run > 0) {
-                        pixel    = LE_16(&buf[stream_ptr]);
+                        pixel    = AV_RL16(&buf[stream_ptr]);
                         stream_ptr += 2;
                         CHECK_PIXEL_PTR(byte_run);
                         for (j = 0; j < byte_run; j++) {
@@ -626,7 +626,7 @@
                         byte_run = -byte_run;
                         CHECK_PIXEL_PTR(byte_run);
                         for (j = 0; j < byte_run; j++) {
-                            *((signed short*)(&pixels[pixel_ptr])) = LE_16(&buf[stream_ptr]);
+                            *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[stream_ptr]);
                             stream_ptr += 2;
                             pixel_ptr  += 2;
                             pixel_countdown--;
@@ -656,7 +656,7 @@
                     pixel_countdown = s->avctx->width;
                     pixel_ptr = 0;
                     while (pixel_countdown > 0) {
-                      *((signed short*)(&pixels[y_ptr + pixel_ptr])) = LE_16(&buf[stream_ptr+pixel_ptr]);
+                      *((signed short*)(&pixels[y_ptr + pixel_ptr])) = AV_RL16(&buf[stream_ptr+pixel_ptr]);
                       pixel_ptr += 2;
                       pixel_countdown--;
                     }
--- a/fraps.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/fraps.c	Fri Jan 19 22:12:59 2007 +0000
@@ -138,7 +138,7 @@
 
     for(i = 0; i < 256; i++){
         s->nodes[i].sym = i;
-        s->nodes[i].count = LE_32(src);
+        s->nodes[i].count = AV_RL32(src);
         s->nodes[i].n0 = -2;
         if(s->nodes[i].count < 0) {
             av_log(s->avctx, AV_LOG_ERROR, "Symbol count < 0\n");
@@ -215,7 +215,7 @@
     int i, is_chroma, planes;
 
 
-    header = LE_32(buf);
+    header = AV_RL32(buf);
     version = header & 0xff;
     header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */
 
@@ -337,12 +337,12 @@
         }
         f->pict_type = FF_I_TYPE;
         f->key_frame = 1;
-        if ((LE_32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) {
+        if ((AV_RL32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) {
             av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n");
             return -1;
         }
         for(i = 0; i < planes; i++) {
-            offs[i] = LE_32(buf + 4 + i * 4);
+            offs[i] = AV_RL32(buf + 4 + i * 4);
             if(offs[i] >= buf_size || (i && offs[i] <= offs[i - 1] + 1024)) {
                 av_log(avctx, AV_LOG_ERROR, "Fraps: plane %i offset is out of bounds\n", i);
                 return -1;
--- a/h264.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/h264.c	Fri Jan 19 22:12:59 2007 +0000
@@ -8215,7 +8215,7 @@
         cnt = *(p+5) & 0x1f; // Number of sps
         p += 6;
         for (i = 0; i < cnt; i++) {
-            nalsize = BE_16(p) + 2;
+            nalsize = AV_RB16(p) + 2;
             if(decode_nal_units(h, p, nalsize) < 0) {
                 av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC failed\n", i);
                 return -1;
@@ -8225,7 +8225,7 @@
         // Decode pps from avcC
         cnt = *(p++); // Number of pps
         for (i = 0; i < cnt; i++) {
-            nalsize = BE_16(p) + 2;
+            nalsize = AV_RB16(p) + 2;
             if(decode_nal_units(h, p, nalsize)  != nalsize) {
                 av_log(avctx, AV_LOG_ERROR, "Decoding pps %d from avcC failed\n", i);
                 return -1;
--- a/kmvc.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/kmvc.c	Fri Jan 19 22:12:59 2007 +0000
@@ -368,13 +368,13 @@
         av_log(NULL, 0, "Extradata missing, decoding may not work properly...\n");
         c->palsize = 127;
     } else {
-        c->palsize = LE_16(avctx->extradata + 10);
+        c->palsize = AV_RL16(avctx->extradata + 10);
     }
 
     if (avctx->extradata_size == 1036) {        // palette in extradata
         uint8_t *src = avctx->extradata + 12;
         for (i = 0; i < 256; i++) {
-            c->pal[i] = LE_32(src);
+            c->pal[i] = AV_RL32(src);
             src += 4;
         }
         c->setpal = 1;
--- a/loco.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/loco.c	Fri Jan 19 22:12:59 2007 +0000
@@ -237,20 +237,20 @@
                avctx->extradata_size);
         return -1;
     }
-    version = LE_32(avctx->extradata);
+    version = AV_RL32(avctx->extradata);
     switch(version) {
     case 1:
         l->lossy = 0;
         break;
     case 2:
-        l->lossy = LE_32(avctx->extradata + 8);
+        l->lossy = AV_RL32(avctx->extradata + 8);
         break;
     default:
-        l->lossy = LE_32(avctx->extradata + 8);
+        l->lossy = AV_RL32(avctx->extradata + 8);
         av_log(avctx, AV_LOG_INFO, "This is LOCO codec version %i, please upload file for study\n", version);
     }
 
-    l->mode = LE_32(avctx->extradata + 4);
+    l->mode = AV_RL32(avctx->extradata + 4);
     switch(l->mode) {
     case LOCO_CYUY2: case LOCO_YUY2: case LOCO_UYVY:
         avctx->pix_fmt = PIX_FMT_YUV422P;
--- a/mjpeg.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/mjpeg.c	Fri Jan 19 22:12:59 2007 +0000
@@ -2540,12 +2540,12 @@
                 break;
             case SOS:
                 bytestream_put_be32(&poutbufp, i + 46); /* scan off */
-                bytestream_put_be32(&poutbufp, i + 46 + BE_16(buf + i + 2)); /* data off */
+                bytestream_put_be32(&poutbufp, i + 46 + AV_RB16(buf + i + 2)); /* data off */
                 bytestream_put_buffer(&poutbufp, buf + 2, buf_size - 2); /* skip already written SOI */
                 *poutbuf_size = poutbufp - *poutbuf;
                 return 1;
             case APP1:
-                if (i + 8 < buf_size && LE_32(buf + i + 8) == ff_get_fourcc("mjpg")) {
+                if (i + 8 < buf_size && AV_RL32(buf + i + 8) == ff_get_fourcc("mjpg")) {
                     av_log(avctx, AV_LOG_ERROR, "bitstream already formatted\n");
                     memcpy(*poutbuf, buf, buf_size);
                     *poutbuf_size = buf_size;
--- a/mmvideo.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/mmvideo.c	Fri Jan 19 22:12:59 2007 +0000
@@ -110,7 +110,7 @@
 
 static void mm_decode_inter(MmContext * s, int half_horiz, int half_vert, const uint8_t *buf, int buf_size)
 {
-    const int data_ptr = 2 + LE_16(&buf[0]);
+    const int data_ptr = 2 + AV_RL16(&buf[0]);
     int d, r, y;
     d = data_ptr; r = 2; y = 0;
 
@@ -162,7 +162,7 @@
         palette_control->palette_changed = 0;
     }
 
-    type = LE_16(&buf[0]);
+    type = AV_RL16(&buf[0]);
     buf += MM_PREAMBLE_SIZE;
     buf_size -= MM_PREAMBLE_SIZE;
 
--- a/msvideo1.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/msvideo1.c	Fri Jan 19 22:12:59 2007 +0000
@@ -245,25 +245,25 @@
                 flags = (byte_b << 8) | byte_a;
 
                 CHECK_STREAM_PTR(4);
-                colors[0] = LE_16(&s->buf[stream_ptr]);
+                colors[0] = AV_RL16(&s->buf[stream_ptr]);
                 stream_ptr += 2;
-                colors[1] = LE_16(&s->buf[stream_ptr]);
+                colors[1] = AV_RL16(&s->buf[stream_ptr]);
                 stream_ptr += 2;
 
                 if (colors[0] & 0x8000) {
                     /* 8-color encoding */
                     CHECK_STREAM_PTR(12);
-                    colors[2] = LE_16(&s->buf[stream_ptr]);
+                    colors[2] = AV_RL16(&s->buf[stream_ptr]);
                     stream_ptr += 2;
-                    colors[3] = LE_16(&s->buf[stream_ptr]);
+                    colors[3] = AV_RL16(&s->buf[stream_ptr]);
                     stream_ptr += 2;
-                    colors[4] = LE_16(&s->buf[stream_ptr]);
+                    colors[4] = AV_RL16(&s->buf[stream_ptr]);
                     stream_ptr += 2;
-                    colors[5] = LE_16(&s->buf[stream_ptr]);
+                    colors[5] = AV_RL16(&s->buf[stream_ptr]);
                     stream_ptr += 2;
-                    colors[6] = LE_16(&s->buf[stream_ptr]);
+                    colors[6] = AV_RL16(&s->buf[stream_ptr]);
                     stream_ptr += 2;
-                    colors[7] = LE_16(&s->buf[stream_ptr]);
+                    colors[7] = AV_RL16(&s->buf[stream_ptr]);
                     stream_ptr += 2;
 
                     for (pixel_y = 0; pixel_y < 4; pixel_y++) {
--- a/nuv.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/nuv.c	Fri Jan 19 22:12:59 2007 +0000
@@ -64,9 +64,9 @@
         return -1;
     }
     for (i = 0; i < 64; i++, buf += 4)
-        c->lq[i] = LE_32(buf);
+        c->lq[i] = AV_RL32(buf);
     for (i = 0; i < 64; i++, buf += 4)
-        c->cq[i] = LE_32(buf);
+        c->cq[i] = AV_RL32(buf);
     return 0;
 }
 
--- a/qdm2.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/qdm2.c	Fri Jan 19 22:12:59 2007 +0000
@@ -1836,7 +1836,7 @@
     extradata += 8;
     extradata_size -= 8;
 
-    size = BE_32(extradata);
+    size = AV_RB32(extradata);
 
     if(size > extradata_size){
         av_log(avctx, AV_LOG_ERROR, "extradata size too small, %i < %i\n",
@@ -1846,29 +1846,29 @@
 
     extradata += 4;
     av_log(avctx, AV_LOG_DEBUG, "size: %d\n", size);
-    if (BE_32(extradata) != MKBETAG('Q','D','C','A')) {
+    if (AV_RB32(extradata) != MKBETAG('Q','D','C','A')) {
         av_log(avctx, AV_LOG_ERROR, "invalid extradata, expecting QDCA\n");
         return -1;
     }
 
     extradata += 8;
 
-    avctx->channels = s->nb_channels = s->channels = BE_32(extradata);
+    avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata);
     extradata += 4;
 
-    avctx->sample_rate = BE_32(extradata);
+    avctx->sample_rate = AV_RB32(extradata);
     extradata += 4;
 
-    avctx->bit_rate = BE_32(extradata);
+    avctx->bit_rate = AV_RB32(extradata);
     extradata += 4;
 
-    s->group_size = BE_32(extradata);
+    s->group_size = AV_RB32(extradata);
     extradata += 4;
 
-    s->fft_size = BE_32(extradata);
+    s->fft_size = AV_RB32(extradata);
     extradata += 4;
 
-    s->checksum_size = BE_32(extradata);
+    s->checksum_size = AV_RB32(extradata);
     extradata += 4;
 
     s->fft_order = av_log2(s->fft_size) + 1;
--- a/qdrw.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/qdrw.c	Fri Jan 19 22:12:59 2007 +0000
@@ -58,7 +58,7 @@
     outdata = a->pic.data[0];
 
     buf += 0x68; /* jump to palette */
-    colors = BE_32(buf);
+    colors = AV_RB32(buf);
     buf += 4;
 
     if(colors < 0 || colors > 256) {
@@ -68,7 +68,7 @@
 
     for (i = 0; i <= colors; i++) {
         unsigned int idx;
-        idx = BE_16(buf); /* color index */
+        idx = AV_RB16(buf); /* color index */
         buf += 2;
 
         if (idx > 255) {
@@ -93,7 +93,7 @@
 
         /* decode line */
         out = outdata;
-        size = BE_16(buf); /* size of packed line */
+        size = AV_RB16(buf); /* size of packed line */
         buf += 2;
         left = size;
         next = buf + size;
--- a/qtrle.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/qtrle.c	Fri Jan 19 22:12:59 2007 +0000
@@ -96,15 +96,15 @@
 
     /* fetch the header */
     CHECK_STREAM_PTR(2);
-    header = BE_16(&s->buf[stream_ptr]);
+    header = AV_RB16(&s->buf[stream_ptr]);
     stream_ptr += 2;
 
     /* if a header is present, fetch additional decoding parameters */
     if (header & 0x0008) {
         CHECK_STREAM_PTR(8);
-        start_line = BE_16(&s->buf[stream_ptr]);
+        start_line = AV_RB16(&s->buf[stream_ptr]);
         stream_ptr += 4;
-        lines_to_change = BE_16(&s->buf[stream_ptr]);
+        lines_to_change = AV_RB16(&s->buf[stream_ptr]);
         stream_ptr += 4;
     } else {
         start_line = 0;
@@ -187,15 +187,15 @@
 
     /* fetch the header */
     CHECK_STREAM_PTR(2);
-    header = BE_16(&s->buf[stream_ptr]);
+    header = AV_RB16(&s->buf[stream_ptr]);
     stream_ptr += 2;
 
     /* if a header is present, fetch additional decoding parameters */
     if (header & 0x0008) {
         CHECK_STREAM_PTR(8);
-        start_line = BE_16(&s->buf[stream_ptr]);
+        start_line = AV_RB16(&s->buf[stream_ptr]);
         stream_ptr += 4;
-        lines_to_change = BE_16(&s->buf[stream_ptr]);
+        lines_to_change = AV_RB16(&s->buf[stream_ptr]);
         stream_ptr += 4;
     } else {
         start_line = 0;
@@ -269,15 +269,15 @@
 
     /* fetch the header */
     CHECK_STREAM_PTR(2);
-    header = BE_16(&s->buf[stream_ptr]);
+    header = AV_RB16(&s->buf[stream_ptr]);
     stream_ptr += 2;
 
     /* if a header is present, fetch additional decoding parameters */
     if (header & 0x0008) {
         CHECK_STREAM_PTR(8);
-        start_line = BE_16(&s->buf[stream_ptr]);
+        start_line = AV_RB16(&s->buf[stream_ptr]);
         stream_ptr += 4;
-        lines_to_change = BE_16(&s->buf[stream_ptr]);
+        lines_to_change = AV_RB16(&s->buf[stream_ptr]);
         stream_ptr += 4;
     } else {
         start_line = 0;
@@ -299,7 +299,7 @@
                 /* decode the run length code */
                 rle_code = -rle_code;
                 CHECK_STREAM_PTR(2);
-                rgb16 = BE_16(&s->buf[stream_ptr]);
+                rgb16 = AV_RB16(&s->buf[stream_ptr]);
                 stream_ptr += 2;
 
                 CHECK_PIXEL_PTR(rle_code * 2);
@@ -314,7 +314,7 @@
 
                 /* copy pixels directly to output */
                 while (rle_code--) {
-                    rgb16 = BE_16(&s->buf[stream_ptr]);
+                    rgb16 = AV_RB16(&s->buf[stream_ptr]);
                     stream_ptr += 2;
                     *(unsigned short *)(&rgb[pixel_ptr]) = rgb16;
                     pixel_ptr += 2;
@@ -347,15 +347,15 @@
 
     /* fetch the header */
     CHECK_STREAM_PTR(2);
-    header = BE_16(&s->buf[stream_ptr]);
+    header = AV_RB16(&s->buf[stream_ptr]);
     stream_ptr += 2;
 
     /* if a header is present, fetch additional decoding parameters */
     if (header & 0x0008) {
         CHECK_STREAM_PTR(8);
-        start_line = BE_16(&s->buf[stream_ptr]);
+        start_line = AV_RB16(&s->buf[stream_ptr]);
         stream_ptr += 4;
-        lines_to_change = BE_16(&s->buf[stream_ptr]);
+        lines_to_change = AV_RB16(&s->buf[stream_ptr]);
         stream_ptr += 4;
     } else {
         start_line = 0;
@@ -427,15 +427,15 @@
 
     /* fetch the header */
     CHECK_STREAM_PTR(2);
-    header = BE_16(&s->buf[stream_ptr]);
+    header = AV_RB16(&s->buf[stream_ptr]);
     stream_ptr += 2;
 
     /* if a header is present, fetch additional decoding parameters */
     if (header & 0x0008) {
         CHECK_STREAM_PTR(8);
-        start_line = BE_16(&s->buf[stream_ptr]);
+        start_line = AV_RB16(&s->buf[stream_ptr]);
         stream_ptr += 4;
-        lines_to_change = BE_16(&s->buf[stream_ptr]);
+        lines_to_change = AV_RB16(&s->buf[stream_ptr]);
         stream_ptr += 4;
     } else {
         start_line = 0;
--- a/rpza.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/rpza.c	Fri Jan 19 22:12:59 2007 +0000
@@ -98,7 +98,7 @@
             s->buf[stream_ptr]);
 
     /* Get chunk size, ingnoring first byte */
-    chunk_size = BE_32(&s->buf[stream_ptr]) & 0x00FFFFFF;
+    chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF;
     stream_ptr += 4;
 
     /* If length mismatch use size from MOV file and try to decode anyway */
@@ -140,7 +140,7 @@
 
         /* Fill blocks with one color */
         case 0xa0:
-            colorA = BE_16 (&s->buf[stream_ptr]);
+            colorA = AV_RB16 (&s->buf[stream_ptr]);
             stream_ptr += 2;
             while (n_blocks--) {
                 block_ptr = row_ptr + pixel_ptr;
@@ -157,10 +157,10 @@
 
         /* Fill blocks with 4 colors */
         case 0xc0:
-            colorA = BE_16 (&s->buf[stream_ptr]);
+            colorA = AV_RB16 (&s->buf[stream_ptr]);
             stream_ptr += 2;
         case 0x20:
-            colorB = BE_16 (&s->buf[stream_ptr]);
+            colorB = AV_RB16 (&s->buf[stream_ptr]);
             stream_ptr += 2;
 
             /* sort out the colors */
@@ -209,7 +209,7 @@
                 for (pixel_x = 0; pixel_x < 4; pixel_x++){
                     /* We already have color of upper left pixel */
                     if ((pixel_y != 0) || (pixel_x !=0)) {
-                        colorA = BE_16 (&s->buf[stream_ptr]);
+                        colorA = AV_RB16 (&s->buf[stream_ptr]);
                         stream_ptr += 2;
                     }
                     pixels[block_ptr] = colorA;
--- a/rv10.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/rv10.c	Fri Jan 19 22:12:59 2007 +0000
@@ -535,7 +535,7 @@
     s->height = avctx->height;
 
     s->h263_long_vectors= ((uint8_t*)avctx->extradata)[3] & 1;
-    avctx->sub_id= BE_32((uint8_t*)avctx->extradata + 4);
+    avctx->sub_id= AV_RB32((uint8_t*)avctx->extradata + 4);
 
     switch(avctx->sub_id){
     case 0x10000000:
--- a/smacker.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/smacker.c	Fri Jan 19 22:12:59 2007 +0000
@@ -277,10 +277,10 @@
     GetBitContext gb;
     int mmap_size, mclr_size, full_size, type_size;
 
-    mmap_size = LE_32(smk->avctx->extradata);
-    mclr_size = LE_32(smk->avctx->extradata + 4);
-    full_size = LE_32(smk->avctx->extradata + 8);
-    type_size = LE_32(smk->avctx->extradata + 12);
+    mmap_size = AV_RL32(smk->avctx->extradata);
+    mclr_size = AV_RL32(smk->avctx->extradata + 4);
+    full_size = AV_RL32(smk->avctx->extradata + 8);
+    type_size = AV_RL32(smk->avctx->extradata + 12);
 
     init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
 
@@ -584,7 +584,7 @@
     int bits, stereo;
     int pred[2] = {0, 0};
 
-    unp_size = LE_32(buf);
+    unp_size = AV_RL32(buf);
 
     init_get_bits(&gb, buf + 4, (buf_size - 4) * 8);
 
--- a/smc.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/smc.c	Fri Jan 19 22:12:59 2007 +0000
@@ -120,7 +120,7 @@
         s->avctx->palctrl->palette_changed = 0;
     }
 
-    chunk_size = BE_32(&s->buf[stream_ptr]) & 0x00FFFFFF;
+    chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF;
     stream_ptr += 4;
     if (chunk_size != s->size)
         av_log(s->avctx, AV_LOG_INFO, "warning: MOV chunk size != encoded chunk size (%d != %d); using MOV chunk size\n",
@@ -278,7 +278,7 @@
                 color_table_index = CPAIR * s->buf[stream_ptr++];
 
             while (n_blocks--) {
-                color_flags = BE_16(&s->buf[stream_ptr]);
+                color_flags = AV_RB16(&s->buf[stream_ptr]);
                 stream_ptr += 2;
                 flag_mask = 0x8000;
                 block_ptr = row_ptr + pixel_ptr;
@@ -321,7 +321,7 @@
                 color_table_index = CQUAD * s->buf[stream_ptr++];
 
             while (n_blocks--) {
-                color_flags = BE_32(&s->buf[stream_ptr]);
+                color_flags = AV_RB32(&s->buf[stream_ptr]);
                 stream_ptr += 4;
                 /* flag mask actually acts as a bit shift count here */
                 flag_mask = 30;
--- a/svq3.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/svq3.c	Fri Jan 19 22:12:59 2007 +0000
@@ -830,7 +830,7 @@
 
       GetBitContext gb;
 
-      size = BE_32(&extradata[4]);
+      size = AV_RB32(&extradata[4]);
       init_get_bits (&gb, extradata + 8, size*8);
 
       /* 'frame size code' and optional 'width, height' */
--- a/targa.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/targa.c	Fri Jan 19 22:12:59 2007 +0000
@@ -61,7 +61,7 @@
                 *dst = *src;
                 break;
             case 2:
-                *((uint16_t*)dst) = LE_16(src);
+                *((uint16_t*)dst) = AV_RL16(src);
                 break;
             case 3:
                 dst[0] = src[0];
@@ -69,7 +69,7 @@
                 dst[2] = src[2];
                 break;
             case 4:
-                *((uint32_t*)dst) = LE_32(src);
+                *((uint32_t*)dst) = AV_RL32(src);
                 break;
             }
             dst += depth;
@@ -104,13 +104,13 @@
     idlen = *buf++;
     pal = *buf++;
     compr = *buf++;
-    first_clr = LE_16(buf); buf += 2;
-    colors = LE_16(buf); buf += 2;
+    first_clr = AV_RL16(buf); buf += 2;
+    colors = AV_RL16(buf); buf += 2;
     csize = *buf++;
-    x = LE_16(buf); buf += 2;
-    y = LE_16(buf); buf += 2;
-    w = LE_16(buf); buf += 2;
-    h = LE_16(buf); buf += 2;
+    x = AV_RL16(buf); buf += 2;
+    y = AV_RL16(buf); buf += 2;
+    w = AV_RL16(buf); buf += 2;
+    h = AV_RL16(buf); buf += 2;
     bpp = *buf++;
     flags = *buf++;
     //skip identifier if any
@@ -200,11 +200,11 @@
                 if((s->bpp + 1) >> 3 == 2){
                     uint16_t *dst16 = (uint16_t*)dst;
                     for(x = 0; x < s->width; x++)
-                        dst16[x] = LE_16(buf + x * 2);
+                        dst16[x] = AV_RL16(buf + x * 2);
                 }else if((s->bpp + 1) >> 3 == 4){
                     uint32_t *dst32 = (uint32_t*)dst;
                     for(x = 0; x < s->width; x++)
-                        dst32[x] = LE_32(buf + x * 4);
+                        dst32[x] = AV_RL32(buf + x * 4);
                 }else
 #endif
                     memcpy(dst, buf, s->width * ((s->bpp + 1) >> 3));
--- a/tiff.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/tiff.c	Fri Jan 19 22:12:59 2007 +0000
@@ -87,13 +87,13 @@
 } TiffContext;
 
 static int tget_short(uint8_t **p, int le){
-    int v = le ? LE_16(*p) : BE_16(*p);
+    int v = le ? AV_RL16(*p) : AV_RB16(*p);
     *p += 2;
     return v;
 }
 
 static int tget_long(uint8_t **p, int le){
-    int v = le ? LE_32(*p) : BE_32(*p);
+    int v = le ? AV_RL32(*p) : AV_RB32(*p);
     *p += 4;
     return v;
 }
@@ -447,7 +447,7 @@
     int i, entries;
 
     //parse image header
-    id = LE_16(buf); buf += 2;
+    id = AV_RL16(buf); buf += 2;
     if(id == 0x4949) le = 1;
     else if(id == 0x4D4D) le = 0;
     else{
--- a/truemotion1.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/truemotion1.c	Fri Jan 19 22:12:59 2007 +0000
@@ -348,9 +348,9 @@
     header.compression = header_buffer[0];
     header.deltaset = header_buffer[1];
     header.vectable = header_buffer[2];
-    header.ysize = LE_16(&header_buffer[3]);
-    header.xsize = LE_16(&header_buffer[5]);
-    header.checksum = LE_16(&header_buffer[7]);
+    header.ysize = AV_RL16(&header_buffer[3]);
+    header.xsize = AV_RL16(&header_buffer[5]);
+    header.checksum = AV_RL16(&header_buffer[7]);
     header.version = header_buffer[9];
     header.header_type = header_buffer[10];
     header.flags = header_buffer[11];
--- a/truemotion2.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/truemotion2.c	Fri Jan 19 22:12:59 2007 +0000
@@ -208,7 +208,7 @@
 
     obuf = buf;
 
-    magic = LE_32(buf);
+    magic = AV_RL32(buf);
     buf += 4;
 
     if(magic == 0x00000100) { /* old header */
@@ -217,7 +217,7 @@
     } else if(magic == 0x00000101) { /* new header */
         int w, h, size, flags, xr, yr;
 
-        length = LE_32(buf);
+        length = AV_RL32(buf);
         buf += 4;
 
         init_get_bits(&ctx->gb, buf, 32 * 8);
@@ -270,17 +270,17 @@
     TM2Codes codes;
 
     /* get stream length in dwords */
-    len = BE_32(buf); buf += 4; cur += 4;
+    len = AV_RB32(buf); buf += 4; cur += 4;
     skip = len * 4 + 4;
 
     if(len == 0)
         return 4;
 
-    toks = BE_32(buf); buf += 4; cur += 4;
+    toks = AV_RB32(buf); buf += 4; cur += 4;
     if(toks & 1) {
-        len = BE_32(buf); buf += 4; cur += 4;
+        len = AV_RB32(buf); buf += 4; cur += 4;
         if(len == TM2_ESCAPE) {
-            len = BE_32(buf); buf += 4; cur += 4;
+            len = AV_RB32(buf); buf += 4; cur += 4;
         }
         if(len > 0) {
             init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
@@ -291,7 +291,7 @@
         }
     }
     /* skip unused fields */
-    if(BE_32(buf) == TM2_ESCAPE) {
+    if(AV_RB32(buf) == TM2_ESCAPE) {
         buf += 4; cur += 4; /* some unknown length - could be escaped too */
     }
     buf += 4; cur += 4;
@@ -312,7 +312,7 @@
     }
     ctx->tokens[stream_id] = av_realloc(ctx->tokens[stream_id], toks * sizeof(int));
     ctx->tok_lens[stream_id] = toks;
-    len = BE_32(buf); buf += 4; cur += 4;
+    len = AV_RB32(buf); buf += 4; cur += 4;
     if(len > 0) {
         init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
         for(i = 0; i < toks; i++)
--- a/truespeech.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/truespeech.c	Fri Jan 19 22:12:59 2007 +0000
@@ -62,7 +62,7 @@
     uint32_t t;
 
     /* first dword */
-    t = LE_32(input);
+    t = AV_RL32(input);
     input += 4;
 
     dec->flag = t & 1;
@@ -77,7 +77,7 @@
     dec->vector[7] = ts_codebook[7][(t >> 29) &  0x7];
 
     /* second dword */
-    t = LE_32(input);
+    t = AV_RL32(input);
     input += 4;
 
     dec->offset2[0] = (t >>  0) & 0x7F;
@@ -88,7 +88,7 @@
     dec->offset1[0] = ((t >> 28) & 0xF) << 4;
 
     /* third dword */
-    t = LE_32(input);
+    t = AV_RL32(input);
     input += 4;
 
     dec->pulseval[0] = (t >>  0) & 0x3FFF;
@@ -97,7 +97,7 @@
     dec->offset1[1] = (t >> 28) & 0x0F;
 
     /* fourth dword */
-    t = LE_32(input);
+    t = AV_RL32(input);
     input += 4;
 
     dec->pulseval[2] = (t >>  0) & 0x3FFF;
@@ -106,7 +106,7 @@
     dec->offset1[1] |= ((t >> 28) & 0x0F) << 4;
 
     /* fifth dword */
-    t = LE_32(input);
+    t = AV_RL32(input);
     input += 4;
 
     dec->pulsepos[0] = (t >> 4) & 0x7FFFFFF;
@@ -116,7 +116,7 @@
     dec->offset1[0] |= (t >> 31) & 1;
 
     /* sixth dword */
-    t = LE_32(input);
+    t = AV_RL32(input);
     input += 4;
 
     dec->pulsepos[1] = (t >> 4) & 0x7FFFFFF;
@@ -126,7 +126,7 @@
     dec->offset1[0] |= ((t >> 31) & 1) << 1;
 
     /* seventh dword */
-    t = LE_32(input);
+    t = AV_RL32(input);
     input += 4;
 
     dec->pulsepos[2] = (t >> 4) & 0x7FFFFFF;
@@ -136,7 +136,7 @@
     dec->offset1[0] |= ((t >> 31) & 1) << 2;
 
     /* eighth dword */
-    t = LE_32(input);
+    t = AV_RL32(input);
     input += 4;
 
     dec->pulsepos[3] = (t >> 4) & 0x7FFFFFF;
--- a/tscc.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/tscc.c	Fri Jan 19 22:12:59 2007 +0000
@@ -121,14 +121,14 @@
                 }
             } else if (c->bpp == 16) {
                 for(i = 0; i < p2; i++) {
-                    pix16 = LE_16(src);
+                    pix16 = AV_RL16(src);
                     src += 2;
                     *(uint16_t*)output = pix16;
                     output += 2;
                 }
             } else if (c->bpp == 32) {
                 for(i = 0; i < p2; i++) {
-                    pix32 = LE_32(src);
+                    pix32 = AV_RL32(src);
                     src += 4;
                     *(uint32_t*)output = pix32;
                     output += 4;
@@ -140,7 +140,7 @@
             switch(c->bpp){
             case  8: pix[0] = *src++;
                      break;
-            case 16: pix16 = LE_16(src);
+            case 16: pix16 = AV_RL16(src);
                      src += 2;
                      *(uint16_t*)pix = pix16;
                      break;
@@ -148,7 +148,7 @@
                      pix[1] = *src++;
                      pix[2] = *src++;
                      break;
-            case 32: pix32 = LE_32(src);
+            case 32: pix32 = AV_RL32(src);
                      src += 4;
                      *(uint32_t*)pix = pix32;
                      break;
--- a/vc1.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/vc1.c	Fri Jan 19 22:12:59 2007 +0000
@@ -4128,7 +4128,7 @@
         }
         while(edata_size > 8) {
             // test if we've found header
-            if(BE_32(edata) == 0x0000010F) {
+            if(AV_RB32(edata) == 0x0000010F) {
                 edata += 4;
                 edata_size -= 4;
                 break;
@@ -4144,7 +4144,7 @@
 
         while(edata_size > 8) {
             // test if we've found entry point
-            if(BE_32(edata) == 0x0000010E) {
+            if(AV_RB32(edata) == 0x0000010E) {
                 edata += 4;
                 edata_size -= 4;
                 break;
--- a/vmdav.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/vmdav.c	Fri Jan 19 22:12:59 2007 +0000
@@ -92,10 +92,10 @@
     s = src;
     d = dest;
     d_end = d + dest_len;
-    dataleft = LE_32(s);
+    dataleft = AV_RL32(s);
     s += 4;
     memset(queue, 0x20, QUEUE_SIZE);
-    if (LE_32(s) == 0x56781234) {
+    if (AV_RL32(s) == 0x56781234) {
         s += 4;
         qpos = 0x111;
         speclen = 0xF + 3;
@@ -204,10 +204,10 @@
     int frame_width, frame_height;
     int dp_size;
 
-    frame_x = LE_16(&s->buf[6]);
-    frame_y = LE_16(&s->buf[8]);
-    frame_width = LE_16(&s->buf[10]) - frame_x + 1;
-    frame_height = LE_16(&s->buf[12]) - frame_y + 1;
+    frame_x = AV_RL16(&s->buf[6]);
+    frame_y = AV_RL16(&s->buf[8]);
+    frame_width = AV_RL16(&s->buf[10]) - frame_x + 1;
+    frame_height = AV_RL16(&s->buf[12]) - frame_y + 1;
 
     /* if only a certain region will be updated, copy the entire previous
      * frame before the decode */
@@ -339,7 +339,7 @@
     }
     vmd_header = (unsigned char *)avctx->extradata;
 
-    s->unpack_buffer_size = LE_32(&vmd_header[800]);
+    s->unpack_buffer_size = AV_RL32(&vmd_header[800]);
     s->unpack_buffer = av_malloc(s->unpack_buffer_size);
     if (!s->unpack_buffer)
         return -1;
--- a/vmnc.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/vmnc.c	Fri Jan 19 22:12:59 2007 +0000
@@ -76,10 +76,10 @@
     switch(bpp * 2 + be) {
     case 2:
     case 3: return *buf;
-    case 4: return LE_16(buf);
-    case 5: return BE_16(buf);
-    case 8: return LE_32(buf);
-    case 9: return BE_32(buf);
+    case 4: return AV_RL16(buf);
+    case 5: return AV_RB16(buf);
+    case 8: return AV_RL32(buf);
+    case 9: return AV_RB32(buf);
     default: return 0;
     }
 }
@@ -328,13 +328,13 @@
         }
     }
     src += 2;
-    chunks = BE_16(src); src += 2;
+    chunks = AV_RB16(src); src += 2;
     while(chunks--) {
-        dx = BE_16(src); src += 2;
-        dy = BE_16(src); src += 2;
-        w  = BE_16(src); src += 2;
-        h  = BE_16(src); src += 2;
-        enc = BE_32(src); src += 4;
+        dx = AV_RB16(src); src += 2;
+        dy = AV_RB16(src); src += 2;
+        w  = AV_RB16(src); src += 2;
+        h  = AV_RB16(src); src += 2;
+        enc = AV_RB32(src); src += 4;
         outptr = c->pic.data[0] + dx * c->bpp2 + dy * c->pic.linesize[0];
         size_left = buf_size - (src - buf);
         switch(enc) {
--- a/vp6.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/vp6.c	Fri Jan 19 22:12:59 2007 +0000
@@ -63,7 +63,7 @@
             return 0;
         }
         if (separated_coeff || !s->filter_header) {
-            coeff_offset = BE_16(buf+2) - 2;
+            coeff_offset = AV_RB16(buf+2) - 2;
             buf += 2;
             buf_size -= 2;
         }
@@ -95,7 +95,7 @@
             return 0;
 
         if (separated_coeff || !s->filter_header) {
-            coeff_offset = BE_16(buf+1) - 2;
+            coeff_offset = AV_RB16(buf+1) - 2;
             buf += 2;
             buf_size -= 2;
         }
--- a/vqavideo.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/vqavideo.c	Fri Jan 19 22:12:59 2007 +0000
@@ -151,8 +151,8 @@
     /* load up the VQA parameters from the header */
     vqa_header = (unsigned char *)s->avctx->extradata;
     s->vqa_version = vqa_header[0];
-    s->width = LE_16(&vqa_header[6]);
-    s->height = LE_16(&vqa_header[8]);
+    s->width = AV_RL16(&vqa_header[6]);
+    s->height = AV_RL16(&vqa_header[8]);
     if(avcodec_check_dimensions(avctx, s->width, s->height)){
         s->width= s->height= 0;
         return -1;
@@ -232,9 +232,9 @@
         if (src[src_index] == 0xFF) {
 
             src_index++;
-            count = LE_16(&src[src_index]);
+            count = AV_RL16(&src[src_index]);
             src_index += 2;
-            src_pos = LE_16(&src[src_index]);
+            src_pos = AV_RL16(&src[src_index]);
             src_index += 2;
             vqa_debug("(1) copy %X bytes from absolute pos %X\n", count, src_pos);
             CHECK_COUNT();
@@ -245,7 +245,7 @@
         } else if (src[src_index] == 0xFE) {
 
             src_index++;
-            count = LE_16(&src[src_index]);
+            count = AV_RL16(&src[src_index]);
             src_index += 2;
             color = src[src_index++];
             vqa_debug("(2) set %X bytes to %02X\n", count, color);
@@ -256,7 +256,7 @@
         } else if ((src[src_index] & 0xC0) == 0xC0) {
 
             count = (src[src_index++] & 0x3F) + 3;
-            src_pos = LE_16(&src[src_index]);
+            src_pos = AV_RL16(&src[src_index]);
             src_index += 2;
             vqa_debug("(3) copy %X bytes from absolute pos %X\n", count, src_pos);
             CHECK_COUNT();
@@ -276,7 +276,7 @@
         } else {
 
             count = ((src[src_index] & 0x70) >> 4) + 3;
-            src_pos = BE_16(&src[src_index]) & 0x0FFF;
+            src_pos = AV_RB16(&src[src_index]) & 0x0FFF;
             src_index += 2;
             vqa_debug("(5) copy %X bytes from relpos %X\n", count, src_pos);
             CHECK_COUNT();
@@ -326,8 +326,8 @@
     /* first, traverse through the frame and find the subchunks */
     while (index < s->size) {
 
-        chunk_type = BE_32(&s->buf[index]);
-        chunk_size = BE_32(&s->buf[index + 4]);
+        chunk_type = AV_RB32(&s->buf[index]);
+        chunk_size = AV_RB32(&s->buf[index + 4]);
 
         switch (chunk_type) {
 
@@ -391,7 +391,7 @@
     /* convert the RGB palette into the machine's endian format */
     if (cpl0_chunk != -1) {
 
-        chunk_size = BE_32(&s->buf[cpl0_chunk + 4]);
+        chunk_size = AV_RB32(&s->buf[cpl0_chunk + 4]);
         /* sanity check the palette size */
         if (chunk_size / 3 > 256) {
             av_log(s->avctx, AV_LOG_ERROR, "  VQA video: problem: found a palette chunk with %d colors\n",
@@ -419,7 +419,7 @@
     /* decompress the full codebook chunk */
     if (cbfz_chunk != -1) {
 
-        chunk_size = BE_32(&s->buf[cbfz_chunk + 4]);
+        chunk_size = AV_RB32(&s->buf[cbfz_chunk + 4]);
         cbfz_chunk += CHUNK_PREAMBLE_SIZE;
         decode_format80(&s->buf[cbfz_chunk], chunk_size,
             s->codebook, s->codebook_size, 0);
@@ -428,7 +428,7 @@
     /* copy a full codebook */
     if (cbf0_chunk != -1) {
 
-        chunk_size = BE_32(&s->buf[cbf0_chunk + 4]);
+        chunk_size = AV_RB32(&s->buf[cbf0_chunk + 4]);
         /* sanity check the full codebook size */
         if (chunk_size > MAX_CODEBOOK_SIZE) {
             av_log(s->avctx, AV_LOG_ERROR, "  VQA video: problem: CBF0 chunk too large (0x%X bytes)\n",
@@ -448,7 +448,7 @@
         return;
     }
 
-    chunk_size = BE_32(&s->buf[vptz_chunk + 4]);
+    chunk_size = AV_RB32(&s->buf[vptz_chunk + 4]);
     vptz_chunk += CHUNK_PREAMBLE_SIZE;
     decode_format80(&s->buf[vptz_chunk], chunk_size,
         s->decode_buffer, s->decode_buffer_size, 1);
@@ -522,7 +522,7 @@
 
     if (cbp0_chunk != -1) {
 
-        chunk_size = BE_32(&s->buf[cbp0_chunk + 4]);
+        chunk_size = AV_RB32(&s->buf[cbp0_chunk + 4]);
         cbp0_chunk += CHUNK_PREAMBLE_SIZE;
 
         /* accumulate partial codebook */
@@ -545,7 +545,7 @@
 
     if (cbpz_chunk != -1) {
 
-        chunk_size = BE_32(&s->buf[cbpz_chunk + 4]);
+        chunk_size = AV_RB32(&s->buf[cbpz_chunk + 4]);
         cbpz_chunk += CHUNK_PREAMBLE_SIZE;
 
         /* accumulate partial codebook */
--- a/wavpack.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/wavpack.c	Fri Jan 19 22:12:59 2007 +0000
@@ -387,15 +387,15 @@
 
     memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr));
 
-    s->samples = LE_32(buf); buf += 4;
+    s->samples = AV_RL32(buf); buf += 4;
     if(!s->samples) return buf_size;
     /* should not happen but who knows */
     if(s->samples * 2 * avctx->channels > AVCODEC_MAX_AUDIO_FRAME_SIZE){
         av_log(avctx, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n");
         return -1;
     }
-    s->joint = LE_32(buf) & WV_JOINT; buf += 4;
-    s->CRC = LE_32(buf); buf += 4;
+    s->joint = AV_RL32(buf) & WV_JOINT; buf += 4;
+    s->CRC = AV_RL32(buf); buf += 4;
     // parse metadata blocks
     while(buf < buf_end){
         id = *buf++;
@@ -467,23 +467,23 @@
             t = 0;
             for(i = s->terms - 1; (i >= 0) && (t < size); i--) {
                 if(s->decorr[i].value > 8){
-                    s->decorr[i].samplesA[0] = wp_exp2(LE_16(buf)); buf += 2;
-                    s->decorr[i].samplesA[1] = wp_exp2(LE_16(buf)); buf += 2;
+                    s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2;
+                    s->decorr[i].samplesA[1] = wp_exp2(AV_RL16(buf)); buf += 2;
                     if(s->stereo){
-                        s->decorr[i].samplesB[0] = wp_exp2(LE_16(buf)); buf += 2;
-                        s->decorr[i].samplesB[1] = wp_exp2(LE_16(buf)); buf += 2;
+                        s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2;
+                        s->decorr[i].samplesB[1] = wp_exp2(AV_RL16(buf)); buf += 2;
                         t += 4;
                     }
                     t += 4;
                 }else if(s->decorr[i].value < 0){
-                    s->decorr[i].samplesA[0] = wp_exp2(LE_16(buf)); buf += 2;
-                    s->decorr[i].samplesB[0] = wp_exp2(LE_16(buf)); buf += 2;
+                    s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2;
+                    s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2;
                     t += 4;
                 }else{
                     for(j = 0; j < s->decorr[i].value; j++){
-                        s->decorr[i].samplesA[j] = wp_exp2(LE_16(buf)); buf += 2;
+                        s->decorr[i].samplesA[j] = wp_exp2(AV_RL16(buf)); buf += 2;
                         if(s->stereo){
-                            s->decorr[i].samplesB[j] = wp_exp2(LE_16(buf)); buf += 2;
+                            s->decorr[i].samplesB[j] = wp_exp2(AV_RL16(buf)); buf += 2;
                         }
                     }
                     t += s->decorr[i].value * 2 * avctx->channels;
@@ -498,7 +498,7 @@
                 continue;
             }
             for(i = 0; i < 3 * avctx->channels; i++){
-                s->median[i] = wp_exp2(LE_16(buf));
+                s->median[i] = wp_exp2(AV_RL16(buf));
                 buf += 2;
             }
             got_entropy = 1;
--- a/ws-snd1.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/ws-snd1.c	Fri Jan 19 22:12:59 2007 +0000
@@ -57,9 +57,9 @@
     if (!buf_size)
         return 0;
 
-    out_size = LE_16(&buf[0]);
+    out_size = AV_RL16(&buf[0]);
     *data_size = out_size * 2;
-    in_size = LE_16(&buf[2]);
+    in_size = AV_RL16(&buf[2]);
     buf += 4;
 
     if (in_size == out_size) {
--- a/xan.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/xan.c	Fri Jan 19 22:12:59 2007 +0000
@@ -296,10 +296,10 @@
     unsigned char *vector_segment;
     unsigned char *imagedata_segment;
 
-    huffman_segment =   s->buf + LE_16(&s->buf[0]);
-    size_segment =      s->buf + LE_16(&s->buf[2]);
-    vector_segment =    s->buf + LE_16(&s->buf[4]);
-    imagedata_segment = s->buf + LE_16(&s->buf[6]);
+    huffman_segment =   s->buf + AV_RL16(&s->buf[0]);
+    size_segment =      s->buf + AV_RL16(&s->buf[2]);
+    vector_segment =    s->buf + AV_RL16(&s->buf[4]);
+    imagedata_segment = s->buf + AV_RL16(&s->buf[6]);
 
     xan_huffman_decode(opcode_buffer, huffman_segment, opcode_buffer_size);
 
@@ -350,7 +350,7 @@
 
         case 10:
         case 20:
-            size = BE_16(&size_segment[0]);
+            size = AV_RB16(&size_segment[0]);
             size_segment += 2;
             break;
 
--- a/xl.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/xl.c	Fri Jan 19 22:12:59 2007 +0000
@@ -73,7 +73,7 @@
 
         for (j = 0; j < avctx->width; j += 4) {
             /* value is stored in LE dword with word swapped */
-            val = LE_32(buf);
+            val = AV_RL32(buf);
             buf -= 4;
             val = ((val >> 16) & 0xFFFF) | ((val & 0xFFFF) << 16);
 
--- a/zmbv.c	Fri Jan 19 12:41:56 2007 +0000
+++ b/zmbv.c	Fri Jan 19 22:12:59 2007 +0000
@@ -545,7 +545,7 @@
         case ZMBV_FMT_15BPP:
             for(j = 0; j < c->height; j++) {
                 for(i = 0; i < c->width; i++) {
-                    uint16_t tmp = LE_16(src);
+                    uint16_t tmp = AV_RL16(src);
                     src += 2;
                     out[i * 3 + 0] = (tmp & 0x7C00) >> 7;
                     out[i * 3 + 1] = (tmp & 0x03E0) >> 2;
@@ -557,7 +557,7 @@
         case ZMBV_FMT_16BPP:
             for(j = 0; j < c->height; j++) {
                 for(i = 0; i < c->width; i++) {
-                    uint16_t tmp = LE_16(src);
+                    uint16_t tmp = AV_RL16(src);
                     src += 2;
                     out[i * 3 + 0] = (tmp & 0xF800) >> 8;
                     out[i * 3 + 1] = (tmp & 0x07E0) >> 3;
@@ -578,7 +578,7 @@
         case ZMBV_FMT_32BPP:
             for(j = 0; j < c->height; j++) {
                 for(i = 0; i < c->width; i++) {
-                    uint32_t tmp = LE_32(src);
+                    uint32_t tmp = AV_RL32(src);
                     src += 4;
                     out[i * 3 + 0] = tmp >> 16;
                     out[i * 3 + 1] = tmp >> 8;