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
71#define HDR_GET_LAYER(h) (((h[1]) >> 1) & 3)71#define HDR_GET_LAYER(h) (((h[1]) >> 1) & 3)
72#define HDR_GET_BITRATE(h) ((h[2]) >> 4)72#define HDR_GET_BITRATE(h) ((h[2]) >> 4)
73#define HDR_GET_SAMPLE_RATE(h) (((h[2]) >> 2) & 3)73#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)
75#define HDR_IS_FRAME_576(h) ((h[1] & 14) == 2)75#define HDR_IS_FRAME_576(h) ((h[1] & 14) == 2)
76#define HDR_IS_LAYER_1(h) ((h[1] & 6) == 6)76#define HDR_IS_LAYER_1(h) ((h[1] & 6) == 6)
77 77
@@ -492,8 +492,7 @@ static void L12_apply_scf_384(L12_scale_info *sci, const float *scf, float *dst) · 414 unmodified lines
492 492
493static int L3_read_side_info(bs_t *bs, L3_gr_info_t *gr, const uint8_t *hdr)493static int L3_read_side_info(bs_t *bs, L3_gr_info_t *gr, const uint8_t *hdr)
494{494{
495 static const uint8_t g_scf_long[9][23] = {495 static const uint8_t g_scf_long[8][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 },
497 { 6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54,0 },496 { 6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54,0 },
498 { 12,12,12,12,12,12,16,20,24,28,32,40,48,56,64,76,90,2,2,2,2,2,0 },497 { 12,12,12,12,12,12,16,20,24,28,32,40,48,56,64,76,90,2,2,2,2,2,0 },
499 { 6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54,0 },498 { 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
503 { 4,4,4,4,4,4,6,6,6,8,10,12,16,18,22,28,34,40,46,54,54,192,0 },502 { 4,4,4,4,4,4,6,6,6,8,10,12,16,18,22,28,34,40,46,54,54,192,0 },
504 { 4,4,4,4,4,4,6,6,8,10,12,16,20,24,30,38,46,56,68,84,102,26,0 }503 { 4,4,4,4,4,4,6,6,8,10,12,16,20,24,30,38,46,56,68,84,102,26,0 }
505 };504 };
506 static const uint8_t g_scf_short[9][40] = {505 static const uint8_t g_scf_short[8][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 },
508 { 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 },506 { 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 },
509 { 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 },507 { 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 },
510 { 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 },508 { 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
514 { 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 },512 { 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 },
515 { 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 }513 { 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 }
516 };514 };
517 static const uint8_t g_scf_mixed[9][40] = {515 static const uint8_t g_scf_mixed[8][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 },
519 { 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 },516 { 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 },
520 { 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 },517 { 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 },
521 { 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 },518 { 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
528 525
529 unsigned tables, scfsi = 0;526 unsigned tables, scfsi = 0;
530 int main_data_begin, part_23_sum = 0;527 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);
532 int gr_count = HDR_IS_MONO(hdr) ? 1 : 2;529 int gr_count = HDR_IS_MONO(hdr) ? 1 : 2;
533 530
534 if (HDR_TEST_MPEG1(hdr))531 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
959 int prev = itop - max_blocks;956 int prev = itop - max_blocks;
960 ist_pos[itop] = max_band[i] >= prev ? default_pos : ist_pos[prev];957 ist_pos[itop] = max_band[i] >= prev ? default_pos : ist_pos[prev];
961 }958 }
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);
963}960}
964 961
965static void L3_reorder(float *grbuf, float *scratch, const uint8_t *sfb)962static 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