ref: d0beb6c4a350758dd0a8013c3f3ff6636fab869c
parent: 2515e1a7b2bbcf880871b412238415edf388d719
author: lieff <[email protected]>
date: Thu Mar 29 13:10:38 EDT 2018
style
--- a/minimp3.h
+++ b/minimp3.h
@@ -71,12 +71,12 @@
#define HDR_GET_LAYER(h) (((h[1]) >> 1) & 3)
#define HDR_GET_BITRATE(h) ((h[2]) >> 4)
#define HDR_GET_SAMPLE_RATE(h) (((h[2]) >> 2) & 3)
-#define HDR_GET_MY_SAMPLE_RATE(h) (HDR_GET_SAMPLE_RATE(h) + (((h[1] >> 3) & 1) + ((h[1] >> 4) & 1)) * 3)
+#define HDR_GET_MY_SAMPLE_RATE(h) (HDR_GET_SAMPLE_RATE(h) + (((h[1] >> 3) & 1) + ((h[1] >> 4) & 1))*3)
#define HDR_IS_FRAME_576(h) ((h[1] & 14) == 2)
#define HDR_IS_LAYER_1(h) ((h[1] & 6) == 6)
#define BITS_DEQUANTIZER_OUT -1
-#define MAX_SCF (255 + BITS_DEQUANTIZER_OUT * 4 - 210)
+#define MAX_SCF (255 + BITS_DEQUANTIZER_OUT*4 - 210)
#define MAX_SCFI ((MAX_SCF + 3) & ~3)
#define MINIMP3_MIN(a, b) ((a) > (b) ? (b) : (a))
@@ -309,7 +309,7 @@
static int hdr_frame_bytes(const uint8_t *h, int free_format_size)
{
- int frame_bytes = hdr_frame_samples(h) * hdr_bitrate_kbps(h) * 125 / hdr_sample_rate_hz(h);
+ int frame_bytes = hdr_frame_samples(h)*hdr_bitrate_kbps(h)*125/hdr_sample_rate_hz(h);
if (HDR_IS_LAYER_1(h))
{
frame_bytes &= ~3; /* slot align */
@@ -385,7 +385,7 @@
if (mask & m)
{
int b = get_bits(bs, 6);
- s = g_deq_L12[ba*3 - 6 + b % 3] * (1 << 21 >> b/3);
+ s = g_deq_L12[ba*3 - 6 + b % 3]*(1 << 21 >> b/3);
}
*scf++ = s;
}
@@ -403,7 +403,7 @@
0,17,18, 3,19,4,5, 6,7, 8, 9,10,11,12,13,14,
0, 2, 3, 4, 5,6,7, 8,9,10,11,12,13,14,15,16
};
- const L12_subband_alloc_t * subband_alloc = L12_subband_alloc_table(hdr, sci);
+ const L12_subband_alloc_t *subband_alloc = L12_subband_alloc_table(hdr, sci);
int i, k = 0, ba_bits = 0;
const uint8_t *ba_code_tab = g_bitalloc_code_tab;
@@ -427,12 +427,12 @@
sci->bitalloc[2*i + 1] = sci->stereo_bands ? ba : 0;
}
- for (i = 0; i < 2 * sci->total_bands; i++)
+ for (i = 0; i < 2*sci->total_bands; i++)
{
sci->scfcod[i] = sci->bitalloc[i] ? HDR_IS_LAYER_1(hdr) ? 2 : get_bits(bs, 2) : 6;
}
- L12_read_scalefactors(bs, sci->bitalloc, sci->scfcod, sci->total_bands * 2, sci->scf);
+ L12_read_scalefactors(bs, sci->bitalloc, sci->scfcod, sci->total_bands*2, sci->scf);
for (i = sci->stereo_bands; i < sci->total_bands; i++)
{
@@ -746,7 +746,7 @@
sign = 2*x & 64;
frac = (float)((x & 63) - sign) / ((x & ~63) + sign);
- return g_pow43[(x + sign) >> 6] * (1.f + frac * ((4.f/3) + frac * (2.f/9))) * mult;
+ return g_pow43[(x + sign) >> 6]*(1.f + frac*((4.f/3) + frac*(2.f/9)))*mult;
}
static void L3_huffman(float *dst, bs_t *bs, const L3_gr_info_t *gr_info, const float *scf, int layer3gr_limit)
@@ -773,10 +773,10 @@
static const int16_t * const tabindex[2*16] = { tab0,tab1,tab2,tab3,tab0,tab5,tab6,tab7,tab8,tab9,tab10,tab11,tab12,tab13,tab0,tab15,tab16,tab16,tab16,tab16,tab16,tab16,tab16,tab16,tab24,tab24,tab24,tab24,tab24,tab24,tab24,tab24 };
static const uint8_t g_linbits[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,6,8,10,13,4,5,6,7,8,9,11,13 };
-#define PEEK_BITS(n) (bs_cache >> (32 - n))
-#define FLUSH_BITS(n) {bs_cache <<= (n); bs_sh += (n);}
-#define CHECK_BITS while (bs_sh >= 0) { bs_cache |= (uint32_t)*bs_next_ptr++ << bs_sh; bs_sh -= 8; }
-#define BSPOS ((bs_next_ptr - bs->buf)*8 - 24 + bs_sh)
+#define PEEK_BITS(n) (bs_cache >> (32 - n))
+#define FLUSH_BITS(n) { bs_cache <<= (n); bs_sh += (n); }
+#define CHECK_BITS while (bs_sh >= 0) { bs_cache |= (uint32_t)*bs_next_ptr++ << bs_sh; bs_sh -= 8; }
+#define BSPOS ((bs_next_ptr - bs->buf)*8 - 24 + bs_sh)
float one = 0.0f;
int ireg = 0, big_val_cnt = gr_info->big_values;
@@ -790,7 +790,7 @@
{
int tab_num = gr_info->table_select[ireg];
int sfb_cnt = gr_info->region_count[ireg++];
- const short * codebook = tabindex[tab_num];
+ const short *codebook = tabindex[tab_num];
int linbits = g_linbits[tab_num];
do
{
@@ -829,7 +829,7 @@
}
CHECK_BITS;
} while (--pairs_to_decode);
- } while ((big_val_cnt -= np) > 0 && --sfb_cnt >= 0 );
+ } while ((big_val_cnt -= np) > 0 && --sfb_cnt >= 0);
}
for (np = 1 - big_val_cnt;; dst += 4)
@@ -845,8 +845,8 @@
{
break;
}
-#define RELOAD_SCALEFACTOR if (!--np) {np = *sfb++/2; if (!np) break; one = *scf++;}
-#define DEQ_COUNT1(s) if (leaf & (128 >> s)) {dst[s] = ((int32_t)bs_cache < 0) ? -one : one; FLUSH_BITS(1)}
+#define RELOAD_SCALEFACTOR if (!--np) { np = *sfb++/2; if (!np) break; one = *scf++; }
+#define DEQ_COUNT1(s) if (leaf & (128 >> s)) { dst[s] = ((int32_t)bs_cache < 0) ? -one : one; FLUSH_BITS(1) }
RELOAD_SCALEFACTOR;
DEQ_COUNT1(0);
DEQ_COUNT1(1);
@@ -979,7 +979,7 @@
*dst++ = src[2*len];
}
}
- memcpy(grbuf, scratch, (dst - scratch) * sizeof(float));
+ memcpy(grbuf, scratch, (dst - scratch)*sizeof(float));
}
static void L3_antialias(float *grbuf, int nbands)
@@ -1458,8 +1458,8 @@
-4,7,-91,117,177,-106,-1428,1698,402,545,-9416,9916,-7154,12980,-61289,66494,
-5,6,-97,111,163,-127,-1498,1634,185,288,-9585,9838,-8540,11455,-62684,65290
};
- float * zlin = lins + 15*64;
- const float * w = g_win;
+ float *zlin = lins + 15*64;
+ const float *w = g_win;
zlin[4*15] = xl[18*16];
zlin[4*15 + 1] = xr[18*16];
@@ -1480,10 +1480,10 @@
if (have_simd()) for (i = 14; i >= 0; i--)
{
#define VLOAD(k) f4 w0 = VSET(*w++); f4 w1 = VSET(*w++); f4 vz = VLD(&zlin[4*i - 64*k]); f4 vy = VLD(&zlin[4*i - 64*(15 - k)]);
-#define V0(k) {VLOAD(k) b = VADD(VMUL(vz, w1), VMUL(vy, w0)) ; a = VSUB(VMUL(vz, w0),VMUL(vy, w1)); }
-#define V1(k) {VLOAD(k) b = VADD(b, VADD(VMUL(vz, w1), VMUL(vy, w0))); a = VADD(a, VSUB(VMUL(vz, w0),VMUL(vy, w1))); }
-#define V2(k) {VLOAD(k) b = VADD(b, VADD(VMUL(vz, w1), VMUL(vy, w0))); a = VADD(a, VSUB(VMUL(vy, w1),VMUL(vz, w0))); }
- f4 a,b;
+#define V0(k) { VLOAD(k) b = VADD(VMUL(vz, w1), VMUL(vy, w0)) ; a = VSUB(VMUL(vz, w0), VMUL(vy, w1)); }
+#define V1(k) { VLOAD(k) b = VADD(b, VADD(VMUL(vz, w1), VMUL(vy, w0))); a = VADD(a, VSUB(VMUL(vz, w0), VMUL(vy, w1))); }
+#define V2(k) { VLOAD(k) b = VADD(b, VADD(VMUL(vz, w1), VMUL(vy, w0))); a = VADD(a, VSUB(VMUL(vy, w1), VMUL(vz, w0))); }
+ f4 a, b;
zlin[4*i] = xl[18*(31 - i)];
zlin[4*i + 1] = xr[18*(31 - i)];
zlin[4*i + 2] = xl[1 + 18*(31 - i)];
@@ -1532,10 +1532,10 @@
#else
for (i = 14; i >= 0; i--)
{
-#define LOAD(k) float w0 = *w++; float w1 = *w++; float * vz = &zlin[4*i - k*64]; float * vy = &zlin[4*i - (15 - k)*64];
-#define S0(k) {int j; LOAD(k); for (j = 0; j < 4; j++) b[j] = vz[j] * w1 + vy[j] * w0, a[j] = vz[j] * w0 - vy[j] * w1;}
-#define S1(k) {int j; LOAD(k); for (j = 0; j < 4; j++) b[j] += vz[j] * w1 + vy[j] * w0, a[j] += vz[j] * w0 - vy[j] * w1;}
-#define S2(k) {int j; LOAD(k); for (j = 0; j < 4; j++) b[j] += vz[j] * w1 + vy[j] * w0, a[j] += vy[j] * w1 - vz[j] * w0;}
+#define LOAD(k) float w0 = *w++; float w1 = *w++; float *vz = &zlin[4*i - k*64]; float *vy = &zlin[4*i - (15 - k)*64];
+#define S0(k) { int j; LOAD(k); for (j = 0; j < 4; j++) b[j] = vz[j]*w1 + vy[j]*w0, a[j] = vz[j]*w0 - vy[j]*w1; }
+#define S1(k) { int j; LOAD(k); for (j = 0; j < 4; j++) b[j] += vz[j]*w1 + vy[j]*w0, a[j] += vz[j]*w0 - vy[j]*w1; }
+#define S2(k) { int j; LOAD(k); for (j = 0; j < 4; j++) b[j] += vz[j]*w1 + vy[j]*w0, a[j] += vy[j]*w1 - vz[j]*w0; }
float a[4], b[4];
zlin[4*i] = xl[18*(31 - i)];