shithub: opus-tools

Download patch

ref: ee4b1430bf5e3de19303b4f4d9047d78ac5bb280
parent: 1d778017e09bfbe3ad89f5d05a76e5b240caf61f
author: Jean-Marc Valin <jean-marc.valin@usherbrooke.ca>
date: Tue Aug 2 08:00:18 EDT 2011

Making the header little endian like the rest

--- a/src/opus_header.c
+++ b/src/opus_header.c
@@ -26,10 +26,10 @@
 {
    if (p->pos>p->maxlen-4)
       return 0;
-   p->data[p->pos  ] = (val>>24) & 0xFF;
-   p->data[p->pos+1] = (val>>16) & 0xFF;
-   p->data[p->pos+2] = (val>> 8) & 0xFF;
-   p->data[p->pos+3] = (val    ) & 0xFF;
+   p->data[p->pos  ] = (val    ) & 0xFF;
+   p->data[p->pos+1] = (val>> 8) & 0xFF;
+   p->data[p->pos+2] = (val>>16) & 0xFF;
+   p->data[p->pos+3] = (val>>24) & 0xFF;
    p->pos += 4;
    return 1;
 }
@@ -38,8 +38,8 @@
 {
    if (p->pos>p->maxlen-2)
       return 0;
-   p->data[p->pos  ] = (val>> 8) & 0xFF;
-   p->data[p->pos+1] = (val    ) & 0xFF;
+   p->data[p->pos  ] = (val    ) & 0xFF;
+   p->data[p->pos+1] = (val>> 8) & 0xFF;
    p->pos += 2;
    return 1;
 }
@@ -58,10 +58,10 @@
 {
    if (p->pos>p->maxlen-4)
       return 0;
-   *val =  (opus_uint32)p->data[p->pos  ]<<24;
-   *val |= (opus_uint32)p->data[p->pos+1]<<16;
-   *val |= (opus_uint32)p->data[p->pos+2]<< 8;
-   *val |= (opus_uint32)p->data[p->pos+3];
+   *val =  (opus_uint32)p->data[p->pos  ];
+   *val |= (opus_uint32)p->data[p->pos+1]<< 8;
+   *val |= (opus_uint32)p->data[p->pos+2]<<16;
+   *val |= (opus_uint32)p->data[p->pos+3]<<24;
    p->pos += 4;
    return 1;
 }
@@ -70,8 +70,8 @@
 {
    if (p->pos>p->maxlen-2)
       return 0;
-   *val =  (opus_uint16)p->data[p->pos  ]<<8;
-   *val |= (opus_uint16)p->data[p->pos+1];
+   *val =  (opus_uint16)p->data[p->pos  ];
+   *val |= (opus_uint16)p->data[p->pos+1]<<8;
    p->pos += 2;
    return 1;
 }