[LIBMPG123] Update to version 1.25.8. CORE-14291
authorThomas Faber <thomas.faber@reactos.org>
Sun, 4 Feb 2018 15:37:07 +0000 (16:37 +0100)
committerThomas Faber <thomas.faber@reactos.org>
Mon, 5 Feb 2018 13:40:39 +0000 (14:40 +0100)
sdk/include/reactos/libs/libmpg123/config.h
sdk/include/reactos/libs/libmpg123/getbits.h
sdk/include/reactos/libs/libmpg123/mpeghead.h
sdk/include/reactos/libs/libmpg123/mpg123.h
sdk/lib/3rdparty/libmpg123/layer3.c
sdk/lib/3rdparty/libmpg123/parse.c

index e481e8d..3f3fdbc 100644 (file)
 #define PACKAGE_NAME "mpg123"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "mpg123 1.25.6"
+#define PACKAGE_STRING "mpg123 1.25.8"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "mpg123"
 #define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "1.25.6"
+#define PACKAGE_VERSION "1.25.8"
 
 /* Define if portaudio v18 API is wanted. */
 /* #undef PORTAUDIO18 */
 /* #undef USE_YASM_FOR_AVX */
 
 /* Version number of package */
-#define VERSION "1.25.6"
+#define VERSION "1.25.8"
 
 /* Define to use Win32 named pipes */
 #define WANT_WIN32_FIFO 1
index b250b6c..4b452f9 100644 (file)
@@ -45,6 +45,7 @@ static unsigned int getbits(mpg123_handle *fr, int number_of_bits)
 fprintf(stderr,"g%d",number_of_bits);
 #endif
   /* Safety catch until we got the nasty code fully figured out. */
+  /* No, that catch stays here, even if we think we got it figured out! */
   if( (long)(fr->wordpointer-fr->bsbuf)*8
       + fr->bitindex+number_of_bits > (long)fr->framesize*8 )
     return 0;
index 549d0ee..7696df7 100644 (file)
@@ -78,7 +78,7 @@
 #define HDR_CMPMASK (HDR_SYNC|HDR_VERSION|HDR_LAYER|HDR_SAMPLERATE)
 
 /* A stricter mask, for matching free format headers. */
-#define HDR_SAMEMASK (HDR_SYNC|HDR_VERSION|HDR_LAYER|HDR_BITRATE|HDR_SAMPLERATE|HDR_CHANNEL|HDR_CHANEX)
+#define HDR_SAMEMASK (HDR_SYNC|HDR_VERSION|HDR_LAYER|HDR_BITRATE|HDR_SAMPLERATE|HDR_CHANNEL)
 
 /* Free format headers have zero bitrate value. */
 #define HDR_FREE_FORMAT(head) (!(head & HDR_BITRATE))
index 71677a4..f7dd4a5 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       libmpg123: MPEG Audio Decoder library (version 1.25.6)
+       libmpg123: MPEG Audio Decoder library (version 1.25.8)
 
        copyright 1995-2015 by the mpg123 project
        free software under the terms of the LGPL 2.1
index a3e7fee..917f3ab 100644 (file)
@@ -280,10 +280,12 @@ void init_layer3(void)
                int *mp;
                int cb,lwin;
                const unsigned char *bdf;
+               int switch_idx;
 
                mp = map[j][0] = mapbuf0[j];
                bdf = bi->longDiff;
