History

reduce tables size by 103 bytes with few instructions in code

lieff committed 8 years ago

Commit 7d789621 parent 5f013261 file · +6 −9Browse files

Unified · Split

minimp3.h+6−9
@@ -71,7 +71,7 @@ int mp3dec_decode_frame(mp3dec_t *dec, const unsigned char *mp3, int mp3_bytes, · 70 unmodified lines
7171 #define HDR_GET_LAYER(h) (((h[1]) >> 1) & 3)
7272 #define HDR_GET_BITRATE(h) ((h[2]) >> 4)
7373 #define HDR_GET_SAMPLE_RATE(h) (((h[2]) >> 2) & 3)
74−#define HDR_GET_MY_SAMPLE_RATE(h) (HDR_GET_SAMPLE_RATE(h) + (((h[1] >> 3) & 1) + ((h[1] >> 4) & 1))*3)
74+#define HDR_GET_MY_SAMPLE_RATE(h) (HDR_GET_SAMPLE_RATE(h) + (((h[1] >> 3) & 1) + ((h[1] >> 4) & 1))*3)
7575 #define HDR_IS_FRAME_576(h) ((h[1] & 14) == 2)
7676 #define HDR_IS_LAYER_1(h) ((h[1] & 6) == 6)
7777
@@ -492,8 +492,7 @@ static void L12_apply_scf_384(L12_scale_info *sci, const float *scf, float *dst) · 414 unmodified lines
492492
493493 static int L3_read_side_info(bs_t *bs, L3_gr_info_t *gr, const uint8_t *hdr)
494494 {
495− static const uint8_t g_scf_long[9][23] = {
496− { 6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54,0 },
495+ static const uint8_t g_scf_long[8][23] = {
497496 { 6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54,0 },
498497 { 12,12,12,12,12,12,16,20,24,28,32,40,48,56,64,76,90,2,2,2,2,2,0 },
499498 { 6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54,0 },
@@ -503,8 +502,7 @@ static int L3_read_side_info(bs_t *bs, L3_gr_info_t *gr, const uint8_t *hdr) · 3 unmodified lines
503502 { 4,4,4,4,4,4,6,6,6,8,10,12,16,18,22,28,34,40,46,54,54,192,0 },
504503 { 4,4,4,4,4,4,6,6,8,10,12,16,20,24,30,38,46,56,68,84,102,26,0 }
505504 };
506− static const uint8_t g_scf_short[9][40] = {
507− { 4,4,4,4,4,4,4,4,4,6,6,6,8,8,8,10,10,10,12,12,12,14,14,14,18,18,18,24,24,24,30,30,30,40,40,40,18,18,18,0 },
505+ static const uint8_t g_scf_short[8][40] = {
508506 { 4,4,4,4,4,4,4,4,4,6,6,6,8,8,8,10,10,10,12,12,12,14,14,14,18,18,18,24,24,24,30,30,30,40,40,40,18,18,18,0 },
509507 { 8,8,8,8,8,8,8,8,8,12,12,12,16,16,16,20,20,20,24,24,24,28,28,28,36,36,36,2,2,2,2,2,2,2,2,2,26,26,26,0 },
510508 { 4,4,4,4,4,4,4,4,4,6,6,6,6,6,6,8,8,8,10,10,10,14,14,14,18,18,18,26,26,26,32,32,32,42,42,42,18,18,18,0 },
@@ -514,8 +512,7 @@ static int L3_read_side_info(bs_t *bs, L3_gr_info_t *gr, const uint8_t *hdr) · 3 unmodified lines
514512 { 4,4,4,4,4,4,4,4,4,4,4,4,6,6,6,6,6,6,10,10,10,12,12,12,14,14,14,16,16,16,20,20,20,26,26,26,66,66,66,0 },
515513 { 4,4,4,4,4,4,4,4,4,4,4,4,6,6,6,8,8,8,12,12,12,16,16,16,20,20,20,26,26,26,34,34,34,42,42,42,12,12,12,0 }
516514 };
517− static const uint8_t g_scf_mixed[9][40] = {
518− { 6,6,6,6,6,6,6,6,6,8,8,8,10,10,10,12,12,12,14,14,14,18,18,18,24,24,24,30,30,30,40,40,40,18,18,18,0 },
515+ static const uint8_t g_scf_mixed[8][40] = {
519516 { 6,6,6,6,6,6,6,6,6,8,8,8,10,10,10,12,12,12,14,14,14,18,18,18,24,24,24,30,30,30,40,40,40,18,18,18,0 },
520517 { 12,12,12,4,4,4,8,8,8,12,12,12,16,16,16,20,20,20,24,24,24,28,28,28,36,36,36,2,2,2,2,2,2,2,2,2,26,26,26,0 },
521518 { 6,6,6,6,6,6,6,6,6,6,6,6,8,8,8,10,10,10,14,14,14,18,18,18,26,26,26,32,32,32,42,42,42,18,18,18,0 },
@@ -528,7 +525,7 @@ static int L3_read_side_info(bs_t *bs, L3_gr_info_t *gr, const uint8_t *hdr) · 6 unmodified lines
528525
529526 unsigned tables, scfsi = 0;
530527 int main_data_begin, part_23_sum = 0;
531− int sr_idx = HDR_GET_MY_SAMPLE_RATE(hdr);
528+ int sr_idx = HDR_GET_MY_SAMPLE_RATE(hdr); sr_idx -= (sr_idx != 0);
532529 int gr_count = HDR_IS_MONO(hdr) ? 1 : 2;
533530
534531 if (HDR_TEST_MPEG1(hdr))
@@ -959,7 +956,7 @@ static void L3_intensity_stereo(float *left, uint8_t *ist_pos, const L3_gr_info_ · 424 unmodified lines
959956 int prev = itop - max_blocks;
960957 ist_pos[itop] = max_band[i] >= prev ? default_pos : ist_pos[prev];
961958 }
962− L3_stereo_process(left, ist_pos, gr->sfbtab, hdr, max_band, gr[1].scalefac_compress&1);
959+ L3_stereo_process(left, ist_pos, gr->sfbtab, hdr, max_band, gr[1].scalefac_compress & 1);
963960 }
964961
965962 static void L3_reorder(float *grbuf, float *scratch, const uint8_t *sfb)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t