-
Notifications
You must be signed in to change notification settings - Fork 8
/
pdmp3.c
2590 lines (2440 loc) · 115 KB
/
pdmp3.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Public Domain (www.unlicense.org)
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors. We intend this dedication to be an
overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Original version written by Krister Lagerström(krister@kmlager.com)
Website: https://sites.google.com/a/kmlager.com/www/projects
Contributors:
technosaurus
Erik Hofman (added a subset of the libmpg123 compatible streaming API)
*/
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#ifdef OUTPUT_SOUND
#include <sys/soundcard.h>
#endif
/* Types used in the frame header */
typedef enum { /* Layer number */
mpeg1_layer_reserved = 0,
mpeg1_layer_3 = 1,
mpeg1_layer_2 = 2,
mpeg1_layer_1 = 3
}
t_mpeg1_layer;
typedef enum { /* Modes */
mpeg1_mode_stereo = 0,
mpeg1_mode_joint_stereo,
mpeg1_mode_dual_channel,
mpeg1_mode_single_channel
}
t_mpeg1_mode;
typedef struct { /* MPEG1 Layer 1-3 frame header */
unsigned id; /* 1 bit */
t_mpeg1_layer layer; /* 2 bits */
unsigned protection_bit; /* 1 bit */
unsigned bitrate_index; /* 4 bits */
unsigned sampling_frequency; /* 2 bits */
unsigned padding_bit; /* 1 bit */
unsigned private_bit; /* 1 bit */
t_mpeg1_mode mode; /* 2 bits */
unsigned mode_extension; /* 2 bits */
unsigned copyright; /* 1 bit */
unsigned original_or_copy; /* 1 bit */
unsigned emphasis; /* 2 bits */
}
t_mpeg1_header;
typedef struct { /* MPEG1 Layer 3 Side Information : [2][2] means [gr][ch] */
unsigned main_data_begin; /* 9 bits */
unsigned private_bits; /* 3 bits in mono,5 in stereo */
unsigned scfsi[2][4]; /* 1 bit */
unsigned part2_3_length[2][2]; /* 12 bits */
unsigned big_values[2][2]; /* 9 bits */
unsigned global_gain[2][2]; /* 8 bits */
unsigned scalefac_compress[2][2]; /* 4 bits */
unsigned win_switch_flag[2][2]; /* 1 bit */
/* if(win_switch_flag[][]) */ //use a union dammit
unsigned block_type[2][2]; /* 2 bits */
unsigned mixed_block_flag[2][2]; /* 1 bit */
unsigned table_select[2][2][3]; /* 5 bits */
unsigned subblock_gain[2][2][3]; /* 3 bits */
/* else */
/* table_select[][][] */
unsigned region0_count[2][2]; /* 4 bits */
unsigned region1_count[2][2]; /* 3 bits */
/* end */
unsigned preflag[2][2]; /* 1 bit */
unsigned scalefac_scale[2][2]; /* 1 bit */
unsigned count1table_select[2][2];/* 1 bit */
unsigned count1[2][2]; /* Not in file,calc. by huff.dec.! */
}
t_mpeg1_side_info;
typedef struct { /* MPEG1 Layer 3 Main Data */
unsigned scalefac_l[2][2][21]; /* 0-4 bits */
unsigned scalefac_s[2][2][12][3]; /* 0-4 bits */
float is[2][2][576]; /* Huffman coded freq. lines */
}
t_mpeg1_main_data;
typedef struct hufftables{
const unsigned short * hufftable;
uint16_t treelen;
uint8_t linbits;
}
hufftables;
typedef struct { /* Scale factor band indices,for long and short windows */
unsigned l[23];
unsigned s[14];
}
t_sf_band_indices;
/** define a subset of a libmpg123 compatible streaming API */
#define PDMP3_OK 0
#define PDMP3_ERR -1
#define PDMP3_NEED_MORE -10
#define PDMP3_NEW_FORMAT -11
#define PDMP3_NO_SPACE 7
#define PDMP3_ENC_SIGNED_16 (0x080|0x040|0x10)
#define INBUF_SIZE (4*4096)
typedef struct
{
size_t processed;
unsigned istart,iend,ostart;
unsigned char in[INBUF_SIZE];
unsigned out[2][576];
t_mpeg1_header g_frame_header;
t_mpeg1_side_info g_side_info; /* < 100 words */
t_mpeg1_main_data g_main_data;
unsigned hsynth_init;
unsigned synth_init;
/* Bit reservoir for main data */
unsigned g_main_data_vec[2*1024];/* Large static data */
unsigned *g_main_data_ptr;/* Pointer into the reservoir */
unsigned g_main_data_idx;/* Index into the current byte(0-7) */
unsigned g_main_data_top;/* Number of bytes in reservoir(0-1024) */
/* Bit reservoir for side info */
unsigned side_info_vec[32+4];
unsigned *side_info_ptr; /* Pointer into the reservoir */
unsigned side_info_idx; /* Index into the current byte(0-7) */
char new_header;
}
pdmp3_handle;
pdmp3_handle* pdmp3_new(const char *decoder,int *error);
void pdmp3_delete(pdmp3_handle *id);
int pdmp3_open_feed(pdmp3_handle *id);
int pdmp3_feed(pdmp3_handle *id,const unsigned char *in,size_t size);
int pdmp3_read(pdmp3_handle *id,unsigned char *outmemory,size_t outsize,size_t *done);
int pdmp3_decode(pdmp3_handle *id,const unsigned char *in,size_t insize,unsigned char *out,size_t outsize,size_t *done);
int pdmp3_getformat(pdmp3_handle *id,long *rate,int *channels,int *encoding);
/** end of the subset of a libmpg123 compatible streaming API */
void pdmp3(char * const *mp3s);
#ifndef PDMP3_HEADER_ONLY
#define SIM_UNIX
#define TRUE 1
#define FALSE 0
#define C_SYNC 0xfff00000
#define C_EOF 0xffffffff
#define C_PI 3.14159265358979323846
#define C_INV_SQRT_2 0.70710678118654752440
#define Hz 1
#define kHz 1000*Hz
#define bit_s 1
#define kbit_s 1000*bit_s
#define FRAG_SIZE_LN2 0x0011 /* 2^17=128kb */
#define FRAG_NUMS 0x0004
#ifndef NDEBUG
#define DBG(str,args...) { printf(str,## args); printf("\n"); }
#define ERR(str,args...) { fprintf(stderr,str,## args) ; fprintf(stderr,"\n"); }
#else
#define DBG(str,args...)
#define ERR(str,args...)
#endif
#ifdef DEBUG //debug functions
void dmp_fr(t_mpeg1_header *hdr);
void dmp_si(t_mpeg1_header *hdr,t_mpeg1_side_info *si);
void dmp_scf(t_mpeg1_side_info *si,t_mpeg1_main_data *md,int gr,int ch);
void dmp_huff(t_mpeg1_main_data *md,int gr,int ch);
void dmp_samples(t_mpeg1_main_data *md,int gr,int ch,int type);
#else
#define dmp_fr(...) do{}while(0)
#define dmp_si(...) do{}while(0)
#define dmp_scf(...) do{}while(0)
#define dmp_huff(...) do{}while(0)
#define dmp_samples(...) do{}while(0)
#endif
static int Decode_L3(pdmp3_handle *id);
static int Get_Bytes(pdmp3_handle *id,unsigned no_of_bytes,unsigned data_vec[]);
static int Get_Main_Data(pdmp3_handle *id,unsigned main_data_size,unsigned main_data_begin);
static int Huffman_Decode(pdmp3_handle *id,unsigned table_num,int32_t *x,int32_t *y,int32_t *v,int32_t *w);
static int Read_Audio_L3(pdmp3_handle *id);
static int Read_CRC(pdmp3_handle *id);
static int Read_Frame(pdmp3_handle *id);
static int Search_Header(pdmp3_handle *id);
static int Read_Main_L3(pdmp3_handle *id);
static int Set_Main_Pos(pdmp3_handle *id,unsigned bit_pos);
static unsigned Get_Inbuf_Filled(pdmp3_handle *id);
static unsigned Get_Inbuf_Free(pdmp3_handle *id);
static unsigned Get_Byte(pdmp3_handle *id);
static unsigned Get_Main_Bit(pdmp3_handle *id);
static unsigned Get_Main_Bits(pdmp3_handle *id,unsigned number_of_bits);
static unsigned Get_Main_Pos(pdmp3_handle *id);
static unsigned Get_Side_Bits(pdmp3_handle *id,unsigned number_of_bits);
static unsigned Get_Filepos(pdmp3_handle *id);
static void Error(const char *s,int e);
static void Get_Sideinfo(pdmp3_handle *id,unsigned sideinfo_size);
static void IMDCT_Win(float in[18],float out[36],unsigned block_type);
static void L3_Antialias(pdmp3_handle *id,unsigned gr,unsigned ch);
static void L3_Frequency_Inversion(pdmp3_handle *id,unsigned gr,unsigned ch);
static void L3_Hybrid_Synthesis(pdmp3_handle *id,unsigned gr,unsigned ch);
static void L3_Requantize(pdmp3_handle *id,unsigned gr,unsigned ch);
static void L3_Reorder(pdmp3_handle *id,unsigned gr,unsigned ch);
static void L3_Stereo(pdmp3_handle *id,unsigned gr);
static void L3_Subband_Synthesis(pdmp3_handle *id,unsigned gr,unsigned ch,unsigned outdata[576]);
static void Read_Huffman(pdmp3_handle *id,unsigned part_2_start,unsigned gr,unsigned ch);
static void Requantize_Process_Long(pdmp3_handle *id,unsigned gr,unsigned ch,unsigned is_pos,unsigned sfb);
static void Requantize_Process_Short(pdmp3_handle *id,unsigned gr,unsigned ch,unsigned is_pos,unsigned sfb,unsigned win);
static void Stereo_Process_Intensity_Long(pdmp3_handle *id,unsigned gr,unsigned sfb);
static void Stereo_Process_Intensity_Short(pdmp3_handle *id,unsigned gr,unsigned sfb);
static const unsigned short g_huffman_table[] = {
//g_huffman_table_1[7] = {
0x0201,0x0000,0x0201,0x0010,0x0201,0x0001,0x0011,
//},g_huffman_table_2[17] = {
0x0201,0x0000,0x0401,0x0201,0x0010,0x0001,0x0201,0x0011,0x0401,0x0201,0x0020,
0x0021,0x0201,0x0012,0x0201,0x0002,0x0022,
//},g_huffman_table_3[17] = {
0x0401,0x0201,0x0000,0x0001,0x0201,0x0011,0x0201,0x0010,0x0401,0x0201,0x0020,
0x0021,0x0201,0x0012,0x0201,0x0002,0x0022,
//},g_huffman_table_5[31] = {
0x0201,0x0000,0x0401,0x0201,0x0010,0x0001,0x0201,0x0011,0x0801,0x0401,0x0201,
0x0020,0x0002,0x0201,0x0021,0x0012,0x0801,0x0401,0x0201,0x0022,0x0030,0x0201,
0x0003,0x0013,0x0201,0x0031,0x0201,0x0032,0x0201,0x0023,0x0033,
//},g_huffman_table_6[31] = {
0x0601,0x0401,0x0201,0x0000,0x0010,0x0011,0x0601,0x0201,0x0001,0x0201,0x0020,
0x0021,0x0601,0x0201,0x0012,0x0201,0x0002,0x0022,0x0401,0x0201,0x0031,0x0013,
0x0401,0x0201,0x0030,0x0032,0x0201,0x0023,0x0201,0x0003,0x0033,
//},g_huffman_table_7[71] = {
0x0201,0x0000,0x0401,0x0201,0x0010,0x0001,0x0801,0x0201,0x0011,0x0401,0x0201,
0x0020,0x0002,0x0021,0x1201,0x0601,0x0201,0x0012,0x0201,0x0022,0x0030,0x0401,
0x0201,0x0031,0x0013,0x0401,0x0201,0x0003,0x0032,0x0201,0x0023,0x0004,0x0a01,
0x0401,0x0201,0x0040,0x0041,0x0201,0x0014,0x0201,0x0042,0x0024,0x0c01,0x0601,
0x0401,0x0201,0x0033,0x0043,0x0050,0x0401,0x0201,0x0034,0x0005,0x0051,0x0601,
0x0201,0x0015,0x0201,0x0052,0x0025,0x0401,0x0201,0x0044,0x0035,0x0401,0x0201,
0x0053,0x0054,0x0201,0x0045,0x0055,
//},g_huffman_table_8[71] = {
0x0601,0x0201,0x0000,0x0201,0x0010,0x0001,0x0201,0x0011,0x0401,0x0201,0x0021,
0x0012,0x0e01,0x0401,0x0201,0x0020,0x0002,0x0201,0x0022,0x0401,0x0201,0x0030,
0x0003,0x0201,0x0031,0x0013,0x0e01,0x0801,0x0401,0x0201,0x0032,0x0023,0x0201,
0x0040,0x0004,0x0201,0x0041,0x0201,0x0014,0x0042,0x0c01,0x0601,0x0201,0x0024,
0x0201,0x0033,0x0050,0x0401,0x0201,0x0043,0x0034,0x0051,0x0601,0x0201,0x0015,
0x0201,0x0005,0x0052,0x0601,0x0201,0x0025,0x0201,0x0044,0x0035,0x0201,0x0053,
0x0201,0x0045,0x0201,0x0054,0x0055,
//},g_huffman_table_9[71] = {
0x0801,0x0401,0x0201,0x0000,0x0010,0x0201,0x0001,0x0011,0x0a01,0x0401,0x0201,
0x0020,0x0021,0x0201,0x0012,0x0201,0x0002,0x0022,0x0c01,0x0601,0x0401,0x0201,
0x0030,0x0003,0x0031,0x0201,0x0013,0x0201,0x0032,0x0023,0x0c01,0x0401,0x0201,
0x0041,0x0014,0x0401,0x0201,0x0040,0x0033,0x0201,0x0042,0x0024,0x0a01,0x0601,
0x0401,0x0201,0x0004,0x0050,0x0043,0x0201,0x0034,0x0051,0x0801,0x0401,0x0201,
0x0015,0x0052,0x0201,0x0025,0x0044,0x0601,0x0401,0x0201,0x0005,0x0054,0x0053,
0x0201,0x0035,0x0201,0x0045,0x0055,
//},g_huffman_table_10[127] = {
0x0201,0x0000,0x0401,0x0201,0x0010,0x0001,0x0a01,0x0201,0x0011,0x0401,0x0201,
0x0020,0x0002,0x0201,0x0021,0x0012,0x1c01,0x0801,0x0401,0x0201,0x0022,0x0030,
0x0201,0x0031,0x0013,0x0801,0x0401,0x0201,0x0003,0x0032,0x0201,0x0023,0x0040,
0x0401,0x0201,0x0041,0x0014,0x0401,0x0201,0x0004,0x0033,0x0201,0x0042,0x0024,
0x1c01,0x0a01,0x0601,0x0401,0x0201,0x0050,0x0005,0x0060,0x0201,0x0061,0x0016,
0x0c01,0x0601,0x0401,0x0201,0x0043,0x0034,0x0051,0x0201,0x0015,0x0201,0x0052,
0x0025,0x0401,0x0201,0x0026,0x0036,0x0071,0x1401,0x0801,0x0201,0x0017,0x0401,
0x0201,0x0044,0x0053,0x0006,0x0601,0x0401,0x0201,0x0035,0x0045,0x0062,0x0201,
0x0070,0x0201,0x0007,0x0064,0x0e01,0x0401,0x0201,0x0072,0x0027,0x0601,0x0201,
0x0063,0x0201,0x0054,0x0055,0x0201,0x0046,0x0073,0x0801,0x0401,0x0201,0x0037,
0x0065,0x0201,0x0056,0x0074,0x0601,0x0201,0x0047,0x0201,0x0066,0x0075,0x0401,
0x0201,0x0057,0x0076,0x0201,0x0067,0x0077,
//},g_huffman_table_11[127] = {
0x0601,0x0201,0x0000,0x0201,0x0010,0x0001,0x0801,0x0201,0x0011,0x0401,0x0201,
0x0020,0x0002,0x0012,0x1801,0x0801,0x0201,0x0021,0x0201,0x0022,0x0201,0x0030,
0x0003,0x0401,0x0201,0x0031,0x0013,0x0401,0x0201,0x0032,0x0023,0x0401,0x0201,
0x0040,0x0004,0x0201,0x0041,0x0014,0x1e01,0x1001,0x0a01,0x0401,0x0201,0x0042,
0x0024,0x0401,0x0201,0x0033,0x0043,0x0050,0x0401,0x0201,0x0034,0x0051,0x0061,
0x0601,0x0201,0x0016,0x0201,0x0006,0x0026,0x0201,0x0062,0x0201,0x0015,0x0201,
0x0005,0x0052,0x1001,0x0a01,0x0601,0x0401,0x0201,0x0025,0x0044,0x0060,0x0201,
0x0063,0x0036,0x0401,0x0201,0x0070,0x0017,0x0071,0x1001,0x0601,0x0401,0x0201,
0x0007,0x0064,0x0072,0x0201,0x0027,0x0401,0x0201,0x0053,0x0035,0x0201,0x0054,
0x0045,0x0a01,0x0401,0x0201,0x0046,0x0073,0x0201,0x0037,0x0201,0x0065,0x0056,
0x0a01,0x0601,0x0401,0x0201,0x0055,0x0057,0x0074,0x0201,0x0047,0x0066,0x0401,
0x0201,0x0075,0x0076,0x0201,0x0067,0x0077,
//},g_huffman_table_12[127] = {
0x0c01,0x0401,0x0201,0x0010,0x0001,0x0201,0x0011,0x0201,0x0000,0x0201,0x0020,
0x0002,0x1001,0x0401,0x0201,0x0021,0x0012,0x0401,0x0201,0x0022,0x0031,0x0201,
0x0013,0x0201,0x0030,0x0201,0x0003,0x0040,0x1a01,0x0801,0x0401,0x0201,0x0032,
0x0023,0x0201,0x0041,0x0033,0x0a01,0x0401,0x0201,0x0014,0x0042,0x0201,0x0024,
0x0201,0x0004,0x0050,0x0401,0x0201,0x0043,0x0034,0x0201,0x0051,0x0015,0x1c01,
0x0e01,0x0801,0x0401,0x0201,0x0052,0x0025,0x0201,0x0053,0x0035,0x0401,0x0201,
0x0060,0x0016,0x0061,0x0401,0x0201,0x0062,0x0026,0x0601,0x0401,0x0201,0x0005,
0x0006,0x0044,0x0201,0x0054,0x0045,0x1201,0x0a01,0x0401,0x0201,0x0063,0x0036,
0x0401,0x0201,0x0070,0x0007,0x0071,0x0401,0x0201,0x0017,0x0064,0x0201,0x0046,
0x0072,0x0a01,0x0601,0x0201,0x0027,0x0201,0x0055,0x0073,0x0201,0x0037,0x0056,
0x0801,0x0401,0x0201,0x0065,0x0074,0x0201,0x0047,0x0066,0x0401,0x0201,0x0075,
0x0057,0x0201,0x0076,0x0201,0x0067,0x0077,
//},g_huffman_table_13[511] = {
0x0201,0x0000,0x0601,0x0201,0x0010,0x0201,0x0001,0x0011,0x1c01,0x0801,0x0401,
0x0201,0x0020,0x0002,0x0201,0x0021,0x0012,0x0801,0x0401,0x0201,0x0022,0x0030,
0x0201,0x0003,0x0031,0x0601,0x0201,0x0013,0x0201,0x0032,0x0023,0x0401,0x0201,
0x0040,0x0004,0x0041,0x4601,0x1c01,0x0e01,0x0601,0x0201,0x0014,0x0201,0x0033,
0x0042,0x0401,0x0201,0x0024,0x0050,0x0201,0x0043,0x0034,0x0401,0x0201,0x0051,
0x0015,0x0401,0x0201,0x0005,0x0052,0x0201,0x0025,0x0201,0x0044,0x0053,0x0e01,
0x0801,0x0401,0x0201,0x0060,0x0006,0x0201,0x0061,0x0016,0x0401,0x0201,0x0080,
0x0008,0x0081,0x1001,0x0801,0x0401,0x0201,0x0035,0x0062,0x0201,0x0026,0x0054,
0x0401,0x0201,0x0045,0x0063,0x0201,0x0036,0x0070,0x0601,0x0401,0x0201,0x0007,
0x0055,0x0071,0x0201,0x0017,0x0201,0x0027,0x0037,0x4801,0x1801,0x0c01,0x0401,
0x0201,0x0018,0x0082,0x0201,0x0028,0x0401,0x0201,0x0064,0x0046,0x0072,0x0801,
0x0401,0x0201,0x0084,0x0048,0x0201,0x0090,0x0009,0x0201,0x0091,0x0019,0x1801,
0x0e01,0x0801,0x0401,0x0201,0x0073,0x0065,0x0201,0x0056,0x0074,0x0401,0x0201,
0x0047,0x0066,0x0083,0x0601,0x0201,0x0038,0x0201,0x0075,0x0057,0x0201,0x0092,
0x0029,0x0e01,0x0801,0x0401,0x0201,0x0067,0x0085,0x0201,0x0058,0x0039,0x0201,
0x0093,0x0201,0x0049,0x0086,0x0601,0x0201,0x00a0,0x0201,0x0068,0x000a,0x0201,
0x00a1,0x001a,0x4401,0x1801,0x0c01,0x0401,0x0201,0x00a2,0x002a,0x0401,0x0201,
0x0095,0x0059,0x0201,0x00a3,0x003a,0x0801,0x0401,0x0201,0x004a,0x0096,0x0201,
0x00b0,0x000b,0x0201,0x00b1,0x001b,0x1401,0x0801,0x0201,0x00b2,0x0401,0x0201,
0x0076,0x0077,0x0094,0x0601,0x0401,0x0201,0x0087,0x0078,0x00a4,0x0401,0x0201,
0x0069,0x00a5,0x002b,0x0c01,0x0601,0x0401,0x0201,0x005a,0x0088,0x00b3,0x0201,
0x003b,0x0201,0x0079,0x00a6,0x0601,0x0401,0x0201,0x006a,0x00b4,0x00c0,0x0401,
0x0201,0x000c,0x0098,0x00c1,0x3c01,0x1601,0x0a01,0x0601,0x0201,0x001c,0x0201,
0x0089,0x00b5,0x0201,0x005b,0x00c2,0x0401,0x0201,0x002c,0x003c,0x0401,0x0201,
0x00b6,0x006b,0x0201,0x00c4,0x004c,0x1001,0x0801,0x0401,0x0201,0x00a8,0x008a,
0x0201,0x00d0,0x000d,0x0201,0x00d1,0x0201,0x004b,0x0201,0x0097,0x00a7,0x0c01,
0x0601,0x0201,0x00c3,0x0201,0x007a,0x0099,0x0401,0x0201,0x00c5,0x005c,0x00b7,
0x0401,0x0201,0x001d,0x00d2,0x0201,0x002d,0x0201,0x007b,0x00d3,0x3401,0x1c01,
0x0c01,0x0401,0x0201,0x003d,0x00c6,0x0401,0x0201,0x006c,0x00a9,0x0201,0x009a,
0x00d4,0x0801,0x0401,0x0201,0x00b8,0x008b,0x0201,0x004d,0x00c7,0x0401,0x0201,
0x007c,0x00d5,0x0201,0x005d,0x00e0,0x0a01,0x0401,0x0201,0x00e1,0x001e,0x0401,
0x0201,0x000e,0x002e,0x00e2,0x0801,0x0401,0x0201,0x00e3,0x006d,0x0201,0x008c,
0x00e4,0x0401,0x0201,0x00e5,0x00ba,0x00f0,0x2601,0x1001,0x0401,0x0201,0x00f1,
0x001f,0x0601,0x0401,0x0201,0x00aa,0x009b,0x00b9,0x0201,0x003e,0x0201,0x00d6,
0x00c8,0x0c01,0x0601,0x0201,0x004e,0x0201,0x00d7,0x007d,0x0201,0x00ab,0x0201,
0x005e,0x00c9,0x0601,0x0201,0x000f,0x0201,0x009c,0x006e,0x0201,0x00f2,0x002f,
0x2001,0x1001,0x0601,0x0401,0x0201,0x00d8,0x008d,0x003f,0x0601,0x0201,0x00f3,
0x0201,0x00e6,0x00ca,0x0201,0x00f4,0x004f,0x0801,0x0401,0x0201,0x00bb,0x00ac,
0x0201,0x00e7,0x00f5,0x0401,0x0201,0x00d9,0x009d,0x0201,0x005f,0x00e8,0x1e01,
0x0c01,0x0601,0x0201,0x006f,0x0201,0x00f6,0x00cb,0x0401,0x0201,0x00bc,0x00ad,
0x00da,0x0801,0x0201,0x00f7,0x0401,0x0201,0x007e,0x007f,0x008e,0x0601,0x0401,
0x0201,0x009e,0x00ae,0x00cc,0x0201,0x00f8,0x008f,0x1201,0x0801,0x0401,0x0201,
0x00db,0x00bd,0x0201,0x00ea,0x00f9,0x0401,0x0201,0x009f,0x00eb,0x0201,0x00be,
0x0201,0x00cd,0x00fa,0x0e01,0x0401,0x0201,0x00dd,0x00ec,0x0601,0x0401,0x0201,
0x00e9,0x00af,0x00dc,0x0201,0x00ce,0x00fb,0x0801,0x0401,0x0201,0x00bf,0x00de,
0x0201,0x00cf,0x00ee,0x0401,0x0201,0x00df,0x00ef,0x0201,0x00ff,0x0201,0x00ed,
0x0201,0x00fd,0x0201,0x00fc,0x00fe,
//},g_huffman_table_15[511] = {
0x1001,0x0601,0x0201,0x0000,0x0201,0x0010,0x0001,0x0201,0x0011,0x0401,0x0201,
0x0020,0x0002,0x0201,0x0021,0x0012,0x3201,0x1001,0x0601,0x0201,0x0022,0x0201,
0x0030,0x0031,0x0601,0x0201,0x0013,0x0201,0x0003,0x0040,0x0201,0x0032,0x0023,
0x0e01,0x0601,0x0401,0x0201,0x0004,0x0014,0x0041,0x0401,0x0201,0x0033,0x0042,
0x0201,0x0024,0x0043,0x0a01,0x0601,0x0201,0x0034,0x0201,0x0050,0x0005,0x0201,
0x0051,0x0015,0x0401,0x0201,0x0052,0x0025,0x0401,0x0201,0x0044,0x0053,0x0061,
0x5a01,0x2401,0x1201,0x0a01,0x0601,0x0201,0x0035,0x0201,0x0060,0x0006,0x0201,
0x0016,0x0062,0x0401,0x0201,0x0026,0x0054,0x0201,0x0045,0x0063,0x0a01,0x0601,
0x0201,0x0036,0x0201,0x0070,0x0007,0x0201,0x0071,0x0055,0x0401,0x0201,0x0017,
0x0064,0x0201,0x0072,0x0027,0x1801,0x1001,0x0801,0x0401,0x0201,0x0046,0x0073,
0x0201,0x0037,0x0065,0x0401,0x0201,0x0056,0x0080,0x0201,0x0008,0x0074,0x0401,
0x0201,0x0081,0x0018,0x0201,0x0082,0x0028,0x1001,0x0801,0x0401,0x0201,0x0047,
0x0066,0x0201,0x0083,0x0038,0x0401,0x0201,0x0075,0x0057,0x0201,0x0084,0x0048,
0x0601,0x0401,0x0201,0x0090,0x0019,0x0091,0x0401,0x0201,0x0092,0x0076,0x0201,
0x0067,0x0029,0x5c01,0x2401,0x1201,0x0a01,0x0401,0x0201,0x0085,0x0058,0x0401,
0x0201,0x0009,0x0077,0x0093,0x0401,0x0201,0x0039,0x0094,0x0201,0x0049,0x0086,
0x0a01,0x0601,0x0201,0x0068,0x0201,0x00a0,0x000a,0x0201,0x00a1,0x001a,0x0401,
0x0201,0x00a2,0x002a,0x0201,0x0095,0x0059,0x1a01,0x0e01,0x0601,0x0201,0x00a3,
0x0201,0x003a,0x0087,0x0401,0x0201,0x0078,0x00a4,0x0201,0x004a,0x0096,0x0601,
0x0401,0x0201,0x0069,0x00b0,0x00b1,0x0401,0x0201,0x001b,0x00a5,0x00b2,0x0e01,
0x0801,0x0401,0x0201,0x005a,0x002b,0x0201,0x0088,0x0097,0x0201,0x00b3,0x0201,
0x0079,0x003b,0x0801,0x0401,0x0201,0x006a,0x00b4,0x0201,0x004b,0x00c1,0x0401,
0x0201,0x0098,0x0089,0x0201,0x001c,0x00b5,0x5001,0x2201,0x1001,0x0601,0x0401,
0x0201,0x005b,0x002c,0x00c2,0x0601,0x0401,0x0201,0x000b,0x00c0,0x00a6,0x0201,
0x00a7,0x007a,0x0a01,0x0401,0x0201,0x00c3,0x003c,0x0401,0x0201,0x000c,0x0099,
0x00b6,0x0401,0x0201,0x006b,0x00c4,0x0201,0x004c,0x00a8,0x1401,0x0a01,0x0401,
0x0201,0x008a,0x00c5,0x0401,0x0201,0x00d0,0x005c,0x00d1,0x0401,0x0201,0x00b7,
0x007b,0x0201,0x001d,0x0201,0x000d,0x002d,0x0c01,0x0401,0x0201,0x00d2,0x00d3,
0x0401,0x0201,0x003d,0x00c6,0x0201,0x006c,0x00a9,0x0601,0x0401,0x0201,0x009a,
0x00b8,0x00d4,0x0401,0x0201,0x008b,0x004d,0x0201,0x00c7,0x007c,0x4401,0x2201,
0x1201,0x0a01,0x0401,0x0201,0x00d5,0x005d,0x0401,0x0201,0x00e0,0x000e,0x00e1,
0x0401,0x0201,0x001e,0x00e2,0x0201,0x00aa,0x002e,0x0801,0x0401,0x0201,0x00b9,
0x009b,0x0201,0x00e3,0x00d6,0x0401,0x0201,0x006d,0x003e,0x0201,0x00c8,0x008c,
0x1001,0x0801,0x0401,0x0201,0x00e4,0x004e,0x0201,0x00d7,0x007d,0x0401,0x0201,
0x00e5,0x00ba,0x0201,0x00ab,0x005e,0x0801,0x0401,0x0201,0x00c9,0x009c,0x0201,
0x00f1,0x001f,0x0601,0x0401,0x0201,0x00f0,0x006e,0x00f2,0x0201,0x002f,0x00e6,
0x2601,0x1201,0x0801,0x0401,0x0201,0x00d8,0x00f3,0x0201,0x003f,0x00f4,0x0601,
0x0201,0x004f,0x0201,0x008d,0x00d9,0x0201,0x00bb,0x00ca,0x0801,0x0401,0x0201,
0x00ac,0x00e7,0x0201,0x007e,0x00f5,0x0801,0x0401,0x0201,0x009d,0x005f,0x0201,
0x00e8,0x008e,0x0201,0x00f6,0x00cb,0x2201,0x1201,0x0a01,0x0601,0x0401,0x0201,
0x000f,0x00ae,0x006f,0x0201,0x00bc,0x00da,0x0401,0x0201,0x00ad,0x00f7,0x0201,
0x007f,0x00e9,0x0801,0x0401,0x0201,0x009e,0x00cc,0x0201,0x00f8,0x008f,0x0401,
0x0201,0x00db,0x00bd,0x0201,0x00ea,0x00f9,0x1001,0x0801,0x0401,0x0201,0x009f,
0x00dc,0x0201,0x00cd,0x00eb,0x0401,0x0201,0x00be,0x00fa,0x0201,0x00af,0x00dd,
0x0e01,0x0601,0x0401,0x0201,0x00ec,0x00ce,0x00fb,0x0401,0x0201,0x00bf,0x00ed,
0x0201,0x00de,0x00fc,0x0601,0x0401,0x0201,0x00cf,0x00fd,0x00ee,0x0401,0x0201,
0x00df,0x00fe,0x0201,0x00ef,0x00ff,
//},g_huffman_table_16[511] = {
0x0201,0x0000,0x0601,0x0201,0x0010,0x0201,0x0001,0x0011,0x2a01,0x0801,0x0401,
0x0201,0x0020,0x0002,0x0201,0x0021,0x0012,0x0a01,0x0601,0x0201,0x0022,0x0201,
0x0030,0x0003,0x0201,0x0031,0x0013,0x0a01,0x0401,0x0201,0x0032,0x0023,0x0401,
0x0201,0x0040,0x0004,0x0041,0x0601,0x0201,0x0014,0x0201,0x0033,0x0042,0x0401,
0x0201,0x0024,0x0050,0x0201,0x0043,0x0034,0x8a01,0x2801,0x1001,0x0601,0x0401,
0x0201,0x0005,0x0015,0x0051,0x0401,0x0201,0x0052,0x0025,0x0401,0x0201,0x0044,
0x0035,0x0053,0x0a01,0x0601,0x0401,0x0201,0x0060,0x0006,0x0061,0x0201,0x0016,
0x0062,0x0801,0x0401,0x0201,0x0026,0x0054,0x0201,0x0045,0x0063,0x0401,0x0201,
0x0036,0x0070,0x0071,0x2801,0x1201,0x0801,0x0201,0x0017,0x0201,0x0007,0x0201,
0x0055,0x0064,0x0401,0x0201,0x0072,0x0027,0x0401,0x0201,0x0046,0x0065,0x0073,
0x0a01,0x0601,0x0201,0x0037,0x0201,0x0056,0x0008,0x0201,0x0080,0x0081,0x0601,
0x0201,0x0018,0x0201,0x0074,0x0047,0x0201,0x0082,0x0201,0x0028,0x0066,0x1801,
0x0e01,0x0801,0x0401,0x0201,0x0083,0x0038,0x0201,0x0075,0x0084,0x0401,0x0201,
0x0048,0x0090,0x0091,0x0601,0x0201,0x0019,0x0201,0x0009,0x0076,0x0201,0x0092,
0x0029,0x0e01,0x0801,0x0401,0x0201,0x0085,0x0058,0x0201,0x0093,0x0039,0x0401,
0x0201,0x00a0,0x000a,0x001a,0x0801,0x0201,0x00a2,0x0201,0x0067,0x0201,0x0057,
0x0049,0x0601,0x0201,0x0094,0x0201,0x0077,0x0086,0x0201,0x00a1,0x0201,0x0068,
0x0095,0xdc01,0x7e01,0x3201,0x1a01,0x0c01,0x0601,0x0201,0x002a,0x0201,0x0059,
0x003a,0x0201,0x00a3,0x0201,0x0087,0x0078,0x0801,0x0401,0x0201,0x00a4,0x004a,
0x0201,0x0096,0x0069,0x0401,0x0201,0x00b0,0x000b,0x00b1,0x0a01,0x0401,0x0201,
0x001b,0x00b2,0x0201,0x002b,0x0201,0x00a5,0x005a,0x0601,0x0201,0x00b3,0x0201,
0x00a6,0x006a,0x0401,0x0201,0x00b4,0x004b,0x0201,0x000c,0x00c1,0x1e01,0x0e01,
0x0601,0x0401,0x0201,0x00b5,0x00c2,0x002c,0x0401,0x0201,0x00a7,0x00c3,0x0201,
0x006b,0x00c4,0x0801,0x0201,0x001d,0x0401,0x0201,0x0088,0x0097,0x003b,0x0401,
0x0201,0x00d1,0x00d2,0x0201,0x002d,0x00d3,0x1201,0x0601,0x0401,0x0201,0x001e,
0x002e,0x00e2,0x0601,0x0401,0x0201,0x0079,0x0098,0x00c0,0x0201,0x001c,0x0201,
0x0089,0x005b,0x0e01,0x0601,0x0201,0x003c,0x0201,0x007a,0x00b6,0x0401,0x0201,
0x004c,0x0099,0x0201,0x00a8,0x008a,0x0601,0x0201,0x000d,0x0201,0x00c5,0x005c,
0x0401,0x0201,0x003d,0x00c6,0x0201,0x006c,0x009a,0x5801,0x5601,0x2401,0x1001,
0x0801,0x0401,0x0201,0x008b,0x004d,0x0201,0x00c7,0x007c,0x0401,0x0201,0x00d5,
0x005d,0x0201,0x00e0,0x000e,0x0801,0x0201,0x00e3,0x0401,0x0201,0x00d0,0x00b7,
0x007b,0x0601,0x0401,0x0201,0x00a9,0x00b8,0x00d4,0x0201,0x00e1,0x0201,0x00aa,
0x00b9,0x1801,0x0a01,0x0601,0x0401,0x0201,0x009b,0x00d6,0x006d,0x0201,0x003e,
0x00c8,0x0601,0x0401,0x0201,0x008c,0x00e4,0x004e,0x0401,0x0201,0x00d7,0x00e5,
0x0201,0x00ba,0x00ab,0x0c01,0x0401,0x0201,0x009c,0x00e6,0x0401,0x0201,0x006e,
0x00d8,0x0201,0x008d,0x00bb,0x0801,0x0401,0x0201,0x00e7,0x009d,0x0201,0x00e8,
0x008e,0x0401,0x0201,0x00cb,0x00bc,0x009e,0x00f1,0x0201,0x001f,0x0201,0x000f,
0x002f,0x4201,0x3801,0x0201,0x00f2,0x3401,0x3201,0x1401,0x0801,0x0201,0x00bd,
0x0201,0x005e,0x0201,0x007d,0x00c9,0x0601,0x0201,0x00ca,0x0201,0x00ac,0x007e,
0x0401,0x0201,0x00da,0x00ad,0x00cc,0x0a01,0x0601,0x0201,0x00ae,0x0201,0x00db,
0x00dc,0x0201,0x00cd,0x00be,0x0601,0x0401,0x0201,0x00eb,0x00ed,0x00ee,0x0601,
0x0401,0x0201,0x00d9,0x00ea,0x00e9,0x0201,0x00de,0x0401,0x0201,0x00dd,0x00ec,
0x00ce,0x003f,0x00f0,0x0401,0x0201,0x00f3,0x00f4,0x0201,0x004f,0x0201,0x00f5,
0x005f,0x0a01,0x0201,0x00ff,0x0401,0x0201,0x00f6,0x006f,0x0201,0x00f7,0x007f,
0x0c01,0x0601,0x0201,0x008f,0x0201,0x00f8,0x00f9,0x0401,0x0201,0x009f,0x00fa,
0x00af,0x0801,0x0401,0x0201,0x00fb,0x00bf,0x0201,0x00fc,0x00cf,0x0401,0x0201,
0x00fd,0x00df,0x0201,0x00fe,0x00ef,
//},g_huffman_table_24[512] = {
0x3c01,0x0801,0x0401,0x0201,0x0000,0x0010,0x0201,0x0001,0x0011,0x0e01,0x0601,
0x0401,0x0201,0x0020,0x0002,0x0021,0x0201,0x0012,0x0201,0x0022,0x0201,0x0030,
0x0003,0x0e01,0x0401,0x0201,0x0031,0x0013,0x0401,0x0201,0x0032,0x0023,0x0401,
0x0201,0x0040,0x0004,0x0041,0x0801,0x0401,0x0201,0x0014,0x0033,0x0201,0x0042,
0x0024,0x0601,0x0401,0x0201,0x0043,0x0034,0x0051,0x0601,0x0401,0x0201,0x0050,
0x0005,0x0015,0x0201,0x0052,0x0025,0xfa01,0x6201,0x2201,0x1201,0x0a01,0x0401,
0x0201,0x0044,0x0053,0x0201,0x0035,0x0201,0x0060,0x0006,0x0401,0x0201,0x0061,
0x0016,0x0201,0x0062,0x0026,0x0801,0x0401,0x0201,0x0054,0x0045,0x0201,0x0063,
0x0036,0x0401,0x0201,0x0071,0x0055,0x0201,0x0064,0x0046,0x2001,0x0e01,0x0601,
0x0201,0x0072,0x0201,0x0027,0x0037,0x0201,0x0073,0x0401,0x0201,0x0070,0x0007,
0x0017,0x0a01,0x0401,0x0201,0x0065,0x0056,0x0401,0x0201,0x0080,0x0008,0x0081,
0x0401,0x0201,0x0074,0x0047,0x0201,0x0018,0x0082,0x1001,0x0801,0x0401,0x0201,
0x0028,0x0066,0x0201,0x0083,0x0038,0x0401,0x0201,0x0075,0x0057,0x0201,0x0084,
0x0048,0x0801,0x0401,0x0201,0x0091,0x0019,0x0201,0x0092,0x0076,0x0401,0x0201,
0x0067,0x0029,0x0201,0x0085,0x0058,0x5c01,0x2201,0x1001,0x0801,0x0401,0x0201,
0x0093,0x0039,0x0201,0x0094,0x0049,0x0401,0x0201,0x0077,0x0086,0x0201,0x0068,
0x00a1,0x0801,0x0401,0x0201,0x00a2,0x002a,0x0201,0x0095,0x0059,0x0401,0x0201,
0x00a3,0x003a,0x0201,0x0087,0x0201,0x0078,0x004a,0x1601,0x0c01,0x0401,0x0201,
0x00a4,0x0096,0x0401,0x0201,0x0069,0x00b1,0x0201,0x001b,0x00a5,0x0601,0x0201,
0x00b2,0x0201,0x005a,0x002b,0x0201,0x0088,0x00b3,0x1001,0x0a01,0x0601,0x0201,
0x0090,0x0201,0x0009,0x00a0,0x0201,0x0097,0x0079,0x0401,0x0201,0x00a6,0x006a,
0x00b4,0x0c01,0x0601,0x0201,0x001a,0x0201,0x000a,0x00b0,0x0201,0x003b,0x0201,
0x000b,0x00c0,0x0401,0x0201,0x004b,0x00c1,0x0201,0x0098,0x0089,0x4301,0x2201,
0x1001,0x0801,0x0401,0x0201,0x001c,0x00b5,0x0201,0x005b,0x00c2,0x0401,0x0201,
0x002c,0x00a7,0x0201,0x007a,0x00c3,0x0a01,0x0601,0x0201,0x003c,0x0201,0x000c,
0x00d0,0x0201,0x00b6,0x006b,0x0401,0x0201,0x00c4,0x004c,0x0201,0x0099,0x00a8,
0x1001,0x0801,0x0401,0x0201,0x008a,0x00c5,0x0201,0x005c,0x00d1,0x0401,0x0201,
0x00b7,0x007b,0x0201,0x001d,0x00d2,0x0901,0x0401,0x0201,0x002d,0x00d3,0x0201,
0x003d,0x00c6,0x55fa,0x0401,0x0201,0x006c,0x00a9,0x0201,0x009a,0x00d4,0x2001,
0x1001,0x0801,0x0401,0x0201,0x00b8,0x008b,0x0201,0x004d,0x00c7,0x0401,0x0201,
0x007c,0x00d5,0x0201,0x005d,0x00e1,0x0801,0x0401,0x0201,0x001e,0x00e2,0x0201,
0x00aa,0x00b9,0x0401,0x0201,0x009b,0x00e3,0x0201,0x00d6,0x006d,0x1401,0x0a01,
0x0601,0x0201,0x003e,0x0201,0x002e,0x004e,0x0201,0x00c8,0x008c,0x0401,0x0201,
0x00e4,0x00d7,0x0401,0x0201,0x007d,0x00ab,0x00e5,0x0a01,0x0401,0x0201,0x00ba,
0x005e,0x0201,0x00c9,0x0201,0x009c,0x006e,0x0801,0x0201,0x00e6,0x0201,0x000d,
0x0201,0x00e0,0x000e,0x0401,0x0201,0x00d8,0x008d,0x0201,0x00bb,0x00ca,0x4a01,
0x0201,0x00ff,0x4001,0x3a01,0x2001,0x1001,0x0801,0x0401,0x0201,0x00ac,0x00e7,
0x0201,0x007e,0x00d9,0x0401,0x0201,0x009d,0x00e8,0x0201,0x008e,0x00cb,0x0801,
0x0401,0x0201,0x00bc,0x00da,0x0201,0x00ad,0x00e9,0x0401,0x0201,0x009e,0x00cc,
0x0201,0x00db,0x00bd,0x1001,0x0801,0x0401,0x0201,0x00ea,0x00ae,0x0201,0x00dc,
0x00cd,0x0401,0x0201,0x00eb,0x00be,0x0201,0x00dd,0x00ec,0x0801,0x0401,0x0201,
0x00ce,0x00ed,0x0201,0x00de,0x00ee,0x000f,0x0401,0x0201,0x00f0,0x001f,0x00f1,
0x0401,0x0201,0x00f2,0x002f,0x0201,0x00f3,0x003f,0x1201,0x0801,0x0401,0x0201,
0x00f4,0x004f,0x0201,0x00f5,0x005f,0x0401,0x0201,0x00f6,0x006f,0x0201,0x00f7,
0x0201,0x007f,0x008f,0x0a01,0x0401,0x0201,0x00f8,0x00f9,0x0401,0x0201,0x009f,
0x00af,0x00fa,0x0801,0x0401,0x0201,0x00fb,0x00bf,0x0201,0x00fc,0x00cf,0x0401,
0x0201,0x00fd,0x00df,0x0201,0x00fe,0x00ef,
//},g_huffman_table_32[31] = {
0x0201,0x0000,0x0801,0x0401,0x0201,0x0008,0x0004,0x0201,0x0001,0x0002,0x0801,
0x0401,0x0201,0x000c,0x000a,0x0201,0x0003,0x0006,0x0601,0x0201,0x0009,0x0201,
0x0005,0x0007,0x0401,0x0201,0x000e,0x000d,0x0201,0x000f,0x000b,
//},g_huffman_table_33[31] = {
0x1001,0x0801,0x0401,0x0201,0x0000,0x0001,0x0201,0x0002,0x0003,0x0401,0x0201,
0x0004,0x0005,0x0201,0x0006,0x0007,0x0801,0x0401,0x0201,0x0008,0x0009,0x0201,
0x000a,0x000b,0x0401,0x0201,0x000c,0x000d,0x0201,0x000e,0x000f,
};
static const unsigned g_mpeg1_bitrates[3 /* layer 1-3 */][15 /* header bitrate_index */] = {
{ /* Layer 1 */
0, 32000, 64000, 96000,128000,160000,192000,224000,
256000,288000,320000,352000,384000,416000,448000
},{ /* Layer 2 */
0, 32000, 48000, 56000, 64000, 80000, 96000,112000,
128000,160000,192000,224000,256000,320000,384000
},{ /* Layer 3 */
0, 32000, 40000, 48000, 56000, 64000, 80000, 96000,
112000,128000,160000,192000,224000,256000,320000
}
},
g_sampling_frequency[3] = { 44100 * Hz,48000 * Hz,32000 * Hz },
mpeg1_scalefac_sizes[16][2 /* slen1,slen2 */] = {
{0,0},{0,1},{0,2},{0,3},{3,0},{1,1},{1,2},{1,3},
{2,1},{2,2},{2,3},{3,1},{3,2},{3,3},{4,2},{4,3}
};
hufftables g_huffman_main [34] = {
{NULL , 0, 0 }, /* Table 0 */
{g_huffman_table , 7, 0 }, /* Table 1 */
{g_huffman_table +7 , 17, 0 }, /* Table 2 */
{g_huffman_table +24 , 17, 0 }, /* Table 3 */
{NULL , 0, 0 }, /* Table 4 */
{g_huffman_table +41 , 31, 0 }, /* Table 5 */
{g_huffman_table +72 , 31, 0 }, /* Table 6 */
{g_huffman_table +103 , 71, 0 }, /* Table 7 */
{g_huffman_table +174 , 71, 0 }, /* Table 8 */
{g_huffman_table +245 , 71, 0 }, /* Table 9 */
{g_huffman_table +316 ,127, 0 }, /* Table 10 */
{g_huffman_table +443 ,127, 0 }, /* Table 11 */
{g_huffman_table +570 ,127, 0 }, /* Table 12 */
{g_huffman_table +697 ,511, 0 }, /* Table 13 */
{NULL , 0, 0 }, /* Table 14 */
{g_huffman_table +1208 ,511, 0 }, /* Table 15 */
{g_huffman_table +1719 ,511, 1 }, /* Table 16 */
{g_huffman_table +1719 ,511, 2 }, /* Table 17 */
{g_huffman_table +1719 ,511, 3 }, /* Table 18 */
{g_huffman_table +1719 ,511, 4 }, /* Table 19 */
{g_huffman_table +1719 ,511, 6 }, /* Table 20 */
{g_huffman_table +1719 ,511, 8 }, /* Table 21 */
{g_huffman_table +1719 ,511,10 }, /* Table 22 */
{g_huffman_table +1719 ,511,13 }, /* Table 23 */
{g_huffman_table +2230 ,512, 4 }, /* Table 24 */
{g_huffman_table +2230 ,512, 5 }, /* Table 25 */
{g_huffman_table +2230 ,512, 6 }, /* Table 26 */
{g_huffman_table +2230 ,512, 7 }, /* Table 27 */
{g_huffman_table +2230 ,512, 8 }, /* Table 28 */
{g_huffman_table +2230 ,512, 9 }, /* Table 29 */
{g_huffman_table +2230 ,512,11 }, /* Table 30 */
{g_huffman_table +2230 ,512,13 }, /* Table 31 */
{g_huffman_table +2742 , 31, 0 }, /* Table 32 */
{g_huffman_table +2261 , 31, 0 }, /* Table 33 */
};
static const float // ci[8]={-0.6,-0.535,-0.33,-0.185,-0.095,-0.041,-0.0142,-0.0037},
cs[8]={0.857493,0.881742,0.949629,0.983315,0.995518,0.999161,0.999899,0.999993},
ca[8]={-0.514496,-0.471732,-0.313377,-0.181913,-0.094574,-0.040966,-0.014199,-0.003700},
is_ratios[6] = {0.000000f,0.267949f,0.577350f,1.000000f,1.732051f,3.732051f},
#ifdef IMDCT_TABLES
g_imdct_win[4][36] = {
{0.043619f,0.130526f,0.216440f,0.300706f,0.382683f,0.461749f,
0.537300f,0.608761f,0.675590f,0.737277f,0.793353f,0.843391f,
0.887011f,0.923880f,0.953717f,0.976296f,0.991445f,0.999048f,
0.999048f,0.991445f,0.976296f,0.953717f,0.923879f,0.887011f,
0.843391f,0.793353f,0.737277f,0.675590f,0.608761f,0.537299f,
0.461748f,0.382683f,0.300706f,0.216439f,0.130526f,0.043619f
},{0.043619f,0.130526f,0.216440f,0.300706f,0.382683f,0.461749f,
0.537300f,0.608761f,0.675590f,0.737277f,0.793353f,0.843391f,
0.887011f,0.923880f,0.953717f,0.976296f,0.991445f,0.999048f,
1.000000f,1.000000f,1.000000f,1.000000f,1.000000f,1.000000f,
0.991445f,0.923880f,0.793353f,0.608761f,0.382683f,0.130526f,
0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f
},{0.130526f,0.382683f,0.608761f,0.793353f,0.923880f,0.991445f,
0.991445f,0.923880f,0.793353f,0.608761f,0.382683f,0.130526f,
0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,
0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,
0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,
0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,
},{0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,0.000000f,
0.130526f,0.382683f,0.608761f,0.793353f,0.923880f,0.991445f,
1.000000f,1.000000f,1.000000f,1.000000f,1.000000f,1.000000f,
0.999048f,0.991445f,0.976296f,0.953717f,0.923879f,0.887011f,
0.843391f,0.793353f,0.737277f,0.675590f,0.608761f,0.537299f,
0.461748f,0.382683f,0.300706f,0.216439f,0.130526f,0.043619f,
}
},
#endif
#ifdef IMDCT_NTABLES
cos_N12[6][12] = {
{ 0.608761f,0.382683f,0.130526f,-0.130526f,-0.382683f,-0.608761f,
-0.793353f,-0.923880f,-0.991445f,-0.991445f,-0.923879f,-0.793353f
},{-0.923880f,-0.923879f,-0.382683f,0.382684f,0.923880f,0.923879f,
0.382683f,-0.382684f,-0.923880f,-0.923879f,-0.382683f,0.382684f
},{-0.130526f,0.923880f,0.608761f,-0.608762f,-0.923879f,0.130526f,
0.991445f,0.382683f,-0.793354f,-0.793353f,0.382684f,0.991445f
},{ 0.991445f,-0.382684f,-0.793353f,0.793354f,0.382683f,-0.991445f,
0.130527f,0.923879f,-0.608762f,-0.608761f,0.923880f,0.130525f
},{-0.382684f,-0.382683f,0.923879f,-0.923880f,0.382684f,0.382683f,
-0.923879f,0.923880f,-0.382684f,-0.382683f,0.923879f,-0.923880f
},{-0.793353f,0.923879f,-0.991445f,0.991445f,-0.923880f,0.793354f,
-0.608762f,0.382684f,-0.130527f,-0.130525f,0.382682f,-0.608761f,},
},
cos_N36[18][36] = {
{ 0.675590f,0.608761f,0.537300f,0.461749f,0.382683f,0.300706f,
0.216440f,0.130526f,0.043619f,-0.043619f,-0.130526f,-0.216440f,
-0.300706f,-0.382684f,-0.461749f,-0.537300f,-0.608762f,-0.675590f,
-0.737277f,-0.793353f,-0.843392f,-0.887011f,-0.923880f,-0.953717f,
-0.976296f,-0.991445f,-0.999048f,-0.999048f,-0.991445f,-0.976296f,
-0.953717f,-0.923879f,-0.887011f,-0.843391f,-0.793353f,-0.737277f
},{-0.793353f,-0.923880f,-0.991445f,-0.991445f,-0.923879f,-0.793353f,
-0.608761f,-0.382683f,-0.130526f,0.130526f,0.382684f,0.608762f,
0.793354f,0.923880f,0.991445f,0.991445f,0.923879f,0.793353f,
0.608761f,0.382683f,0.130526f,-0.130527f,-0.382684f,-0.608762f,
-0.793354f,-0.923880f,-0.991445f,-0.991445f,-0.923879f,-0.793353f,
-0.608761f,-0.382683f,-0.130526f,0.130527f,0.382684f,0.608762f
},{-0.537299f,-0.130526f,0.300706f,0.675590f,0.923880f,0.999048f,
0.887011f,0.608761f,0.216439f,-0.216440f,-0.608762f,-0.887011f,
-0.999048f,-0.923879f,-0.675590f,-0.300705f,0.130527f,0.537300f,
0.843392f,0.991445f,0.953717f,0.737277f,0.382683f,-0.043620f,
-0.461749f,-0.793354f,-0.976296f,-0.976296f,-0.793353f,-0.461748f,
-0.043618f,0.382684f,0.737278f,0.953717f,0.991445f,0.843391f
},{ 0.887011f,0.991445f,0.737277f,0.216439f,-0.382684f,-0.843392f,
-0.999048f,-0.793353f,-0.300705f,0.300706f,0.793354f,0.999048f,
0.843391f,0.382683f,-0.216440f,-0.737278f,-0.991445f,-0.887010f,
-0.461748f,0.130527f,0.675591f,0.976296f,0.923879f,0.537299f,
-0.043621f,-0.608762f,-0.953717f,-0.953717f,-0.608760f,-0.043618f,
0.537301f,0.923880f,0.976296f,0.675589f,0.130525f,-0.461750f
},{ 0.382683f,-0.382684f,-0.923880f,-0.923879f,-0.382683f,0.382684f,
0.923880f,0.923879f,0.382683f,-0.382684f,-0.923880f,-0.923879f,
-0.382683f,0.382684f,0.923880f,0.923879f,0.382682f,-0.382685f,
-0.923880f,-0.923879f,-0.382682f,0.382685f,0.923880f,0.923879f,
0.382682f,-0.382685f,-0.923880f,-0.923879f,-0.382682f,0.382685f,
0.923880f,0.923879f,0.382682f,-0.382685f,-0.923880f,-0.923879f
},{-0.953717f,-0.793353f,0.043620f,0.843392f,0.923879f,0.216439f,
-0.675591f,-0.991445f,-0.461748f,0.461749f,0.991445f,0.675589f,
-0.216441f,-0.923880f,-0.843391f,-0.043618f,0.793354f,0.953717f,
0.300704f,-0.608763f,-0.999048f,-0.537298f,0.382685f,0.976296f,
0.737276f,-0.130528f,-0.887012f,-0.887010f,-0.130524f,0.737279f,
0.976296f,0.382681f,-0.537301f,-0.999048f,-0.608760f,0.300708f
},{-0.216439f,0.793354f,0.887010f,-0.043620f,-0.923880f,-0.737277f,
0.300707f,0.991445f,0.537299f,-0.537301f,-0.991445f,-0.300705f,
0.737278f,0.923879f,0.043618f,-0.887012f,-0.793352f,0.216441f,
0.976296f,0.608760f,-0.461750f,-0.999048f,-0.382682f,0.675592f,
0.953716f,0.130524f,-0.843393f,-0.843390f,0.130529f,0.953718f,
0.675588f,-0.382686f,-0.999048f,-0.461746f,0.608764f,0.976295f
},{ 0.991445f,0.382683f,-0.793354f,-0.793353f,0.382684f,0.991445f,
0.130525f,-0.923880f,-0.608760f,0.608763f,0.923879f,-0.130528f,
-0.991445f,-0.382682f,0.793354f,0.793352f,-0.382685f,-0.991445f,
-0.130524f,0.923880f,0.608760f,-0.608763f,-0.923879f,0.130529f,
0.991445f,0.382681f,-0.793355f,-0.793352f,0.382686f,0.991444f,
0.130523f,-0.923881f,-0.608759f,0.608764f,0.923878f,-0.130529f
},{ 0.043619f,-0.991445f,-0.216439f,0.953717f,0.382682f,-0.887011f,
-0.537299f,0.793354f,0.675589f,-0.675591f,-0.793352f,0.537301f,
0.887010f,-0.382685f,-0.953716f,0.216442f,0.991445f,-0.043622f,
-0.999048f,-0.130524f,0.976297f,0.300703f,-0.923881f,-0.461746f,
0.843393f,0.608759f,-0.737279f,-0.737275f,0.608764f,0.843390f,
-0.461752f,-0.923878f,0.300709f,0.976295f,-0.130530f,-0.999048f
},{-0.999048f,0.130527f,0.976296f,-0.300707f,-0.923879f,0.461750f,
0.843391f,-0.608763f,-0.737276f,0.737279f,0.608760f,-0.843392f,
-0.461747f,0.923880f,0.300704f,-0.976297f,-0.130524f,0.999048f,
-0.043622f,-0.991445f,0.216442f,0.953716f,-0.382686f,-0.887009f,
0.537302f,0.793351f,-0.675593f,-0.675588f,0.793355f,0.537297f,
-0.887013f,-0.382680f,0.953718f,0.216436f,-0.991445f,-0.043615f
},{ 0.130527f,0.923879f,-0.608762f,-0.608760f,0.923880f,0.130525f,
-0.991445f,0.382685f,0.793352f,-0.793355f,-0.382682f,0.991445f,
-0.130528f,-0.923879f,0.608763f,0.608759f,-0.923881f,-0.130523f,
0.991444f,-0.382686f,-0.793351f,0.793355f,0.382680f,-0.991445f,
0.130530f,0.923878f,-0.608764f,-0.608758f,0.923881f,0.130522f,
-0.991444f,0.382687f,0.793351f,-0.793356f,-0.382679f,0.991445f
},{ 0.976296f,-0.608762f,-0.461747f,0.999048f,-0.382685f,-0.675589f,
0.953717f,-0.130528f,-0.843390f,0.843393f,0.130524f,-0.953716f,
0.675592f,0.382681f,-0.999048f,0.461751f,0.608759f,-0.976297f,
0.216443f,0.793351f,-0.887012f,-0.043616f,0.923878f,-0.737280f,
-0.300702f,0.991444f,-0.537303f,-0.537296f,0.991445f,-0.300710f,
-0.737274f,0.923881f,-0.043624f,-0.887009f,0.793356f,0.216435f
},{-0.300707f,-0.608760f,0.999048f,-0.537301f,-0.382682f,0.976296f,
-0.737279f,-0.130524f,0.887010f,-0.887012f,0.130529f,0.737276f,
-0.976297f,0.382686f,0.537297f,-0.999048f,0.608764f,0.300703f,
-0.953716f,0.793355f,0.043616f,-0.843389f,0.923881f,-0.216444f,
-0.675587f,0.991445f,-0.461752f,-0.461745f,0.991444f,-0.675594f,
-0.216435f,0.923878f,-0.843394f,0.043625f,0.793350f,-0.953719f
},{-0.923879f,0.923880f,-0.382685f,-0.382682f,0.923879f,-0.923880f,
0.382685f,0.382681f,-0.923879f,0.923880f,-0.382686f,-0.382681f,
0.923878f,-0.923881f,0.382686f,0.382680f,-0.923878f,0.923881f,
-0.382687f,-0.382680f,0.923878f,-0.923881f,0.382687f,0.382679f,
-0.923878f,0.923881f,-0.382688f,-0.382679f,0.923878f,-0.923881f,
0.382688f,0.382678f,-0.923877f,0.923882f,-0.382689f,-0.382678f
},{ 0.461750f,0.130525f,-0.675589f,0.976296f,-0.923880f,0.537301f,
0.043617f,-0.608760f,0.953716f,-0.953718f,0.608764f,-0.043622f,
-0.537297f,0.923878f,-0.976297f,0.675593f,-0.130530f,-0.461745f,
0.887009f,-0.991445f,0.737280f,-0.216444f,-0.382679f,0.843389f,
-0.999048f,0.793356f,-0.300711f,-0.300701f,0.793350f,-0.999048f,
0.843394f,-0.382689f,-0.216434f,0.737273f,-0.991444f,0.887014f
},{ 0.843391f,-0.991445f,0.953717f,-0.737279f,0.382685f,0.043617f,
-0.461747f,0.793352f,-0.976295f,0.976297f,-0.793355f,0.461751f,
-0.043623f,-0.382680f,0.737275f,-0.953716f,0.991445f,-0.843394f,
0.537303f,-0.130530f,-0.300702f,0.675587f,-0.923878f,0.999048f,
-0.887013f,0.608766f,-0.216445f,-0.216434f,0.608757f,-0.887008f,
0.999048f,-0.923882f,0.675595f,-0.300712f,-0.130520f,0.537294f
},{-0.608763f,0.382685f,-0.130528f,-0.130524f,0.382681f,-0.608760f,
0.793352f,-0.923879f,0.991444f,-0.991445f,0.923881f,-0.793355f,
0.608764f,-0.382687f,0.130530f,0.130522f,-0.382680f,0.608758f,
-0.793351f,0.923878f,-0.991444f,0.991446f,-0.923881f,0.793357f,
-0.608766f,0.382689f,-0.130532f,-0.130520f,0.382678f,-0.608756f,
0.793349f,-0.923877f,0.991444f,-0.991446f,0.923882f,-0.793358f
},{-0.737276f,0.793352f,-0.843390f,0.887010f,-0.923879f,0.953716f,
-0.976295f,0.991444f,-0.999048f,0.999048f,-0.991445f,0.976297f,
-0.953718f,0.923881f,-0.887013f,0.843394f,-0.793356f,0.737280f,
-0.675594f,0.608765f,-0.537304f,0.461753f,-0.382688f,0.300711f,
-0.216445f,0.130532f,-0.043625f,-0.043613f,0.130520f,-0.216433f,
0.300699f,-0.382677f,0.461742f,-0.537293f,0.608755f,-0.675585f
}},
#endif
#ifdef POW34_ITERATE
static const float powtab34[32] = {
0.000000f,1.000000f,2.519842f,4.326749f,6.349605f,8.549880f,10.902724f,
13.390519f,16.000001f,18.720756f,21.544349f,24.463783f,27.473145f,30.567354f,
33.741995f,36.993185f,40.317478f,43.711792f,47.173351f,50.699637f,54.288359f,
57.937415f,61.644873f,65.408949f,69.227988f,73.100453f,77.024908f,81.000011f,
85.024502f,89.097200f,93.216988f,97.382814f
},
#endif
g_synth_dtbl[512] = {
0.000000000,-0.000015259,-0.000015259,-0.000015259,
-0.000015259,-0.000015259,-0.000015259,-0.000030518,
-0.000030518,-0.000030518,-0.000030518,-0.000045776,
-0.000045776,-0.000061035,-0.000061035,-0.000076294,
-0.000076294,-0.000091553,-0.000106812,-0.000106812,
-0.000122070,-0.000137329,-0.000152588,-0.000167847,
-0.000198364,-0.000213623,-0.000244141,-0.000259399,
-0.000289917,-0.000320435,-0.000366211,-0.000396729,
-0.000442505,-0.000473022,-0.000534058,-0.000579834,
-0.000625610,-0.000686646,-0.000747681,-0.000808716,
-0.000885010,-0.000961304,-0.001037598,-0.001113892,
-0.001205444,-0.001296997,-0.001388550,-0.001480103,
-0.001586914,-0.001693726,-0.001785278,-0.001907349,
-0.002014160,-0.002120972,-0.002243042,-0.002349854,
-0.002456665,-0.002578735,-0.002685547,-0.002792358,
-0.002899170,-0.002990723,-0.003082275,-0.003173828,
0.003250122, 0.003326416, 0.003387451, 0.003433228,
0.003463745, 0.003479004, 0.003479004, 0.003463745,
0.003417969, 0.003372192, 0.003280640, 0.003173828,
0.003051758, 0.002883911, 0.002700806, 0.002487183,
0.002227783, 0.001937866, 0.001617432, 0.001266479,
0.000869751, 0.000442505,-0.000030518,-0.000549316,
-0.001098633,-0.001693726,-0.002334595,-0.003005981,
-0.003723145,-0.004486084,-0.005294800,-0.006118774,
-0.007003784,-0.007919312,-0.008865356,-0.009841919,
-0.010848999,-0.011886597,-0.012939453,-0.014022827,
-0.015121460,-0.016235352,-0.017349243,-0.018463135,
-0.019577026,-0.020690918,-0.021789551,-0.022857666,
-0.023910522,-0.024932861,-0.025909424,-0.026840210,
-0.027725220,-0.028533936,-0.029281616,-0.029937744,
-0.030532837,-0.031005859,-0.031387329,-0.031661987,
-0.031814575,-0.031845093,-0.031738281,-0.031478882,
0.031082153, 0.030517578, 0.029785156, 0.028884888,
0.027801514, 0.026535034, 0.025085449, 0.023422241,
0.021575928, 0.019531250, 0.017257690, 0.014801025,
0.012115479, 0.009231567, 0.006134033, 0.002822876,
-0.000686646,-0.004394531,-0.008316040,-0.012420654,
-0.016708374,-0.021179199,-0.025817871,-0.030609131,
-0.035552979,-0.040634155,-0.045837402,-0.051132202,
-0.056533813,-0.061996460,-0.067520142,-0.073059082,
-0.078628540,-0.084182739,-0.089706421,-0.095169067,
-0.100540161,-0.105819702,-0.110946655,-0.115921021,
-0.120697021,-0.125259399,-0.129562378,-0.133590698,
-0.137298584,-0.140670776,-0.143676758,-0.146255493,
-0.148422241,-0.150115967,-0.151306152,-0.151962280,
-0.152069092,-0.151596069,-0.150497437,-0.148773193,
-0.146362305,-0.143264771,-0.139450073,-0.134887695,
-0.129577637,-0.123474121,-0.116577148,-0.108856201,
0.100311279, 0.090927124, 0.080688477, 0.069595337,
0.057617188, 0.044784546, 0.031082153, 0.016510010,
0.001068115,-0.015228271,-0.032379150,-0.050354004,
-0.069168091,-0.088775635,-0.109161377,-0.130310059,
-0.152206421,-0.174789429,-0.198059082,-0.221984863,
-0.246505737,-0.271591187,-0.297210693,-0.323318481,
-0.349868774,-0.376800537,-0.404083252,-0.431655884,
-0.459472656,-0.487472534,-0.515609741,-0.543823242,
-0.572036743,-0.600219727,-0.628295898,-0.656219482,
-0.683914185,-0.711318970,-0.738372803,-0.765029907,
-0.791213989,-0.816864014,-0.841949463,-0.866363525,
-0.890090942,-0.913055420,-0.935195923,-0.956481934,
-0.976852417,-0.996246338,-1.014617920,-1.031936646,
-1.048156738,-1.063217163,-1.077117920,-1.089782715,
-1.101211548,-1.111373901,-1.120223999,-1.127746582,
-1.133926392,-1.138763428,-1.142211914,-1.144287109,
1.144989014, 1.144287109, 1.142211914, 1.138763428,
1.133926392, 1.127746582, 1.120223999, 1.111373901,
1.101211548, 1.089782715, 1.077117920, 1.063217163,
1.048156738, 1.031936646, 1.014617920, 0.996246338,
0.976852417, 0.956481934, 0.935195923, 0.913055420,
0.890090942, 0.866363525, 0.841949463, 0.816864014,
0.791213989, 0.765029907, 0.738372803, 0.711318970,
0.683914185, 0.656219482, 0.628295898, 0.600219727,
0.572036743, 0.543823242, 0.515609741, 0.487472534,
0.459472656, 0.431655884, 0.404083252, 0.376800537,
0.349868774, 0.323318481, 0.297210693, 0.271591187,
0.246505737, 0.221984863, 0.198059082, 0.174789429,
0.152206421, 0.130310059, 0.109161377, 0.088775635,
0.069168091, 0.050354004, 0.032379150, 0.015228271,
-0.001068115,-0.016510010,-0.031082153,-0.044784546,
-0.057617188,-0.069595337,-0.080688477,-0.090927124,
0.100311279, 0.108856201, 0.116577148, 0.123474121,
0.129577637, 0.134887695, 0.139450073, 0.143264771,
0.146362305, 0.148773193, 0.150497437, 0.151596069,
0.152069092, 0.151962280, 0.151306152, 0.150115967,
0.148422241, 0.146255493, 0.143676758, 0.140670776,
0.137298584, 0.133590698, 0.129562378, 0.125259399,
0.120697021, 0.115921021, 0.110946655, 0.105819702,
0.100540161, 0.095169067, 0.089706421, 0.084182739,
0.078628540, 0.073059082, 0.067520142, 0.061996460,
0.056533813, 0.051132202, 0.045837402, 0.040634155,
0.035552979, 0.030609131, 0.025817871, 0.021179199,
0.016708374, 0.012420654, 0.008316040, 0.004394531,
0.000686646,-0.002822876,-0.006134033,-0.009231567,
-0.012115479,-0.014801025,-0.017257690,-0.019531250,
-0.021575928,-0.023422241,-0.025085449,-0.026535034,
-0.027801514,-0.028884888,-0.029785156,-0.030517578,
0.031082153, 0.031478882, 0.031738281, 0.031845093,
0.031814575, 0.031661987, 0.031387329, 0.031005859,
0.030532837, 0.029937744, 0.029281616, 0.028533936,
0.027725220, 0.026840210, 0.025909424, 0.024932861,
0.023910522, 0.022857666, 0.021789551, 0.020690918,
0.019577026, 0.018463135, 0.017349243, 0.016235352,
0.015121460, 0.014022827, 0.012939453, 0.011886597,
0.010848999, 0.009841919, 0.008865356, 0.007919312,
0.007003784, 0.006118774, 0.005294800, 0.004486084,
0.003723145, 0.003005981, 0.002334595, 0.001693726,
0.001098633, 0.000549316, 0.000030518,-0.000442505,
-0.000869751,-0.001266479,-0.001617432,-0.001937866,
-0.002227783,-0.002487183,-0.002700806,-0.002883911,
-0.003051758,-0.003173828,-0.003280640,-0.003372192,
-0.003417969,-0.003463745,-0.003479004,-0.003479004,
-0.003463745,-0.003433228,-0.003387451,-0.003326416,
0.003250122, 0.003173828, 0.003082275, 0.002990723,
0.002899170, 0.002792358, 0.002685547, 0.002578735,
0.002456665, 0.002349854, 0.002243042, 0.002120972,
0.002014160, 0.001907349, 0.001785278, 0.001693726,
0.001586914, 0.001480103, 0.001388550, 0.001296997,
0.001205444, 0.001113892, 0.001037598, 0.000961304,
0.000885010, 0.000808716, 0.000747681, 0.000686646,
0.000625610, 0.000579834, 0.000534058, 0.000473022,
0.000442505, 0.000396729, 0.000366211, 0.000320435,
0.000289917, 0.000259399, 0.000244141, 0.000213623,
0.000198364, 0.000167847, 0.000152588, 0.000137329,
0.000122070, 0.000106812, 0.000106812, 0.000091553,
0.000076294, 0.000076294, 0.000061035, 0.000061035,
0.000045776, 0.000045776, 0.000030518, 0.000030518,
0.000030518, 0.000030518, 0.000015259, 0.000015259,
0.000015259, 0.000015259, 0.000015259, 0.000015259,
//},g_synth_n_win[64][32]={
};
/* Scale factor band indices
*
* One table per sample rate. Each table contains the frequency indices
* for the 12 short and 21 long scalefactor bands. The short indices
* must be multiplied by 3 to get the actual index.
*/
static const t_sf_band_indices g_sf_band_indices[3 /* Sampling freq. */] = {
{
{0,4,8,12,16,20,24,30,36,44,52,62,74,90,110,134,162,196,238,288,342,418,576},
{0,4,8,12,16,22,30,40,52,66,84,106,136,192}
},
{
{0,4,8,12,16,20,24,30,36,42,50,60,72,88,106,128,156,190,230,276,330,384,576},
{0,4,8,12,16,22,28,38,50,64,80,100,126,192}
},
{
{0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576},
{0,4,8,12,16,22,30,42,58,78,104,138,180,192}
}
};
#ifdef DEBUG
static void dmp_fr(t_mpeg1_header *hdr){
printf("rate %d,sfreq %d,pad %d,mod %d,modext %d,emph %d\n",
hdr->bitrate_index,hdr->sampling_frequency,hdr->padding_bit,
hdr->mode,hdr->mode_extension,hdr->emphasis);
}
static void dmp_si(t_mpeg1_header *hdr,t_mpeg1_side_info *si){
int nch,ch,gr;
nch = hdr->mode == mpeg1_mode_single_channel ? 1 : 2;
printf("main_data_begin %d,priv_bits %d\n",si->main_data_begin,si->private_bits);
for(ch = 0; ch < nch; ch++) {
printf("scfsi %d %d %d %d\n",si->scfsi[ch][0],si->scfsi[ch][1],si->scfsi[ch][2],si->scfsi[ch][3]);
for(gr = 0; gr < 2; gr++) {
printf("p23l %d,bv %d,gg %d,scfc %d,wsf %d,bt %d\n",
si->part2_3_length[gr][ch],si->big_values[gr][ch],
si->global_gain[gr][ch],si->scalefac_compress[gr][ch],
si->win_switch_flag[gr][ch],si->block_type[gr][ch]);
if(si->win_switch_flag[gr][ch]) {
printf("mbf %d,ts1 %d,ts2 %d,sbg1 %d,sbg2 %d,sbg3 %d\n",
si->mixed_block_flag[gr][ch],si->table_select[gr][ch][0],
si->table_select[gr][ch][1],si->subblock_gain[gr][ch][0],
si->subblock_gain[gr][ch][1],si->subblock_gain[gr][ch][2]);
}else{
printf("ts1 %d,ts2 %d,ts3 %d\n",si->table_select[gr][ch][0],
si->table_select[gr][ch][1],si->table_select[gr][ch][2]);
}
printf("r0c %d,r1c %d\n",si->region0_count[gr][ch],si->region1_count[gr][ch]);
printf("pf %d,scfs %d,c1ts %d\n",si->preflag[gr][ch],si->scalefac_scale[gr][ch],si->count1table_select[gr][ch]);
}
}
}
static void dmp_scf(t_mpeg1_side_info *si,t_mpeg1_main_data *md,int gr,int ch){
int sfb,win;
if((si->win_switch_flag[gr][ch] != 0) &&(si->block_type[gr][ch] == 2)) {
if(si->mixed_block_flag[gr][ch] != 0) { /* First the long block scalefacs */
for(sfb = 0; sfb < 8; sfb++)
printf("scfl%d %d%s",sfb,md->scalefac_l[gr][ch][sfb],(sfb==7)?"\n":",");
for(sfb = 3; sfb < 12; sfb++) /* And next the short block scalefacs */
for(win = 0; win < 3; win++)
printf("scfs%d,%d %d%s",sfb,win,md->scalefac_s[gr][ch][sfb][win],(win==2)?"\n":",");
}else{ /* Just short blocks */
for(sfb = 0; sfb < 12; sfb++)
for(win = 0; win < 3; win++)
printf("scfs%d,%d %d%s",sfb,win,md->scalefac_s[gr][ch][sfb][win],(win==2)?"\n":",");
}
}else for(sfb = 0; sfb < 21; sfb++) /* Just long blocks; scalefacs first */
printf("scfl%d %d%s",sfb,md->scalefac_l[gr][ch][sfb](sfb == 20)?"\n":",");
}
static void dmp_huff(t_mpeg1_main_data *md,int gr,int ch){
int i;
printf("HUFFMAN\n");
for(i = 0; i < 576; i++) printf("%d: %d\n",i,(int) md->is[gr][ch][i]);
}
static void dmp_samples(t_mpeg1_main_data *md,int gr,int ch,int type){
int i,val;
extern double rint(double);
printf("SAMPLES%d\n",type);
for(i = 0; i < 576; i++) {
val =(int) rint(md->is[gr][ch][i] * 32768.0);
if(val >= 32768) val = 32767;
if(val < -32768) val = -32768;
printf("%d: %d\n",i,val);
}
}
#endif
/**Description: calculates y=x^(4/3) when requantizing samples.
* Parameters: TBD
* Return value: TBD
* Author: Krister Lagerström(krister@kmlager.com) **/
static inline float Requantize_Pow_43(unsigned is_pos){
#ifdef POW34_TABLE
static float powtab34[8207];
static int init = 0;
int i;
if(init == 0) { /* First time initialization */
for(i = 0; i < 8207; i++)
powtab34[i] = pow((float) i,4.0 / 3.0);
init = 1;
}
#ifdef DEBUG
if(is_pos > 8206) {
ERR("is_pos = %d larger than 8206!",is_pos);
is_pos = 8206;
}
#endif /* DEBUG */
return(powtab34[is_pos]); /* Done */
#elif defined POW34_ITERATE
float a4,a2,x,x2,x3,x_next,is_f1,is_f2,is_f3;
unsigned i;
//static unsigned init = 0;
//static float powtab34[32];
static float coeff[3] = {-1.030797119e+02,6.319399834e+00,2.395095071e-03};
//if(init == 0) { /* First time initialization */
// for(i = 0; i < 32; i++) powtab34[i] = pow((float) i,4.0 / 3.0);
// init = 1;
//}
/* We use a table for 0<is_pos<32 since they are so common */
if(is_pos < 32) return(powtab34[is_pos]);