-               for(i=0,cb = 0; cb < 8 ; cb++,i+=*bdf++)
+               switch_idx = (j < 3) ? 8 : 6;
+               for(i=0,cb = 0; cb < switch_idx ; cb++,i+=*bdf++)
                {
                        *mp++ = (*bdf) >> 1;
                        *mp++ = i;
@@ -465,8 +467,14 @@ static int III_get_side_info(mpg123_handle *fr, struct III_sideinfo *si,int ster
                }
                gr_info->pow2gain = fr->gainpow2+256 - getbits_fast(fr, 8) + powdiff;
                if(ms_stereo) gr_info->pow2gain += 2;
-
                gr_info->scalefac_compress = getbits(fr, tab[4]);
+               if(gr_info->part2_3_length == 0)
+               {
+                       if(gr_info->scalefac_compress > 0)
+                               debug1( "scalefac_compress _should_ be zero instead of %i"
+                               ,       gr_info->scalefac_compress );
+                       gr_info->scalefac_compress = 0;
+               }
 
                if(get1bit(fr))
                { /* window switch flag  */
@@ -553,6 +561,14 @@ static int III_get_scale_factors_1(mpg123_handle *fr, int *scf,struct gr_info_s
        int num0 = slen[0][gr_info->scalefac_compress];
        int num1 = slen[1][gr_info->scalefac_compress];
 
+       if(gr_info->part2_3_length == 0)
+       {
+               int i;
+               for(i=0;i<39;i++)
+                       *scf++ = 0;
+               return 0;
+       }
+
        if(gr_info->block_type == 2)
        {
                int i=18;
@@ -667,6 +683,14 @@ static int III_get_scale_factors_2(mpg123_handle *fr, int *scf,struct gr_info_s
 
        pnt = stab[n][(slen>>12)&0x7];
 
+       if(gr_info->part2_3_length == 0)
+       {
+               int i;
+               for(i=0;i<39;i++)
+                       *scf++ = 0;
+               return 0;
+       }
+
        for(i=0;i<4;i++)
        {
                int num = slen & 0x7;
@@ -680,7 +704,7 @@ static int III_get_scale_factors_2(mpg123_handle *fr, int *scf,struct gr_info_s
                else
                for(j=0;j<(int)(pnt[i]);j++) *scf++ = 0;
        }
-  
+
        n = (n << 1) + 1;
        for(i=0;i<n;i++) *scf++ = 0;
 
@@ -735,6 +759,12 @@ static int III_dequantize_sample(mpg123_handle *fr, real xr[SBLIMIT][SSLIMIT],in
        int gainpow2_scale_idx = 378;
 #endif
 
+       /* Assumption: If there is some part2_3_length at all, there should be
+          enough of it to work with properly. In case of zero length we silently
+          zero things. */
+       if(gr_info->part2_3_length > 0)
+       {
+
        /* mhipp tree has this split up a bit... */
        int num=getbitoffset(fr);
        MASK_TYPE mask;
@@ -1197,6 +1227,18 @@ static int III_dequantize_sample(mpg123_handle *fr, real xr[SBLIMIT][SSLIMIT],in
        backbits(fr, num);
        num = 0;
 
+       }
+       else
+       {
+               part2remain = 0;
+               /* Not entirely sure what good values are, must be > 0. */
+               gr_info->maxband[0] =
+               gr_info->maxband[1] =
+               gr_info->maxband[2] =
+               gr_info->maxbandl   = 0;
+               gr_info->maxb       = 1;
+       }
+
        while(xrpnt < &xr[SBLIMIT][0]) 
        *xrpnt++ = DOUBLE_TO_REAL(0.0);
 
index 2e3652e..e0059a7 100644 (file)
@@ -889,26 +889,7 @@ void set_pointer(mpg123_handle *fr, long backstep)
 
 double compute_bpf(mpg123_handle *fr)
 {
-       double bpf;
-
-       switch(fr->lay) 
-       {
-               case 1:
-                       bpf = tabsel_123[fr->lsf][0][fr->bitrate_index];
-                       bpf *= 12000.0 * 4.0;
-                       bpf /= freqs[fr->sampling_frequency] <<(fr->lsf);
-               break;
-               case 2:
-               case 3:
-                       bpf = tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index];
-                       bpf *= 144000;
-                       bpf /= freqs[fr->sampling_frequency] << (fr->lsf);
-               break;
-               default:
-                       bpf = 1.0;
-       }
-
-       return bpf;
+       return (fr->framesize > 0) ? fr->framesize + 4.0 : 1.0;
 }
 
 int attribute_align_arg mpg123_spf(mpg123_handle *mh)