Browse code

bswap: change ME to NE in macro names

Other parts of FFmpeg use NE (native endian) rather than ME (machine).
This makes it consistent.

Originally committed as revision 24169 to svn://svn.ffmpeg.org/ffmpeg/trunk

Måns Rullgård authored on 2010/07/11 07:09:01
Showing 27 changed files
... ...
@@ -333,16 +333,16 @@ static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src, int lo
333 333
             av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
334 334
             return;
335 335
         }
336
-        mcdc(dst, src, log2w, h, stride, 1, le2me_16(*f->wordstream++));
336
+        mcdc(dst, src, log2w, h, stride, 1, le2ne_16(*f->wordstream++));
337 337
     }else if(code == 5){
338
-        mcdc(dst, src, log2w, h, stride, 0, le2me_16(*f->wordstream++));
338
+        mcdc(dst, src, log2w, h, stride, 0, le2ne_16(*f->wordstream++));
339 339
     }else if(code == 6){
340 340
         if(log2w){
341
-            dst[0] = le2me_16(*f->wordstream++);
342
-            dst[1] = le2me_16(*f->wordstream++);
341
+            dst[0] = le2ne_16(*f->wordstream++);
342
+            dst[1] = le2ne_16(*f->wordstream++);
343 343
         }else{
344
-            dst[0     ] = le2me_16(*f->wordstream++);
345
-            dst[stride] = le2me_16(*f->wordstream++);
344
+            dst[0     ] = le2ne_16(*f->wordstream++);
345
+            dst[stride] = le2ne_16(*f->wordstream++);
346 346
         }
347 347
     }
348 348
 }
... ...
@@ -100,7 +100,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
100 100
                 for(row = 0; row < height; row++) {
101 101
                         pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p];
102 102
                         pixptr_end = pixptr + c->pic.linesize[0];
103
-                        dlen = be2me_16(*(const unsigned short *)(lp+row*2));
103
+                        dlen = be2ne_16(*(const unsigned short *)(lp+row*2));
104 104
                         /* Decode a row of this plane */
105 105
                         while(dlen > 0) {
106 106
                                 if(dp + 1 >= buf+buf_size) return -1;
... ...
@@ -80,7 +80,7 @@ static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,
80 80
         uint8_t  u8[8];
81 81
     } tmp;
82 82
 
83
-    tmp.u64 = be2me_64(state);
83
+    tmp.u64 = be2ne_64(state);
84 84
     init_get_bits(&bits, tmp.u8+8-AAC_ADTS_HEADER_SIZE, AAC_ADTS_HEADER_SIZE * 8);
85 85
 
86 86
     if ((size = ff_aac_parse_header(&bits, &hdr)) < 0)
... ...
@@ -164,7 +164,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
164 164
     union {
165 165
         uint64_t u64;
166 166
         uint8_t  u8[8];
167
-    } tmp = { be2me_64(state) };
167
+    } tmp = { be2ne_64(state) };
168 168
     AC3HeaderInfo hdr;
169 169
     GetBitContext gbc;
170 170
 
