[Tremor] Byte order problem

Niklas Barsk nibarius at gmail.com
Tue Sep 21 23:21:38 PDT 2004


Hi,

I tried using ntohs and ntohl on the buffer from ov_read() but it does
not do anything with its content. I have not found any good examples
of how to use ntohl so I might use it the wrong way. This is what I
tried to do right after the ov_read() (buf contains the read data):

{
int i;
for( i = 0; i < buflen; ++i)
 buf[i] = htonl( buf[i] );
}

Best regards
Niklas Barsk

On Mon, 20 Sep 2004 16:00:00 -0400 (EDT), Frederic Bastien
<nouiz at nouiz.org> wrote:
> Hi,
> 
> I had also problem with endienness. What I have find is that the
> definition in misc.h is used only for the computation. It don't change the
> endienness of the output. You can use ntohs (network to host short)or
> ntohl (network to host long)to revert the output regerated end it will
> give you the good result.
> 
> i.e. after your ov_read() make a loop that will change the endieness of
> the buffer before continuing.
> 
> It is the way that I have solved my problem.
> 
> Frederic Bastien
> 
> 
> 
> > Hi,
> > I am running the lowmem branch of Tremor on a Sun Solaris workstation.
> > There were some problems compiling the misc.h file, both endian
> > versions of the union magic was compiled and caused a conflict. So I
> > just commented out the little endian version since I am running on a big
> > endian machine.
> >
> > With this modification the code compiles but the output file just
> > contains noise. I tried to run Tremor on another Linux computer and
> > that gives a good output. I have decoded the same Vorbis file on both
> > systems and compared them with a hex editor. The difference is that  the
> > Sun decoded file has a somewhat different byte order than the Linux.
> > When the Linux version has the order A B C D the Sun version has B A D
> > C.
> >
> > I have tried to comment out the big endian code instead, but the
> > generated file has no similarities, which I can spot, with the
> > correct one if I do that.
> >
> > Does anyone know why this happens and how I can solve it?
> >
> > Best regards
> > Niklas Barsk
> > _______________________________________________
> > Tremor mailing list
> > Tremor at xiph.org
> > http://lists.xiph.org/mailman/listinfo/tremor
> 
>


More information about the Tremor mailing list