[MPlayer-dev-eng] [PATCH] bigendian fix for hwac3

Ulion ulion2002 at gmail.com
Sat Sep 15 02:17:28 CEST 2007


2007/9/15, elupus <elupus at ecce.se>:
> "reimar" <subversion at mplayerhq.hu> wrote in message
> news:20070914125213.AB4153B613 at natsuki.mplayerhq.hu...
> > Author: reimar
> > Date: Fri Sep 14 14:52:13 2007
> > New Revision: 24456
> >
> > Log:
> > Fix off-by-one error if fsize is odd (does handling that case even make
> > sense?)
> > and remove a TODO comment that no longer applies.
> >
> >
> > Modified:
> >   trunk/libmpcodecs/ad_hwac3.c
> >
> > Modified: trunk/libmpcodecs/ad_hwac3.c
> > ==============================================================================
> > --- trunk/libmpcodecs/ad_hwac3.c (original)
> > +++ trunk/libmpcodecs/ad_hwac3.c Fri Sep 14 14:52:13 2007
> > @@ -360,10 +360,9 @@ static int decode_audio_dts(unsigned cha
> > #ifdef WORDS_BIGENDIAN
> >   memcpy(&buf[8], indata_ptr, fsize);
> > #else
> > -  //TODO if fzise is odd, swab doesn't copy the last byte
> >   swab(indata_ptr, &buf[8], fsize);
> >   if (fsize & 1)
> > -    buf[8+fsize] = indata_ptr[fsize];
> > +    buf[8+fsize-1] = indata_ptr[fsize-1];
> > #endif
> >   memset(&buf[fsize + 8], 0, nr_samples * 2 * 2 - (fsize + 8));
>
>
> Yea it does. It does, i have a sample somewhere that has the issue. Think it
> was dts thou, but still the same. In essence the solution was to extend the
> data with a zero for swab to use. This how we handle it in xbmc's dvdplayer.
>
>   if( size & 0x1 )
>   {
>     swab(src, dst, size-1);
>     dst+=size-1;
>     src+=size-1;
>
>     dst[0] = 0x0;
>     dst[1] = src[0];
>     return size+1;
>   }
>   else
>   {
>     swab(src, dst, size);
>     return size;
>   }
>
> cheers
>
>

I made a patch according to your sample code, here it is.


-- 
Ulion
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: hwac3_odd.txt
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070915/5b8d0043/attachment.txt>


More information about the MPlayer-dev-eng mailing list