... ...
@@ -588,8 +588,8 @@ static av_cold int encode_init(AVCodecContext *avctx){
588 588
 
589 589
     avctx->extradata= av_mallocz(8);
590 590
     avctx->extradata_size=8;
591
-    ((uint32_t*)avctx->extradata)[0]= le2me_32(a->inv_qscale);
592
-    ((uint32_t*)avctx->extradata)[1]= le2me_32(AV_RL32("ASUS"));
591
+    ((uint32_t*)avctx->extradata)[0]= le2ne_32(a->inv_qscale);
592
+    ((uint32_t*)avctx->extradata)[1]= le2ne_32(AV_RL32("ASUS"));
593 593
 
594 594
     for(i=0; i<64; i++){
595 595
         int q= 32*scale*ff_mpeg1_default_intra_matrix[i];
... ...
@@ -179,7 +179,7 @@ static int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){
179 179
 
180 180
     off = (intptr_t)inbuffer & 3;
181 181
     buf = (const uint32_t*) (inbuffer - off);
182
-    c = be2me_32((0x537F6103 >> (off*8)) | (0x537F6103 << (32-(off*8))));
182
+    c = be2ne_32((0x537F6103 >> (off*8)) | (0x537F6103 << (32-(off*8))));
183 183
     bytes += 3 + off;
184 184
     for (i = 0; i < bytes/4; i++)
185 185
         obuf[i] = c ^ buf[i];
... ...
@@ -290,7 +290,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
290 290
                 uint16_t *dst = (uint16_t *) ptr;
291 291
 
292 292
                 for(j = 0; j < avctx->width; j++)
293
-                    *dst++ = le2me_16(*src++);
293
+                    *dst++ = le2ne_16(*src++);
294 294
 
295 295
                 buf += n;
296 296
                 ptr += linesize;
... ...
@@ -316,12 +316,12 @@ static inline int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes)
316 316
     /* FIXME: 64 bit platforms would be able to do 64 bits at a time.
317 317
      * I'm too lazy though, should be something like
318 318
      * for(i=0 ; i<bitamount/64 ; i++)
319
-     *     (int64_t)out[i] = 0x37c511f237c511f2^be2me_64(int64_t)in[i]);
319
+     *     (int64_t)out[i] = 0x37c511f237c511f2^be2ne_64(int64_t)in[i]);
320 320
      * Buffer alignment needs to be checked. */
321 321
 
322 322
     off = (intptr_t)inbuffer & 3;
323 323
     buf = (const uint32_t*) (inbuffer - off);
324
-    c = be2me_32((0x37c511f2 >> (off*8)) | (0x37c511f2 << (32-(off*8))));
324
+    c = be2ne_32((0x37c511f2 >> (off*8)) | (0x37c511f2 << (32-(off*8))));
325 325
     bytes += 3 + off;
326 326
     for (i = 0; i < bytes/4; i++)
327 327
         obuf[i] = c ^ buf[i];
... ...
@@ -1164,7 +1164,7 @@ static void update_md5_sum(FlacEncodeContext *s, int16_t *samples)
1164 1164
 #if HAVE_BIGENDIAN
1165 1165
     int i;
1166 1166
     for(i = 0; i < s->frame.blocksize*s->channels; i++) {
1167
-        int16_t smp = le2me_16(samples[i]);
1167
+        int16_t smp = le2ne_16(samples[i]);
1168 1168
         av_md5_update(s->md5ctx, (uint8_t *)&smp, 2);
1169 1169
     }
1170 1170
 #else
... ...
@@ -267,7 +267,7 @@ static inline void skip_bits_long(GetBitContext *s, int n){
267 267
 
268 268
 #   define UPDATE_CACHE(name, gb)\
269 269
     if(name##_bit_count > 0){\
270
-        const uint32_t next= be2me_32( *name##_buffer_ptr );\
270
+        const uint32_t next= be2ne_32( *name##_buffer_ptr );\
271 271
         name##_cache0 |= NEG_USR32(next,name##_bit_count);\
272 272
         name##_cache1 |= next<<name##_bit_count;\
273 273
         name##_buffer_ptr++;\
... ...
@@ -319,7 +319,7 @@ static inline void skip_bits_long(GetBitContext *s, int n){
319 319
     re_bit_count += n;
320 320
     re_buffer_ptr += re_bit_count>>5;
321 321
     re_bit_count &= 31;
322
-    re_cache0 = be2me_32( re_buffer_ptr[-1] ) << re_bit_count;
322
+    re_cache0 = be2ne_32( re_buffer_ptr[-1] ) << re_bit_count;
323 323
     re_cache1 = 0;
324 324
     UPDATE_CACHE(re, s)
325 325
     CLOSE_READER(re, s)
... ...
@@ -38,22 +38,22 @@ typedef struct {
38 38
 } IffContext;
39 39
 
40 40
 #define LUT8_PART(plane, v)                             \
41
-    AV_LE2ME64C(UINT64_C(0x0000000)<<32 | v) << plane,  \
42
-    AV_LE2ME64C(UINT64_C(0x1000000)<<32 | v) << plane,  \
43
-    AV_LE2ME64C(UINT64_C(0x0010000)<<32 | v) << plane,  \
44
-    AV_LE2ME64C(UINT64_C(0x1010000)<<32 | v) << plane,  \
45
-    AV_LE2ME64C(UINT64_C(0x0000100)<<32 | v) << plane,  \
46
-    AV_LE2ME64C(UINT64_C(0x1000100)<<32 | v) << plane,  \
47
-    AV_LE2ME64C(UINT64_C(0x0010100)<<32 | v) << plane,  \
48
-    AV_LE2ME64C(UINT64_C(0x1010100)<<32 | v) << plane,  \
49
-    AV_LE2ME64C(UINT64_C(0x0000001)<<32 | v) << plane,  \
50
-    AV_LE2ME64C(UINT64_C(0x1000001)<<32 | v) << plane,  \
51
-    AV_LE2ME64C(UINT64_C(0x0010001)<<32 | v) << plane,  \
52
-    AV_LE2ME64C(UINT64_C(0x1010001)<<32 | v) << plane,  \
53
-    AV_LE2ME64C(UINT64_C(0x0000101)<<32 | v) << plane,  \
54
-    AV_LE2ME64C(UINT64_C(0x1000101)<<32 | v) << plane,  \
55
-    AV_LE2ME64C(UINT64_C(0x0010101)<<32 | v) << plane,  \
56
-    AV_LE2ME64C(UINT64_C(0x1010101)<<32 | v) << plane
41
+    AV_LE2NE64C(UINT64_C(0x0000000)<<32 | v) << plane,  \
42
+    AV_LE2NE64C(UINT64_C(0x1000000)<<32 | v) << plane,  \
43
+    AV_LE2NE64C(UINT64_C(0x0010000)<<32 | v) << plane,  \
44
+    AV_LE2NE64C(UINT64_C(0x1010000)<<32 | v) << plane,  \
45
+    AV_LE2NE64C(UINT64_C(0x0000100)<<32 | v) << plane,  \
46
+    AV_LE2NE64C(UINT64_C(0x1000100)<<32 | v) << plane,  \
47
+    AV_LE2NE64C(UINT64_C(0x0010100)<<32 | v) << plane,  \
48
+    AV_LE2NE64C(UINT64_C(0x1010100)<<32 | v) << plane,  \
49
+    AV_LE2NE64C(UINT64_C(0x0000001)<<32 | v) << plane,  \
50
+    AV_LE2NE64C(UINT64_C(0x1000001)<<32 | v) << plane,  \
51
+    AV_LE2NE64C(UINT64_C(0x0010001)<<32 | v) << plane,  \
52
+    AV_LE2NE64C(UINT64_C(0x1010001)<<32 | v) << plane,  \
53
+    AV_LE2NE64C(UINT64_C(0x0000101)<<32 | v) << plane,  \
54
+    AV_LE2NE64C(UINT64_C(0x1000101)<<32 | v) << plane,  \
55
+    AV_LE2NE64C(UINT64_C(0x0010101)<<32 | v) << plane,  \
56
+    AV_LE2NE64C(UINT64_C(0x1010101)<<32 | v) << plane
57 57
 
58 58
 #define LUT8(plane) {                           \
59 59
     LUT8_PART(plane, 0x0000000),                \
... ...
@@ -359,14 +359,14 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
359 359
 
360 360
                             switch(correction_type_sp[0][k]) {
361 361
                             case 0:
362
-                                *cur_lp = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
362
+                                *cur_lp = le2ne_32(((le2ne_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
363 363
                                 lp2++;
364 364
                                 break;
365 365
                             case 1:
366
-                                res = ((le2me_16(((unsigned short *)(ref_lp))[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
367
-                                ((unsigned short *)cur_lp)[0] = le2me_16(res);
368
-                                res = ((le2me_16(((unsigned short *)(ref_lp))[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
369
-                                ((unsigned short *)cur_lp)[1] = le2me_16(res);
366
+                                res = ((le2ne_16(((unsigned short *)(ref_lp))[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
367
+                                ((unsigned short *)cur_lp)[0] = le2ne_16(res);
368
+                                res = ((le2ne_16(((unsigned short *)(ref_lp))[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
369
+                                ((unsigned short *)cur_lp)[1] = le2ne_16(res);
370 370
                                 buf1++;
371 371
                                 lp2++;
372 372
                                 break;
... ...
@@ -462,19 +462,19 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
462 462
 
463 463
                             switch(correction_type_sp[lp2 & 0x01][k]) {
464 464
                             case 0:
465
-                                cur_lp[width_tbl[1]] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
465
+                                cur_lp[width_tbl[1]] = le2ne_32(((le2ne_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
466 466
                                 if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
467 467
                                     cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
468 468
                                 else
469
-                                    cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
469
+                                    cur_lp[0] = le2ne_32(((le2ne_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
470 470
                                 lp2++;
471 471
                                 break;
472 472
 
473 473
                             case 1:
474
-                                res = ((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
475
-                                ((unsigned short *)cur_lp)[width_tbl[2]] = le2me_16(res);
476
-                                res = ((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
477
-                                ((unsigned short *)cur_lp)[width_tbl[2]+1] = le2me_16(res);
474
+                                res = ((le2ne_16(((unsigned short *)ref_lp)[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
475
+                                ((unsigned short *)cur_lp)[width_tbl[2]] = le2ne_16(res);
476
+                                res = ((le2ne_16(((unsigned short *)ref_lp)[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
477
+                                ((unsigned short *)cur_lp)[width_tbl[2]+1] = le2ne_16(res);
478 478
 
479 479
                                 if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
480 480
                                     cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
... ...
@@ -591,8 +591,8 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
591 591
 
592 592
                                 switch(correction_type_sp[lp2 & 0x01][k]) {
593 593
                                 case 0:
594
-                                    cur_lp[width_tbl[1]] = le2me_32(((le2me_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
595
-                                    cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(lv2) >> 1) + correctionhighorder_lp[lp2 & 0x01][k]) << 1);
594
+                                    cur_lp[width_tbl[1]] = le2ne_32(((le2ne_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
595
+                                    cur_lp[width_tbl[1]+1] = le2ne_32(((le2ne_32(lv2) >> 1) + correctionhighorder_lp[lp2 & 0x01][k]) << 1);
596 596
                                     if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
597 597
                                         cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
598 598
                                         cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
... ...
@@ -604,8 +604,8 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
604 604
                                     break;
605 605
 
606 606
                                 case 1:
607
-                                    cur_lp[width_tbl[1]] = le2me_32(((le2me_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][*buf1]) << 1);
608
-                                    cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(lv2) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
607
+                                    cur_lp[width_tbl[1]] = le2ne_32(((le2ne_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][*buf1]) << 1);
608
+                                    cur_lp[width_tbl[1]+1] = le2ne_32(((le2ne_32(lv2) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
609 609
                                     if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
610 610
                                         cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
611 611
                                         cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
... ...
@@ -748,20 +748,20 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
748 748
                                 case 0:
749 749
                                     lv1 = correctionloworder_lp[lp2 & 0x01][k];
750 750
                                     lv2 = correctionhighorder_lp[lp2 & 0x01][k];
751
-                                    cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + lv1) << 1);
752
-                                    cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + lv2) << 1);
753
-                                    cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
754
-                                    cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
751
+                                    cur_lp[0] = le2ne_32(((le2ne_32(ref_lp[0]) >> 1) + lv1) << 1);
752
+                                    cur_lp[1] = le2ne_32(((le2ne_32(ref_lp[1]) >> 1) + lv2) << 1);
753
+                                    cur_lp[width_tbl[1]] = le2ne_32(((le2ne_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
754
+                                    cur_lp[width_tbl[1]+1] = le2ne_32(((le2ne_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
755 755
                                     lp2++;
756 756
                                     break;
757 757
 
758 758
                                 case 1:
759 759
                                     lv1 = correctionloworder_lp[lp2 & 0x01][*buf1++];
760 760
                                     lv2 = correctionloworder_lp[lp2 & 0x01][k];
761
-                                    cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + lv1) << 1);
762
-                                    cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + lv2) << 1);
763
-                                    cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
764
-                                    cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
761
+                                    cur_lp[0] = le2ne_32(((le2ne_32(ref_lp[0]) >> 1) + lv1) << 1);
762
+                                    cur_lp[1] = le2ne_32(((le2ne_32(ref_lp[1]) >> 1) + lv2) << 1);
763
+                                    cur_lp[width_tbl[1]] = le2ne_32(((le2ne_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
764
+                                    cur_lp[width_tbl[1]+1] = le2ne_32(((le2ne_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
765 765
                                     lp2++;
766 766
                                     break;
767 767
 
... ...
@@ -849,22 +849,22 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
849 849
 
850 850
                             switch(correction_type_sp[lp2 & 0x01][k]) {
851 851
                             case 0:
852
-                                cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
853
-                                cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
852
+                                cur_lp[0] = le2ne_32(((le2ne_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
853
+                                cur_lp[width_tbl[1]] = le2ne_32(((le2ne_32(ref_lp[width_tbl[1]]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
854 854
                                 lp2++;
855 855
                                 break;
856 856
 
857 857
                             case 1:
858 858
                                 lv1 = (unsigned short)(correction_lp[lp2 & 0x01][*buf1++]);
859 859
                                 lv2 = (unsigned short)(correction_lp[lp2 & 0x01][k]);
860
-                                res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + lv1) << 1);
861
-                                ((unsigned short *)cur_lp)[0] = le2me_16(res);
862
-                                res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + lv2) << 1);
863
-                                ((unsigned short *)cur_lp)[1] = le2me_16(res);
864
-                                res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[width_tbl[2]]) >> 1) + lv1) << 1);
865
-                                ((unsigned short *)cur_lp)[width_tbl[2]] = le2me_16(res);
866
-                                res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[width_tbl[2]+1]) >> 1) + lv2) << 1);
867
-                                ((unsigned short *)cur_lp)[width_tbl[2]+1] = le2me_16(res);
860
+                                res = (unsigned short)(((le2ne_16(((unsigned short *)ref_lp)[0]) >> 1) + lv1) << 1);
861
+                                ((unsigned short *)cur_lp)[0] = le2ne_16(res);
862
+                                res = (unsigned short)(((le2ne_16(((unsigned short *)ref_lp)[1]) >> 1) + lv2) << 1);
863
+                                ((unsigned short *)cur_lp)[1] = le2ne_16(res);
864
+                                res = (unsigned short)(((le2ne_16(((unsigned short *)ref_lp)[width_tbl[2]]) >> 1) + lv1) << 1);
865
+                                ((unsigned short *)cur_lp)[width_tbl[2]] = le2ne_16(res);
866
+                                res = (unsigned short)(((le2ne_16(((unsigned short *)ref_lp)[width_tbl[2]+1]) >> 1) + lv2) << 1);
867
+                                ((unsigned short *)cur_lp)[width_tbl[2]+1] = le2ne_16(res);
868 868
                                 lp2++;
869 869
                                 break;
870 870
 
... ...
@@ -1027,7 +1027,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
1027 1027
         return -1;
1028 1028
 
1029 1029
     id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16);
1030
-    id = be2me_32(id);
1030
+    id = be2ne_32(id);
1031 1031
     len -= 6;
1032 1032
 
1033 1033
     if(s->avctx->debug & FF_DEBUG_STARTCODE){
... ...
@@ -1134,7 +1134,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
1134 1134
     if ((s->start_code == APP1) && (len > (0x28 - 8)))
1135 1135
     {
1136 1136
         id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16);
1137
-        id = be2me_32(id);
1137
+        id = be2ne_32(id);
1138 1138
         len -= 4;
1139 1139
         if (id == AV_RL32("mjpg")) /* Apple MJPEG-A */
1140 1140
         {
... ...
@@ -124,7 +124,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
124 124
             } else if (upgrade == 2) {
125 125
                 unsigned int j, v, f = (65535 * 32768 + s->maxval / 2) / s->maxval;
126 126
                 for (j = 0; j < n / 2; j++) {
127
-                    v = be2me_16(((uint16_t *)s->bytestream)[j]);
127
+                    v = be2ne_16(((uint16_t *)s->bytestream)[j]);
128 128
                     ((uint16_t *)ptr)[j] = (v * f + 16384) >> 15;
129 129
                 }
130 130
             }
... ...
@@ -168,7 +168,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
168 168
             AV_WL32(s->buf_ptr, bit_buf);
169 169
         } else
170 170
 #endif
171
-        *(uint32_t *)s->buf_ptr = le2me_32(bit_buf);
171
+        *(uint32_t *)s->buf_ptr = le2ne_32(bit_buf);
172 172
         s->buf_ptr+=4;
173 173
         bit_buf = (bit_left==32)?0:value >> bit_left;
174 174
         bit_left+=32;
... ...
@@ -186,7 +186,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
186 186
             AV_WB32(s->buf_ptr, bit_buf);
187 187
         } else
188 188
 #endif
189
-        *(uint32_t *)s->buf_ptr = be2me_32(bit_buf);
189
+        *(uint32_t *)s->buf_ptr = be2ne_32(bit_buf);
190 190
         //printf("bitbuf = %08x\n", bit_buf);
191 191
         s->buf_ptr+=4;
192 192
         bit_left+=32 - n;
... ...
@@ -224,8 +224,8 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
224 224
 
225 225
     value<<= 32-n;
226 226
 
227
-    ptr[0] |= be2me_32(value>>(index&31));
228
-    ptr[1]  = be2me_32(value<<(32-(index&31)));
227
+    ptr[0] |= be2ne_32(value>>(index&31));
228
+    ptr[1]  = be2ne_32(value<<(32-(index&31)));
229 229
 //if(n>24) printf("%d %d\n", n, value);
230 230
     index+= n;
231 231
     s->index= index;
... ...
@@ -252,7 +252,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
252 252
     int index= s->index;
253 253
     uint32_t *ptr= (uint32_t*)(((uint8_t *)s->buf)+(index>>3));
254 254
 
255
-    ptr[0] |= be2me_32(value<<(32-n-(index&7) ));
255
+    ptr[0] |= be2ne_32(value<<(32-n-(index&7) ));
256 256
     ptr[1] = 0;
257 257
 //if(n>24) printf("%d %d\n", n, value);
258 258
     index+= n;
... ...
@@ -61,7 +61,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
61 61
     for (h = 0; h < avctx->height; h++) {
62 62
         uint16_t *dst = (uint16_t *)dst_line;
63 63
         for (w = 0; w < avctx->width; w++) {
64
-            uint32_t pixel = be2me_32(*src++);
64
+            uint32_t pixel = be2ne_32(*src++);
65 65
             uint16_t r, g, b;
66 66
             b =  pixel <<  6;
67 67
             g = (pixel >>  4) & 0xffc0;
... ...
@@ -68,7 +68,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
68 68
 
69 69
 #define READ_PIXELS(a, b, c)         \
70 70
     do {                             \
71
-        val  = le2me_32(*src++);     \
71
+        val  = le2ne_32(*src++);     \
72 72
         *a++ =  val <<  6;           \
73 73
         *b++ = (val >>  4) & 0xFFC0; \
74 74
         *c++ = (val >> 14) & 0xFFC0; \
... ...
@@ -86,14 +86,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
86 86
         if (w < avctx->width - 1) {
87 87
             READ_PIXELS(u, y, v);
88 88
 
89
-            val  = le2me_32(*src++);
89
+            val  = le2ne_32(*src++);
90 90
             *y++ =  val <<  6;
91 91
         }
92 92
         if (w < avctx->width - 3) {
93 93
             *u++ = (val >>  4) & 0xFFC0;
94 94
             *y++ = (val >> 14) & 0xFFC0;
95 95
 
96
-            val  = le2me_32(*src++);
96
+            val  = le2ne_32(*src++);
97 97
             *v++ =  val <<  6;
98 98
             *y++ = (val >>  4) & 0xFFC0;
99 99
         }
... ...
@@ -67,12 +67,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
67 67
     pic->key_frame= 1;
68 68
 
69 69
     for(;;){
70
-        uint32_t v= be2me_32(*src++);
70
+        uint32_t v= be2ne_32(*src++);
71 71
         *udst++= (v>>16) & 0xFFC0;
72 72
         *ydst++= (v>>6 ) & 0xFFC0;
73 73
         *vdst++= (v<<4 ) & 0xFFC0;
74 74
 
75
-        v= be2me_32(*src++);
75
+        v= be2ne_32(*src++);
76 76
         *ydst++= (v>>16) & 0xFFC0;
77 77
 
78 78
         if(ydst >= yend){
... ...
@@ -87,7 +87,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
87 87
         *udst++= (v>>6 ) & 0xFFC0;
88 88
         *ydst++= (v<<4 ) & 0xFFC0;
89 89
 
90
-        v= be2me_32(*src++);
90
+        v= be2ne_32(*src++);
91 91
         *vdst++= (v>>16) & 0xFFC0;
92 92
         *ydst++= (v>>6 ) & 0xFFC0;
93 93
 
... ...
@@ -102,7 +102,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
102 102
 
103 103
         *udst++= (v<<4 ) & 0xFFC0;
104 104
 
105
-        v= be2me_32(*src++);
105
+        v= be2ne_32(*src++);
106 106
         *ydst++= (v>>16) & 0xFFC0;
107 107
         *vdst++= (v>>6 ) & 0xFFC0;
108 108
         *ydst++= (v<<4 ) & 0xFFC0;
... ...
@@ -170,7 +170,7 @@ void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len) {
170 170
         ms_state = multiswap_enc(ms_keys, ms_state, AV_RL64(qwords));
171 171
     multiswap_invert_keys(ms_keys);
172 172
     packetkey = (packetkey << 32) | (packetkey >> 32);
173
-    packetkey = le2me_64(packetkey);
173
+    packetkey = le2ne_64(packetkey);
174 174
     packetkey = multiswap_dec(ms_keys, ms_state, packetkey);
175 175
     AV_WL64(qwords, packetkey);
176 176
 }
... ...
@@ -94,7 +94,7 @@ static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_ch
94 94
     int64_t size;
95 95
 //    start= url_ftell(bc) - 8;
96 96
 
97
-    startcode= be2me_64(startcode);
97
+    startcode= be2ne_64(startcode);
98 98
     startcode= ff_crc04C11DB7_update(0, (uint8_t*)&startcode, 8);
99 99
 
100 100
     init_checksum(bc, ff_crc04C11DB7_update, startcode);
... ...
@@ -213,10 +213,10 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
213 213
         av_free(smk->frm_flags);
214 214
         return AVERROR(EIO);
215 215
     }
216
-    ((int32_t*)st->codec->extradata)[0] = le2me_32(smk->mmap_size);
217
-    ((int32_t*)st->codec->extradata)[1] = le2me_32(smk->mclr_size);
218
-    ((int32_t*)st->codec->extradata)[2] = le2me_32(smk->full_size);
219
-    ((int32_t*)st->codec->extradata)[3] = le2me_32(smk->type_size);
216
+    ((int32_t*)st->codec->extradata)[0] = le2ne_32(smk->mmap_size);
217
+    ((int32_t*)st->codec->extradata)[1] = le2ne_32(smk->mclr_size);
218
+    ((int32_t*)st->codec->extradata)[2] = le2ne_32(smk->full_size);
219
+    ((int32_t*)st->codec->extradata)[3] = le2ne_32(smk->type_size);
220 220
 
221 221
     smk->curstream = -1;
222 222
     smk->nextpos = url_ftell(pb);
... ...
@@ -34,7 +34,7 @@ static int sol_probe(AVProbeData *p)
34 34
 {
35 35
     /* check file header */
36 36
     uint16_t magic;
37
-    magic=le2me_16(*((uint16_t*)p->buf));
37
+    magic=le2ne_16(*((uint16_t*)p->buf));
38 38
     if ((magic == 0x0B8D || magic == 0x0C0D || magic == 0x0C8D) &&
39 39
         p->buf[2] == 'S' && p->buf[3] == 'O' &&
40 40
         p->buf[4] == 'L' && p->buf[5] == 0)
... ...
@@ -85,34 +85,34 @@ static inline uint64_t av_const bswap_64(uint64_t x)
85 85
 }
86 86
 #endif
87 87
 
88
-// be2me ... big-endian to machine-endian
89
-// le2me ... little-endian to machine-endian
88
+// be2ne ... big-endian to native-endian
89
+// le2ne ... little-endian to native-endian
90 90
 
91 91
 #if HAVE_BIGENDIAN
92
-#define be2me_16(x) (x)
93
-#define be2me_32(x) (x)
94
-#define be2me_64(x) (x)
95
-#define le2me_16(x) bswap_16(x)
96
-#define le2me_32(x) bswap_32(x)
97
-#define le2me_64(x) bswap_64(x)
98
-#define AV_BE2MEC(s, x) (x)
99
-#define AV_LE2MEC(s, x) AV_BSWAPC(s, x)
92
+#define be2ne_16(x) (x)
93
+#define be2ne_32(x) (x)
94
+#define be2ne_64(x) (x)
95
+#define le2ne_16(x) bswap_16(x)
96
+#define le2ne_32(x) bswap_32(x)
97
+#define le2ne_64(x) bswap_64(x)
98
+#define AV_BE2NEC(s, x) (x)
99
+#define AV_LE2NEC(s, x) AV_BSWAPC(s, x)
100 100
 #else
101
-#define be2me_16(x) bswap_16(x)
102
-#define be2me_32(x) bswap_32(x)
103
-#define be2me_64(x) bswap_64(x)
104
-#define le2me_16(x) (x)
105
-#define le2me_32(x) (x)
106
-#define le2me_64(x) (x)
107
-#define AV_BE2MEC(s, x) AV_BSWAPC(s, x)
108
-#define AV_LE2MEC(s, x) (x)
101
+#define be2ne_16(x) bswap_16(x)
102
+#define be2ne_32(x) bswap_32(x)
103
+#define be2ne_64(x) bswap_64(x)
104
+#define le2ne_16(x) (x)
105
+#define le2ne_32(x) (x)
106
+#define le2ne_64(x) (x)
107
+#define AV_BE2NEC(s, x) AV_BSWAPC(s, x)
108
+#define AV_LE2NEC(s, x) (x)
109 109
 #endif
110 110
 
111
-#define AV_BE2ME16C(x) AV_BE2MEC(16, x)
112
-#define AV_BE2ME32C(x) AV_BE2MEC(32, x)
113
-#define AV_BE2ME64C(x) AV_BE2MEC(64, x)
114
-#define AV_LE2ME16C(x) AV_LE2MEC(16, x)
115
-#define AV_LE2ME32C(x) AV_LE2MEC(32, x)
116
-#define AV_LE2ME64C(x) AV_LE2MEC(64, x)
111
+#define AV_BE2NE16C(x) AV_BE2NEC(16, x)
112
+#define AV_BE2NE32C(x) AV_BE2NEC(32, x)
113
+#define AV_BE2NE64C(x) AV_BE2NEC(64, x)
114
+#define AV_LE2NE16C(x) AV_LE2NEC(16, x)
115
+#define AV_LE2NE32C(x) AV_LE2NEC(32, x)
116
+#define AV_LE2NE64C(x) AV_LE2NEC(64, x)
117 117
 
118 118
 #endif /* AVUTIL_BSWAP_H */
... ...
@@ -121,7 +121,7 @@ uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t le
121 121
             crc = ctx[((uint8_t)crc) ^ *buffer++] ^ (crc >> 8);
122 122
 
123 123
         while(buffer<end-3){
124
-            crc ^= le2me_32(*(const uint32_t*)buffer); buffer+=4;
124
+            crc ^= le2ne_32(*(const uint32_t*)buffer); buffer+=4;
125 125
             crc =  ctx[3*256 + ( crc     &0xFF)]
126 126
                   ^ctx[2*256 + ((crc>>8 )&0xFF)]
127 127
                   ^ctx[1*256 + ((crc>>16)&0xFF)]
... ...
@@ -297,10 +297,10 @@ int av_des_init(AVDES *d, const uint8_t *key, int key_bits, int decrypt) {
297 297
 }
298 298
 
299 299
 void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt) {
300
-    uint64_t iv_val = iv ? be2me_64(*(uint64_t *)iv) : 0;
300
+    uint64_t iv_val = iv ? be2ne_64(*(uint64_t *)iv) : 0;
301 301
     while (count-- > 0) {
302 302
         uint64_t dst_val;
303
-        uint64_t src_val = src ? be2me_64(*(const uint64_t *)src) : 0;
303
+        uint64_t src_val = src ? be2ne_64(*(const uint64_t *)src) : 0;
304 304
         if (decrypt) {
305 305
             uint64_t tmp = src_val;
306 306
             if (d->triple_des) {
... ...
@@ -317,12 +317,12 @@ void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t
317 317
             }
318 318
             iv_val = iv ? dst_val : 0;
319 319
         }
320
-        *(uint64_t *)dst = be2me_64(dst_val);
320
+        *(uint64_t *)dst = be2ne_64(dst_val);
321 321
         src += 8;
322 322
         dst += 8;
323 323
     }
324 324
     if (iv)
325
-        *(uint64_t *)iv = be2me_64(iv_val);
325
+        *(uint64_t *)iv = be2ne_64(iv_val);
326 326
 }
327 327
 
328 328
 #ifdef TEST
... ...
@@ -141,7 +141,7 @@ void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len){
141 141
 
142 142
 void av_md5_final(AVMD5 *ctx, uint8_t *dst){
143 143
     int i;
144
-    uint64_t finalcount= le2me_64(ctx->len<<3);
144
+    uint64_t finalcount= le2ne_64(ctx->len<<3);
145 145
 
146 146
     av_md5_update(ctx, "\200", 1);
147 147
     while((ctx->len & 63)!=56)
... ...
@@ -150,7 +150,7 @@ void av_md5_final(AVMD5 *ctx, uint8_t *dst){
150 150
     av_md5_update(ctx, (uint8_t*)&finalcount, 8);
151 151
 
152 152
     for(i=0; i<4; i++)
153
-        ((uint32_t*)dst)[i]= le2me_32(ctx->ABCD[3-i]);
153
+        ((uint32_t*)dst)[i]= le2ne_32(ctx->ABCD[3-i]);
154 154
 }
155 155
 
156 156
 void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len){
... ...
@@ -43,7 +43,7 @@ const int av_sha_size = sizeof(AVSHA);
43 43
 #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
44 44
 
45 45
 /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
46
-#define blk0(i) (block[i] = be2me_32(((const uint32_t*)buffer)[i]))
46
+#define blk0(i) (block[i] = be2ne_32(((const uint32_t*)buffer)[i]))
47 47
 #define blk(i)  (block[i] = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1))
48 48
 
49 49
 #define R0(v,w,x,y,z,i) z += ((w&(x^y))^y)     + blk0(i) + 0x5A827999 + rol(v, 5); w = rol(w, 30);
... ...
@@ -68,7 +68,7 @@ static void sha1_transform(uint32_t state[5], const uint8_t buffer[64])
68 68
     for (i = 0; i < 80; i++) {
69 69
         int t;
70 70
         if (i < 16)
71
-            t = be2me_32(((uint32_t*)buffer)[i]);
71
+            t = be2ne_32(((uint32_t*)buffer)[i]);
72 72
         else
73 73
             t = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1);
74 74
         block[i] = t;
... ...
@@ -314,7 +314,7 @@ void av_sha_update(AVSHA* ctx, const uint8_t* data, unsigned int len)
314 314
 void av_sha_final(AVSHA* ctx, uint8_t *digest)
315 315
 {
316 316
     int i;
317
-    uint64_t finalcount = be2me_64(ctx->count << 3);
317
+    uint64_t finalcount = be2ne_64(ctx->count << 3);
318 318
 
319 319
     av_sha_update(ctx, "\200", 1);
320 320
     while ((ctx->count & 63) != 56)