Universal Binary

This commit is contained in:
vspader 2006-04-17 12:23:48 +00:00
parent 8396352b0e
commit 4ffb9cf24c
144 changed files with 75437 additions and 0 deletions

Binary file not shown.

View file

@ -0,0 +1,794 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
8EBDF3EA09F28B08004F2528 /* aacinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF3D509F28B08004F2528 /* aacinfo.c */; };
8EBDF3EB09F28B08004F2528 /* aacinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF3D609F28B08004F2528 /* aacinfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
8EBDF3EE09F28B08004F2528 /* getopt.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF3D909F28B08004F2528 /* getopt.c */; };
8EBDF3EF09F28B08004F2528 /* getopt.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF3DA09F28B08004F2528 /* getopt.h */; };
8EBDF3F209F28B08004F2528 /* drms.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF3DE09F28B08004F2528 /* drms.c */; };
8EBDF3F309F28B08004F2528 /* drms.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF3DF09F28B08004F2528 /* drms.h */; };
8EBDF3F409F28B08004F2528 /* drmstables.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF3E009F28B08004F2528 /* drmstables.h */; };
8EBDF3F509F28B08004F2528 /* mp4atom.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF3E109F28B08004F2528 /* mp4atom.c */; };
8EBDF3F709F28B08004F2528 /* mp4ff.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF3E309F28B08004F2528 /* mp4ff.h */; };
8EBDF3F809F28B08004F2528 /* mp4ff_int_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF3E409F28B08004F2528 /* mp4ff_int_types.h */; };
8EBDF3F909F28B08004F2528 /* mp4ffint.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF3E509F28B08004F2528 /* mp4ffint.h */; };
8EBDF3FA09F28B08004F2528 /* mp4meta.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF3E609F28B08004F2528 /* mp4meta.c */; };
8EBDF3FB09F28B08004F2528 /* mp4sample.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF3E709F28B08004F2528 /* mp4sample.c */; };
8EBDF3FC09F28B08004F2528 /* mp4tagupdate.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF3E809F28B08004F2528 /* mp4tagupdate.c */; };
8EBDF3FD09F28B08004F2528 /* mp4util.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF3E909F28B08004F2528 /* mp4util.c */; };
8EBDF40009F28B1F004F2528 /* faad.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF3FE09F28B1F004F2528 /* faad.h */; settings = {ATTRIBUTES = (Public, ); }; };
8EBDF40109F28B1F004F2528 /* neaacdec.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF3FF09F28B1F004F2528 /* neaacdec.h */; settings = {ATTRIBUTES = (Public, ); }; };
8EBDF47209F28B2C004F2528 /* analysis.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF40209F28B2C004F2528 /* analysis.h */; };
8EBDF47309F28B2C004F2528 /* bits.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF40309F28B2C004F2528 /* bits.c */; };
8EBDF47409F28B2C004F2528 /* bits.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF40409F28B2C004F2528 /* bits.h */; };
8EBDF47509F28B2C004F2528 /* cfft_tab.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF40509F28B2C004F2528 /* cfft_tab.h */; };
8EBDF47609F28B2C004F2528 /* cfft.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF40609F28B2C004F2528 /* cfft.c */; };
8EBDF47709F28B2C004F2528 /* cfft.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF40709F28B2C004F2528 /* cfft.h */; };
8EBDF47809F28B2C004F2528 /* hcb.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF40909F28B2C004F2528 /* hcb.h */; };
8EBDF47909F28B2C004F2528 /* hcb_1.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF40A09F28B2C004F2528 /* hcb_1.h */; };
8EBDF47A09F28B2C004F2528 /* hcb_10.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF40B09F28B2C004F2528 /* hcb_10.h */; };
8EBDF47B09F28B2C004F2528 /* hcb_11.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF40C09F28B2C004F2528 /* hcb_11.h */; };
8EBDF47C09F28B2C004F2528 /* hcb_2.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF40D09F28B2C004F2528 /* hcb_2.h */; };
8EBDF47D09F28B2C004F2528 /* hcb_3.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF40E09F28B2C004F2528 /* hcb_3.h */; };
8EBDF47E09F28B2C004F2528 /* hcb_4.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF40F09F28B2C004F2528 /* hcb_4.h */; };
8EBDF47F09F28B2C004F2528 /* hcb_5.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF41009F28B2C004F2528 /* hcb_5.h */; };
8EBDF48009F28B2C004F2528 /* hcb_6.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF41109F28B2C004F2528 /* hcb_6.h */; };
8EBDF48109F28B2C004F2528 /* hcb_7.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF41209F28B2C004F2528 /* hcb_7.h */; };
8EBDF48209F28B2C004F2528 /* hcb_8.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF41309F28B2C004F2528 /* hcb_8.h */; };
8EBDF48309F28B2C004F2528 /* hcb_9.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF41409F28B2C004F2528 /* hcb_9.h */; };
8EBDF48409F28B2C004F2528 /* hcb_sf.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF41509F28B2C004F2528 /* hcb_sf.h */; };
8EBDF48509F28B2C004F2528 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF41609F28B2C004F2528 /* common.c */; };
8EBDF48609F28B2C004F2528 /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF41709F28B2C004F2528 /* common.h */; };
8EBDF48709F28B2C004F2528 /* decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF41809F28B2C004F2528 /* decoder.c */; };
8EBDF48809F28B2C004F2528 /* decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF41909F28B2C004F2528 /* decoder.h */; };
8EBDF48909F28B2C004F2528 /* drc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF41A09F28B2C004F2528 /* drc.c */; };
8EBDF48A09F28B2C004F2528 /* drc.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF41B09F28B2C004F2528 /* drc.h */; };
8EBDF48B09F28B2C004F2528 /* drm_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF41C09F28B2C004F2528 /* drm_dec.c */; };
8EBDF48C09F28B2C004F2528 /* drm_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF41D09F28B2C004F2528 /* drm_dec.h */; };
8EBDF48D09F28B2C004F2528 /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF41E09F28B2C004F2528 /* error.c */; };
8EBDF48E09F28B2C004F2528 /* error.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF41F09F28B2C004F2528 /* error.h */; };
8EBDF48F09F28B2C004F2528 /* filtbank.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF42009F28B2C004F2528 /* filtbank.c */; };
8EBDF49009F28B2C004F2528 /* filtbank.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF42109F28B2C004F2528 /* filtbank.h */; };
8EBDF49109F28B2C004F2528 /* fixed.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF42209F28B2C004F2528 /* fixed.h */; };
8EBDF49209F28B2C004F2528 /* hcr.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF42309F28B2C004F2528 /* hcr.c */; };
8EBDF49309F28B2C004F2528 /* huffman.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF42409F28B2C004F2528 /* huffman.c */; };
8EBDF49409F28B2C004F2528 /* huffman.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF42509F28B2C004F2528 /* huffman.h */; };
8EBDF49509F28B2C004F2528 /* ic_predict.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF42609F28B2C004F2528 /* ic_predict.c */; };
8EBDF49609F28B2C004F2528 /* ic_predict.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF42709F28B2C004F2528 /* ic_predict.h */; };
8EBDF49709F28B2C004F2528 /* iq_table.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF42809F28B2C004F2528 /* iq_table.h */; };
8EBDF49809F28B2C004F2528 /* is.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF42909F28B2C004F2528 /* is.c */; };
8EBDF49909F28B2C004F2528 /* is.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF42A09F28B2C004F2528 /* is.h */; };
8EBDF49A09F28B2C004F2528 /* kbd_win.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF42B09F28B2C004F2528 /* kbd_win.h */; };
8EBDF4A609F28B2C004F2528 /* lt_predict.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF43709F28B2C004F2528 /* lt_predict.c */; };
8EBDF4A709F28B2C004F2528 /* lt_predict.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF43809F28B2C004F2528 /* lt_predict.h */; };
8EBDF4A909F28B2C004F2528 /* mdct_tab.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF43A09F28B2C004F2528 /* mdct_tab.h */; };
8EBDF4AA09F28B2C004F2528 /* mdct.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF43B09F28B2C004F2528 /* mdct.c */; };
8EBDF4AB09F28B2C004F2528 /* mdct.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF43C09F28B2C004F2528 /* mdct.h */; };
8EBDF4AC09F28B2C004F2528 /* mp4.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF43D09F28B2C004F2528 /* mp4.c */; };
8EBDF4AD09F28B2C004F2528 /* mp4.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF43E09F28B2C004F2528 /* mp4.h */; };
8EBDF4AE09F28B2C004F2528 /* ms.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF43F09F28B2C004F2528 /* ms.c */; };
8EBDF4AF09F28B2C004F2528 /* ms.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF44009F28B2C004F2528 /* ms.h */; };
8EBDF4B009F28B2C004F2528 /* output.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF44109F28B2C004F2528 /* output.c */; };
8EBDF4B109F28B2C004F2528 /* output.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF44209F28B2C004F2528 /* output.h */; };
8EBDF4B209F28B2C004F2528 /* pns.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF44309F28B2C004F2528 /* pns.c */; };
8EBDF4B309F28B2C004F2528 /* pns.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF44409F28B2C004F2528 /* pns.h */; };
8EBDF4B409F28B2C004F2528 /* ps_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF44509F28B2C004F2528 /* ps_dec.c */; };
8EBDF4B509F28B2C004F2528 /* ps_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF44609F28B2C004F2528 /* ps_dec.h */; };
8EBDF4B609F28B2C004F2528 /* ps_syntax.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF44709F28B2C004F2528 /* ps_syntax.c */; };
8EBDF4B709F28B2C004F2528 /* ps_tables.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF44809F28B2C004F2528 /* ps_tables.h */; };
8EBDF4B809F28B2C004F2528 /* pulse.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF44909F28B2C004F2528 /* pulse.c */; };
8EBDF4B909F28B2C004F2528 /* pulse.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF44A09F28B2C004F2528 /* pulse.h */; };
8EBDF4BA09F28B2C004F2528 /* rvlc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF44B09F28B2C004F2528 /* rvlc.c */; };
8EBDF4BB09F28B2C004F2528 /* rvlc.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF44C09F28B2C004F2528 /* rvlc.h */; };
8EBDF4BC09F28B2C004F2528 /* sbr_dct.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF44D09F28B2C004F2528 /* sbr_dct.c */; };
8EBDF4BD09F28B2C004F2528 /* sbr_dct.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF44E09F28B2C004F2528 /* sbr_dct.h */; };
8EBDF4BE09F28B2C004F2528 /* sbr_dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF44F09F28B2C004F2528 /* sbr_dec.c */; };
8EBDF4BF09F28B2C004F2528 /* sbr_dec.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF45009F28B2C004F2528 /* sbr_dec.h */; };
8EBDF4C009F28B2C004F2528 /* sbr_e_nf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF45109F28B2C004F2528 /* sbr_e_nf.c */; };
8EBDF4C109F28B2C004F2528 /* sbr_e_nf.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF45209F28B2C004F2528 /* sbr_e_nf.h */; };
8EBDF4C209F28B2C004F2528 /* sbr_fbt.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF45309F28B2C004F2528 /* sbr_fbt.c */; };
8EBDF4C309F28B2C004F2528 /* sbr_fbt.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF45409F28B2C004F2528 /* sbr_fbt.h */; };
8EBDF4C409F28B2C004F2528 /* sbr_hfadj.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF45509F28B2C004F2528 /* sbr_hfadj.c */; };
8EBDF4C509F28B2C004F2528 /* sbr_hfadj.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF45609F28B2C004F2528 /* sbr_hfadj.h */; };
8EBDF4C609F28B2C004F2528 /* sbr_hfgen.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF45709F28B2C004F2528 /* sbr_hfgen.c */; };
8EBDF4C709F28B2C004F2528 /* sbr_hfgen.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF45809F28B2C004F2528 /* sbr_hfgen.h */; };
8EBDF4C809F28B2C004F2528 /* sbr_huff.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF45909F28B2C004F2528 /* sbr_huff.c */; };
8EBDF4C909F28B2C004F2528 /* sbr_huff.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF45A09F28B2C004F2528 /* sbr_huff.h */; };
8EBDF4CA09F28B2C004F2528 /* sbr_noise.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF45B09F28B2C004F2528 /* sbr_noise.h */; };
8EBDF4CB09F28B2C004F2528 /* sbr_qmf_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF45C09F28B2C004F2528 /* sbr_qmf_c.h */; };
8EBDF4CC09F28B2C004F2528 /* sbr_qmf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF45D09F28B2C004F2528 /* sbr_qmf.c */; };
8EBDF4CD09F28B2C004F2528 /* sbr_qmf.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF45E09F28B2C004F2528 /* sbr_qmf.h */; };
8EBDF4CE09F28B2C004F2528 /* sbr_syntax.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF45F09F28B2C004F2528 /* sbr_syntax.c */; };
8EBDF4CF09F28B2C004F2528 /* sbr_syntax.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF46009F28B2C004F2528 /* sbr_syntax.h */; };
8EBDF4D009F28B2C004F2528 /* sbr_tf_grid.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF46109F28B2C004F2528 /* sbr_tf_grid.c */; };
8EBDF4D109F28B2C004F2528 /* sbr_tf_grid.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF46209F28B2C004F2528 /* sbr_tf_grid.h */; };
8EBDF4D209F28B2C004F2528 /* sine_win.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF46309F28B2C004F2528 /* sine_win.h */; };
8EBDF4D309F28B2C004F2528 /* specrec.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF46409F28B2C004F2528 /* specrec.c */; };
8EBDF4D409F28B2C004F2528 /* specrec.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF46509F28B2C004F2528 /* specrec.h */; };
8EBDF4D509F28B2C004F2528 /* ssr_fb.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF46609F28B2C004F2528 /* ssr_fb.c */; };
8EBDF4D609F28B2C004F2528 /* ssr_fb.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF46709F28B2C004F2528 /* ssr_fb.h */; };
8EBDF4D709F28B2C004F2528 /* ssr_ipqf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF46809F28B2C004F2528 /* ssr_ipqf.c */; };
8EBDF4D809F28B2C004F2528 /* ssr_ipqf.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF46909F28B2C004F2528 /* ssr_ipqf.h */; };
8EBDF4D909F28B2C004F2528 /* ssr_win.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF46A09F28B2C004F2528 /* ssr_win.h */; };
8EBDF4DA09F28B2C004F2528 /* ssr.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF46B09F28B2C004F2528 /* ssr.c */; };
8EBDF4DB09F28B2C004F2528 /* ssr.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF46C09F28B2C004F2528 /* ssr.h */; };
8EBDF4DC09F28B2C004F2528 /* structs.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF46D09F28B2C004F2528 /* structs.h */; };
8EBDF4DD09F28B2C004F2528 /* syntax.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF46E09F28B2C004F2528 /* syntax.c */; };
8EBDF4DE09F28B2C004F2528 /* syntax.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF46F09F28B2C004F2528 /* syntax.h */; };
8EBDF4DF09F28B2C004F2528 /* tns.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EBDF47009F28B2C004F2528 /* tns.c */; };
8EBDF4E009F28B2C004F2528 /* tns.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF47109F28B2C004F2528 /* tns.h */; };
8EBDF4E409F28B3F004F2528 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EBDF4E309F28B3F004F2528 /* config.h */; };
/* End PBXBuildFile section */
/* Begin PBXBuildStyle section */
014CEA440018CDF011CA2923 /* Debug */ = {
isa = PBXBuildStyle;
buildSettings = {
};
name = Debug;
};
014CEA450018CDF011CA2923 /* Release */ = {
isa = PBXBuildStyle;
buildSettings = {
};
name = Release;
};
/* End PBXBuildStyle section */
/* Begin PBXFileReference section */
089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* FAAD2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FAAD2.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8EBDF3D509F28B08004F2528 /* aacinfo.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = aacinfo.c; sourceTree = "<group>"; };
8EBDF3D609F28B08004F2528 /* aacinfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = aacinfo.h; sourceTree = "<group>"; };
8EBDF3D909F28B08004F2528 /* getopt.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = getopt.c; sourceTree = "<group>"; };
8EBDF3DA09F28B08004F2528 /* getopt.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = getopt.h; sourceTree = "<group>"; };
8EBDF3DE09F28B08004F2528 /* drms.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = drms.c; sourceTree = "<group>"; };
8EBDF3DF09F28B08004F2528 /* drms.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = drms.h; sourceTree = "<group>"; };
8EBDF3E009F28B08004F2528 /* drmstables.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = drmstables.h; sourceTree = "<group>"; };
8EBDF3E109F28B08004F2528 /* mp4atom.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mp4atom.c; sourceTree = "<group>"; };
8EBDF3E309F28B08004F2528 /* mp4ff.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mp4ff.h; sourceTree = "<group>"; };
8EBDF3E409F28B08004F2528 /* mp4ff_int_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mp4ff_int_types.h; sourceTree = "<group>"; };
8EBDF3E509F28B08004F2528 /* mp4ffint.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mp4ffint.h; sourceTree = "<group>"; };
8EBDF3E609F28B08004F2528 /* mp4meta.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mp4meta.c; sourceTree = "<group>"; };
8EBDF3E709F28B08004F2528 /* mp4sample.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mp4sample.c; sourceTree = "<group>"; };
8EBDF3E809F28B08004F2528 /* mp4tagupdate.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mp4tagupdate.c; sourceTree = "<group>"; };
8EBDF3E909F28B08004F2528 /* mp4util.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mp4util.c; sourceTree = "<group>"; };
8EBDF3FE09F28B1F004F2528 /* faad.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = faad.h; path = Files/include/faad.h; sourceTree = "<group>"; };
8EBDF3FF09F28B1F004F2528 /* neaacdec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = neaacdec.h; path = Files/include/neaacdec.h; sourceTree = "<group>"; };
8EBDF40209F28B2C004F2528 /* analysis.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = analysis.h; path = Files/libfaad/analysis.h; sourceTree = "<group>"; };
8EBDF40309F28B2C004F2528 /* bits.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = bits.c; path = Files/libfaad/bits.c; sourceTree = "<group>"; };
8EBDF40409F28B2C004F2528 /* bits.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = bits.h; path = Files/libfaad/bits.h; sourceTree = "<group>"; };
8EBDF40509F28B2C004F2528 /* cfft_tab.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = cfft_tab.h; path = Files/libfaad/cfft_tab.h; sourceTree = "<group>"; };
8EBDF40609F28B2C004F2528 /* cfft.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = cfft.c; path = Files/libfaad/cfft.c; sourceTree = "<group>"; };
8EBDF40709F28B2C004F2528 /* cfft.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = cfft.h; path = Files/libfaad/cfft.h; sourceTree = "<group>"; };
8EBDF40909F28B2C004F2528 /* hcb.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hcb.h; sourceTree = "<group>"; };
8EBDF40A09F28B2C004F2528 /* hcb_1.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hcb_1.h; sourceTree = "<group>"; };
8EBDF40B09F28B2C004F2528 /* hcb_10.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hcb_10.h; sourceTree = "<group>"; };
8EBDF40C09F28B2C004F2528 /* hcb_11.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hcb_11.h; sourceTree = "<group>"; };
8EBDF40D09F28B2C004F2528 /* hcb_2.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hcb_2.h; sourceTree = "<group>"; };
8EBDF40E09F28B2C004F2528 /* hcb_3.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hcb_3.h; sourceTree = "<group>"; };
8EBDF40F09F28B2C004F2528 /* hcb_4.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hcb_4.h; sourceTree = "<group>"; };
8EBDF41009F28B2C004F2528 /* hcb_5.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hcb_5.h; sourceTree = "<group>"; };
8EBDF41109F28B2C004F2528 /* hcb_6.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hcb_6.h; sourceTree = "<group>"; };
8EBDF41209F28B2C004F2528 /* hcb_7.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hcb_7.h; sourceTree = "<group>"; };
8EBDF41309F28B2C004F2528 /* hcb_8.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hcb_8.h; sourceTree = "<group>"; };
8EBDF41409F28B2C004F2528 /* hcb_9.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hcb_9.h; sourceTree = "<group>"; };
8EBDF41509F28B2C004F2528 /* hcb_sf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hcb_sf.h; sourceTree = "<group>"; };
8EBDF41609F28B2C004F2528 /* common.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = common.c; path = Files/libfaad/common.c; sourceTree = "<group>"; };
8EBDF41709F28B2C004F2528 /* common.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = common.h; path = Files/libfaad/common.h; sourceTree = "<group>"; };
8EBDF41809F28B2C004F2528 /* decoder.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = decoder.c; path = Files/libfaad/decoder.c; sourceTree = "<group>"; };
8EBDF41909F28B2C004F2528 /* decoder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = decoder.h; path = Files/libfaad/decoder.h; sourceTree = "<group>"; };
8EBDF41A09F28B2C004F2528 /* drc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = drc.c; path = Files/libfaad/drc.c; sourceTree = "<group>"; };
8EBDF41B09F28B2C004F2528 /* drc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = drc.h; path = Files/libfaad/drc.h; sourceTree = "<group>"; };
8EBDF41C09F28B2C004F2528 /* drm_dec.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = drm_dec.c; path = Files/libfaad/drm_dec.c; sourceTree = "<group>"; };
8EBDF41D09F28B2C004F2528 /* drm_dec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = drm_dec.h; path = Files/libfaad/drm_dec.h; sourceTree = "<group>"; };
8EBDF41E09F28B2C004F2528 /* error.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = error.c; path = Files/libfaad/error.c; sourceTree = "<group>"; };
8EBDF41F09F28B2C004F2528 /* error.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = error.h; path = Files/libfaad/error.h; sourceTree = "<group>"; };
8EBDF42009F28B2C004F2528 /* filtbank.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = filtbank.c; path = Files/libfaad/filtbank.c; sourceTree = "<group>"; };
8EBDF42109F28B2C004F2528 /* filtbank.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = filtbank.h; path = Files/libfaad/filtbank.h; sourceTree = "<group>"; };
8EBDF42209F28B2C004F2528 /* fixed.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = fixed.h; path = Files/libfaad/fixed.h; sourceTree = "<group>"; };
8EBDF42309F28B2C004F2528 /* hcr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hcr.c; path = Files/libfaad/hcr.c; sourceTree = "<group>"; };
8EBDF42409F28B2C004F2528 /* huffman.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = huffman.c; path = Files/libfaad/huffman.c; sourceTree = "<group>"; };
8EBDF42509F28B2C004F2528 /* huffman.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = huffman.h; path = Files/libfaad/huffman.h; sourceTree = "<group>"; };
8EBDF42609F28B2C004F2528 /* ic_predict.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ic_predict.c; path = Files/libfaad/ic_predict.c; sourceTree = "<group>"; };
8EBDF42709F28B2C004F2528 /* ic_predict.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ic_predict.h; path = Files/libfaad/ic_predict.h; sourceTree = "<group>"; };
8EBDF42809F28B2C004F2528 /* iq_table.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = iq_table.h; path = Files/libfaad/iq_table.h; sourceTree = "<group>"; };
8EBDF42909F28B2C004F2528 /* is.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = is.c; path = Files/libfaad/is.c; sourceTree = "<group>"; };
8EBDF42A09F28B2C004F2528 /* is.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = is.h; path = Files/libfaad/is.h; sourceTree = "<group>"; };
8EBDF42B09F28B2C004F2528 /* kbd_win.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = kbd_win.h; path = Files/libfaad/kbd_win.h; sourceTree = "<group>"; };
8EBDF43709F28B2C004F2528 /* lt_predict.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = lt_predict.c; path = Files/libfaad/lt_predict.c; sourceTree = "<group>"; };
8EBDF43809F28B2C004F2528 /* lt_predict.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = lt_predict.h; path = Files/libfaad/lt_predict.h; sourceTree = "<group>"; };
8EBDF43A09F28B2C004F2528 /* mdct_tab.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = mdct_tab.h; path = Files/libfaad/mdct_tab.h; sourceTree = "<group>"; };
8EBDF43B09F28B2C004F2528 /* mdct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = mdct.c; path = Files/libfaad/mdct.c; sourceTree = "<group>"; };
8EBDF43C09F28B2C004F2528 /* mdct.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = mdct.h; path = Files/libfaad/mdct.h; sourceTree = "<group>"; };
8EBDF43D09F28B2C004F2528 /* mp4.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = mp4.c; path = Files/libfaad/mp4.c; sourceTree = "<group>"; };
8EBDF43E09F28B2C004F2528 /* mp4.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = mp4.h; path = Files/libfaad/mp4.h; sourceTree = "<group>"; };
8EBDF43F09F28B2C004F2528 /* ms.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ms.c; path = Files/libfaad/ms.c; sourceTree = "<group>"; };
8EBDF44009F28B2C004F2528 /* ms.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ms.h; path = Files/libfaad/ms.h; sourceTree = "<group>"; };
8EBDF44109F28B2C004F2528 /* output.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = output.c; path = Files/libfaad/output.c; sourceTree = "<group>"; };
8EBDF44209F28B2C004F2528 /* output.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = output.h; path = Files/libfaad/output.h; sourceTree = "<group>"; };
8EBDF44309F28B2C004F2528 /* pns.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pns.c; path = Files/libfaad/pns.c; sourceTree = "<group>"; };
8EBDF44409F28B2C004F2528 /* pns.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pns.h; path = Files/libfaad/pns.h; sourceTree = "<group>"; };
8EBDF44509F28B2C004F2528 /* ps_dec.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ps_dec.c; path = Files/libfaad/ps_dec.c; sourceTree = "<group>"; };
8EBDF44609F28B2C004F2528 /* ps_dec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ps_dec.h; path = Files/libfaad/ps_dec.h; sourceTree = "<group>"; };
8EBDF44709F28B2C004F2528 /* ps_syntax.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ps_syntax.c; path = Files/libfaad/ps_syntax.c; sourceTree = "<group>"; };
8EBDF44809F28B2C004F2528 /* ps_tables.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ps_tables.h; path = Files/libfaad/ps_tables.h; sourceTree = "<group>"; };
8EBDF44909F28B2C004F2528 /* pulse.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pulse.c; path = Files/libfaad/pulse.c; sourceTree = "<group>"; };
8EBDF44A09F28B2C004F2528 /* pulse.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pulse.h; path = Files/libfaad/pulse.h; sourceTree = "<group>"; };
8EBDF44B09F28B2C004F2528 /* rvlc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = rvlc.c; path = Files/libfaad/rvlc.c; sourceTree = "<group>"; };
8EBDF44C09F28B2C004F2528 /* rvlc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = rvlc.h; path = Files/libfaad/rvlc.h; sourceTree = "<group>"; };
8EBDF44D09F28B2C004F2528 /* sbr_dct.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sbr_dct.c; path = Files/libfaad/sbr_dct.c; sourceTree = "<group>"; };
8EBDF44E09F28B2C004F2528 /* sbr_dct.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sbr_dct.h; path = Files/libfaad/sbr_dct.h; sourceTree = "<group>"; };
8EBDF44F09F28B2C004F2528 /* sbr_dec.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sbr_dec.c; path = Files/libfaad/sbr_dec.c; sourceTree = "<group>"; };
8EBDF45009F28B2C004F2528 /* sbr_dec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sbr_dec.h; path = Files/libfaad/sbr_dec.h; sourceTree = "<group>"; };
8EBDF45109F28B2C004F2528 /* sbr_e_nf.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sbr_e_nf.c; path = Files/libfaad/sbr_e_nf.c; sourceTree = "<group>"; };
8EBDF45209F28B2C004F2528 /* sbr_e_nf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sbr_e_nf.h; path = Files/libfaad/sbr_e_nf.h; sourceTree = "<group>"; };
8EBDF45309F28B2C004F2528 /* sbr_fbt.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sbr_fbt.c; path = Files/libfaad/sbr_fbt.c; sourceTree = "<group>"; };
8EBDF45409F28B2C004F2528 /* sbr_fbt.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sbr_fbt.h; path = Files/libfaad/sbr_fbt.h; sourceTree = "<group>"; };
8EBDF45509F28B2C004F2528 /* sbr_hfadj.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sbr_hfadj.c; path = Files/libfaad/sbr_hfadj.c; sourceTree = "<group>"; };
8EBDF45609F28B2C004F2528 /* sbr_hfadj.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sbr_hfadj.h; path = Files/libfaad/sbr_hfadj.h; sourceTree = "<group>"; };
8EBDF45709F28B2C004F2528 /* sbr_hfgen.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sbr_hfgen.c; path = Files/libfaad/sbr_hfgen.c; sourceTree = "<group>"; };
8EBDF45809F28B2C004F2528 /* sbr_hfgen.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sbr_hfgen.h; path = Files/libfaad/sbr_hfgen.h; sourceTree = "<group>"; };
8EBDF45909F28B2C004F2528 /* sbr_huff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sbr_huff.c; path = Files/libfaad/sbr_huff.c; sourceTree = "<group>"; };
8EBDF45A09F28B2C004F2528 /* sbr_huff.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sbr_huff.h; path = Files/libfaad/sbr_huff.h; sourceTree = "<group>"; };
8EBDF45B09F28B2C004F2528 /* sbr_noise.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sbr_noise.h; path = Files/libfaad/sbr_noise.h; sourceTree = "<group>"; };
8EBDF45C09F28B2C004F2528 /* sbr_qmf_c.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sbr_qmf_c.h; path = Files/libfaad/sbr_qmf_c.h; sourceTree = "<group>"; };
8EBDF45D09F28B2C004F2528 /* sbr_qmf.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sbr_qmf.c; path = Files/libfaad/sbr_qmf.c; sourceTree = "<group>"; };
8EBDF45E09F28B2C004F2528 /* sbr_qmf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sbr_qmf.h; path = Files/libfaad/sbr_qmf.h; sourceTree = "<group>"; };
8EBDF45F09F28B2C004F2528 /* sbr_syntax.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sbr_syntax.c; path = Files/libfaad/sbr_syntax.c; sourceTree = "<group>"; };
8EBDF46009F28B2C004F2528 /* sbr_syntax.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sbr_syntax.h; path = Files/libfaad/sbr_syntax.h; sourceTree = "<group>"; };
8EBDF46109F28B2C004F2528 /* sbr_tf_grid.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sbr_tf_grid.c; path = Files/libfaad/sbr_tf_grid.c; sourceTree = "<group>"; };
8EBDF46209F28B2C004F2528 /* sbr_tf_grid.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sbr_tf_grid.h; path = Files/libfaad/sbr_tf_grid.h; sourceTree = "<group>"; };
8EBDF46309F28B2C004F2528 /* sine_win.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sine_win.h; path = Files/libfaad/sine_win.h; sourceTree = "<group>"; };
8EBDF46409F28B2C004F2528 /* specrec.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = specrec.c; path = Files/libfaad/specrec.c; sourceTree = "<group>"; };
8EBDF46509F28B2C004F2528 /* specrec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = specrec.h; path = Files/libfaad/specrec.h; sourceTree = "<group>"; };
8EBDF46609F28B2C004F2528 /* ssr_fb.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ssr_fb.c; path = Files/libfaad/ssr_fb.c; sourceTree = "<group>"; };
8EBDF46709F28B2C004F2528 /* ssr_fb.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ssr_fb.h; path = Files/libfaad/ssr_fb.h; sourceTree = "<group>"; };
8EBDF46809F28B2C004F2528 /* ssr_ipqf.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ssr_ipqf.c; path = Files/libfaad/ssr_ipqf.c; sourceTree = "<group>"; };
8EBDF46909F28B2C004F2528 /* ssr_ipqf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ssr_ipqf.h; path = Files/libfaad/ssr_ipqf.h; sourceTree = "<group>"; };
8EBDF46A09F28B2C004F2528 /* ssr_win.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ssr_win.h; path = Files/libfaad/ssr_win.h; sourceTree = "<group>"; };
8EBDF46B09F28B2C004F2528 /* ssr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ssr.c; path = Files/libfaad/ssr.c; sourceTree = "<group>"; };
8EBDF46C09F28B2C004F2528 /* ssr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ssr.h; path = Files/libfaad/ssr.h; sourceTree = "<group>"; };
8EBDF46D09F28B2C004F2528 /* structs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = structs.h; path = Files/libfaad/structs.h; sourceTree = "<group>"; };
8EBDF46E09F28B2C004F2528 /* syntax.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = syntax.c; path = Files/libfaad/syntax.c; sourceTree = "<group>"; };
8EBDF46F09F28B2C004F2528 /* syntax.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = syntax.h; path = Files/libfaad/syntax.h; sourceTree = "<group>"; };
8EBDF47009F28B2C004F2528 /* tns.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = tns.c; path = Files/libfaad/tns.c; sourceTree = "<group>"; };
8EBDF47109F28B2C004F2528 /* tns.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = tns.h; path = Files/libfaad/tns.h; sourceTree = "<group>"; };
8EBDF4E309F28B3F004F2528 /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = config.h; path = Files/config.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8DC2EF560486A6940098B216 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
034768DFFF38A50411DB9C8B /* Products */ = {
isa = PBXGroup;
children = (
8DC2EF5B0486A6940098B216 /* FAAD2.framework */,
);
name = Products;
sourceTree = "<group>";
};
0867D691FE84028FC02AAC07 /* FAAD2 */ = {
isa = PBXGroup;
children = (
8EBDF3CF09F28ACA004F2528 /* Common */,
8EBDF3C609F28ABA004F2528 /* Headers */,
8EBDF3C509F28AB4004F2528 /* Source */,
089C1665FE841158C02AAC07 /* Resources */,
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
034768DFFF38A50411DB9C8B /* Products */,
);
name = FAAD2;
sourceTree = "<group>";
};
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */,
1058C7B2FEA5585E11CA2CBB /* Other Frameworks */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";
};
089C1665FE841158C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
8DC2EF5A0486A6940098B216 /* Info.plist */,
089C1666FE841158C02AAC07 /* InfoPlist.strings */,
);
name = Resources;
sourceTree = "<group>";
};
1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
);
name = "Other Frameworks";
sourceTree = "<group>";
};
8EBDF3C509F28AB4004F2528 /* Source */ = {
isa = PBXGroup;
children = (
8EBDF40209F28B2C004F2528 /* analysis.h */,
8EBDF40309F28B2C004F2528 /* bits.c */,
8EBDF40409F28B2C004F2528 /* bits.h */,
8EBDF40509F28B2C004F2528 /* cfft_tab.h */,
8EBDF40609F28B2C004F2528 /* cfft.c */,
8EBDF40709F28B2C004F2528 /* cfft.h */,
8EBDF40809F28B2C004F2528 /* codebook */,
8EBDF41609F28B2C004F2528 /* common.c */,
8EBDF41709F28B2C004F2528 /* common.h */,
8EBDF41809F28B2C004F2528 /* decoder.c */,
8EBDF41909F28B2C004F2528 /* decoder.h */,
8EBDF41A09F28B2C004F2528 /* drc.c */,
8EBDF41B09F28B2C004F2528 /* drc.h */,
8EBDF41C09F28B2C004F2528 /* drm_dec.c */,
8EBDF41D09F28B2C004F2528 /* drm_dec.h */,
8EBDF41E09F28B2C004F2528 /* error.c */,
8EBDF41F09F28B2C004F2528 /* error.h */,
8EBDF42009F28B2C004F2528 /* filtbank.c */,
8EBDF42109F28B2C004F2528 /* filtbank.h */,
8EBDF42209F28B2C004F2528 /* fixed.h */,
8EBDF42309F28B2C004F2528 /* hcr.c */,
8EBDF42409F28B2C004F2528 /* huffman.c */,
8EBDF42509F28B2C004F2528 /* huffman.h */,
8EBDF42609F28B2C004F2528 /* ic_predict.c */,
8EBDF42709F28B2C004F2528 /* ic_predict.h */,
8EBDF42809F28B2C004F2528 /* iq_table.h */,
8EBDF42909F28B2C004F2528 /* is.c */,
8EBDF42A09F28B2C004F2528 /* is.h */,
8EBDF42B09F28B2C004F2528 /* kbd_win.h */,
8EBDF43709F28B2C004F2528 /* lt_predict.c */,
8EBDF43809F28B2C004F2528 /* lt_predict.h */,
8EBDF43A09F28B2C004F2528 /* mdct_tab.h */,
8EBDF43B09F28B2C004F2528 /* mdct.c */,
8EBDF43C09F28B2C004F2528 /* mdct.h */,
8EBDF43D09F28B2C004F2528 /* mp4.c */,
8EBDF43E09F28B2C004F2528 /* mp4.h */,
8EBDF43F09F28B2C004F2528 /* ms.c */,
8EBDF44009F28B2C004F2528 /* ms.h */,
8EBDF44109F28B2C004F2528 /* output.c */,
8EBDF44209F28B2C004F2528 /* output.h */,
8EBDF44309F28B2C004F2528 /* pns.c */,
8EBDF44409F28B2C004F2528 /* pns.h */,
8EBDF44509F28B2C004F2528 /* ps_dec.c */,
8EBDF44609F28B2C004F2528 /* ps_dec.h */,
8EBDF44709F28B2C004F2528 /* ps_syntax.c */,
8EBDF44809F28B2C004F2528 /* ps_tables.h */,
8EBDF44909F28B2C004F2528 /* pulse.c */,
8EBDF44A09F28B2C004F2528 /* pulse.h */,
8EBDF44B09F28B2C004F2528 /* rvlc.c */,
8EBDF44C09F28B2C004F2528 /* rvlc.h */,
8EBDF44D09F28B2C004F2528 /* sbr_dct.c */,
8EBDF44E09F28B2C004F2528 /* sbr_dct.h */,
8EBDF44F09F28B2C004F2528 /* sbr_dec.c */,
8EBDF45009F28B2C004F2528 /* sbr_dec.h */,
8EBDF45109F28B2C004F2528 /* sbr_e_nf.c */,
8EBDF45209F28B2C004F2528 /* sbr_e_nf.h */,
8EBDF45309F28B2C004F2528 /* sbr_fbt.c */,
8EBDF45409F28B2C004F2528 /* sbr_fbt.h */,
8EBDF45509F28B2C004F2528 /* sbr_hfadj.c */,
8EBDF45609F28B2C004F2528 /* sbr_hfadj.h */,
8EBDF45709F28B2C004F2528 /* sbr_hfgen.c */,
8EBDF45809F28B2C004F2528 /* sbr_hfgen.h */,
8EBDF45909F28B2C004F2528 /* sbr_huff.c */,
8EBDF45A09F28B2C004F2528 /* sbr_huff.h */,
8EBDF45B09F28B2C004F2528 /* sbr_noise.h */,
8EBDF45C09F28B2C004F2528 /* sbr_qmf_c.h */,
8EBDF45D09F28B2C004F2528 /* sbr_qmf.c */,
8EBDF45E09F28B2C004F2528 /* sbr_qmf.h */,
8EBDF45F09F28B2C004F2528 /* sbr_syntax.c */,
8EBDF46009F28B2C004F2528 /* sbr_syntax.h */,
8EBDF46109F28B2C004F2528 /* sbr_tf_grid.c */,
8EBDF46209F28B2C004F2528 /* sbr_tf_grid.h */,
8EBDF46309F28B2C004F2528 /* sine_win.h */,
8EBDF46409F28B2C004F2528 /* specrec.c */,
8EBDF46509F28B2C004F2528 /* specrec.h */,
8EBDF46609F28B2C004F2528 /* ssr_fb.c */,
8EBDF46709F28B2C004F2528 /* ssr_fb.h */,
8EBDF46809F28B2C004F2528 /* ssr_ipqf.c */,
8EBDF46909F28B2C004F2528 /* ssr_ipqf.h */,
8EBDF46A09F28B2C004F2528 /* ssr_win.h */,
8EBDF46B09F28B2C004F2528 /* ssr.c */,
8EBDF46C09F28B2C004F2528 /* ssr.h */,
8EBDF46D09F28B2C004F2528 /* structs.h */,
8EBDF46E09F28B2C004F2528 /* syntax.c */,
8EBDF46F09F28B2C004F2528 /* syntax.h */,
8EBDF47009F28B2C004F2528 /* tns.c */,
8EBDF47109F28B2C004F2528 /* tns.h */,
);
name = Source;
sourceTree = "<group>";
};
8EBDF3C609F28ABA004F2528 /* Headers */ = {
isa = PBXGroup;
children = (
8EBDF4E309F28B3F004F2528 /* config.h */,
8EBDF3FE09F28B1F004F2528 /* faad.h */,
8EBDF3FF09F28B1F004F2528 /* neaacdec.h */,
);
name = Headers;
sourceTree = "<group>";
};
8EBDF3CF09F28ACA004F2528 /* Common */ = {
isa = PBXGroup;
children = (
8EBDF3D409F28B08004F2528 /* faad */,
8EBDF3DD09F28B08004F2528 /* mp4ff */,
);
name = Common;
sourceTree = "<group>";
};
8EBDF3D409F28B08004F2528 /* faad */ = {
isa = PBXGroup;
children = (
8EBDF3D509F28B08004F2528 /* aacinfo.c */,
8EBDF3D609F28B08004F2528 /* aacinfo.h */,
8EBDF3D909F28B08004F2528 /* getopt.c */,
8EBDF3DA09F28B08004F2528 /* getopt.h */,
);
name = faad;
path = Files/common/faad;
sourceTree = "<group>";
};
8EBDF3DD09F28B08004F2528 /* mp4ff */ = {
isa = PBXGroup;
children = (
8EBDF3DE09F28B08004F2528 /* drms.c */,
8EBDF3DF09F28B08004F2528 /* drms.h */,
8EBDF3E009F28B08004F2528 /* drmstables.h */,
8EBDF3E109F28B08004F2528 /* mp4atom.c */,
8EBDF3E309F28B08004F2528 /* mp4ff.h */,
8EBDF3E409F28B08004F2528 /* mp4ff_int_types.h */,
8EBDF3E509F28B08004F2528 /* mp4ffint.h */,
8EBDF3E609F28B08004F2528 /* mp4meta.c */,
8EBDF3E709F28B08004F2528 /* mp4sample.c */,
8EBDF3E809F28B08004F2528 /* mp4tagupdate.c */,
8EBDF3E909F28B08004F2528 /* mp4util.c */,
);
name = mp4ff;
path = Files/common/mp4ff;
sourceTree = "<group>";
};
8EBDF40809F28B2C004F2528 /* codebook */ = {
isa = PBXGroup;
children = (
8EBDF40909F28B2C004F2528 /* hcb.h */,
8EBDF40A09F28B2C004F2528 /* hcb_1.h */,
8EBDF40B09F28B2C004F2528 /* hcb_10.h */,
8EBDF40C09F28B2C004F2528 /* hcb_11.h */,
8EBDF40D09F28B2C004F2528 /* hcb_2.h */,
8EBDF40E09F28B2C004F2528 /* hcb_3.h */,
8EBDF40F09F28B2C004F2528 /* hcb_4.h */,
8EBDF41009F28B2C004F2528 /* hcb_5.h */,
8EBDF41109F28B2C004F2528 /* hcb_6.h */,
8EBDF41209F28B2C004F2528 /* hcb_7.h */,
8EBDF41309F28B2C004F2528 /* hcb_8.h */,
8EBDF41409F28B2C004F2528 /* hcb_9.h */,
8EBDF41509F28B2C004F2528 /* hcb_sf.h */,
);
name = codebook;
path = Files/libfaad/codebook;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
8DC2EF500486A6940098B216 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
8EBDF3EB09F28B08004F2528 /* aacinfo.h in Headers */,
8EBDF3EF09F28B08004F2528 /* getopt.h in Headers */,
8EBDF3F309F28B08004F2528 /* drms.h in Headers */,
8EBDF3F409F28B08004F2528 /* drmstables.h in Headers */,
8EBDF3F709F28B08004F2528 /* mp4ff.h in Headers */,
8EBDF3F809F28B08004F2528 /* mp4ff_int_types.h in Headers */,
8EBDF3F909F28B08004F2528 /* mp4ffint.h in Headers */,
8EBDF40009F28B1F004F2528 /* faad.h in Headers */,
8EBDF40109F28B1F004F2528 /* neaacdec.h in Headers */,
8EBDF47209F28B2C004F2528 /* analysis.h in Headers */,
8EBDF47409F28B2C004F2528 /* bits.h in Headers */,
8EBDF47509F28B2C004F2528 /* cfft_tab.h in Headers */,
8EBDF47709F28B2C004F2528 /* cfft.h in Headers */,
8EBDF47809F28B2C004F2528 /* hcb.h in Headers */,
8EBDF47909F28B2C004F2528 /* hcb_1.h in Headers */,
8EBDF47A09F28B2C004F2528 /* hcb_10.h in Headers */,
8EBDF47B09F28B2C004F2528 /* hcb_11.h in Headers */,
8EBDF47C09F28B2C004F2528 /* hcb_2.h in Headers */,
8EBDF47D09F28B2C004F2528 /* hcb_3.h in Headers */,
8EBDF47E09F28B2C004F2528 /* hcb_4.h in Headers */,
8EBDF47F09F28B2C004F2528 /* hcb_5.h in Headers */,
8EBDF48009F28B2C004F2528 /* hcb_6.h in Headers */,
8EBDF48109F28B2C004F2528 /* hcb_7.h in Headers */,
8EBDF48209F28B2C004F2528 /* hcb_8.h in Headers */,
8EBDF48309F28B2C004F2528 /* hcb_9.h in Headers */,
8EBDF48409F28B2C004F2528 /* hcb_sf.h in Headers */,
8EBDF48609F28B2C004F2528 /* common.h in Headers */,
8EBDF48809F28B2C004F2528 /* decoder.h in Headers */,
8EBDF48A09F28B2C004F2528 /* drc.h in Headers */,
8EBDF48C09F28B2C004F2528 /* drm_dec.h in Headers */,
8EBDF48E09F28B2C004F2528 /* error.h in Headers */,
8EBDF49009F28B2C004F2528 /* filtbank.h in Headers */,
8EBDF49109F28B2C004F2528 /* fixed.h in Headers */,
8EBDF49409F28B2C004F2528 /* huffman.h in Headers */,
8EBDF49609F28B2C004F2528 /* ic_predict.h in Headers */,
8EBDF49709F28B2C004F2528 /* iq_table.h in Headers */,
8EBDF49909F28B2C004F2528 /* is.h in Headers */,
8EBDF49A09F28B2C004F2528 /* kbd_win.h in Headers */,
8EBDF4A709F28B2C004F2528 /* lt_predict.h in Headers */,
8EBDF4A909F28B2C004F2528 /* mdct_tab.h in Headers */,
8EBDF4AB09F28B2C004F2528 /* mdct.h in Headers */,
8EBDF4AD09F28B2C004F2528 /* mp4.h in Headers */,
8EBDF4AF09F28B2C004F2528 /* ms.h in Headers */,
8EBDF4B109F28B2C004F2528 /* output.h in Headers */,
8EBDF4B309F28B2C004F2528 /* pns.h in Headers */,
8EBDF4B509F28B2C004F2528 /* ps_dec.h in Headers */,
8EBDF4B709F28B2C004F2528 /* ps_tables.h in Headers */,
8EBDF4B909F28B2C004F2528 /* pulse.h in Headers */,
8EBDF4BB09F28B2C004F2528 /* rvlc.h in Headers */,
8EBDF4BD09F28B2C004F2528 /* sbr_dct.h in Headers */,
8EBDF4BF09F28B2C004F2528 /* sbr_dec.h in Headers */,
8EBDF4C109F28B2C004F2528 /* sbr_e_nf.h in Headers */,
8EBDF4C309F28B2C004F2528 /* sbr_fbt.h in Headers */,
8EBDF4C509F28B2C004F2528 /* sbr_hfadj.h in Headers */,
8EBDF4C709F28B2C004F2528 /* sbr_hfgen.h in Headers */,
8EBDF4C909F28B2C004F2528 /* sbr_huff.h in Headers */,
8EBDF4CA09F28B2C004F2528 /* sbr_noise.h in Headers */,
8EBDF4CB09F28B2C004F2528 /* sbr_qmf_c.h in Headers */,
8EBDF4CD09F28B2C004F2528 /* sbr_qmf.h in Headers */,
8EBDF4CF09F28B2C004F2528 /* sbr_syntax.h in Headers */,
8EBDF4D109F28B2C004F2528 /* sbr_tf_grid.h in Headers */,
8EBDF4D209F28B2C004F2528 /* sine_win.h in Headers */,
8EBDF4D409F28B2C004F2528 /* specrec.h in Headers */,
8EBDF4D609F28B2C004F2528 /* ssr_fb.h in Headers */,
8EBDF4D809F28B2C004F2528 /* ssr_ipqf.h in Headers */,
8EBDF4D909F28B2C004F2528 /* ssr_win.h in Headers */,
8EBDF4DB09F28B2C004F2528 /* ssr.h in Headers */,
8EBDF4DC09F28B2C004F2528 /* structs.h in Headers */,
8EBDF4DE09F28B2C004F2528 /* syntax.h in Headers */,
8EBDF4E009F28B2C004F2528 /* tns.h in Headers */,
8EBDF4E409F28B3F004F2528 /* config.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
8DC2EF4F0486A6940098B216 /* FAAD2 */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "FAAD2" */;
buildPhases = (
8DC2EF500486A6940098B216 /* Headers */,
8DC2EF520486A6940098B216 /* Resources */,
8DC2EF540486A6940098B216 /* Sources */,
8DC2EF560486A6940098B216 /* Frameworks */,
);
buildRules = (
);
buildSettings = {
};
dependencies = (
);
name = FAAD2;
productInstallPath = "$(HOME)/Library/Frameworks";
productName = FAAD2;
productReference = 8DC2EF5B0486A6940098B216 /* FAAD2.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "FAAD2" */;
buildSettings = {
};
buildStyles = (
014CEA440018CDF011CA2923 /* Debug */,
014CEA450018CDF011CA2923 /* Release */,
);
hasScannedForEncodings = 1;
mainGroup = 0867D691FE84028FC02AAC07 /* FAAD2 */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
targets = (
8DC2EF4F0486A6940098B216 /* FAAD2 */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8DC2EF520486A6940098B216 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8DC2EF540486A6940098B216 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8EBDF3EA09F28B08004F2528 /* aacinfo.c in Sources */,
8EBDF3EE09F28B08004F2528 /* getopt.c in Sources */,
8EBDF3F209F28B08004F2528 /* drms.c in Sources */,
8EBDF3F509F28B08004F2528 /* mp4atom.c in Sources */,
8EBDF3FA09F28B08004F2528 /* mp4meta.c in Sources */,
8EBDF3FB09F28B08004F2528 /* mp4sample.c in Sources */,
8EBDF3FC09F28B08004F2528 /* mp4tagupdate.c in Sources */,
8EBDF3FD09F28B08004F2528 /* mp4util.c in Sources */,
8EBDF47309F28B2C004F2528 /* bits.c in Sources */,
8EBDF47609F28B2C004F2528 /* cfft.c in Sources */,
8EBDF48509F28B2C004F2528 /* common.c in Sources */,
8EBDF48709F28B2C004F2528 /* decoder.c in Sources */,
8EBDF48909F28B2C004F2528 /* drc.c in Sources */,
8EBDF48B09F28B2C004F2528 /* drm_dec.c in Sources */,
8EBDF48D09F28B2C004F2528 /* error.c in Sources */,
8EBDF48F09F28B2C004F2528 /* filtbank.c in Sources */,
8EBDF49209F28B2C004F2528 /* hcr.c in Sources */,
8EBDF49309F28B2C004F2528 /* huffman.c in Sources */,
8EBDF49509F28B2C004F2528 /* ic_predict.c in Sources */,
8EBDF49809F28B2C004F2528 /* is.c in Sources */,
8EBDF4A609F28B2C004F2528 /* lt_predict.c in Sources */,
8EBDF4AA09F28B2C004F2528 /* mdct.c in Sources */,
8EBDF4AC09F28B2C004F2528 /* mp4.c in Sources */,
8EBDF4AE09F28B2C004F2528 /* ms.c in Sources */,
8EBDF4B009F28B2C004F2528 /* output.c in Sources */,
8EBDF4B209F28B2C004F2528 /* pns.c in Sources */,
8EBDF4B409F28B2C004F2528 /* ps_dec.c in Sources */,
8EBDF4B609F28B2C004F2528 /* ps_syntax.c in Sources */,
8EBDF4B809F28B2C004F2528 /* pulse.c in Sources */,
8EBDF4BA09F28B2C004F2528 /* rvlc.c in Sources */,
8EBDF4BC09F28B2C004F2528 /* sbr_dct.c in Sources */,
8EBDF4BE09F28B2C004F2528 /* sbr_dec.c in Sources */,
8EBDF4C009F28B2C004F2528 /* sbr_e_nf.c in Sources */,
8EBDF4C209F28B2C004F2528 /* sbr_fbt.c in Sources */,
8EBDF4C409F28B2C004F2528 /* sbr_hfadj.c in Sources */,
8EBDF4C609F28B2C004F2528 /* sbr_hfgen.c in Sources */,
8EBDF4C809F28B2C004F2528 /* sbr_huff.c in Sources */,
8EBDF4CC09F28B2C004F2528 /* sbr_qmf.c in Sources */,
8EBDF4CE09F28B2C004F2528 /* sbr_syntax.c in Sources */,
8EBDF4D009F28B2C004F2528 /* sbr_tf_grid.c in Sources */,
8EBDF4D309F28B2C004F2528 /* specrec.c in Sources */,
8EBDF4D509F28B2C004F2528 /* ssr_fb.c in Sources */,
8EBDF4D709F28B2C004F2528 /* ssr_ipqf.c in Sources */,
8EBDF4DA09F28B2C004F2528 /* ssr.c in Sources */,
8EBDF4DD09F28B2C004F2528 /* syntax.c in Sources */,
8EBDF4DF09F28B2C004F2528 /* tns.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
089C1666FE841158C02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C1667FE841158C02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
1DEB91AE08733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
HEADER_SEARCH_PATHS = Files/libfaad/;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Frameworks";
OTHER_CFLAGS = "-DHAVE_CONFIG_H";
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES;
PRODUCT_NAME = FAAD2;
WRAPPER_EXTENSION = framework;
ZERO_LINK = YES;
};
name = Debug;
};
1DEB91AF08733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
);
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
HEADER_SEARCH_PATHS = Files/libfaad/;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@executable_path/../Frameworks";
OTHER_CFLAGS = "-DHAVE_CONFIG_H";
PRODUCT_NAME = FAAD2;
WRAPPER_EXTENSION = framework;
};
name = Release;
};
1DEB91B208733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Debug;
};
1DEB91B308733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "FAAD2" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB91AE08733DA50010E9CD /* Debug */,
1DEB91AF08733DA50010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "FAAD2" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB91B208733DA50010E9CD /* Debug */,
1DEB91B308733DA50010E9CD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
}

View file

@ -0,0 +1,17 @@
M. Bakker (mbakker(at)nero.com)
- complete library
Alexander Kurpiers (a.kurpiers(at)nt.tu-darmstadt.de)
- HCR code
- DRM stuff
- lot's of bug fixes
Volker Fischer (v.fischer(at)nt.tu-darmstadt.de)
- DRM code
- lot's of bug fixes
Gian-Carlo Pascutto (gpascutto(at)nero.com)
- DRM PS code
- bugfixes

View file

@ -0,0 +1,350 @@
Any non-GPL usage of this software or parts of this software is strictly
forbidden.
Commercial non-GPL licensing of this software is possible.
For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View file

@ -0,0 +1,126 @@
8 september 2004 mbakker(at)nero.com
- specrec.c: fixed compilation without PS
4 september 2004 mbakker(at)nero.com
- sbr_fbt.c, sbr_hfgen.c: fixed possible lockup with bad data.
4 september 2004 mbakker(at)nero.com
- cfft.c,h, common.c,h, filtbank.c,h, mdct.h, sbr_qmf.h, structs.h, decoder.c, specrec.c:
Removed USE_SSE
4 september 2004 gpascutto(at)nero.com
- specrec.c: small optimizations to inverse quant
3 september 2004 mbakker(at)nero.com
- neaacdec.h, decoder.c, syntax.c, structs.h: added output flag for PS
3 september 2004 mbakker(at)nero.com
- common.c: added log2_fix()
28 august 2004 gpascutto(at)nero.com
- sbr_syntax.c: bugfix with PS_DEC and DRM_PS defines
21 august 2004 mbakker(at)nero.com
- cfft.c, cfft_tab.h: added size 128 fixed point FFT tables for HVXC
18 august 2004 mbakker(at)nero.com
- sbr_syntax.c: allow only 1 PS data element per SBR extension data
18 august 2004 gpascutto(at)nero.com
- specrec.c: safeguard against PS suddenly going on
4 august 2004 gpascutto(at)nero.com
- drm_dec.c: make sure we still copy to the right channel if there's no data
2 august 2004 gpascutto(at)nero.com
- hcr.c: bugfix
31 july 2004 gpascutto(at)nero.com
- hcr.c: Rewritten and optimized
29 july 2004 mbakker(at)nero.com
- /mp4ff/mp4ff.c,mp4atoms.c: support video decoding better
28 july 2004 gpascutto(at)nero.com
- drm_dec.*, sbr_dec.c, syntax.c: improved error concealment
27 july 2004 gpascutto(at)nero.com
- sbr_dec.c, sbr_syntax.c: duplicate code removal
25 july 2004 gpascutto(at)nero.com
- syntax.c: re-enable SBR CRC checking for DRM
22 july 2004 gpascutto(at)nero.com
- drm_dec.*: changed delay filter to 2 samples plus fractional delay, as in normal PS AAC
(DRM standard is wrong here)
2 july 2004 mbakker(at)nero.com
- huffman.c: Implemented VCB11 error concealment
22 june 2004 mbakker(at)nero.com
- ps_dec.c: Removed samplerate dependancy in PS, likely to be updated in corrigendum
15 june 2004 mbakker(at)nero.com
- sbr_dct.c,h: Removed huge ugly DCT_4_64...
- sbr_qmf.c: replaced DCT_IV in qmf synthesis
13 june 2004 mbakker(at)nero.com
- ps_dec.c: Fixed fixed point code, no more cos() and sin() used
7 june 2004 mbakker(at)nero.com
- sbr_*.c,h: Overall speedups and improvements in SBR code.
4 june 2004 gpascutto(at)nero.com
- drm_dec.c: Fixed a bug in the standard (PAN mixing)
3 june 2004 mbakker(at)nero.com
- ps_syntax.c: fixed a bug in one of the huffman tables
2 june 2004 gpascutto(at)nero.com
- drm_dec.c: Fully working fixed point support
27 may 2004 mbakker(at)nero.com
- sbr_qmf.c, sbr_dec.h: Fixed fixed point problems with downsampled QMF
17 may 2004 mbakker(at)nero.com
- syntax.c, decoder.c: Added some logging output
17 may 2004 mbakker(at)nero.com
- mp4atom.c: Fixed an issue with broken MP4 files
16 may 2004 mbakker(at)nero.com
- ps_dec.c: fixed point: forgot to convert a few multiplies
14 may 2004 mbakker(at)nero.com
- sbr_*.c: reduced memory usage
6 may 2004 mbakker(at)nero.com
- common.c: added some bit tricks and fixed point log2/pow2
- sbr_hfadj.c: log2/pow2 based gain calculation for SBR
- sbr_hfgen.c: use block exponent instead of stupid search to find max value
5 may 2004 mbakker(at)nero.com
- decoder.c, neaacdec.h, decoder.h: added extra decode function to which a
buffer can be provided. Instead of the library providing a buffer.
5 may 2004 mbakker(at)nero.com
- mdct.c: fixed fixed point MDCT with framesizes 960, 480, 120
2 may 2004 mbakker(at)nero.com
- mdct_tab.h, mdct.c: Added tables for MDCT, for increased accuracy in fixed point
- specrec.c: Moved quantisation, scaling and reordering to 1 function
20 april 2004 gpacutto(at)nero.com
- drm_dec.c, drm_dec.h: Don't do PS processing if no data was read this frame.
Fix for bitstread reading bug in specification.
15 april 2004 mbakker(at)nero.com
- sbr_hfadj.c: fixed buffer overflow
- multiple: fixed some eVC problems
12 april 2004 mbakker(at)nero.com
- common.h, ps_dec.c: Updates for PS fixed point, should completely work now
12 april 2004 gpascutto(at)nero.com
- drm_dec.c, drm_dec.h: eliminated sqrt and SA mapping/dequantization from DRM PS decoder

View file

@ -0,0 +1,7 @@
6 February 2004
- FAAD2 version 2.0 released
25 July 2003
- Release version with SBR decoding

View file

@ -0,0 +1,122 @@
Freeware Advanced Audio (AAC) Decoder including SBR decoding
http://www.audiocoding.com/
FAAD2 is a HE, LC, MAIN and LTP profile, MPEG2 and MPEG-4 AAC decoder.
FAAD2 includes code for SBR (HE AAC) decoding.
FAAD2 is licensed under the GPL.
__________
COPYRIGHTS
For FAAD2 the following license applies:
******************************************************************************
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker (mbakker(at)nero.com), Ahead Software AG
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Commercial non-GPL licensing of this software is also possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
******************************************************************************
Please note that the use of this software may require the payment of
patent royalties. You need to consider this issue before you start
building derivative works. We are not warranting or indemnifying you in
any way for patent royalities! YOU ARE SOLELY RESPONSIBLE FOR YOUR OWN
ACTIONS!
______
PEOPLE
FAAD2 is written by:
- M. Bakker (mbakker(at)nero.com).
_______________
VERSION HISTORY
Sorry, try building a ChangeLog from CVS.
__________________________________
REDISTRIBUTED OPEN SOURCE PACKAGES
This is the list of redistributed open source packages that are included
in FAAD2:
Name: mp4v2
Version: 0.9.8.6
Origin: http://www.mpeg4ip.net
Author: David Mackie
Directory: common/mp4v2
License: MPL, Mozilla Public License, version 1.1
Name: mp4av
Version: 0.9.8.6
Origin: http://www.mpeg4ip.net
Author: David Mackie
Directory: common/mp4av
License: MPL, Mozilla Public License, version 1.1
___________________
DIRECTORY STRUCTURE
faad2 - top level directory.
aacDECdrop - windows decoder/player with drag'n'drop functionality
common - generally used libraries and code.
faad - general common functions like filereading and streaming
as well as getting info from aac files.
mp4v2 - MPEG-4 file reading library.
mp4av - MPEG-4 file general function library.
mp4ff - Small MP4 file format library (includes tagging abilities).
CoreAAC - AAC DirectShow filter.
frontend - command line frontend to the FAAD2 library, also supports
MPEG-4 file decoding.
include - inlude file for the FAAD2 library.
libfaad - the FAAD2 AAC decoder library including SBR.
codebook - Huffman codebooks
plugins - plugins for all kinds of pograms.
in_mp4 - winamp MPEG-4 AAC file input plugin.
QCD - Quintessential player AAC plugin.
QCDMp4 - Quintessential player MP4 plugin.
winamp - winamp2 AAC input plugin.
winamp3 - winamp3 AAC input plugin.
xmms - xmms AAC plugin
mpeg4ip - plugin for the mpeg4ip player

View file

@ -0,0 +1,16 @@
To compile under Linux.
----------------------
just run :
autoreconf -vif
./configure --with-mp4v2
make
sudo make install
about the xmms plugin.
---------------------
The xmms plugin need to be build after the install of the faad project.
so after you have installed correctly faad (--with-xmms options) you need
to configure and build the xmms plugin part in the plugins/xmms directory.
Read the README and INSTALL files into the xmms directory.

View file

@ -0,0 +1,2 @@
- Not much...

View file

@ -0,0 +1,366 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: aacinfo.c 19 2005-06-07 04:16:15Z vspader $
**/
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>
//#include "filestream.h"
#include "aacinfo.h"
#define ADIF_MAX_SIZE 30 /* Should be enough */
#define ADTS_MAX_SIZE 10 /* Should be enough */
static int sample_rates[] = {96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000};
static int read_ADIF_header(FILE *file, faadAACInfo *info)
{
int bitstream;
unsigned char buffer[ADIF_MAX_SIZE];
int skip_size = 0;
int sf_idx;
/* Get ADIF header data */
info->headertype = 1;
if(fread(buffer, 1, ADIF_MAX_SIZE, file) < 0)
return -1;
/* copyright string */
if(buffer[0] & 0x80)
skip_size += 9; /* skip 9 bytes */
bitstream = buffer[0 + skip_size] & 0x10;
info->bitrate = ((unsigned int)(buffer[0 + skip_size] & 0x0F)<<19)|
((unsigned int)buffer[1 + skip_size]<<11)|
((unsigned int)buffer[2 + skip_size]<<3)|
((unsigned int)buffer[3 + skip_size] & 0xE0);
if (bitstream == 0)
{
info->object_type = ((buffer[6 + skip_size]&0x01)<<1)|((buffer[7 + skip_size]&0x80)>>7);
sf_idx = (buffer[7 + skip_size]&0x78)>>3;
} else {
info->object_type = (buffer[4 + skip_size] & 0x18)>>3;
sf_idx = ((buffer[4 + skip_size] & 0x07)<<1)|((buffer[5 + skip_size] & 0x80)>>7);
}
info->sampling_rate = sample_rates[sf_idx];
return 0;
}
static int read_ADTS_header(FILE *file, faadAACInfo *info,
unsigned long **seek_table, int *seek_table_len,
int tagsize, int no_seek_table)
{
/* Get ADTS header data */
unsigned char buffer[ADTS_MAX_SIZE];
int frames, framesinsec=0, t_framelength = 0, frame_length, sr_idx, ID;
int second = 0, pos;
int i;
float frames_per_sec = 0;
unsigned long bytes;
unsigned long *tmp_seek_table = NULL;
info->headertype = 2;
/* Read all frames to ensure correct time and bitrate */
for(frames=0; /* */; frames++, framesinsec++)
{
/* If streaming, only go until we hit 5 seconds worth */
/* if(file->http)
{
if(frames >= 43 * 5)
{
break;
}
}
*/
pos = ftell(file);//tell_filestream(file);
/* 12 bit SYNCWORD */
bytes = fread(buffer, 1, ADTS_MAX_SIZE, file);
if(bytes != ADTS_MAX_SIZE)
{
/* Bail out if no syncword found */
break;
}
/* check syncword */
if (!((buffer[0] == 0xFF)&&((buffer[1] & 0xF6) == 0xF0)))
break;
if(!frames)
{
/* fixed ADTS header is the same for every frame, so we read it only once */
/* Syncword found, proceed to read in the fixed ADTS header */
ID = buffer[1] & 0x08;
info->object_type = (buffer[2]&0xC0)>>6;
sr_idx = (buffer[2]&0x3C)>>2;
info->channels = ((buffer[2]&0x01)<<2)|((buffer[3]&0xC0)>>6);
frames_per_sec = sample_rates[sr_idx] / 1024.f;
}
/* ...and the variable ADTS header */
if (ID == 0) {
info->version = 4;
} else { /* MPEG-2 */
info->version = 2;
}
frame_length = ((((unsigned int)buffer[3] & 0x3)) << 11)
| (((unsigned int)buffer[4]) << 3) | (buffer[5] >> 5);
t_framelength += frame_length;
// if(!file->http)
{
if(framesinsec == 43)
framesinsec = 0;
if(framesinsec == 0 && seek_table_len)
{
tmp_seek_table = (unsigned long *) realloc(tmp_seek_table, (second + 1) * sizeof(unsigned long));
tmp_seek_table[second] = pos;
}
if(framesinsec == 0)
second++;
}
/* NOTE: While simply skipping ahead by reading may seem to be more work than seeking,
it is actually much faster, and keeps compatibility with streaming */
//F THAT
fseek(file, frame_length - ADTS_MAX_SIZE, SEEK_CUR);
/* for(i=0; i < frame_length - ADTS_MAX_SIZE; i++)
{
if(read_byte_filestream(file) < 0)
break;
}
*/
}
if(seek_table_len)
{
*seek_table_len = second;
*seek_table = tmp_seek_table;
}
info->sampling_rate = sample_rates[sr_idx];
info->bitrate = (int)(((t_framelength / frames) * (info->sampling_rate/1024.0)) +0.5)*8;
/* if(file->http)
{
// Since we only use 5 seconds of aac data to get a rough bitrate, we must use a different
// method of calculating the overall length
if(filelength_filestream(file))
{
info->length = (int)((filelength_filestream(file)/(((info->bitrate*8)/1024)*16))*1000);
}
else
{
// Since the server didnt tell us how long the file is,
// we have no way of determining length
info->length = 0;
}
}
else
*/ {
info->length = (int)((float)(frames/frames_per_sec))*1000;
}
return 0;
}
int get_AAC_format(FILE *file, faadAACInfo *info,
unsigned long **seek_table, int *seek_table_len,
int no_seek_table)
{
unsigned long tagsize;
char buffer[10];
unsigned long file_len;
unsigned char adxx_id[5];
unsigned long tmp;
memset(info, 0, sizeof(faadAACInfo));
fseek(file, 0, SEEK_END);
file_len = ftell(file);
/* Skip the tag, if it's there */
tmp = fread(buffer, 1, 10, file);
if (StringComp(buffer, "ID3", 3) == 0)
{
unsigned int i;
/* high bit is not used */
tagsize = (buffer[6] << 21) | (buffer[7] << 14) |
(buffer[8] << 7) | (buffer[9] << 0);
fseek(file, tagsize, SEEK_CUR);
tagsize += 10;
}
else
{
tagsize = 0;
fseek(file, 0, SEEK_SET);
}
if(file_len)
file_len -= tagsize;
tmp = fread(adxx_id, 1, 2, file);
//seek_filestream(file, tagsize, FILE_BEGIN);
adxx_id[5-1] = 0;
info->length = 0;
/* Determine the header type of the file, check the first two bytes */
if(strncasecmp((char *)adxx_id, "AD", 2) == 0)
{
/* We think its an ADIF header, but check the rest just to make sure */
tmp = fread(adxx_id+2, 1, 2, file);
if(strncasecmp((char *)adxx_id, "ADIF", 4) == 0)
{
read_ADIF_header(file, info);
}
}
else
{
/* No ADIF, check for ADTS header */
if ((adxx_id[0] == 0xFF)&&((adxx_id[1] & 0xF6) == 0xF0))
{
/* ADTS header located */
/* Since this routine must work for streams, we can't use the seek function to go backwards, thus
we have to use a quick hack as seen below to go back where we need to. */
fseek(file, -2, SEEK_CUR);
/* if(file->buffer_offset >= 2)
{
// simple seeking hack, though not really safe, the probability of it causing a problem is low.
file->buffer_offset -= 2;
file->file_offset -= 2;
}
*/
read_ADTS_header(file, info, seek_table, seek_table_len, tagsize,
no_seek_table);
}
else
{
/* Unknown/headerless AAC file, assume format: */
info->version = 2;
info->bitrate = 128000;
info->sampling_rate = 44100;
info->channels = 2;
info->headertype = 0;
info->object_type = 1;
}
}
return 0;
}
int StringComp(char const *str1, char const *str2, unsigned long len)
{
signed int c1 = 0, c2 = 0;
while (len--) {
c1 = *str1++;
c2 = *str2++;
if (c1 == 0 || c1 != c2)
break;
}
return c1 - c2;
}
#ifdef TEST
/* Program to test aacinfo functionality */
#include <stdio.h>
void main(int argc, char *argv[])
{
faadAACInfo info;
unsigned long *seek_table = NULL;
int seek_table_len = 0;
char *header, *object;
if (argc < 2)
{
fprintf(stderr, "USAGE: aacinfo aacfile.aac\n");
return;
}
get_AAC_format(argv[1], &info, &seek_table, &seek_table_len, 0);
fprintf(stdout, "MPEG version: %d\n", info.version);
fprintf(stdout, "channels: %d\n", info.channels);
fprintf(stdout, "sampling_rate: %d\n", info.sampling_rate);
fprintf(stdout, "bitrate: %d\n", info.bitrate);
fprintf(stdout, "length: %.3f\n", (float)info.length/1000.0);
switch (info.object_type)
{
case 0:
object = "MAIN";
break;
case 1:
object = "LC";
break;
case 2:
object = "SSR";
break;
case 3:
object = "LTP";
break;
}
fprintf(stdout, "object_type: %s\n", object);
switch (info.headertype)
{
case 0:
header = "RAW";
break;
case 1:
header = "ADIF";
break;
case 2:
header = "ADTS";
break;
}
fprintf(stdout, "headertype: %s\n", header);
}
#endif

View file

@ -0,0 +1,54 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: aacinfo.h 19 2005-06-07 04:16:15Z vspader $
**/
#ifndef AACINFO_H__
#define AACINFO_H__
//#include "filestream.h"
#include <stdio.h>
typedef struct {
int version;
int channels;
int sampling_rate;
int bitrate;
int length;
int object_type;
int headertype;
} faadAACInfo;
int get_AAC_format(FILE *file, faadAACInfo *info,
unsigned long **seek_table, int *seek_table_len,
int no_seek_table);
static int read_ADIF_header(FILE *file, faadAACInfo *info);
static int read_ADTS_header(FILE *file, faadAACInfo *info,
unsigned long **seek_table, int *seek_table_len,
int tagsize, int no_seek_table);
int StringComp(char const *str1, char const *str2, unsigned long len);
#endif

View file

@ -0,0 +1,470 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: filestream.c 19 2005-06-07 04:16:15Z vspader $
**/
/* Not very portable yet */
#include <winsock2.h> // Note: Must be *before* windows.h
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include "filestream.h"
#include "aacinfo.h"
/* TEMPROARY HACK */
#define CommonExit(A) MessageBox(NULL, A, "FAAD Plugin", MB_OK)
int winsock_init=0; // 0=winsock not initialized, 1=success
long m_local_buffer_size = 64;
long m_stream_buffer_size = 128;
FILE_STREAM *open_filestream(char *filename)
{
FILE_STREAM *fs;
if(StringComp(filename,"http://", 7) == 0)
{
fs = (FILE_STREAM *)LocalAlloc(LPTR, sizeof(FILE_STREAM) + m_stream_buffer_size * 1024);
if(fs == NULL)
return NULL;
fs->data = (unsigned char *)&fs[1];
if(http_file_open(filename, fs) < 0)
{
LocalFree(fs);
return NULL;
}
fs->http = 1;
}
else
{
fs = (FILE_STREAM*)LocalAlloc(LPTR, sizeof(FILE_STREAM) + m_local_buffer_size * 1024);
if(fs == NULL)
return NULL;
fs->data = (unsigned char *)&fs[1];
fs->stream = CreateFile(filename, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, 0);
if (fs->stream == INVALID_HANDLE_VALUE)
{
LocalFree(fs);
return NULL;
}
fs->http = 0;
}
fs->buffer_length = 0;
fs->buffer_offset = 0;
fs->file_offset = 0;
return fs;
}
int read_byte_filestream(FILE_STREAM *fs)
{
if(fs->buffer_offset == fs->buffer_length)
{
fs->buffer_offset = 0;
if(fs->http)
fs->buffer_length = recv(fs->inetStream, fs->data, m_stream_buffer_size * 1024, 0);
else
ReadFile(fs->stream, fs->data, m_local_buffer_size * 1024, &fs->buffer_length, 0);
if(fs->buffer_length <= 0)
{
if(fs->http)
{
int x;
x = WSAGetLastError();
if(x == 0)
{
/* Equivalent of a successful EOF for HTTP */
}
}
fs->buffer_length = 0;
return -1;
}
}
fs->file_offset++;
return fs->data[fs->buffer_offset++];
}
int read_buffer_filestream(FILE_STREAM *fs, void *data, int length)
{
int i, tmp;
unsigned char *data2 = (unsigned char *)data;
for(i=0; i < length; i++)
{
if((tmp = read_byte_filestream(fs)) < 0)
{
if(i)
{
break;
}
else
{
return -1;
}
}
data2[i] = tmp;
}
return i;
}
unsigned long filelength_filestream(FILE_STREAM *fs)
{
unsigned long fsize;
if (fs->http)
{
fsize = fs->http_file_length;
}
else
{
fsize = GetFileSize(fs->stream, NULL);
}
return fsize;
}
void seek_filestream(FILE_STREAM *fs, unsigned long offset, int mode)
{
if(fs->http)
{
return;
}
SetFilePointer(fs->stream, offset, NULL, mode);
if(mode == FILE_CURRENT)
fs->file_offset += offset;
else if(mode == FILE_END)
fs->file_offset = filelength_filestream(fs) + offset;
else
fs->file_offset = offset;
fs->buffer_length = 0;
fs->buffer_offset = 0;
}
unsigned long tell_filestream(FILE_STREAM *fs)
{
return fs->file_offset;
}
void close_filestream(FILE_STREAM *fs)
{
if(fs)
{
if (fs->http)
{
if (fs->inetStream)
{
/* The 'proper' way to close a TCP connection */
if(fs->inetStream)
{
CloseTCP(fs->inetStream);
}
}
}
else
{
if(fs->stream)
CloseHandle(fs->stream);
}
LocalFree(fs);
fs = NULL;
}
}
int WinsockInit()
{
/* Before using winsock, you must load the DLL... */
WSADATA wsaData;
/* Load version 2.0 */
if (WSAStartup( MAKEWORD( 2, 0 ), &wsaData ))
{
/* Disable streaming */
return -1;
}
winsock_init = 1;
return 0;
}
void WinsockDeInit()
{
/* Unload the DLL */
if(winsock_init)
WSACleanup();
}
int FindCRLF(char *str)
{
int i;
for(i=0; i != lstrlen(str) && str[i] != '\r'; i++);
return i;
}
void CloseTCP(int s)
{
char tempbuf[1024];
/* Set the socket to ignore any new incoming data */
shutdown(s, 1);
/* Get any old remaining data */
while(recv(s, tempbuf, 1024, 0) > 0);
/* Deallocate the socket */
closesocket(s);
}
int resolve_host(char *host, SOCKADDR_IN *sck_addr, unsigned short remote_port)
{
HOSTENT *hp;
if (isalpha(host[0]))
{
/* server address is a name */
hp = gethostbyname(host);
}
else
{
unsigned long addr;
/* Convert nnn.nnn address to a usable one */
addr = inet_addr(host);
hp = gethostbyaddr((char *)&addr, 4, AF_INET);
}
if (hp == NULL)
{
char tmp[128];
wsprintf(tmp, "Error resolving host address [%s]!\n", host);
CommonExit(tmp);
return -1;
}
ZeroMemory(sck_addr, sizeof(SOCKADDR_IN));
sck_addr->sin_family = AF_INET;
sck_addr->sin_port = htons(remote_port);
CopyMemory(&sck_addr->sin_addr, hp->h_addr, hp->h_length);
return 0;
}
int http_file_open(char *url, FILE_STREAM *fs)
{
SOCKET sck;
SOCKADDR_IN host;
char server[1024], file[1024], request[1024], *temp = NULL, *tmpfile = NULL;
int i, j, port = 80, bytes_recv, http_code;
/* No winsock, no streaming */
if(!winsock_init)
{
return -1;
}
url += 7; // Skip over http://
/* Extract data from the URL */
for(i=0; url[i] != '/' && url[i] != ':' && url[i] != 0; i++);
ZeroMemory(server, 1024);
CopyMemory(server, url, i);
if(url[i] == ':')
{
/* A certain port was specified */
port = atol(url + (i + 1));
}
for(; url[i] != '/' && url[i] != 0; i++);
ZeroMemory(file, 1024);
CopyMemory(file, url + i, lstrlen(url));
/* END OF URL PARSING */
/* Create a TCP/IP socket */
sck = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if(sck == INVALID_SOCKET)
{
CommonExit("Error creating TCP/IP new socket");
return -1;
}
/* Resolve the host address (turn www.blah.com into an IP) */
if(resolve_host(server, &host, (unsigned short)port))
{
CommonExit("Error resolving host address");
CloseTCP(sck);
return -1;
}
/* Connect to the server */
if(connect(sck, (SOCKADDR *)&host, sizeof(SOCKADDR)) == SOCKET_ERROR)
{
CommonExit("Error connecting to remote server");
CloseTCP(sck);
return -1;
}
tmpfile = calloc(1, (strlen(file) * 3) + 1);
/* Encode URL */
for(i=0, j=0; i < (int)strlen(file); i++)
{
if((unsigned char)file[i] <= 31 || (unsigned char)file[i] >= 127)
{
/* encode ASCII-control characters */
wsprintf(tmpfile + j, "%%%X", (unsigned char)file[i]);
j += 3;
continue;
}
else
{
switch(file[i])
{
/* encode characters that could confuse some servers */
case ' ':
case '"':
case '>':
case '<':
case '#':
case '%':
case '{':
case '}':
case '|':
case '\\':
case '^':
case '~':
case '[':
case ']':
case '`':
wsprintf(tmpfile + j, "%%%X", (unsigned char)file[i]);
j += 3;
continue;
}
}
tmpfile[j] = file[i];
j++;
}
wsprintf(request, "GET %s\r\n\r\n", tmpfile);
free(tmpfile);
/* Send the request */
if(send(sck, request, lstrlen(request), 0) <= 0)
{
/* Error sending data */
CloseTCP(sck);
return -1;
}
ZeroMemory(request, 1024);
/* Send the request */
if((bytes_recv = recv(sck, request, 1024, 0)) <= 0)
{
/* Error sending data */
CloseTCP(sck);
return -1;
}
if(StringComp(request,"HTTP/1.", 7) != 0)
{
/* Invalid header */
CloseTCP(sck);
return -1;
}
http_code = atol(request + 9);
if(http_code < 200 || http_code > 299)
{
/* HTTP error */
CloseTCP(sck);
return -1;
}
// Search for a length field
fs->http_file_length = 0;
/* Limit search to only 20 loops */
if((temp = strstr(request, "Content-Length: ")) != NULL)
{
/* Has a content-length field, copy into structure */
fs->http_file_length = atol(temp + 16);
}
/* Copy the handle data into the structure */
fs->inetStream = sck;
/* Copy any excess data beyond the header into the filestream buffers */
temp = strstr(request, "\r\n\r\n");
if(temp)
{
temp += 4;
}
if(temp - request < bytes_recv)
{
memcpy(fs->data, temp, (temp - request) - bytes_recv);
fs->buffer_length = (temp - request) - bytes_recv;
fs->buffer_offset = 0;
}
return 0;
}

View file

@ -0,0 +1,57 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: filestream.h 19 2005-06-07 04:16:15Z vspader $
**/
#ifndef FILESTREAM_H
#define FILESTREAM_H
typedef struct {
HANDLE stream;
unsigned short inetStream;
unsigned char *data;
int http;
int buffer_offset;
int buffer_length;
int file_offset;
int http_file_length;
} FILE_STREAM;
extern long m_local_buffer_size;
extern long m_stream_buffer_size;
FILE_STREAM *open_filestream(char *filename);
int read_byte_filestream(FILE_STREAM *fs);
int read_buffer_filestream(FILE_STREAM *fs, void *data, int length);
unsigned long filelength_filestream(FILE_STREAM *fs);
void close_filestream(FILE_STREAM *fs);
void seek_filestream(FILE_STREAM *fs, unsigned long offset, int mode);
unsigned long tell_filestream(FILE_STREAM *fs);
int http_file_open(char *url, FILE_STREAM *fs);
int WinsockInit();
void WinsockDeInit();
void CloseTCP(int s);
#endif

View file

@ -0,0 +1,755 @@
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
before changing it!
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef __STDC__
# ifndef const
# define const
# endif
#endif
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. */
#ifndef _NO_PROTO
#define _NO_PROTO
#endif
#include <stdio.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__) || !__MacOSX__
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
#include <stdlib.h>
#endif /* GNU C library. */
/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
long-named option. Because this is not POSIX.2 compliant, it is
being phased out. */
/* #define GETOPT_COMPAT */
/* This version of `getopt' appears to the caller like standard Unix `getopt'
but it behaves differently for the user, since it allows the user
to intersperse the options with the other arguments.
As `getopt' works, it permutes the elements of ARGV so that,
when it is done, all the options precede everything else. Thus
all application programs are extended to handle flexible argument order.
Setting the environment variable POSIXLY_CORRECT disables permutation.
Then the behavior is completely standard.
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
#include "getopt.h"
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
char *optarg = 0;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns EOF, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
/* XXX 1003.2 says this must be 1 before any call. */
int optind = 0;
/* The next char to be scanned in the option-element
in which the last option character we returned was found.
This allows us to pick up the scan where we left off.
If this is zero, or a null string, it means resume the scan
by advancing to the next ARGV-element. */
static char *nextchar;
/* Callers store zero here to inhibit the error message
for unrecognized options. */
int opterr = 1;
/* Set to an option character which was unrecognized.
This must be initialized on some systems to avoid linking in the
system's own getopt implementation. */
#define BAD_OPTION '\0'
int optopt = BAD_OPTION;
/* Describe how to deal with options that follow non-option ARGV-elements.
If the caller did not specify anything,
the default is REQUIRE_ORDER if the environment variable
POSIXLY_CORRECT is defined, PERMUTE otherwise.
REQUIRE_ORDER means don't recognize them as options;
stop option processing when the first non-option is seen.
This is what Unix does.
This mode of operation is selected by either setting the environment
variable POSIXLY_CORRECT, or using `+' as the first character
of the list of option characters.
PERMUTE is the default. We permute the contents of ARGV as we scan,
so that eventually all the non-options are at the end. This allows options
to be given in any order, even with programs that were not written to
expect this.
RETURN_IN_ORDER is an option available to programs that were written
to expect options and other ARGV-elements in any order and that care about
the ordering of the two. We describe each non-option ARGV-element
as if it were the argument of an option with character code 1.
Using `-' as the first character of the list of option characters
selects this mode of operation.
The special argument `--' forces an end of option-scanning regardless
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
`--' can cause `getopt' to return EOF with `optind' != ARGC. */
static enum
{
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} ordering;
#ifdef __GNU_LIBRARY__
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
in GCC. */
#include <string.h>
#define my_index strchr
#define my_strlen strlen
#else
/* Avoid depending on library functions or files
whose names are inconsistent. */
#if __STDC__ || defined(PROTO)
extern char *getenv(const char *name);
extern int strcmp (const char *s1, const char *s2);
extern int strncmp(const char *s1, const char *s2, unsigned int n);
static int my_strlen(const char *s);
static char *my_index (const char *str, int chr);
#else
extern char *getenv ();
#endif
static int
my_strlen (str)
const char *str;
{
int n = 0;
while (*str++)
n++;
return n;
}
static char *
my_index (str, chr)
const char *str;
int chr;
{
while (*str)
{
if (*str == chr)
return (char *) str;
str++;
}
return 0;
}
#endif /* GNU C library. */
/* Handle permutation of arguments. */
/* Describe the part of ARGV that contains non-options that have
been skipped. `first_nonopt' is the index in ARGV of the first of them;
`last_nonopt' is the index after the last of them. */
static int first_nonopt;
static int last_nonopt;
/* Exchange two adjacent subsequences of ARGV.
One subsequence is elements [first_nonopt,last_nonopt)
which contains all the non-options that have been skipped so far.
The other is elements [last_nonopt,optind), which contains all
the options processed since those non-options were skipped.
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved.
To perform the swap, we first reverse the order of all elements. So
all options now come before all non options, but they are in the
wrong order. So we put back the options and non options in original
order by reversing them again. For example:
original input: a b c -x -y
reverse all: -y -x c b a
reverse options: -x -y c b a
reverse non options: -x -y a b c
*/
#if __STDC__ || defined(PROTO)
static void exchange (char **argv);
#endif
static void
exchange (argv)
char **argv;
{
char *temp, **first, **last;
/* Reverse all the elements [first_nonopt, optind) */
first = &argv[first_nonopt];
last = &argv[optind-1];
while (first < last) {
temp = *first; *first = *last; *last = temp; first++; last--;
}
/* Put back the options in order */
first = &argv[first_nonopt];
first_nonopt += (optind - last_nonopt);
last = &argv[first_nonopt - 1];
while (first < last) {
temp = *first; *first = *last; *last = temp; first++; last--;
}
/* Put back the non options in order */
first = &argv[first_nonopt];
last_nonopt = optind;
last = &argv[last_nonopt-1];
while (first < last) {
temp = *first; *first = *last; *last = temp; first++; last--;
}
}
/* Scan elements of ARGV (whose length is ARGC) for option characters
given in OPTSTRING.
If an element of ARGV starts with '-', and is not exactly "-" or "--",
then it is an option element. The characters of this element
(aside from the initial '-') are option characters. If `getopt'
is called repeatedly, it returns successively each of the option characters
from each of the option elements.
If `getopt' finds another option character, it returns that character,
updating `optind' and `nextchar' so that the next call to `getopt' can
resume the scan with the following option character or ARGV-element.
If there are no more option characters, `getopt' returns `EOF'.
Then `optind' is the index in ARGV of the first ARGV-element
that is not an option. (The ARGV-elements have been permuted
so that those that are not options now come last.)
OPTSTRING is a string containing the legitimate option characters.
If an option character is seen that is not listed in OPTSTRING,
return BAD_OPTION after printing an error message. If you set `opterr' to
zero, the error message is suppressed but we still return BAD_OPTION.
If a char in OPTSTRING is followed by a colon, that means it wants an arg,
so the following text in the same ARGV-element, or the text of the following
ARGV-element, is returned in `optarg'. Two colons mean an option that
wants an optional arg; if there is text in the current ARGV-element,
it is returned in `optarg', otherwise `optarg' is set to zero.
If OPTSTRING starts with `-' or `+', it requests different methods of
handling the non-option ARGV-elements.
See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
Long-named options begin with `--' instead of `-'.
Their names may be abbreviated as long as the abbreviation is unique
or is an exact match for some defined option. If they have an
argument, it follows the option name in the same ARGV-element, separated
from the option name by a `=', or else the in next ARGV-element.
When `getopt' finds a long-named option, it returns 0 if that option's
`flag' field is nonzero, the value of the option's `val' field
if the `flag' field is zero.
The elements of ARGV aren't really const, because we permute them.
But we pretend they're const in the prototype to be compatible
with other systems.
LONGOPTS is a vector of `struct option' terminated by an
element containing a name which is zero.
LONGIND returns the index in LONGOPT of the long-named option found.
It is only valid when a long-named option has been found by the most
recent call.
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
long-named options. */
int
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
int argc;
char *const *argv;
const char *optstring;
const struct option *longopts;
int *longind;
int long_only;
{
int option_index;
optarg = 0;
/* Initialize the internal data when the first call is made.
Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
non-option ARGV-elements is empty. */
if (optind == 0)
{
first_nonopt = last_nonopt = optind = 1;
nextchar = NULL;
/* Determine how to handle the ordering of options and nonoptions. */
if (optstring[0] == '-')
{
ordering = RETURN_IN_ORDER;
++optstring;
}
else if (optstring[0] == '+')
{
ordering = REQUIRE_ORDER;
++optstring;
}
else if (getenv ("POSIXLY_CORRECT") != NULL)
ordering = REQUIRE_ORDER;
else
ordering = PERMUTE;
}
if (nextchar == NULL || *nextchar == '\0')
{
if (ordering == PERMUTE)
{
/* If we have just processed some options following some non-options,
exchange them so that the options come first. */
if (first_nonopt != last_nonopt && last_nonopt != optind)
exchange ((char **) argv);
else if (last_nonopt != optind)
first_nonopt = optind;
/* Now skip any additional non-options
and extend the range of non-options previously skipped. */
while (optind < argc
&& (argv[optind][0] != '-' || argv[optind][1] == '\0')
#ifdef GETOPT_COMPAT
&& (longopts == NULL
|| argv[optind][0] != '+' || argv[optind][1] == '\0')
#endif /* GETOPT_COMPAT */
)
optind++;
last_nonopt = optind;
}
/* Special ARGV-element `--' means premature end of options.
Skip it like a null option,
then exchange with previous non-options as if it were an option,
then skip everything else like a non-option. */
if (optind != argc && !strcmp (argv[optind], "--"))
{
optind++;
if (first_nonopt != last_nonopt && last_nonopt != optind)
exchange ((char **) argv);
else if (first_nonopt == last_nonopt)
first_nonopt = optind;
last_nonopt = argc;
optind = argc;
}
/* If we have done all the ARGV-elements, stop the scan
and back over any non-options that we skipped and permuted. */
if (optind == argc)
{
/* Set the next-arg-index to point at the non-options
that we previously skipped, so the caller will digest them. */
if (first_nonopt != last_nonopt)
optind = first_nonopt;
return EOF;
}
/* If we have come to a non-option and did not permute it,
either stop the scan or describe it to the caller and pass it by. */
if ((argv[optind][0] != '-' || argv[optind][1] == '\0')
#ifdef GETOPT_COMPAT
&& (longopts == NULL
|| argv[optind][0] != '+' || argv[optind][1] == '\0')
#endif /* GETOPT_COMPAT */
)
{
if (ordering == REQUIRE_ORDER)
return EOF;
optarg = argv[optind++];
return 1;
}
/* We have found another option-ARGV-element.
Start decoding its characters. */
nextchar = (argv[optind] + 1
+ (longopts != NULL && argv[optind][1] == '-'));
}
if (longopts != NULL
&& ((argv[optind][0] == '-'
&& (argv[optind][1] == '-' || long_only))
#ifdef GETOPT_COMPAT
|| argv[optind][0] == '+'
#endif /* GETOPT_COMPAT */
))
{
const struct option *p;
char *s = nextchar;
int exact = 0;
int ambig = 0;
const struct option *pfound = NULL;
int indfound = 0;
while (*s && *s != '=')
s++;
/* Test all options for either exact match or abbreviated matches. */
for (p = longopts, option_index = 0; p->name;
p++, option_index++)
if (!strncmp (p->name, nextchar, s - nextchar))
{
if (s - nextchar == my_strlen (p->name))
{
/* Exact match found. */
pfound = p;
indfound = option_index;
exact = 1;
break;
}
else if (pfound == NULL)
{
/* First nonexact match found. */
pfound = p;
indfound = option_index;
}
else
/* Second nonexact match found. */
ambig = 1;
}
if (ambig && !exact)
{
if (opterr)
fprintf (stderr, "%s: option `%s' is ambiguous\n",
argv[0], argv[optind]);
nextchar += my_strlen (nextchar);
optind++;
return BAD_OPTION;
}
if (pfound != NULL)
{
option_index = indfound;
optind++;
if (*s)
{
/* Don't test has_arg with >, because some C compilers don't
allow it to be used on enums. */
if (pfound->has_arg)
optarg = s + 1;
else
{
if (opterr)
{
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
"%s: option `--%s' doesn't allow an argument\n",
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
"%s: option `%c%s' doesn't allow an argument\n",
argv[0], argv[optind - 1][0], pfound->name);
}
nextchar += my_strlen (nextchar);
return BAD_OPTION;
}
}
else if (pfound->has_arg == 1)
{
if (optind < argc)
optarg = argv[optind++];
else
{
if (opterr)
fprintf (stderr, "%s: option `%s' requires an argument\n",
argv[0], argv[optind - 1]);
nextchar += my_strlen (nextchar);
return optstring[0] == ':' ? ':' : BAD_OPTION;
}
}
nextchar += my_strlen (nextchar);
if (longind != NULL)
*longind = option_index;
if (pfound->flag)
{
*(pfound->flag) = pfound->val;
return 0;
}
return pfound->val;
}
/* Can't find it as a long option. If this is not getopt_long_only,
or the option starts with '--' or is not a valid short
option, then it's an error.
Otherwise interpret it as a short option. */
if (!long_only || argv[optind][1] == '-'
#ifdef GETOPT_COMPAT
|| argv[optind][0] == '+'
#endif /* GETOPT_COMPAT */
|| my_index (optstring, *nextchar) == NULL)
{
if (opterr)
{
if (argv[optind][1] == '-')
/* --option */
fprintf (stderr, "%s: unrecognized option `--%s'\n",
argv[0], nextchar);
else
/* +option or -option */
fprintf (stderr, "%s: unrecognized option `%c%s'\n",
argv[0], argv[optind][0], nextchar);
}
nextchar = (char *) "";
optind++;
return BAD_OPTION;
}
}
/* Look at and handle the next option-character. */
{
char c = *nextchar++;
char *temp = my_index (optstring, c);
/* Increment `optind' when we start to process its last character. */
if (*nextchar == '\0')
++optind;
if (temp == NULL || c == ':')
{
if (opterr)
{
#if 0
if (c < 040 || c >= 0177)
fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
argv[0], c);
else
fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c);
#else
/* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
#endif
}
optopt = c;
return BAD_OPTION;
}
if (temp[1] == ':')
{
if (temp[2] == ':')
{
/* This is an option that accepts an argument optionally. */
if (*nextchar != '\0')
{
optarg = nextchar;
optind++;
}
else
optarg = 0;
nextchar = NULL;
}
else
{
/* This is an option that requires an argument. */
if (*nextchar != '\0')
{
optarg = nextchar;
/* If we end this ARGV-element by taking the rest as an arg,
we must advance to the next element now. */
optind++;
}
else if (optind == argc)
{
if (opterr)
{
#if 0
fprintf (stderr, "%s: option `-%c' requires an argument\n",
argv[0], c);
#else
/* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: option requires an argument -- %c\n",
argv[0], c);
#endif
}
optopt = c;
if (optstring[0] == ':')
c = ':';
else
c = BAD_OPTION;
}
else
/* We already incremented `optind' once;
increment it again when taking next ARGV-elt as argument. */
optarg = argv[optind++];
nextchar = NULL;
}
}
return c;
}
}
int
getopt (argc, argv, optstring)
int argc;
char *const *argv;
const char *optstring;
{
return _getopt_internal (argc, argv, optstring,
(const struct option *) 0,
(int *) 0,
0);
}
int
getopt_long (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#ifdef TEST
/* Compile with -DTEST to make an executable for use in testing
the above definition of `getopt'. */
int
main (argc, argv)
int argc;
char **argv;
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
c = getopt (argc, argv, "abc:d:0123456789");
if (c == EOF)
break;
switch (c)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
case 'a':
printf ("option a\n");
break;
case 'b':
printf ("option b\n");
break;
case 'c':
printf ("option c with value `%s'\n", optarg);
break;
case BAD_OPTION:
break;
default:
printf ("?? getopt returned character code 0%o ??\n", c);
}
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\n");
}
exit (0);
}
#endif /* TEST */

View file

@ -0,0 +1,130 @@
/* Declarations for getopt.
Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _GETOPT_H
#define _GETOPT_H 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __MacOSX__
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns EOF, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
#endif
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
#if __STDC__
const char *name;
#else
char *name;
#endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
#define no_argument 0
#define required_argument 1
#define optional_argument 2
//#if __STDC__ || defined(PROTO)
#if defined(__GNU_LIBRARY__)
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#endif /* not __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind);
/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind,
int long_only);
//#else /* not __STDC__ */
extern int getopt (int argc, char *const *argv, const char *shortopts);
//extern int getopt_long ();
//extern int getopt_long_only ();
//extern int _getopt_internal ();
//#endif /* not __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _GETOPT_H */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,54 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: id3v2tag.h 19 2005-06-07 04:16:15Z vspader $
**/
#ifndef __ID3V2TAG_H__
#define __ID3V2TAG_H__
void GetID3FileTitle(char *filename, char *title, char *format);
void FillID3List(HWND hwndDlg, HWND hwndList, char *filename);
void List_OnGetDispInfo(LV_DISPINFO *pnmv);
BOOL List_EditData(HWND hwndApp, HWND hwndList);
void List_SaveID3(HWND hwndApp, HWND hwndList, char *filename);
BOOL List_DeleteSelected(HWND hwndApp, HWND hwndList);
BOOL List_AddFrame(HWND hwndApp, HWND hwndList);
BOOL List_AddStandardFrames(HWND hwndApp, HWND hwndList);
void AddFrameFromRAWData(HWND hwndList, int frameId, LPSTR data1, LPSTR data2);
HINSTANCE hInstance_for_id3editor;
typedef struct ID3GENRES_TAG
{
BYTE id;
char name[30];
} ID3GENRES;
typedef struct id3item_tag {
int frameId;
LPSTR aCols[2];
} ID3ITEM;
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
/*****************************************************************************
* drms.h : DRMS
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: drms.h 19 2005-06-07 04:16:15Z vspader $
*
* Author: Jon Lech Johansen <jon-vl@nanocrew.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
extern void *drms_alloc( char *psz_homedir );
extern void drms_free( void *p_drms );
extern int drms_init( void *p_drms, uint32_t i_type,
uint8_t *p_info, uint32_t i_len );
extern void drms_decrypt( void *p_drms, uint32_t *p_buffer,
uint32_t i_len );

View file

@ -0,0 +1,288 @@
/*****************************************************************************
* drmstables.h : AES/Rijndael block cipher and miscellaneous tables
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: drmstables.h 19 2005-06-07 04:16:15Z vspader $
*
* Author: Jon Lech Johansen <jon-vl@nanocrew.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#define AES_ROR( x, n ) (((x) << (32-(n))) | ((x) >> (n)))
#define AES_XOR_ROR( p_table, p_tmp ) \
( p_table[ (p_tmp[ t > 2 ? t - 3 : t + 1 ] >> 24) & 0xFF ] \
^ AES_ROR( p_table[ (p_tmp[ t > 1 ? t - 2 : t + 2 ] >> 16) & 0xFF ], 8 ) \
^ AES_ROR( p_table[ (p_tmp[ t > 0 ? t - 1 : t + 3 ] >> 8) & 0xFF ], 16 ) \
^ AES_ROR( p_table[ p_tmp[ t ] & 0xFF ], 24 ) )
#define AES_KEY_COUNT 10
static uint32_t const p_aes_table[ AES_KEY_COUNT ] =
{
0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020,
0x00000040, 0x00000080, 0x0000001b, 0x00000036
};
static uint32_t const p_aes_encrypt[ 256 ] =
{
0x63000000, 0x7c000000, 0x77000000, 0x7b000000, 0xf2000000, 0x6b000000,
0x6f000000, 0xc5000000, 0x30000000, 0x01000000, 0x67000000, 0x2b000000,
0xfe000000, 0xd7000000, 0xab000000, 0x76000000, 0xca000000, 0x82000000,
0xc9000000, 0x7d000000, 0xfa000000, 0x59000000, 0x47000000, 0xf0000000,
0xad000000, 0xd4000000, 0xa2000000, 0xaf000000, 0x9c000000, 0xa4000000,
0x72000000, 0xc0000000, 0xb7000000, 0xfd000000, 0x93000000, 0x26000000,
0x36000000, 0x3f000000, 0xf7000000, 0xcc000000, 0x34000000, 0xa5000000,
0xe5000000, 0xf1000000, 0x71000000, 0xd8000000, 0x31000000, 0x15000000,
0x04000000, 0xc7000000, 0x23000000, 0xc3000000, 0x18000000, 0x96000000,
0x05000000, 0x9a000000, 0x07000000, 0x12000000, 0x80000000, 0xe2000000,
0xeb000000, 0x27000000, 0xb2000000, 0x75000000, 0x09000000, 0x83000000,
0x2c000000, 0x1a000000, 0x1b000000, 0x6e000000, 0x5a000000, 0xa0000000,
0x52000000, 0x3b000000, 0xd6000000, 0xb3000000, 0x29000000, 0xe3000000,
0x2f000000, 0x84000000, 0x53000000, 0xd1000000, 0x00000000, 0xed000000,
0x20000000, 0xfc000000, 0xb1000000, 0x5b000000, 0x6a000000, 0xcb000000,
0xbe000000, 0x39000000, 0x4a000000, 0x4c000000, 0x58000000, 0xcf000000,
0xd0000000, 0xef000000, 0xaa000000, 0xfb000000, 0x43000000, 0x4d000000,
0x33000000, 0x85000000, 0x45000000, 0xf9000000, 0x02000000, 0x7f000000,
0x50000000, 0x3c000000, 0x9f000000, 0xa8000000, 0x51000000, 0xa3000000,
0x40000000, 0x8f000000, 0x92000000, 0x9d000000, 0x38000000, 0xf5000000,
0xbc000000, 0xb6000000, 0xda000000, 0x21000000, 0x10000000, 0xff000000,
0xf3000000, 0xd2000000, 0xcd000000, 0x0c000000, 0x13000000, 0xec000000,
0x5f000000, 0x97000000, 0x44000000, 0x17000000, 0xc4000000, 0xa7000000,
0x7e000000, 0x3d000000, 0x64000000, 0x5d000000, 0x19000000, 0x73000000,
0x60000000, 0x81000000, 0x4f000000, 0xdc000000, 0x22000000, 0x2a000000,
0x90000000, 0x88000000, 0x46000000, 0xee000000, 0xb8000000, 0x14000000,
0xde000000, 0x5e000000, 0x0b000000, 0xdb000000, 0xe0000000, 0x32000000,
0x3a000000, 0x0a000000, 0x49000000, 0x06000000, 0x24000000, 0x5c000000,
0xc2000000, 0xd3000000, 0xac000000, 0x62000000, 0x91000000, 0x95000000,
0xe4000000, 0x79000000, 0xe7000000, 0xc8000000, 0x37000000, 0x6d000000,
0x8d000000, 0xd5000000, 0x4e000000, 0xa9000000, 0x6c000000, 0x56000000,
0xf4000000, 0xea000000, 0x65000000, 0x7a000000, 0xae000000, 0x08000000,
0xba000000, 0x78000000, 0x25000000, 0x2e000000, 0x1c000000, 0xa6000000,
0xb4000000, 0xc6000000, 0xe8000000, 0xdd000000, 0x74000000, 0x1f000000,
0x4b000000, 0xbd000000, 0x8b000000, 0x8a000000, 0x70000000, 0x3e000000,
0xb5000000, 0x66000000, 0x48000000, 0x03000000, 0xf6000000, 0x0e000000,
0x61000000, 0x35000000, 0x57000000, 0xb9000000, 0x86000000, 0xc1000000,
0x1d000000, 0x9e000000, 0xe1000000, 0xf8000000, 0x98000000, 0x11000000,
0x69000000, 0xd9000000, 0x8e000000, 0x94000000, 0x9b000000, 0x1e000000,
0x87000000, 0xe9000000, 0xce000000, 0x55000000, 0x28000000, 0xdf000000,
0x8c000000, 0xa1000000, 0x89000000, 0x0d000000, 0xbf000000, 0xe6000000,
0x42000000, 0x68000000, 0x41000000, 0x99000000, 0x2d000000, 0x0f000000,
0xb0000000, 0x54000000, 0xbb000000, 0x16000000
};
static uint32_t const p_aes_itable[ 256 ] =
{
0x5150a7f4, 0x7e536541, 0x1ac3a417, 0x3a965e27, 0x3bcb6bab, 0x1ff1459d,
0xacab58fa, 0x4b9303e3, 0x2055fa30, 0xadf66d76, 0x889176cc, 0xf5254c02,
0x4ffcd7e5, 0xc5d7cb2a, 0x26804435, 0xb58fa362, 0xde495ab1, 0x25671bba,
0x45980eea, 0x5de1c0fe, 0xc302752f, 0x8112f04c, 0x8da39746, 0x6bc6f9d3,
0x03e75f8f, 0x15959c92, 0xbfeb7a6d, 0x95da5952, 0xd42d83be, 0x58d32174,
0x492969e0, 0x8e44c8c9, 0x756a89c2, 0xf478798e, 0x996b3e58, 0x27dd71b9,
0xbeb64fe1, 0xf017ad88, 0xc966ac20, 0x7db43ace, 0x63184adf, 0xe582311a,
0x97603351, 0x62457f53, 0xb1e07764, 0xbb84ae6b, 0xfe1ca081, 0xf9942b08,
0x70586848, 0x8f19fd45, 0x94876cde, 0x52b7f87b, 0xab23d373, 0x72e2024b,
0xe3578f1f, 0x662aab55, 0xb20728eb, 0x2f03c2b5, 0x869a7bc5, 0xd3a50837,
0x30f28728, 0x23b2a5bf, 0x02ba6a03, 0xed5c8216, 0x8a2b1ccf, 0xa792b479,
0xf3f0f207, 0x4ea1e269, 0x65cdf4da, 0x06d5be05, 0xd11f6234, 0xc48afea6,
0x349d532e, 0xa2a055f3, 0x0532e18a, 0xa475ebf6, 0x0b39ec83, 0x40aaef60,
0x5e069f71, 0xbd51106e, 0x3ef98a21, 0x963d06dd, 0xddae053e, 0x4d46bde6,
0x91b58d54, 0x71055dc4, 0x046fd406, 0x60ff1550, 0x1924fb98, 0xd697e9bd,
0x89cc4340, 0x67779ed9, 0xb0bd42e8, 0x07888b89, 0xe7385b19, 0x79dbeec8,
0xa1470a7c, 0x7ce90f42, 0xf8c91e84, 0x00000000, 0x09838680, 0x3248ed2b,
0x1eac7011, 0x6c4e725a, 0xfdfbff0e, 0x0f563885, 0x3d1ed5ae, 0x3627392d,
0x0a64d90f, 0x6821a65c, 0x9bd1545b, 0x243a2e36, 0x0cb1670a, 0x930fe757,
0xb4d296ee, 0x1b9e919b, 0x804fc5c0, 0x61a220dc, 0x5a694b77, 0x1c161a12,
0xe20aba93, 0xc0e52aa0, 0x3c43e022, 0x121d171b, 0x0e0b0d09, 0xf2adc78b,
0x2db9a8b6, 0x14c8a91e, 0x578519f1, 0xaf4c0775, 0xeebbdd99, 0xa3fd607f,
0xf79f2601, 0x5cbcf572, 0x44c53b66, 0x5b347efb, 0x8b762943, 0xcbdcc623,
0xb668fced, 0xb863f1e4, 0xd7cadc31, 0x42108563, 0x13402297, 0x842011c6,
0x857d244a, 0xd2f83dbb, 0xae1132f9, 0xc76da129, 0x1d4b2f9e, 0xdcf330b2,
0x0dec5286, 0x77d0e3c1, 0x2b6c16b3, 0xa999b970, 0x11fa4894, 0x472264e9,
0xa8c48cfc, 0xa01a3ff0, 0x56d82c7d, 0x22ef9033, 0x87c74e49, 0xd9c1d138,
0x8cfea2ca, 0x98360bd4, 0xa6cf81f5, 0xa528de7a, 0xda268eb7, 0x3fa4bfad,
0x2ce49d3a, 0x500d9278, 0x6a9bcc5f, 0x5462467e, 0xf6c2138d, 0x90e8b8d8,
0x2e5ef739, 0x82f5afc3, 0x9fbe805d, 0x697c93d0, 0x6fa92dd5, 0xcfb31225,
0xc83b99ac, 0x10a77d18, 0xe86e639c, 0xdb7bbb3b, 0xcd097826, 0x6ef41859,
0xec01b79a, 0x83a89a4f, 0xe6656e95, 0xaa7ee6ff, 0x2108cfbc, 0xefe6e815,
0xbad99be7, 0x4ace366f, 0xead4099f, 0x29d67cb0, 0x31afb2a4, 0x2a31233f,
0xc63094a5, 0x35c066a2, 0x7437bc4e, 0xfca6ca82, 0xe0b0d090, 0x3315d8a7,
0xf14a9804, 0x41f7daec, 0x7f0e50cd, 0x172ff691, 0x768dd64d, 0x434db0ef,
0xcc544daa, 0xe4df0496, 0x9ee3b5d1, 0x4c1b886a, 0xc1b81f2c, 0x467f5165,
0x9d04ea5e, 0x015d358c, 0xfa737487, 0xfb2e410b, 0xb35a1d67, 0x9252d2db,
0xe9335610, 0x6d1347d6, 0x9a8c61d7, 0x377a0ca1, 0x598e14f8, 0xeb893c13,
0xceee27a9, 0xb735c961, 0xe1ede51c, 0x7a3cb147, 0x9c59dfd2, 0x553f73f2,
0x1879ce14, 0x73bf37c7, 0x53eacdf7, 0x5f5baafd, 0xdf146f3d, 0x7886db44,
0xca81f3af, 0xb93ec468, 0x382c3424, 0xc25f40a3, 0x1672c31d, 0xbc0c25e2,
0x288b493c, 0xff41950d, 0x397101a8, 0x08deb30c, 0xd89ce4b4, 0x6490c156,
0x7b6184cb, 0xd570b632, 0x48745c6c, 0xd04257b8
};
static uint32_t const p_aes_decrypt[ 256 ] =
{
0x52000000, 0x09000000, 0x6a000000, 0xd5000000, 0x30000000, 0x36000000,
0xa5000000, 0x38000000, 0xbf000000, 0x40000000, 0xa3000000, 0x9e000000,
0x81000000, 0xf3000000, 0xd7000000, 0xfb000000, 0x7c000000, 0xe3000000,
0x39000000, 0x82000000, 0x9b000000, 0x2f000000, 0xff000000, 0x87000000,
0x34000000, 0x8e000000, 0x43000000, 0x44000000, 0xc4000000, 0xde000000,
0xe9000000, 0xcb000000, 0x54000000, 0x7b000000, 0x94000000, 0x32000000,
0xa6000000, 0xc2000000, 0x23000000, 0x3d000000, 0xee000000, 0x4c000000,
0x95000000, 0x0b000000, 0x42000000, 0xfa000000, 0xc3000000, 0x4e000000,
0x08000000, 0x2e000000, 0xa1000000, 0x66000000, 0x28000000, 0xd9000000,
0x24000000, 0xb2000000, 0x76000000, 0x5b000000, 0xa2000000, 0x49000000,
0x6d000000, 0x8b000000, 0xd1000000, 0x25000000, 0x72000000, 0xf8000000,
0xf6000000, 0x64000000, 0x86000000, 0x68000000, 0x98000000, 0x16000000,
0xd4000000, 0xa4000000, 0x5c000000, 0xcc000000, 0x5d000000, 0x65000000,
0xb6000000, 0x92000000, 0x6c000000, 0x70000000, 0x48000000, 0x50000000,
0xfd000000, 0xed000000, 0xb9000000, 0xda000000, 0x5e000000, 0x15000000,
0x46000000, 0x57000000, 0xa7000000, 0x8d000000, 0x9d000000, 0x84000000,
0x90000000, 0xd8000000, 0xab000000, 0x00000000, 0x8c000000, 0xbc000000,
0xd3000000, 0x0a000000, 0xf7000000, 0xe4000000, 0x58000000, 0x05000000,
0xb8000000, 0xb3000000, 0x45000000, 0x06000000, 0xd0000000, 0x2c000000,
0x1e000000, 0x8f000000, 0xca000000, 0x3f000000, 0x0f000000, 0x02000000,
0xc1000000, 0xaf000000, 0xbd000000, 0x03000000, 0x01000000, 0x13000000,
0x8a000000, 0x6b000000, 0x3a000000, 0x91000000, 0x11000000, 0x41000000,
0x4f000000, 0x67000000, 0xdc000000, 0xea000000, 0x97000000, 0xf2000000,
0xcf000000, 0xce000000, 0xf0000000, 0xb4000000, 0xe6000000, 0x73000000,
0x96000000, 0xac000000, 0x74000000, 0x22000000, 0xe7000000, 0xad000000,
0x35000000, 0x85000000, 0xe2000000, 0xf9000000, 0x37000000, 0xe8000000,
0x1c000000, 0x75000000, 0xdf000000, 0x6e000000, 0x47000000, 0xf1000000,
0x1a000000, 0x71000000, 0x1d000000, 0x29000000, 0xc5000000, 0x89000000,
0x6f000000, 0xb7000000, 0x62000000, 0x0e000000, 0xaa000000, 0x18000000,
0xbe000000, 0x1b000000, 0xfc000000, 0x56000000, 0x3e000000, 0x4b000000,
0xc6000000, 0xd2000000, 0x79000000, 0x20000000, 0x9a000000, 0xdb000000,
0xc0000000, 0xfe000000, 0x78000000, 0xcd000000, 0x5a000000, 0xf4000000,
0x1f000000, 0xdd000000, 0xa8000000, 0x33000000, 0x88000000, 0x07000000,
0xc7000000, 0x31000000, 0xb1000000, 0x12000000, 0x10000000, 0x59000000,
0x27000000, 0x80000000, 0xec000000, 0x5f000000, 0x60000000, 0x51000000,
0x7f000000, 0xa9000000, 0x19000000, 0xb5000000, 0x4a000000, 0x0d000000,
0x2d000000, 0xe5000000, 0x7a000000, 0x9f000000, 0x93000000, 0xc9000000,
0x9c000000, 0xef000000, 0xa0000000, 0xe0000000, 0x3b000000, 0x4d000000,
0xae000000, 0x2a000000, 0xf5000000, 0xb0000000, 0xc8000000, 0xeb000000,
0xbb000000, 0x3c000000, 0x83000000, 0x53000000, 0x99000000, 0x61000000,
0x17000000, 0x2b000000, 0x04000000, 0x7e000000, 0xba000000, 0x77000000,
0xd6000000, 0x26000000, 0xe1000000, 0x69000000, 0x14000000, 0x63000000,
0x55000000, 0x21000000, 0x0c000000, 0x7d000000
};
static uint16_t const p_shuffle_xor[ 256 ] =
{
0x00d1, 0x0315, 0x1a32, 0x19ec, 0x1bbb, 0x1d6f, 0x14fe, 0x0e9e,
0x029e, 0x1b8f, 0x0b70, 0x033a, 0x188e, 0x1d18, 0x0bd8, 0x0edb,
0x0c64, 0x1c2b, 0x149c, 0x047b, 0x1064, 0x1c7c, 0x118d, 0x1355,
0x0ae5, 0x0f18, 0x016f, 0x17d6, 0x1595, 0x0084, 0x0616, 0x1ccd,
0x1d94, 0x0618, 0x182c, 0x195b, 0x196d, 0x0394, 0x07db, 0x0287,
0x1636, 0x0b81, 0x1519, 0x0df9, 0x1ba3, 0x1cc3, 0x0ee2, 0x1434,
0x1457, 0x0ced, 0x0f7d, 0x0d7b, 0x0b9e, 0x0d13, 0x13d7, 0x18d0,
0x1259, 0x1977, 0x0606, 0x1e80, 0x05f2, 0x06b8, 0x1f07, 0x1365,
0x0334, 0x0e30, 0x195f, 0x15f1, 0x058e, 0x0aa8, 0x045a, 0x0465,
0x0b3e, 0x071e, 0x0a36, 0x105c, 0x01ac, 0x1a1e, 0x04e4, 0x056b,
0x12bf, 0x0da2, 0x0b41, 0x0eaf, 0x034f, 0x0181, 0x04e2, 0x002b,
0x12e6, 0x01be, 0x10e8, 0x128f, 0x0eb2, 0x1369, 0x05be, 0x1a59,
0x117e, 0x047c, 0x1e86, 0x056a, 0x0da7, 0x0d61, 0x03fc, 0x1e6e,
0x1d0c, 0x1e6d, 0x14bf, 0x0c50, 0x063a, 0x1b47, 0x17ae, 0x1321,
0x041b, 0x0a24, 0x0d4d, 0x1f2b, 0x1cb6, 0x1bed, 0x1549, 0x03a7,
0x0254, 0x006c, 0x0c9e, 0x0f73, 0x006c, 0x0008, 0x11f9, 0x0dd5,
0x0bcf, 0x0af9, 0x1dfe, 0x0341, 0x0e49, 0x0d38, 0x17cb, 0x1513,
0x0e96, 0x00ed, 0x0556, 0x1b28, 0x100c, 0x19d8, 0x14fa, 0x028c,
0x1c60, 0x1232, 0x13d3, 0x0d00, 0x1534, 0x192c, 0x14b5, 0x1cf2,
0x0504, 0x0b5b, 0x1ecf, 0x0423, 0x183b, 0x06b0, 0x169e, 0x1066,
0x04cb, 0x08a2, 0x1b4a, 0x1254, 0x198d, 0x1044, 0x0236, 0x1bd8,
0x18a1, 0x03ff, 0x1a0d, 0x0277, 0x0c2d, 0x17c9, 0x007c, 0x116e,
0x048a, 0x1eaf, 0x0922, 0x0c45, 0x0766, 0x1e5f, 0x1a28, 0x0120,
0x1c15, 0x034c, 0x0508, 0x0e73, 0x0879, 0x0441, 0x09ae, 0x132f,
0x14fe, 0x0413, 0x0a9d, 0x1727, 0x01d7, 0x1a2b, 0x0474, 0x18f0,
0x1f3b, 0x14f5, 0x1071, 0x0895, 0x1071, 0x18ff, 0x18e3, 0x0eb9,
0x0ba9, 0x0961, 0x1599, 0x019e, 0x1d12, 0x1baa, 0x1e94, 0x1921,
0x14dc, 0x124e, 0x0a25, 0x03ab, 0x1cc0, 0x1ebb, 0x0b4b, 0x16e5,
0x11ea, 0x0d78, 0x1bb3, 0x1ba7, 0x1510, 0x1b7b, 0x0c64, 0x1995,
0x1a58, 0x1651, 0x1964, 0x147a, 0x15f2, 0x11bb, 0x1654, 0x166e,
0x0ea9, 0x1de1, 0x1443, 0x13c5, 0x00e1, 0x0b2f, 0x0b6f, 0x0a37,
0x18ac, 0x08e6, 0x06f0, 0x136e, 0x0853, 0x0b2e, 0x0813, 0x10d6
};
static uint16_t const p_shuffle_sub[ 256 ] =
{
0x067a, 0x0c7d, 0x0b4f, 0x127d, 0x0bd6, 0x04ac, 0x16e0, 0x1730,
0x0587, 0x0afb, 0x1ac3, 0x0120, 0x14b5, 0x0f67, 0x11de, 0x0961,
0x1127, 0x1a68, 0x07f0, 0x17d0, 0x1a6f, 0x1f3b, 0x01ef, 0x0919,
0x131e, 0x0f90, 0x19e9, 0x18a8, 0x0cb2, 0x1ad0, 0x0c66, 0x0378,
0x03b0, 0x01be, 0x1866, 0x1159, 0x197c, 0x1105, 0x010b, 0x0353,
0x1abb, 0x09a6, 0x028a, 0x1bad, 0x1b20, 0x0455, 0x0f57, 0x0588,
0x1491, 0x0a1d, 0x0f04, 0x0650, 0x191e, 0x1e0e, 0x174b, 0x016b,
0x051f, 0x0532, 0x00df, 0x1aea, 0x0005, 0x0e1b, 0x0ff6, 0x08d8,
0x14b4, 0x086a, 0x0c20, 0x0149, 0x1971, 0x0f26, 0x1852, 0x017d,
0x1228, 0x0352, 0x0a44, 0x1330, 0x18df, 0x1e38, 0x01bc, 0x0bac,
0x1a48, 0x021f, 0x02f7, 0x0c31, 0x0bc4, 0x1e75, 0x105c, 0x13e3,
0x0b20, 0x03a1, 0x1af3, 0x1a36, 0x0e34, 0x181f, 0x09bd, 0x122b,
0x0ee0, 0x163b, 0x0be7, 0x103d, 0x1075, 0x1e9d, 0x02af, 0x0ba2,
0x1daa, 0x0cf1, 0x04b6, 0x0598, 0x06a1, 0x0d33, 0x1cfe, 0x04ee,
0x1bad, 0x07c8, 0x1a48, 0x05e6, 0x031f, 0x0e0a, 0x0326, 0x1650,
0x0526, 0x0b4e, 0x08fc, 0x0e4d, 0x0832, 0x06ea, 0x09bf, 0x0993,
0x09eb, 0x0f31, 0x071b, 0x14d5, 0x11ca, 0x0722, 0x120d, 0x014c,
0x1993, 0x0ae4, 0x1ccb, 0x04e9, 0x0aee, 0x1708, 0x0c3d, 0x12f2,
0x1a19, 0x07c1, 0x05a7, 0x0744, 0x1606, 0x1a9b, 0x042d, 0x1bfc,
0x1841, 0x0c3c, 0x0ffe, 0x1ab1, 0x1416, 0x18a9, 0x0320, 0x1ec2,
0x0ae7, 0x11c6, 0x124a, 0x11df, 0x0f81, 0x06cf, 0x0ed9, 0x0253,
0x1d2b, 0x0349, 0x0805, 0x08b3, 0x1052, 0x12cf, 0x0a44, 0x0ea6,
0x03bf, 0x1d90, 0x0ef8, 0x0657, 0x156d, 0x0405, 0x10be, 0x091f,
0x1c82, 0x1725, 0x19ef, 0x0b8c, 0x04d9, 0x02c7, 0x025a, 0x1b89,
0x0f5c, 0x013d, 0x02f7, 0x12e3, 0x0bc5, 0x1b56, 0x0848, 0x0239,
0x0fcf, 0x03a4, 0x092d, 0x1354, 0x1d83, 0x01bd, 0x071a, 0x0af1,
0x0875, 0x0793, 0x1b41, 0x1782, 0x0def, 0x1d20, 0x13be, 0x0095,
0x1650, 0x19d4, 0x0de3, 0x0980, 0x18f2, 0x0ca3, 0x0098, 0x149a,
0x0b81, 0x0ad2, 0x1bba, 0x1a02, 0x027b, 0x1906, 0x07f5, 0x1cae,
0x0c3f, 0x02f6, 0x1298, 0x175e, 0x15b2, 0x13d8, 0x14cc, 0x161a,
0x0a42, 0x15f3, 0x0870, 0x1c1d, 0x1203, 0x18b1, 0x1738, 0x1954,
0x1143, 0x1ae8, 0x1d9d, 0x155b, 0x11e8, 0x0ed9, 0x06f7, 0x04ca
};
static uint16_t const p_shuffle_add[ 256 ] =
{
0x0706, 0x175a, 0x0def, 0x1e72, 0x0297, 0x1b0e, 0x1d5a, 0x15b8,
0x13e2, 0x1347, 0x10c6, 0x0b4f, 0x0629, 0x0a75, 0x0a9b, 0x0f55,
0x1a69, 0x09bf, 0x0ba6, 0x1582, 0x1086, 0x1921, 0x01cb, 0x1c6a,
0x0ff5, 0x00f7, 0x0a67, 0x0a1e, 0x1838, 0x0196, 0x10d6, 0x0c7a,
0x180e, 0x038d, 0x1add, 0x0684, 0x154a, 0x0ab0, 0x18a4, 0x0d73,
0x1641, 0x0ec6, 0x09f1, 0x1a62, 0x0414, 0x162a, 0x194e, 0x1ec9,
0x022f, 0x0296, 0x1104, 0x14fc, 0x096c, 0x1d02, 0x09bd, 0x027c,
0x080e, 0x1324, 0x128c, 0x0dc1, 0x00b9, 0x17f2, 0x0cbc, 0x0f97,
0x1b93, 0x1c3c, 0x0415, 0x0395, 0x0c7a, 0x06cc, 0x0d4b, 0x16e2,
0x04a2, 0x0dab, 0x1228, 0x012b, 0x0896, 0x0012, 0x1cd6, 0x1dac,
0x080d, 0x0446, 0x047a, 0x00ad, 0x029e, 0x0686, 0x17c3, 0x1466,
0x0d16, 0x1896, 0x076e, 0x00cd, 0x17dc, 0x1e9f, 0x1a7c, 0x02bb,
0x0d06, 0x112b, 0x14cb, 0x0a03, 0x1541, 0x1290, 0x0f6d, 0x1503,
0x084b, 0x0382, 0x1a3f, 0x0371, 0x1977, 0x0b67, 0x0cad, 0x1df8,
0x1ce3, 0x1306, 0x13f8, 0x1163, 0x1b0b, 0x00bd, 0x0bf0, 0x1a4f,
0x16f7, 0x0b4f, 0x0cf8, 0x1254, 0x0541, 0x100d, 0x0296, 0x0410,
0x1a2b, 0x1169, 0x17d9, 0x0819, 0x03d6, 0x0d03, 0x194d, 0x184a,
0x07ca, 0x1989, 0x0fad, 0x011c, 0x1c71, 0x0ef6, 0x0dc8, 0x0f2f,
0x0fa5, 0x11be, 0x0f3b, 0x1d52, 0x0de2, 0x016e, 0x1ad1, 0x0c4a,
0x1bc2, 0x0ac9, 0x1485, 0x1bee, 0x0949, 0x1a79, 0x1894, 0x12bb,
0x17b6, 0x14f5, 0x16b1, 0x142c, 0x1301, 0x03ef, 0x16ff, 0x0d37,
0x0d78, 0x01ff, 0x00d6, 0x1053, 0x1a2a, 0x0f61, 0x1352, 0x0c7f,
0x137f, 0x09c4, 0x1d96, 0x021d, 0x1037, 0x1b19, 0x10ef, 0x14e4,
0x02a0, 0x0236, 0x0a5d, 0x1519, 0x141c, 0x1399, 0x007e, 0x1e74,
0x0941, 0x1b3c, 0x0062, 0x0371, 0x09ad, 0x08e8, 0x0a24, 0x0b97,
0x1ed2, 0x0889, 0x136b, 0x0006, 0x1c4c, 0x0444, 0x06f8, 0x0dfb,
0x1d0f, 0x198d, 0x0700, 0x0afc, 0x1781, 0x12f3, 0x10da, 0x1f19,
0x1055, 0x0dc9, 0x1860, 0x012b, 0x05bf, 0x082d, 0x0c17, 0x1941,
0x0359, 0x1232, 0x104c, 0x0762, 0x0897, 0x1d6c, 0x030f, 0x1a36,
0x16b0, 0x094d, 0x1782, 0x036f, 0x0eea, 0x06e6, 0x0d00, 0x0187,
0x17e2, 0x05e5, 0x19fa, 0x1950, 0x146a, 0x0b2a, 0x0512, 0x0ee0,
0x1e27, 0x112d, 0x1df0, 0x0b13, 0x0378, 0x1dd0, 0x00c1, 0x01e6
};

View file

@ -0,0 +1,901 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mp4atom.c 19 2005-06-07 04:16:15Z vspader $
**/
#include <stdlib.h>
#ifndef _WIN32
#include "config.h"
#else
#include <tchar.h>
#ifdef ITUNES_DRM
#include <shlobj.h>
#endif
#include <windows.h>
#endif
#ifdef HAVE_GETPWUID
# include <pwd.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#include "mp4ffint.h"
#include "drms.h"
/* parse atom header size */
static int32_t mp4ff_atom_get_size(const int8_t *data)
{
uint32_t result;
uint32_t a, b, c, d;
a = (uint8_t)data[0];
b = (uint8_t)data[1];
c = (uint8_t)data[2];
d = (uint8_t)data[3];
result = (a<<24) | (b<<16) | (c<<8) | d;
//if (result > 0 && result < 8) result = 8;
return (int32_t)result;
}
/* comnapre 2 atom names, returns 1 for equal, 0 for unequal */
static int32_t mp4ff_atom_compare(const int8_t a1, const int8_t b1, const int8_t c1, const int8_t d1,
const int8_t a2, const int8_t b2, const int8_t c2, const int8_t d2)
{
if (a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2)
return 1;
else
return 0;
}
static uint8_t mp4ff_atom_name_to_type(const int8_t a, const int8_t b,
const int8_t c, const int8_t d)
{
if (a == 'm')
{
if (mp4ff_atom_compare(a,b,c,d, 'm','o','o','v'))
return ATOM_MOOV;
else if (mp4ff_atom_compare(a,b,c,d, 'm','i','n','f'))
return ATOM_MINF;
else if (mp4ff_atom_compare(a,b,c,d, 'm','d','i','a'))
return ATOM_MDIA;
else if (mp4ff_atom_compare(a,b,c,d, 'm','d','a','t'))
return ATOM_MDAT;
else if (mp4ff_atom_compare(a,b,c,d, 'm','d','h','d'))
return ATOM_MDHD;
else if (mp4ff_atom_compare(a,b,c,d, 'm','v','h','d'))
return ATOM_MVHD;
else if (mp4ff_atom_compare(a,b,c,d, 'm','p','4','a'))
return ATOM_MP4A;
else if (mp4ff_atom_compare(a,b,c,d, 'm','p','4','v'))
return ATOM_MP4V;
else if (mp4ff_atom_compare(a,b,c,d, 'm','p','4','s'))
return ATOM_MP4S;
else if (mp4ff_atom_compare(a,b,c,d, 'm','e','t','a'))
return ATOM_META;
} else if (a == 't') {
if (mp4ff_atom_compare(a,b,c,d, 't','r','a','k'))
return ATOM_TRAK;
else if (mp4ff_atom_compare(a,b,c,d, 't','k','h','d'))
return ATOM_TKHD;
else if (mp4ff_atom_compare(a,b,c,d, 't','r','e','f'))
return ATOM_TREF;
else if (mp4ff_atom_compare(a,b,c,d, 't','r','k','n'))
return ATOM_TRACK;
else if (mp4ff_atom_compare(a,b,c,d, 't','m','p','o'))
return ATOM_TEMPO;
} else if (a == 's') {
if (mp4ff_atom_compare(a,b,c,d, 's','t','b','l'))
return ATOM_STBL;
else if (mp4ff_atom_compare(a,b,c,d, 's','m','h','d'))
return ATOM_SMHD;
else if (mp4ff_atom_compare(a,b,c,d, 's','t','s','d'))
return ATOM_STSD;
else if (mp4ff_atom_compare(a,b,c,d, 's','t','t','s'))
return ATOM_STTS;
else if (mp4ff_atom_compare(a,b,c,d, 's','t','c','o'))
return ATOM_STCO;
else if (mp4ff_atom_compare(a,b,c,d, 's','t','s','c'))
return ATOM_STSC;
else if (mp4ff_atom_compare(a,b,c,d, 's','t','s','z'))
return ATOM_STSZ;
else if (mp4ff_atom_compare(a,b,c,d, 's','t','z','2'))
return ATOM_STZ2;
else if (mp4ff_atom_compare(a,b,c,d, 's','k','i','p'))
return ATOM_SKIP;
else if (mp4ff_atom_compare(a,b,c,d, 's','i','n','f'))
return ATOM_SINF;
else if (mp4ff_atom_compare(a,b,c,d, 's','c','h','i'))
return ATOM_SCHI;
} else if (a == '©') {
if (mp4ff_atom_compare(a,b,c,d, '©','n','a','m'))
return ATOM_TITLE;
else if (mp4ff_atom_compare(a,b,c,d, '©','A','R','T'))
return ATOM_ARTIST;
else if (mp4ff_atom_compare(a,b,c,d, '©','w','r','t'))
return ATOM_WRITER;
else if (mp4ff_atom_compare(a,b,c,d, '©','a','l','b'))
return ATOM_ALBUM;
else if (mp4ff_atom_compare(a,b,c,d, '©','d','a','y'))
return ATOM_DATE;
else if (mp4ff_atom_compare(a,b,c,d, '©','t','o','o'))
return ATOM_TOOL;
else if (mp4ff_atom_compare(a,b,c,d, '©','c','m','t'))
return ATOM_COMMENT;
else if (mp4ff_atom_compare(a,b,c,d, '©','g','e','n'))
return ATOM_GENRE1;
}
if (mp4ff_atom_compare(a,b,c,d, 'e','d','t','s'))
return ATOM_EDTS;
else if (mp4ff_atom_compare(a,b,c,d, 'e','s','d','s'))
return ATOM_ESDS;
else if (mp4ff_atom_compare(a,b,c,d, 'f','t','y','p'))
return ATOM_FTYP;
else if (mp4ff_atom_compare(a,b,c,d, 'f','r','e','e'))
return ATOM_FREE;
else if (mp4ff_atom_compare(a,b,c,d, 'h','m','h','d'))
return ATOM_HMHD;
else if (mp4ff_atom_compare(a,b,c,d, 'v','m','h','d'))
return ATOM_VMHD;
else if (mp4ff_atom_compare(a,b,c,d, 'u','d','t','a'))
return ATOM_UDTA;
else if (mp4ff_atom_compare(a,b,c,d, 'i','l','s','t'))
return ATOM_ILST;
else if (mp4ff_atom_compare(a,b,c,d, 'n','a','m','e'))
return ATOM_NAME;
else if (mp4ff_atom_compare(a,b,c,d, 'd','a','t','a'))
return ATOM_DATA;
else if (mp4ff_atom_compare(a,b,c,d, 'd','i','s','k'))
return ATOM_DISC;
else if (mp4ff_atom_compare(a,b,c,d, 'g','n','r','e'))
return ATOM_GENRE2;
else if (mp4ff_atom_compare(a,b,c,d, 'c','o','v','r'))
return ATOM_COVER;
else if (mp4ff_atom_compare(a,b,c,d, 'c','p','i','l'))
return ATOM_COMPILATION;
else if (mp4ff_atom_compare(a,b,c,d, 'c','t','t','s'))
return ATOM_CTTS;
else if (mp4ff_atom_compare(a,b,c,d, 'd','r','m','s'))
return ATOM_DRMS;
else if (mp4ff_atom_compare(a,b,c,d, 'f','r','m','a'))
return ATOM_FRMA;
else if (mp4ff_atom_compare(a,b,c,d, 'p','r','i','v'))
return ATOM_PRIV;
else if (mp4ff_atom_compare(a,b,c,d, 'i','v','i','v'))
return ATOM_IVIV;
else if (mp4ff_atom_compare(a,b,c,d, 'u','s','e','r'))
return ATOM_USER;
else if (mp4ff_atom_compare(a,b,c,d, 'k','e','y',' '))
return ATOM_KEY;
else
return ATOM_UNKNOWN;
}
/* read atom header, return atom size, atom size is with header included */
uint64_t mp4ff_atom_read_header(mp4ff_t *f, uint8_t *atom_type, uint8_t *header_size)
{
uint64_t size;
int32_t ret;
int8_t atom_header[8];
ret = mp4ff_read_data(f, atom_header, 8);
if (ret != 8)
return 0;
size = mp4ff_atom_get_size(atom_header);
*header_size = 8;
/* check for 64 bit atom size */
if (size == 1)
{
*header_size = 16;
size = mp4ff_read_int64(f);
}
//printf("%c%c%c%c\n", atom_header[4], atom_header[5], atom_header[6], atom_header[7]);
*atom_type = mp4ff_atom_name_to_type(atom_header[4], atom_header[5], atom_header[6], atom_header[7]);
return size;
}
static int32_t mp4ff_read_stsz(mp4ff_t *f)
{
mp4ff_read_char(f); /* version */
mp4ff_read_int24(f); /* flags */
f->track[f->total_tracks - 1]->stsz_sample_size = mp4ff_read_int32(f);
f->track[f->total_tracks - 1]->stsz_sample_count = mp4ff_read_int32(f);
if (f->track[f->total_tracks - 1]->stsz_sample_size == 0)
{
int32_t i;
f->track[f->total_tracks - 1]->stsz_table =
(int32_t*)malloc(f->track[f->total_tracks - 1]->stsz_sample_count*sizeof(int32_t));
for (i = 0; i < f->track[f->total_tracks - 1]->stsz_sample_count; i++)
{
f->track[f->total_tracks - 1]->stsz_table[i] = mp4ff_read_int32(f);
}
}
return 0;
}
static int32_t mp4ff_read_esds(mp4ff_t *f)
{
uint8_t tag;
uint32_t temp;
mp4ff_read_char(f); /* version */
mp4ff_read_int24(f); /* flags */
/* get and verify ES_DescrTag */
tag = mp4ff_read_char(f);
if (tag == 0x03)
{
/* read length */
if (mp4ff_read_mp4_descr_length(f) < 5 + 15)
{
return 1;
}
/* skip 3 bytes */
mp4ff_read_int24(f);
} else {
/* skip 2 bytes */
mp4ff_read_int16(f);
}
/* get and verify DecoderConfigDescrTab */
if (mp4ff_read_char(f) != 0x04)
{
return 1;
}
/* read length */
temp = mp4ff_read_mp4_descr_length(f);
if (temp < 13) return 1;
f->track[f->total_tracks - 1]->audioType = mp4ff_read_char(f);
mp4ff_read_int32(f);//0x15000414 ????
f->track[f->total_tracks - 1]->maxBitrate = mp4ff_read_int32(f);
f->track[f->total_tracks - 1]->avgBitrate = mp4ff_read_int32(f);
/* get and verify DecSpecificInfoTag */
if (mp4ff_read_char(f) != 0x05)
{
return 1;
}
/* read length */
f->track[f->total_tracks - 1]->decoderConfigLen = mp4ff_read_mp4_descr_length(f);
if (f->track[f->total_tracks - 1]->decoderConfig)
free(f->track[f->total_tracks - 1]->decoderConfig);
f->track[f->total_tracks - 1]->decoderConfig = malloc(f->track[f->total_tracks - 1]->decoderConfigLen);
if (f->track[f->total_tracks - 1]->decoderConfig)
{
mp4ff_read_data(f, f->track[f->total_tracks - 1]->decoderConfig, f->track[f->total_tracks - 1]->decoderConfigLen);
} else {
f->track[f->total_tracks - 1]->decoderConfigLen = 0;
}
/* will skip the remainder of the atom */
return 0;
}
static int32_t mp4ff_read_mp4a(mp4ff_t *f)
{
uint64_t size;
int32_t i;
uint8_t atom_type = 0;
uint8_t header_size = 0;
for (i = 0; i < 6; i++)
{
mp4ff_read_char(f); /* reserved */
}
/* data_reference_index */ mp4ff_read_int16(f);
mp4ff_read_int32(f); /* reserved */
mp4ff_read_int32(f); /* reserved */
f->track[f->total_tracks - 1]->channelCount = mp4ff_read_int16(f);
f->track[f->total_tracks - 1]->sampleSize = mp4ff_read_int16(f);
mp4ff_read_int16(f);
mp4ff_read_int16(f);
f->track[f->total_tracks - 1]->sampleRate = mp4ff_read_int16(f);
mp4ff_read_int16(f);
size = mp4ff_atom_read_header(f, &atom_type, &header_size);
if (atom_type == ATOM_ESDS)
{
mp4ff_read_esds(f);
}
return 0;
}
#ifdef ITUNES_DRM
char *GetHomeDir( void )
{
char *p_tmp, *p_homedir = NULL;
#if defined(HAVE_GETPWUID)
struct passwd *p_pw = NULL;
#endif
#if defined(_WIN32) || defined(UNDER_CE)
typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD,
LPSTR );
# define CSIDL_FLAG_CREATE 0x8000
# define CSIDL_APPDATA 0x1A
# define SHGFP_TYPE_CURRENT 0
HINSTANCE shfolder_dll;
SHGETFOLDERPATH SHGetFolderPath ;
/* load the shfolder dll to retrieve SHGetFolderPath */
if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL )
{
SHGetFolderPath = (void *)GetProcAddress( shfolder_dll,
_T("SHGetFolderPathA") );
if ( SHGetFolderPath != NULL )
{
p_homedir = (char *)malloc( MAX_PATH );
if( !p_homedir )
{
return NULL;
}
/* get the "Application Data" folder for the current user */
if( S_OK == SHGetFolderPath( NULL,
CSIDL_APPDATA | CSIDL_FLAG_CREATE,
NULL, SHGFP_TYPE_CURRENT,
p_homedir ) )
{
FreeLibrary( shfolder_dll );
return p_homedir;
}
free( p_homedir );
}
FreeLibrary( shfolder_dll );
}
#endif
#if defined(HAVE_GETPWUID)
if( ( p_pw = getpwuid( getuid() ) ) == NULL )
#endif
{
if( ( p_tmp = getenv( "HOME" ) ) == NULL )
{
if( ( p_tmp = getenv( "TMP" ) ) == NULL )
{
p_tmp = "/tmp";
}
}
p_homedir = strdup( p_tmp );
}
#if defined(HAVE_GETPWUID)
else
{
p_homedir = strdup( p_pw->pw_dir );
}
#endif
return p_homedir;
}
static int32_t mp4ff_read_drms(mp4ff_t *f, uint64_t skip)
{
uint64_t size;
int32_t i;
uint8_t atom_type = 0;
uint8_t header_size = 0;
f->track[f->total_tracks - 1]->p_drms = drms_alloc( GetHomeDir() );
for (i = 0; i < 6; i++)
{
mp4ff_read_char(f); /* reserved */
}
/* data_reference_index */ mp4ff_read_int16(f);
mp4ff_read_int32(f); /* reserved */
mp4ff_read_int32(f); /* reserved */
f->track[f->total_tracks - 1]->channelCount = mp4ff_read_int16(f);
f->track[f->total_tracks - 1]->sampleSize = mp4ff_read_int16(f);
mp4ff_read_int16(f);
mp4ff_read_int16(f);
f->track[f->total_tracks - 1]->sampleRate = mp4ff_read_int16(f);
mp4ff_read_int16(f);
size = mp4ff_atom_read_header(f, &atom_type, &header_size);
if (atom_type == ATOM_ESDS)
{
mp4ff_read_esds(f);
}
mp4ff_set_position(f, skip+size+28);
size = mp4ff_atom_read_header(f, &atom_type, &header_size);
if (atom_type == ATOM_SINF)
{
parse_sub_atoms(f, size-header_size,0);
}
return 0;
}
static int32_t mp4ff_read_frma(mp4ff_t *f)
{
uint8_t atom_type;
int8_t type[4];
mp4ff_read_data(f, type, 4);
atom_type = mp4ff_atom_name_to_type(type[0], type[1], type[2], type[3]);
if (atom_type == ATOM_MP4A)
{
f->track[f->total_tracks - 1]->type = TRACK_AUDIO;
} else if (atom_type == ATOM_MP4V) {
f->track[f->total_tracks - 1]->type = TRACK_VIDEO;
} else if (atom_type == ATOM_MP4S) {
f->track[f->total_tracks - 1]->type = TRACK_SYSTEM;
} else {
f->track[f->total_tracks - 1]->type = TRACK_UNKNOWN;
}
return 0;
}
static int32_t mp4ff_read_name(mp4ff_t *f, uint64_t size)
{
uint8_t *data = malloc(size);
mp4ff_read_data(f, data, size);
if (f->track[f->total_tracks - 1]->p_drms != NULL)
{
drms_init(f->track[f->total_tracks - 1]->p_drms,
FOURCC_name, data, strlen(data) );
}
if (data)
free(data);
return 0;
}
static int32_t mp4ff_read_priv(mp4ff_t *f, uint64_t size)
{
uint8_t *data = malloc(size);
mp4ff_read_data(f, data, size);
if (f->track[f->total_tracks - 1]->p_drms != 0)
{
drms_init(f->track[f->total_tracks - 1]->p_drms,
FOURCC_priv, data, size );
}
if (data)
free(data);
return 0;
}
static int32_t mp4ff_read_iviv(mp4ff_t *f, uint64_t size)
{
uint8_t *data = malloc(size);
mp4ff_read_data(f, data, size);
if (f->track[f->total_tracks - 1]->p_drms != 0)
{
drms_init(f->track[f->total_tracks - 1]->p_drms,
FOURCC_iviv, data, sizeof(uint32_t) * 4 );
}
if (data)
free(data);
return 0;
}
static int32_t mp4ff_read_user(mp4ff_t *f, uint64_t size)
{
uint8_t *data = malloc(size);
mp4ff_read_data(f, data, size);
if (f->track[f->total_tracks - 1]->p_drms != 0)
{
drms_init(f->track[f->total_tracks - 1]->p_drms,
FOURCC_user, data, size );
}
if (data)
free(data);
return 0;
}
static int32_t mp4ff_read_key(mp4ff_t *f, uint64_t size)
{
uint8_t *data = malloc(size);
mp4ff_read_data(f, data, size);
if (f->track[f->total_tracks - 1]->p_drms != 0)
{
drms_init(f->track[f->total_tracks - 1]->p_drms,
FOURCC_key, data, size );
}
if (data)
free(data);
return 0;
}
#endif
static int32_t mp4ff_read_stsd(mp4ff_t *f)
{
int32_t i;
uint8_t header_size = 0;
mp4ff_read_char(f); /* version */
mp4ff_read_int24(f); /* flags */
f->track[f->total_tracks - 1]->stsd_entry_count = mp4ff_read_int32(f);
for (i = 0; i < f->track[f->total_tracks - 1]->stsd_entry_count; i++)
{
uint64_t skip = mp4ff_position(f);
uint64_t size;
uint8_t atom_type = 0;
size = mp4ff_atom_read_header(f, &atom_type, &header_size);
skip += size;
if (atom_type == ATOM_MP4A)
{
f->track[f->total_tracks - 1]->type = TRACK_AUDIO;
mp4ff_read_mp4a(f);
} else if (atom_type == ATOM_MP4V) {
f->track[f->total_tracks - 1]->type = TRACK_VIDEO;
} else if (atom_type == ATOM_MP4S) {
f->track[f->total_tracks - 1]->type = TRACK_SYSTEM;
#ifdef ITUNES_DRM
} else if (atom_type == ATOM_DRMS) {
// track type is read from the "frma" atom
f->track[f->total_tracks - 1]->type = TRACK_UNKNOWN;
mp4ff_read_drms(f, skip-size+header_size);
#endif
} else {
f->track[f->total_tracks - 1]->type = TRACK_UNKNOWN;
}
mp4ff_set_position(f, skip);
}
return 0;
}
static int32_t mp4ff_read_stsc(mp4ff_t *f)
{
int32_t i;
mp4ff_read_char(f); /* version */
mp4ff_read_int24(f); /* flags */
f->track[f->total_tracks - 1]->stsc_entry_count = mp4ff_read_int32(f);
f->track[f->total_tracks - 1]->stsc_first_chunk =
(int32_t*)malloc(f->track[f->total_tracks - 1]->stsc_entry_count*sizeof(int32_t));
f->track[f->total_tracks - 1]->stsc_samples_per_chunk =
(int32_t*)malloc(f->track[f->total_tracks - 1]->stsc_entry_count*sizeof(int32_t));
f->track[f->total_tracks - 1]->stsc_sample_desc_index =
(int32_t*)malloc(f->track[f->total_tracks - 1]->stsc_entry_count*sizeof(int32_t));
for (i = 0; i < f->track[f->total_tracks - 1]->stsc_entry_count; i++)
{
f->track[f->total_tracks - 1]->stsc_first_chunk[i] = mp4ff_read_int32(f);
f->track[f->total_tracks - 1]->stsc_samples_per_chunk[i] = mp4ff_read_int32(f);
f->track[f->total_tracks - 1]->stsc_sample_desc_index[i] = mp4ff_read_int32(f);
}
return 0;
}
static int32_t mp4ff_read_stco(mp4ff_t *f)
{
int32_t i;
mp4ff_read_char(f); /* version */
mp4ff_read_int24(f); /* flags */
f->track[f->total_tracks - 1]->stco_entry_count = mp4ff_read_int32(f);
f->track[f->total_tracks - 1]->stco_chunk_offset =
(int32_t*)malloc(f->track[f->total_tracks - 1]->stco_entry_count*sizeof(int32_t));
for (i = 0; i < f->track[f->total_tracks - 1]->stco_entry_count; i++)
{
f->track[f->total_tracks - 1]->stco_chunk_offset[i] = mp4ff_read_int32(f);
}
return 0;
}
static int32_t mp4ff_read_ctts(mp4ff_t *f)
{
int32_t i;
mp4ff_track_t * p_track = f->track[f->total_tracks - 1];
if (p_track->ctts_entry_count) return 0;
mp4ff_read_char(f); /* version */
mp4ff_read_int24(f); /* flags */
p_track->ctts_entry_count = mp4ff_read_int32(f);
p_track->ctts_sample_count = (int32_t*)malloc(p_track->ctts_entry_count * sizeof(int32_t));
p_track->ctts_sample_offset = (int32_t*)malloc(p_track->ctts_entry_count * sizeof(int32_t));
if (p_track->ctts_sample_count == 0 || p_track->ctts_sample_offset == 0)
{
if (p_track->ctts_sample_count) {free(p_track->ctts_sample_count);p_track->ctts_sample_count=0;}
if (p_track->ctts_sample_offset) {free(p_track->ctts_sample_offset);p_track->ctts_sample_offset=0;}
p_track->ctts_entry_count = 0;
return 0;
}
else
{
for (i = 0; i < f->track[f->total_tracks - 1]->ctts_entry_count; i++)
{
p_track->ctts_sample_count[i] = mp4ff_read_int32(f);
p_track->ctts_sample_offset[i] = mp4ff_read_int32(f);
}
return 1;
}
}
static int32_t mp4ff_read_stts(mp4ff_t *f)
{
int32_t i;
mp4ff_track_t * p_track = f->track[f->total_tracks - 1];
if (p_track->stts_entry_count) return 0;
mp4ff_read_char(f); /* version */
mp4ff_read_int24(f); /* flags */
p_track->stts_entry_count = mp4ff_read_int32(f);
p_track->stts_sample_count = (int32_t*)malloc(p_track->stts_entry_count * sizeof(int32_t));
p_track->stts_sample_delta = (int32_t*)malloc(p_track->stts_entry_count * sizeof(int32_t));
if (p_track->stts_sample_count == 0 || p_track->stts_sample_delta == 0)
{
if (p_track->stts_sample_count) {free(p_track->stts_sample_count);p_track->stts_sample_count=0;}
if (p_track->stts_sample_delta) {free(p_track->stts_sample_delta);p_track->stts_sample_delta=0;}
p_track->stts_entry_count = 0;
return 0;
}
else
{
for (i = 0; i < f->track[f->total_tracks - 1]->stts_entry_count; i++)
{
p_track->stts_sample_count[i] = mp4ff_read_int32(f);
p_track->stts_sample_delta[i] = mp4ff_read_int32(f);
}
return 1;
}
}
static int32_t mp4ff_read_mvhd(mp4ff_t *f)
{
int32_t i;
mp4ff_read_char(f); /* version */
mp4ff_read_int24(f); /* flags */
/* creation_time */ mp4ff_read_int32(f);
/* modification_time */ mp4ff_read_int32(f);
f->time_scale = mp4ff_read_int32(f);
f->duration = mp4ff_read_int32(f);
/* preferred_rate */ mp4ff_read_int32(f); /*mp4ff_read_fixed32(f);*/
/* preferred_volume */ mp4ff_read_int16(f); /*mp4ff_read_fixed16(f);*/
for (i = 0; i < 10; i++)
{
/* reserved */ mp4ff_read_char(f);
}
for (i = 0; i < 9; i++)
{
mp4ff_read_int32(f); /* matrix */
}
/* preview_time */ mp4ff_read_int32(f);
/* preview_duration */ mp4ff_read_int32(f);
/* poster_time */ mp4ff_read_int32(f);
/* selection_time */ mp4ff_read_int32(f);
/* selection_duration */ mp4ff_read_int32(f);
/* current_time */ mp4ff_read_int32(f);
/* next_track_id */ mp4ff_read_int32(f);
return 0;
}
#if 0
static int32_t mp4ff_read_tkhd(mp4ff_t *f)
{
uint8_t version;
uint32_t flags;
version = mp4ff_read_char(f); /* version */
flags = mp4ff_read_int24(f); /* flags */
if (version==1)
{
mp4ff_read_int64(f);//creation-time
mp4ff_read_int64(f);//modification-time
mp4ff_read_int32(f);//track-id
mp4ff_read_int32(f);//reserved
f->track[f->total_tracks - 1]->duration = mp4ff_read_int64(f);//duration
}
else //version == 0
{
mp4ff_read_int32(f);//creation-time
mp4ff_read_int32(f);//modification-time
mp4ff_read_int32(f);//track-id
mp4ff_read_int32(f);//reserved
f->track[f->total_tracks - 1]->duration = mp4ff_read_int32(f);//duration
if (f->track[f->total_tracks - 1]->duration == 0xFFFFFFFF)
f->track[f->total_tracks - 1]->duration = 0xFFFFFFFFFFFFFFFF;
}
mp4ff_read_int32(f);//reserved
mp4ff_read_int32(f);//reserved
mp4ff_read_int16(f);//layer
mp4ff_read_int16(f);//pre-defined
mp4ff_read_int16(f);//volume
mp4ff_read_int16(f);//reserved
//matrix
mp4ff_read_int32(f); mp4ff_read_int32(f); mp4ff_read_int32(f);
mp4ff_read_int32(f); mp4ff_read_int32(f); mp4ff_read_int32(f);
mp4ff_read_int32(f); mp4ff_read_int32(f); mp4ff_read_int32(f);
mp4ff_read_int32(f);//width
mp4ff_read_int32(f);//height
return 1;
}
#endif
static int32_t mp4ff_read_mdhd(mp4ff_t *f)
{
uint32_t version;
version = mp4ff_read_int32(f);
if (version==1)
{
mp4ff_read_int64(f);//creation-time
mp4ff_read_int64(f);//modification-time
f->track[f->total_tracks - 1]->timeScale = mp4ff_read_int32(f);//timescale
f->track[f->total_tracks - 1]->duration = mp4ff_read_int64(f);//duration
}
else //version == 0
{
uint32_t temp;
mp4ff_read_int32(f);//creation-time
mp4ff_read_int32(f);//modification-time
f->track[f->total_tracks - 1]->timeScale = mp4ff_read_int32(f);//timescale
temp = mp4ff_read_int32(f);
f->track[f->total_tracks - 1]->duration = (temp == (uint32_t)(-1)) ? (uint64_t)(-1) : (uint64_t)(temp);
}
mp4ff_read_int16(f);
mp4ff_read_int16(f);
return 1;
}
#ifdef USE_TAGGING
static int32_t mp4ff_read_meta(mp4ff_t *f, const uint64_t size)
{
uint64_t subsize, sumsize = 0;
uint8_t atom_type;
uint8_t header_size = 0;
mp4ff_read_char(f); /* version */
mp4ff_read_int24(f); /* flags */
while (sumsize < (size-(header_size+4)))
{
subsize = mp4ff_atom_read_header(f, &atom_type, &header_size);
if (subsize <= header_size+4)
return 1;
if (atom_type == ATOM_ILST)
{
mp4ff_parse_metadata(f, (uint32_t)(subsize-(header_size+4)));
} else {
mp4ff_set_position(f, mp4ff_position(f)+subsize-header_size);
}
sumsize += subsize;
}
return 0;
}
#endif
int32_t mp4ff_atom_read(mp4ff_t *f, const int32_t size, const uint8_t atom_type)
{
uint64_t dest_position = mp4ff_position(f)+size-8;
if (atom_type == ATOM_STSZ)
{
/* sample size box */
mp4ff_read_stsz(f);
} else if (atom_type == ATOM_STTS) {
/* time to sample box */
mp4ff_read_stts(f);
} else if (atom_type == ATOM_CTTS) {
/* composition offset box */
mp4ff_read_ctts(f);
} else if (atom_type == ATOM_STSC) {
/* sample to chunk box */
mp4ff_read_stsc(f);
} else if (atom_type == ATOM_STCO) {
/* chunk offset box */
mp4ff_read_stco(f);
} else if (atom_type == ATOM_STSD) {
/* sample description box */
mp4ff_read_stsd(f);
} else if (atom_type == ATOM_MVHD) {
/* movie header box */
mp4ff_read_mvhd(f);
} else if (atom_type == ATOM_MDHD) {
/* track header */
mp4ff_read_mdhd(f);
#ifdef ITUNES_DRM
} else if (atom_type == ATOM_FRMA) {
/* DRM track format */
mp4ff_read_frma(f);
} else if (atom_type == ATOM_IVIV) {
mp4ff_read_iviv(f, size-8);
} else if (atom_type == ATOM_NAME) {
mp4ff_read_name(f, size-8);
} else if (atom_type == ATOM_PRIV) {
mp4ff_read_priv(f, size-8);
} else if (atom_type == ATOM_USER) {
mp4ff_read_user(f, size-8);
} else if (atom_type == ATOM_KEY) {
mp4ff_read_key(f, size-8);
#endif
#ifdef USE_TAGGING
} else if (atom_type == ATOM_META) {
/* iTunes Metadata box */
mp4ff_read_meta(f, size);
#endif
}
mp4ff_set_position(f, dest_position);
return 0;
}

View file

@ -0,0 +1,474 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mp4ff.c 19 2005-06-07 04:16:15Z vspader $
**/
#include <stdlib.h>
#include <string.h>
#include "mp4ffint.h"
#include "drms.h"
mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f)
{
mp4ff_t *ff = malloc(sizeof(mp4ff_t));
memset(ff, 0, sizeof(mp4ff_t));
ff->stream = f;
parse_atoms(ff,0);
return ff;
}
mp4ff_t *mp4ff_open_read_metaonly(mp4ff_callback_t *f)
{
mp4ff_t *ff = malloc(sizeof(mp4ff_t));
memset(ff, 0, sizeof(mp4ff_t));
ff->stream = f;
parse_atoms(ff,1);
return ff;
}
void mp4ff_close(mp4ff_t *ff)
{
int32_t i;
for (i = 0; i < ff->total_tracks; i++)
{
if (ff->track[i])
{
if (ff->track[i]->stsz_table)
free(ff->track[i]->stsz_table);
if (ff->track[i]->stts_sample_count)
free(ff->track[i]->stts_sample_count);
if (ff->track[i]->stts_sample_delta)
free(ff->track[i]->stts_sample_delta);
if (ff->track[i]->stsc_first_chunk)
free(ff->track[i]->stsc_first_chunk);
if (ff->track[i]->stsc_samples_per_chunk)
free(ff->track[i]->stsc_samples_per_chunk);
if (ff->track[i]->stsc_sample_desc_index)
free(ff->track[i]->stsc_sample_desc_index);
if (ff->track[i]->stco_chunk_offset)
free(ff->track[i]->stco_chunk_offset);
if (ff->track[i]->decoderConfig)
free(ff->track[i]->decoderConfig);
if (ff->track[i]->ctts_sample_count)
free(ff->track[i]->ctts_sample_count);
if (ff->track[i]->ctts_sample_offset)
free(ff->track[i]->ctts_sample_offset);
#ifdef ITUNES_DRM
if (ff->track[i]->p_drms)
drms_free(ff->track[i]->p_drms);
#endif
free(ff->track[i]);
}
}
#ifdef USE_TAGGING
mp4ff_tag_delete(&(ff->tags));
#endif
if (ff) free(ff);
}
static void mp4ff_track_add(mp4ff_t *f)
{
f->total_tracks++;
f->track[f->total_tracks - 1] = malloc(sizeof(mp4ff_track_t));
memset(f->track[f->total_tracks - 1], 0, sizeof(mp4ff_track_t));
}
static int need_parse_when_meta_only(uint8_t atom_type)
{
switch(atom_type)
{
case ATOM_EDTS:
// case ATOM_MDIA:
// case ATOM_MINF:
case ATOM_DRMS:
case ATOM_SINF:
case ATOM_SCHI:
// case ATOM_STBL:
// case ATOM_STSD:
case ATOM_STTS:
case ATOM_STSZ:
case ATOM_STZ2:
case ATOM_STCO:
case ATOM_STSC:
// case ATOM_CTTS:
case ATOM_FRMA:
case ATOM_IVIV:
case ATOM_PRIV:
return 0;
default:
return 1;
}
}
/* parse atoms that are sub atoms of other atoms */
int32_t parse_sub_atoms(mp4ff_t *f, const uint64_t total_size,int meta_only)
{
uint64_t size;
uint8_t atom_type = 0;
uint64_t counted_size = 0;
uint8_t header_size = 0;
while (counted_size < total_size)
{
size = mp4ff_atom_read_header(f, &atom_type, &header_size);
counted_size += size;
/* check for end of file */
if (size == 0)
break;
/* we're starting to read a new track, update index,
* so that all data and tables get written in the right place
*/
if (atom_type == ATOM_TRAK)
{
mp4ff_track_add(f);
}
/* parse subatoms */
if (meta_only && !need_parse_when_meta_only(atom_type))
{
mp4ff_set_position(f, mp4ff_position(f)+size-header_size);
} else if (atom_type < SUBATOMIC)
{
parse_sub_atoms(f, size-header_size,meta_only);
} else {
mp4ff_atom_read(f, (uint32_t)size, atom_type);
}
}
return 0;
}
/* parse root atoms */
int32_t parse_atoms(mp4ff_t *f,int meta_only)
{
uint64_t size;
uint8_t atom_type = 0;
uint8_t header_size = 0;
f->file_size = 0;
while ((size = mp4ff_atom_read_header(f, &atom_type, &header_size)) != 0)
{
f->file_size += size;
f->last_atom = atom_type;
if (atom_type == ATOM_MDAT && f->moov_read)
{
/* moov atom is before mdat, we can stop reading when mdat is encountered */
/* file position will stay at beginning of mdat data */
// break;
}
if (atom_type == ATOM_MOOV && size > header_size)
{
f->moov_read = 1;
f->moov_offset = mp4ff_position(f)-header_size;
f->moov_size = size;
}
/* parse subatoms */
if (meta_only && !need_parse_when_meta_only(atom_type))
{
mp4ff_set_position(f, mp4ff_position(f)+size-header_size);
} else if (atom_type < SUBATOMIC)
{
parse_sub_atoms(f, size-header_size,meta_only);
} else {
/* skip this atom */
mp4ff_set_position(f, mp4ff_position(f)+size-header_size);
}
}
return 0;
}
int32_t mp4ff_get_decoder_config(const mp4ff_t *f, const int32_t track,
uint8_t** ppBuf, uint32_t* pBufSize)
{
if (track >= f->total_tracks)
{
*ppBuf = NULL;
*pBufSize = 0;
return 1;
}
if (f->track[track]->decoderConfig == NULL || f->track[track]->decoderConfigLen == 0)
{
*ppBuf = NULL;
*pBufSize = 0;
} else {
*ppBuf = malloc(f->track[track]->decoderConfigLen);
if (*ppBuf == NULL)
{
*pBufSize = 0;
return 1;
}
memcpy(*ppBuf, f->track[track]->decoderConfig, f->track[track]->decoderConfigLen);
*pBufSize = f->track[track]->decoderConfigLen;
}
return 0;
}
int32_t mp4ff_get_track_type(const mp4ff_t *f, const int track)
{
return f->track[track]->type;
}
int32_t mp4ff_total_tracks(const mp4ff_t *f)
{
return f->total_tracks;
}
int32_t mp4ff_time_scale(const mp4ff_t *f, const int32_t track)
{
return f->track[track]->timeScale;
}
uint32_t mp4ff_get_avg_bitrate(const mp4ff_t *f, const int32_t track)
{
return f->track[track]->avgBitrate;
}
uint32_t mp4ff_get_max_bitrate(const mp4ff_t *f, const int32_t track)
{
return f->track[track]->maxBitrate;
}
int64_t mp4ff_get_track_duration(const mp4ff_t *f, const int32_t track)
{
return f->track[track]->duration;
}
int64_t mp4ff_get_track_duration_use_offsets(const mp4ff_t *f, const int32_t track)
{
int64_t duration = mp4ff_get_track_duration(f,track);
if (duration!=-1)
{
int64_t offset = mp4ff_get_sample_offset(f,track,0);
if (offset > duration) duration = 0;
else duration -= offset;
}
return duration;
}
int32_t mp4ff_num_samples(const mp4ff_t *f, const int32_t track)
{
int32_t i;
int32_t total = 0;
for (i = 0; i < f->track[track]->stts_entry_count; i++)
{
total += f->track[track]->stts_sample_count[i];
}
return total;
}
uint32_t mp4ff_get_sample_rate(const mp4ff_t *f, const int32_t track)
{
return f->track[track]->sampleRate;
}
uint32_t mp4ff_get_channel_count(const mp4ff_t * f,const int32_t track)
{
return f->track[track]->channelCount;
}
uint32_t mp4ff_get_audio_type(const mp4ff_t * f,const int32_t track)
{
return f->track[track]->audioType;
}
int32_t mp4ff_get_sample_duration_use_offsets(const mp4ff_t *f, const int32_t track, const int32_t sample)
{
int32_t d,o;
d = mp4ff_get_sample_duration(f,track,sample);
if (d!=-1)
{
o = mp4ff_get_sample_offset(f,track,sample);
if (o>d) d = 0;
else d -= o;
}
return d;
}
int32_t mp4ff_get_sample_duration(const mp4ff_t *f, const int32_t track, const int32_t sample)
{
int32_t i, co = 0;
for (i = 0; i < f->track[track]->stts_entry_count; i++)
{
int32_t delta = f->track[track]->stts_sample_count[i];
if (sample < co + delta)
return f->track[track]->stts_sample_delta[i];
co += delta;
}
return (int32_t)(-1);
}
int64_t mp4ff_get_sample_position(const mp4ff_t *f, const int32_t track, const int32_t sample)
{
int32_t i, co = 0;
int64_t acc = 0;
for (i = 0; i < f->track[track]->stts_entry_count; i++)
{
int32_t delta = f->track[track]->stts_sample_count[i];
if (sample < co + delta)
{
acc += f->track[track]->stts_sample_delta[i] * (sample - co);
return acc;
}
else
{
acc += f->track[track]->stts_sample_delta[i] * delta;
}
co += delta;
}
return (int64_t)(-1);
}
int32_t mp4ff_get_sample_offset(const mp4ff_t *f, const int32_t track, const int32_t sample)
{
int32_t i, co = 0;
for (i = 0; i < f->track[track]->ctts_entry_count; i++)
{
int32_t delta = f->track[track]->ctts_sample_count[i];
if (sample < co + delta)
return f->track[track]->ctts_sample_offset[i];
co += delta;
}
return 0;
}
int32_t mp4ff_find_sample(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip)
{
int32_t i, co = 0;
int64_t offset_total = 0;
mp4ff_track_t * p_track = f->track[track];
for (i = 0; i < p_track->stts_entry_count; i++)
{
int32_t sample_count = p_track->stts_sample_count[i];
int32_t sample_delta = p_track->stts_sample_delta[i];
int64_t offset_delta = (int64_t)sample_delta * (int64_t)sample_count;
if (offset < offset_total + offset_delta)
{
int64_t offset_fromstts = offset - offset_total;
if (toskip) *toskip = (int32_t)(offset_fromstts % sample_delta);
return co + (int32_t)(offset_fromstts / sample_delta);
}
else
{
offset_total += offset_delta;
}
co += sample_count;
}
return (int32_t)(-1);
}
int32_t mp4ff_find_sample_use_offsets(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip)
{
return mp4ff_find_sample(f,track,offset + mp4ff_get_sample_offset(f,track,0),toskip);
}
int32_t mp4ff_read_sample(mp4ff_t *f, const int32_t track, const int32_t sample,
uint8_t **audio_buffer, uint32_t *bytes)
{
int32_t result = 0;
*bytes = mp4ff_audio_frame_size(f, track, sample);
if (*bytes==0) return 0;
*audio_buffer = (uint8_t*)malloc(*bytes);
mp4ff_set_sample_position(f, track, sample);
result = mp4ff_read_data(f, *audio_buffer, *bytes);
if (!result)
{
free(*audio_buffer);
*audio_buffer = 0;
return 0;
}
#ifdef ITUNES_DRM
if (f->track[track]->p_drms != NULL)
{
drms_decrypt(f->track[track]->p_drms, (uint32_t*)*audio_buffer, *bytes);
}
#endif
return *bytes;
}
int32_t mp4ff_read_sample_v2(mp4ff_t *f, const int track, const int sample,unsigned char *buffer)
{
int32_t result = 0;
int32_t size = mp4ff_audio_frame_size(f,track,sample);
if (size<=0) return 0;
mp4ff_set_sample_position(f, track, sample);
result = mp4ff_read_data(f,buffer,size);
#ifdef ITUNES_DRM
if (f->track[track]->p_drms != NULL)
{
drms_decrypt(f->track[track]->p_drms, (uint32_t*)buffer, size);
}
#endif
return result;
}
int32_t mp4ff_read_sample_getsize(mp4ff_t *f, const int track, const int sample)
{
int32_t temp = mp4ff_audio_frame_size(f, track, sample);
if (temp<0) temp = 0;
return temp;
}

View file

@ -0,0 +1,131 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mp4ff.h 19 2005-06-07 04:16:15Z vspader $
**/
#ifndef MP4FF_H
#define MP4FF_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "mp4ff_int_types.h"
/* file callback structure */
typedef struct
{
uint32_t (*read)(void *user_data, void *buffer, uint32_t length);
uint32_t (*write)(void *udata, void *buffer, uint32_t length);
uint32_t (*seek)(void *user_data, uint64_t position);
uint32_t (*truncate)(void *user_data);
void *user_data;
} mp4ff_callback_t;
/* mp4 main file structure */
typedef void* mp4ff_t;
/* API */
mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f);
mp4ff_t *mp4ff_open_read_metaonly(mp4ff_callback_t *f);
void mp4ff_close(mp4ff_t *f);
int32_t mp4ff_get_sample_duration(const mp4ff_t *f, const int32_t track, const int32_t sample);
int32_t mp4ff_get_sample_duration_use_offsets(const mp4ff_t *f, const int32_t track, const int32_t sample);
int64_t mp4ff_get_sample_position(const mp4ff_t *f, const int32_t track, const int32_t sample);
int32_t mp4ff_get_sample_offset(const mp4ff_t *f, const int32_t track, const int32_t sample);
int32_t mp4ff_find_sample(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip);
int32_t mp4ff_find_sample_use_offsets(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip);
int32_t mp4ff_read_sample(mp4ff_t *f, const int track, const int sample,
unsigned char **audio_buffer, unsigned int *bytes);
int32_t mp4ff_read_sample_v2(mp4ff_t *f, const int track, const int sample,unsigned char *buffer);//returns 0 on error, number of bytes read on success, use mp4ff_read_sample_getsize() to check buffer size needed
int32_t mp4ff_read_sample_getsize(mp4ff_t *f, const int track, const int sample);//returns 0 on error, buffer size needed for mp4ff_read_sample_v2() on success
int32_t mp4ff_get_decoder_config(const mp4ff_t *f, const int track,
unsigned char** ppBuf, unsigned int* pBufSize);
int32_t mp4ff_get_track_type(const mp4ff_t *f, const int track);
int32_t mp4ff_total_tracks(const mp4ff_t *f);
int32_t mp4ff_num_samples(const mp4ff_t *f, const int track);
int32_t mp4ff_time_scale(const mp4ff_t *f, const int track);
uint32_t mp4ff_get_avg_bitrate(const mp4ff_t *f, const int32_t track);
uint32_t mp4ff_get_max_bitrate(const mp4ff_t *f, const int32_t track);
int64_t mp4ff_get_track_duration(const mp4ff_t *f, const int32_t track); //returns (-1) if unknown
int64_t mp4ff_get_track_duration_use_offsets(const mp4ff_t *f, const int32_t track); //returns (-1) if unknown
uint32_t mp4ff_get_sample_rate(const mp4ff_t *f, const int32_t track);
uint32_t mp4ff_get_channel_count(const mp4ff_t * f,const int32_t track);
uint32_t mp4ff_get_audio_type(const mp4ff_t * f,const int32_t track);
/* metadata */
int mp4ff_meta_get_num_items(const mp4ff_t *f);
int mp4ff_meta_get_by_index(const mp4ff_t *f, unsigned int index,
char **item, char **value);
int mp4ff_meta_get_title(const mp4ff_t *f, char **value);
int mp4ff_meta_get_artist(const mp4ff_t *f, char **value);
int mp4ff_meta_get_writer(const mp4ff_t *f, char **value);
int mp4ff_meta_get_album(const mp4ff_t *f, char **value);
int mp4ff_meta_get_date(const mp4ff_t *f, char **value);
int mp4ff_meta_get_tool(const mp4ff_t *f, char **value);
int mp4ff_meta_get_comment(const mp4ff_t *f, char **value);
int mp4ff_meta_get_genre(const mp4ff_t *f, char **value);
int mp4ff_meta_get_track(const mp4ff_t *f, char **value);
int mp4ff_meta_get_disc(const mp4ff_t *f, char **value);
int mp4ff_meta_get_totaltracks(const mp4ff_t *f, char **value);
int mp4ff_meta_get_totaldiscs(const mp4ff_t *f, char **value);
int mp4ff_meta_get_compilation(const mp4ff_t *f, char **value);
int mp4ff_meta_get_tempo(const mp4ff_t *f, char **value);
int32_t mp4ff_meta_get_coverart(const mp4ff_t *f, char **value);
#ifdef USE_TAGGING
/* metadata tag structure */
typedef struct
{
char *item;
char *value;
} mp4ff_tag_t;
/* metadata list structure */
typedef struct
{
mp4ff_tag_t *tags;
uint32_t count;
} mp4ff_metadata_t;
int32_t mp4ff_meta_update(mp4ff_callback_t *f,const mp4ff_metadata_t * data);
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

View file

@ -0,0 +1,23 @@
#ifndef _MP4FF_INT_TYPES_H_
#define _MP4FF_INT_TYPES_H_
#ifdef _WIN32
typedef char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef long int32_t;
typedef unsigned long uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
#endif

View file

@ -0,0 +1,373 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mp4ffint.h 19 2005-06-07 04:16:15Z vspader $
**/
#ifndef MP4FF_INTERNAL_H
#define MP4FF_INTERNAL_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "mp4ff_int_types.h"
#if defined(_WIN32) && !defined(_WIN32_WCE)
#define ITUNES_DRM
static __inline uint32_t GetDWLE( void const * _p )
{
uint8_t * p = (uint8_t *)_p;
return ( ((uint32_t)p[3] << 24) | ((uint32_t)p[2] << 16)
| ((uint32_t)p[1] << 8) | p[0] );
}
static __inline uint32_t U32_AT( void const * _p )
{
uint8_t * p = (uint8_t *)_p;
return ( ((uint32_t)p[0] << 24) | ((uint32_t)p[1] << 16)
| ((uint32_t)p[2] << 8) | p[3] );
}
static __inline uint64_t U64_AT( void const * _p )
{
uint8_t * p = (uint8_t *)_p;
return ( ((uint64_t)p[0] << 56) | ((uint64_t)p[1] << 48)
| ((uint64_t)p[2] << 40) | ((uint64_t)p[3] << 32)
| ((uint64_t)p[4] << 24) | ((uint64_t)p[5] << 16)
| ((uint64_t)p[6] << 8) | p[7] );
}
#ifdef WORDS_BIGENDIAN
# define VLC_FOURCC( a, b, c, d ) \
( ((uint32_t)d) | ( ((uint32_t)c) << 8 ) \
| ( ((uint32_t)b) << 16 ) | ( ((uint32_t)a) << 24 ) )
# define VLC_TWOCC( a, b ) \
( (uint16_t)(b) | ( (uint16_t)(a) << 8 ) )
#else
# define VLC_FOURCC( a, b, c, d ) \
( ((uint32_t)a) | ( ((uint32_t)b) << 8 ) \
| ( ((uint32_t)c) << 16 ) | ( ((uint32_t)d) << 24 ) )
# define VLC_TWOCC( a, b ) \
( (uint16_t)(a) | ( (uint16_t)(b) << 8 ) )
#endif
#define FOURCC_user VLC_FOURCC( 'u', 's', 'e', 'r' )
#define FOURCC_key VLC_FOURCC( 'k', 'e', 'y', ' ' )
#define FOURCC_iviv VLC_FOURCC( 'i', 'v', 'i', 'v' )
#define FOURCC_name VLC_FOURCC( 'n', 'a', 'm', 'e' )
#define FOURCC_priv VLC_FOURCC( 'p', 'r', 'i', 'v' )
#endif
#define MAX_TRACKS 1024
#define TRACK_UNKNOWN 0
#define TRACK_AUDIO 1
#define TRACK_VIDEO 2
#define TRACK_SYSTEM 3
#define SUBATOMIC 128
/* atoms without subatoms */
#define ATOM_FTYP 129
#define ATOM_MDAT 130
#define ATOM_MVHD 131
#define ATOM_TKHD 132
#define ATOM_TREF 133
#define ATOM_MDHD 134
#define ATOM_VMHD 135
#define ATOM_SMHD 136
#define ATOM_HMHD 137
#define ATOM_STSD 138
#define ATOM_STTS 139
#define ATOM_STSZ 140
#define ATOM_STZ2 141
#define ATOM_STCO 142
#define ATOM_STSC 143
#define ATOM_MP4A 144
#define ATOM_MP4V 145
#define ATOM_MP4S 146
#define ATOM_ESDS 147
#define ATOM_META 148 /* iTunes Metadata box */
#define ATOM_NAME 149 /* iTunes Metadata name box */
#define ATOM_DATA 150 /* iTunes Metadata data box */
#define ATOM_CTTS 151
#define ATOM_FRMA 152
#define ATOM_IVIV 153
#define ATOM_PRIV 154
#define ATOM_USER 155
#define ATOM_KEY 156
#define ATOM_UNKNOWN 255
#define ATOM_FREE ATOM_UNKNOWN
#define ATOM_SKIP ATOM_UNKNOWN
/* atoms with subatoms */
#define ATOM_MOOV 1
#define ATOM_TRAK 2
#define ATOM_EDTS 3
#define ATOM_MDIA 4
#define ATOM_MINF 5
#define ATOM_STBL 6
#define ATOM_UDTA 7
#define ATOM_ILST 8 /* iTunes Metadata list */
#define ATOM_TITLE 9
#define ATOM_ARTIST 10
#define ATOM_WRITER 11
#define ATOM_ALBUM 12
#define ATOM_DATE 13
#define ATOM_TOOL 14
#define ATOM_COMMENT 15
#define ATOM_GENRE1 16
#define ATOM_TRACK 17
#define ATOM_DISC 18
#define ATOM_COMPILATION 19
#define ATOM_GENRE2 20
#define ATOM_TEMPO 21
#define ATOM_COVER 22
#define ATOM_DRMS 23
#define ATOM_SINF 24
#define ATOM_SCHI 25
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#if !(defined(_WIN32) || defined(_WIN32_WCE))
#define stricmp strcasecmp
#endif
/* file callback structure */
typedef struct
{
uint32_t (*read)(void *user_data, void *buffer, uint32_t length);
uint32_t (*write)(void *udata, void *buffer, uint32_t length);
uint32_t (*seek)(void *user_data, uint64_t position);
uint32_t (*truncate)(void *user_data);
void *user_data;
} mp4ff_callback_t;
/* metadata tag structure */
typedef struct
{
char *item;
char *value;
} mp4ff_tag_t;
/* metadata list structure */
typedef struct
{
mp4ff_tag_t *tags;
uint32_t count;
} mp4ff_metadata_t;
typedef struct
{
int32_t type;
int32_t channelCount;
int32_t sampleSize;
uint16_t sampleRate;
int32_t audioType;
/* stsd */
int32_t stsd_entry_count;
/* stsz */
int32_t stsz_sample_size;
int32_t stsz_sample_count;
int32_t *stsz_table;
/* stts */
int32_t stts_entry_count;
int32_t *stts_sample_count;
int32_t *stts_sample_delta;
/* stsc */
int32_t stsc_entry_count;
int32_t *stsc_first_chunk;
int32_t *stsc_samples_per_chunk;
int32_t *stsc_sample_desc_index;
/* stsc */
int32_t stco_entry_count;
int32_t *stco_chunk_offset;
/* ctts */
int32_t ctts_entry_count;
int32_t *ctts_sample_count;
int32_t *ctts_sample_offset;
/* esde */
uint8_t *decoderConfig;
int32_t decoderConfigLen;
uint32_t maxBitrate;
uint32_t avgBitrate;
uint32_t timeScale;
uint64_t duration;
#ifdef ITUNES_DRM
/* drms */
void *p_drms;
#endif
} mp4ff_track_t;
/* mp4 main file structure */
typedef struct
{
/* stream to read from */
mp4ff_callback_t *stream;
int64_t current_position;
int32_t moov_read;
uint64_t moov_offset;
uint64_t moov_size;
uint8_t last_atom;
uint64_t file_size;
/* mvhd */
int32_t time_scale;
int32_t duration;
/* incremental track index while reading the file */
int32_t total_tracks;
/* track data */
mp4ff_track_t *track[MAX_TRACKS];
/* metadata */
mp4ff_metadata_t tags;
} mp4ff_t;
/* mp4util.c */
int32_t mp4ff_read_data(mp4ff_t *f, int8_t *data, uint32_t size);
int32_t mp4ff_write_data(mp4ff_t *f, int8_t *data, uint32_t size);
uint64_t mp4ff_read_int64(mp4ff_t *f);
uint32_t mp4ff_read_int32(mp4ff_t *f);
uint32_t mp4ff_read_int24(mp4ff_t *f);
uint16_t mp4ff_read_int16(mp4ff_t *f);
uint8_t mp4ff_read_char(mp4ff_t *f);
int32_t mp4ff_write_int32(mp4ff_t *f,const uint32_t data);
uint32_t mp4ff_read_mp4_descr_length(mp4ff_t *f);
int64_t mp4ff_position(const mp4ff_t *f);
int32_t mp4ff_set_position(mp4ff_t *f, const int64_t position);
int32_t mp4ff_truncate(mp4ff_t * f);
char * mp4ff_read_string(mp4ff_t * f,uint32_t length);
/* mp4atom.c */
static int32_t mp4ff_atom_get_size(const int8_t *data);
static int32_t mp4ff_atom_compare(const int8_t a1, const int8_t b1, const int8_t c1, const int8_t d1,
const int8_t a2, const int8_t b2, const int8_t c2, const int8_t d2);
static uint8_t mp4ff_atom_name_to_type(const int8_t a, const int8_t b, const int8_t c, const int8_t d);
uint64_t mp4ff_atom_read_header(mp4ff_t *f, uint8_t *atom_type, uint8_t *header_size);
static int32_t mp4ff_read_stsz(mp4ff_t *f);
static int32_t mp4ff_read_esds(mp4ff_t *f);
static int32_t mp4ff_read_mp4a(mp4ff_t *f);
static int32_t mp4ff_read_stsd(mp4ff_t *f);
static int32_t mp4ff_read_stsc(mp4ff_t *f);
static int32_t mp4ff_read_stco(mp4ff_t *f);
static int32_t mp4ff_read_stts(mp4ff_t *f);
#ifdef USE_TAGGING
static int32_t mp4ff_read_meta(mp4ff_t *f, const uint64_t size);
#endif
int32_t mp4ff_atom_read(mp4ff_t *f, const int32_t size, const uint8_t atom_type);
/* mp4sample.c */
static int32_t mp4ff_chunk_of_sample(const mp4ff_t *f, const int32_t track, const int32_t sample,
int32_t *chunk_sample, int32_t *chunk);
static int32_t mp4ff_chunk_to_offset(const mp4ff_t *f, const int32_t track, const int32_t chunk);
static int32_t mp4ff_sample_range_size(const mp4ff_t *f, const int32_t track,
const int32_t chunk_sample, const int32_t sample);
static int32_t mp4ff_sample_to_offset(const mp4ff_t *f, const int32_t track, const int32_t sample);
int32_t mp4ff_audio_frame_size(const mp4ff_t *f, const int32_t track, const int32_t sample);
int32_t mp4ff_set_sample_position(mp4ff_t *f, const int32_t track, const int32_t sample);
#ifdef USE_TAGGING
/* mp4meta.c */
static int32_t mp4ff_tag_add_field(mp4ff_metadata_t *tags, const char *item, const char *value);
static int32_t mp4ff_tag_set_field(mp4ff_metadata_t *tags, const char *item, const char *value);
static int32_t mp4ff_set_metadata_name(mp4ff_t *f, const uint8_t atom_type, char **name);
static int32_t mp4ff_parse_tag(mp4ff_t *f, const uint8_t parent_atom_type, const int32_t size);
static int32_t mp4ff_meta_find_by_name(const mp4ff_t *f, const char *item, char **value);
int32_t mp4ff_parse_metadata(mp4ff_t *f, const int32_t size);
int32_t mp4ff_tag_delete(mp4ff_metadata_t *tags);
int32_t mp4ff_meta_get_num_items(const mp4ff_t *f);
int32_t mp4ff_meta_get_by_index(const mp4ff_t *f, uint32_t index,
char **item, char **value);
int32_t mp4ff_meta_get_title(const mp4ff_t *f, char **value);
int32_t mp4ff_meta_get_artist(const mp4ff_t *f, char **value);
int32_t mp4ff_meta_get_writer(const mp4ff_t *f, char **value);
int32_t mp4ff_meta_get_album(const mp4ff_t *f, char **value);
int32_t mp4ff_meta_get_date(const mp4ff_t *f, char **value);
int32_t mp4ff_meta_get_tool(const mp4ff_t *f, char **value);
int32_t mp4ff_meta_get_comment(const mp4ff_t *f, char **value);
int32_t mp4ff_meta_get_genre(const mp4ff_t *f, char **value);
int32_t mp4ff_meta_get_track(const mp4ff_t *f, char **value);
int32_t mp4ff_meta_get_disc(const mp4ff_t *f, char **value);
int32_t mp4ff_meta_get_compilation(const mp4ff_t *f, char **value);
int32_t mp4ff_meta_get_tempo(const mp4ff_t *f, char **value);
int32_t mp4ff_meta_get_coverart(const mp4ff_t *f, char **value);
#endif
/* mp4ff.c */
mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f);
#ifdef USE_TAGGING
mp4ff_t *mp4ff_open_edit(mp4ff_callback_t *f);
#endif
void mp4ff_close(mp4ff_t *ff);
void mp4ff_track_add(mp4ff_t *f);
int32_t parse_sub_atoms(mp4ff_t *f, const uint64_t total_size,int meta_only);
int32_t parse_atoms(mp4ff_t *f,int meta_only);
int32_t mp4ff_get_sample_duration(const mp4ff_t *f, const int32_t track, const int32_t sample);
int64_t mp4ff_get_sample_position(const mp4ff_t *f, const int32_t track, const int32_t sample);
int32_t mp4ff_get_sample_offset(const mp4ff_t *f, const int32_t track, const int32_t sample);
int32_t mp4ff_find_sample(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip);
int32_t mp4ff_read_sample(mp4ff_t *f, const int32_t track, const int32_t sample,
uint8_t **audio_buffer, uint32_t *bytes);
int32_t mp4ff_get_decoder_config(const mp4ff_t *f, const int32_t track,
uint8_t** ppBuf, uint32_t* pBufSize);
int32_t mp4ff_total_tracks(const mp4ff_t *f);
int32_t mp4ff_time_scale(const mp4ff_t *f, const int32_t track);
int32_t mp4ff_num_samples(const mp4ff_t *f, const int32_t track);
uint32_t mp4ff_meta_genre_to_index(const char * genrestr);//returns 1-based index, 0 if not found
const char * mp4ff_meta_index_to_genre(uint32_t idx);//returns pointer to static string
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

View file

@ -0,0 +1,426 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mp4meta.c 19 2005-06-07 04:16:15Z vspader $
**/
#ifdef USE_TAGGING
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "mp4ffint.h"
static int32_t mp4ff_tag_add_field(mp4ff_metadata_t *tags, const char *item, const char *value)
{
void *backup = (void *)tags->tags;
if (!item || (item && !*item) || !value) return 0;
tags->tags = (mp4ff_tag_t*)realloc(tags->tags, (tags->count+1) * sizeof(mp4ff_tag_t));
if (!tags->tags)
{
if (backup) free(backup);
return 0;
} else {
tags->tags[tags->count].item = strdup(item);
tags->tags[tags->count].value = strdup(value);
if (!tags->tags[tags->count].item || !tags->tags[tags->count].value)
{
if (!tags->tags[tags->count].item) free (tags->tags[tags->count].item);
if (!tags->tags[tags->count].value) free (tags->tags[tags->count].value);
tags->tags[tags->count].item = NULL;
tags->tags[tags->count].value = NULL;
return 0;
}
tags->count++;
return 1;
}
}
static int32_t mp4ff_tag_set_field(mp4ff_metadata_t *tags, const char *item, const char *value)
{
unsigned int i;
if (!item || (item && !*item) || !value) return 0;
for (i = 0; i < tags->count; i++)
{
if (!stricmp(tags->tags[i].item, item))
{
free(tags->tags[i].value);
tags->tags[i].value = strdup(value);
return 1;
}
}
return mp4ff_tag_add_field(tags, item, value);
}
int32_t mp4ff_tag_delete(mp4ff_metadata_t *tags)
{
uint32_t i;
for (i = 0; i < tags->count; i++)
{
if (tags->tags[i].item) free(tags->tags[i].item);
if (tags->tags[i].value) free(tags->tags[i].value);
}
if (tags->tags) free(tags->tags);
tags->tags = NULL;
tags->count = 0;
return 0;
}
static const char* ID3v1GenreList[] = {
"Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk",
"Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies",
"Other", "Pop", "R&B", "Rap", "Reggae", "Rock",
"Techno", "Industrial", "Alternative", "Ska", "Death Metal", "Pranks",
"Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk",
"Fusion", "Trance", "Classical", "Instrumental", "Acid", "House",
"Game", "Sound Clip", "Gospel", "Noise", "AlternRock", "Bass",
"Soul", "Punk", "Space", "Meditative", "Instrumental Pop", "Instrumental Rock",
"Ethnic", "Gothic", "Darkwave", "Techno-Industrial", "Electronic", "Pop-Folk",
"Eurodance", "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta",
"Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American", "Cabaret",
"New Wave", "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi",
"Tribal", "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical",
"Rock & Roll", "Hard Rock", "Folk", "Folk/Rock", "National Folk", "Swing",
"Fast-Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde",
"Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", "Big Band",
"Chorus", "Easy Listening", "Acoustic", "Humour", "Speech", "Chanson",
"Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus",
"Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba",
"Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet",
"Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall",
"Goa", "Drum & Bass", "Club House", "Hardcore", "Terror",
"Indie", "BritPop", "NegerPunk", "Polsk Punk", "Beat",
"Christian Gangsta", "Heavy Metal", "Black Metal", "Crossover", "Contemporary C",
"Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop",
"SynthPop",
};
uint32_t mp4ff_meta_genre_to_index(const char * genrestr)
{
unsigned n;
for(n=0;n<sizeof(ID3v1GenreList)/sizeof(ID3v1GenreList[0]);n++)
{
if (!stricmp(genrestr,ID3v1GenreList[n])) return n+1;
}
return 0;
}
const char * mp4ff_meta_index_to_genre(uint32_t idx)
{
if (idx>0 && idx<=sizeof(ID3v1GenreList)/sizeof(ID3v1GenreList[0]))
{
return ID3v1GenreList[idx-1];
}
else
{
return 0;
}
}
static int32_t TrackToString(char** str, const uint16_t track, const uint16_t totalTracks)
{
char temp[32];
sprintf(temp, "%.5u of %.5u", track, totalTracks);
*str = strdup(temp);
return 0;
}
static int32_t mp4ff_set_metadata_name(mp4ff_t *f, const uint8_t atom_type, char **name)
{
static char *tag_names[] = {
"unknown", "title", "artist", "writer", "album",
"date", "tool", "comment", "genre", "track",
"disc", "compilation", "genre", "tempo", "cover"
};
uint8_t tag_idx = 0;
switch (atom_type)
{
case ATOM_TITLE: tag_idx = 1; break;
case ATOM_ARTIST: tag_idx = 2; break;
case ATOM_WRITER: tag_idx = 3; break;
case ATOM_ALBUM: tag_idx = 4; break;
case ATOM_DATE: tag_idx = 5; break;
case ATOM_TOOL: tag_idx = 6; break;
case ATOM_COMMENT: tag_idx = 7; break;
case ATOM_GENRE1: tag_idx = 8; break;
case ATOM_TRACK: tag_idx = 9; break;
case ATOM_DISC: tag_idx = 10; break;
case ATOM_COMPILATION: tag_idx = 11; break;
case ATOM_GENRE2: tag_idx = 12; break;
case ATOM_TEMPO: tag_idx = 13; break;
case ATOM_COVER: tag_idx = 14; break;
default: tag_idx = 0; break;
}
*name = strdup(tag_names[tag_idx]);
return 0;
}
static int32_t mp4ff_parse_tag(mp4ff_t *f, const uint8_t parent_atom_type, const int32_t size)
{
uint8_t atom_type;
uint8_t header_size = 0;
uint64_t subsize, sumsize = 0;
char * name = NULL;
char * data = NULL;
uint32_t done = 0;
while (sumsize < size)
{
uint64_t destpos;
subsize = mp4ff_atom_read_header(f, &atom_type, &header_size);
destpos = mp4ff_position(f)+subsize-header_size;
if (!done)
{
if (atom_type == ATOM_DATA)
{
mp4ff_read_char(f); /* version */
mp4ff_read_int24(f); /* flags */
mp4ff_read_int32(f); /* reserved */
/* some need special attention */
if (parent_atom_type == ATOM_GENRE2 || parent_atom_type == ATOM_TEMPO)
{
if (subsize - header_size >= 8 + 2)
{
uint16_t val = mp4ff_read_int16(f);
if (parent_atom_type == ATOM_TEMPO)
{
char temp[16];
sprintf(temp, "%.5u BPM", val);
mp4ff_tag_add_field(&(f->tags), "tempo", temp);
}
else
{
const char * temp = mp4ff_meta_index_to_genre(val);
if (temp)
{
mp4ff_tag_add_field(&(f->tags), "genre", temp);
}
}
done = 1;
}
} else if (parent_atom_type == ATOM_TRACK || parent_atom_type == ATOM_DISC) {
if (!done && subsize - header_size >= 8 + 8)
{
uint16_t index,total;
char temp[32];
mp4ff_read_int16(f);
index = mp4ff_read_int16(f);
total = mp4ff_read_int16(f);
mp4ff_read_int16(f);
sprintf(temp,"%d",index);
mp4ff_tag_add_field(&(f->tags), parent_atom_type == ATOM_TRACK ? "track" : "disc", temp);
if (total>0)
{
sprintf(temp,"%d",total);
mp4ff_tag_add_field(&(f->tags), parent_atom_type == ATOM_TRACK ? "totaltracks" : "totaldiscs", temp);
}
done = 1;
}
} else
{
if (data) {free(data);data = NULL;}
data = mp4ff_read_string(f,(uint32_t)(subsize-(header_size+8)));
}
} else if (atom_type == ATOM_NAME) {
if (!done)
{
mp4ff_read_char(f); /* version */
mp4ff_read_int24(f); /* flags */
if (name) free(name);
name = mp4ff_read_string(f,(uint32_t)(subsize-(header_size+4)));
}
}
mp4ff_set_position(f, destpos);
sumsize += subsize;
}
}
if (data)
{
if (!done)
{
if (name == NULL) mp4ff_set_metadata_name(f, parent_atom_type, &name);
if (name) mp4ff_tag_add_field(&(f->tags), name, data);
}
free(data);
}
if (name) free(name);
return 1;
}
int32_t mp4ff_parse_metadata(mp4ff_t *f, const int32_t size)
{
uint64_t subsize, sumsize = 0;
uint8_t atom_type;
uint8_t header_size = 0;
while (sumsize < size)
{
subsize = mp4ff_atom_read_header(f, &atom_type, &header_size);
mp4ff_parse_tag(f, atom_type, (uint32_t)(subsize-header_size));
sumsize += subsize;
}
return 0;
}
/* find a metadata item by name */
/* returns 0 if item found, 1 if no such item */
static int32_t mp4ff_meta_find_by_name(const mp4ff_t *f, const char *item, char **value)
{
uint32_t i;
for (i = 0; i < f->tags.count; i++)
{
if (!stricmp(f->tags.tags[i].item, item))
{
*value = strdup(f->tags.tags[i].value);
return 1;
}
}
*value = NULL;
/* not found */
return 0;
}
int32_t mp4ff_meta_get_num_items(const mp4ff_t *f)
{
return f->tags.count;
}
int32_t mp4ff_meta_get_by_index(const mp4ff_t *f, uint32_t index,
char **item, char **value)
{
if (index >= f->tags.count)
{
*item = NULL;
*value = NULL;
return 0;
} else {
*item = strdup(f->tags.tags[index].item);
*value = strdup(f->tags.tags[index].value);
return 1;
}
}
int32_t mp4ff_meta_get_title(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "title", value);
}
int32_t mp4ff_meta_get_artist(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "artist", value);
}
int32_t mp4ff_meta_get_writer(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "writer", value);
}
int32_t mp4ff_meta_get_album(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "album", value);
}
int32_t mp4ff_meta_get_date(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "date", value);
}
int32_t mp4ff_meta_get_tool(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "tool", value);
}
int32_t mp4ff_meta_get_comment(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "comment", value);
}
int32_t mp4ff_meta_get_genre(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "genre", value);
}
int32_t mp4ff_meta_get_track(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "track", value);
}
int32_t mp4ff_meta_get_totaltracks(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "totaltracks", value);
}
int32_t mp4ff_meta_get_disc(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "disc", value);
}
int32_t mp4ff_meta_get_totaldiscs(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "totaldiscs", value);
}
int32_t mp4ff_meta_get_compilation(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "compilation", value);
}
int32_t mp4ff_meta_get_tempo(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "tempo", value);
}
int32_t mp4ff_meta_get_coverart(const mp4ff_t *f, char **value)
{
return mp4ff_meta_find_by_name(f, "cover", value);
}
#endif

View file

@ -0,0 +1,152 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mp4sample.c 19 2005-06-07 04:16:15Z vspader $
**/
#include <stdlib.h>
#include "mp4ffint.h"
static int32_t mp4ff_chunk_of_sample(const mp4ff_t *f, const int32_t track, const int32_t sample,
int32_t *chunk_sample, int32_t *chunk)
{
int32_t total_entries = 0;
int32_t chunk2entry;
int32_t chunk1, chunk2, chunk1samples, range_samples, total = 0;
if (f->track[track] == NULL)
{
return -1;
}
total_entries = f->track[track]->stsc_entry_count;
chunk1 = 1;
chunk1samples = 0;
chunk2entry = 0;
do
{
chunk2 = f->track[track]->stsc_first_chunk[chunk2entry];
*chunk = chunk2 - chunk1;
range_samples = *chunk * chunk1samples;
if (sample < total + range_samples) break;
chunk1samples = f->track[track]->stsc_samples_per_chunk[chunk2entry];
chunk1 = chunk2;
if(chunk2entry < total_entries)
{
chunk2entry++;
total += range_samples;
}
} while (chunk2entry < total_entries);
if (chunk1samples)
*chunk = (sample - total) / chunk1samples + chunk1;
else
*chunk = 1;
*chunk_sample = total + (*chunk - chunk1) * chunk1samples;
return 0;
}
static int32_t mp4ff_chunk_to_offset(const mp4ff_t *f, const int32_t track, const int32_t chunk)
{
const mp4ff_track_t * p_track = f->track[track];
if (p_track->stco_entry_count && (chunk > p_track->stco_entry_count))
{
return p_track->stco_chunk_offset[p_track->stco_entry_count - 1];
} else if (p_track->stco_entry_count) {
return p_track->stco_chunk_offset[chunk - 1];
} else {
return 8;
}
return 0;
}
static int32_t mp4ff_sample_range_size(const mp4ff_t *f, const int32_t track,
const int32_t chunk_sample, const int32_t sample)
{
int32_t i, total;
const mp4ff_track_t * p_track = f->track[track];
if (p_track->stsz_sample_size)
{
return (sample - chunk_sample) * p_track->stsz_sample_size;
}
else
{
if (sample>=p_track->stsz_sample_count) return 0;//error
for(i = chunk_sample, total = 0; i < sample; i++)
{
total += p_track->stsz_table[i];
}
}
return total;
}
static int32_t mp4ff_sample_to_offset(const mp4ff_t *f, const int32_t track, const int32_t sample)
{
int32_t chunk, chunk_sample, chunk_offset1, chunk_offset2;
mp4ff_chunk_of_sample(f, track, sample, &chunk_sample, &chunk);
chunk_offset1 = mp4ff_chunk_to_offset(f, track, chunk);
chunk_offset2 = chunk_offset1 + mp4ff_sample_range_size(f, track, chunk_sample, sample);
return chunk_offset2;
}
int32_t mp4ff_audio_frame_size(const mp4ff_t *f, const int32_t track, const int32_t sample)
{
int32_t bytes;
const mp4ff_track_t * p_track = f->track[track];
if (p_track->stsz_sample_size)
{
bytes = p_track->stsz_sample_size;
} else {
bytes = p_track->stsz_table[sample];
}
return bytes;
}
int32_t mp4ff_set_sample_position(mp4ff_t *f, const int32_t track, const int32_t sample)
{
int32_t offset;
offset = mp4ff_sample_to_offset(f, track, sample);
mp4ff_set_position(f, offset);
return 0;
}

View file

@ -0,0 +1,645 @@
#include <stdlib.h>
#include <string.h>
#include "mp4ffint.h"
#ifdef USE_TAGGING
static uint32_t fix_byte_order_32(uint32_t src)
{
uint32_t result;
uint32_t a, b, c, d;
int8_t data[4];
memcpy(data,&src,sizeof(src));
a = (uint8_t)data[0];
b = (uint8_t)data[1];
c = (uint8_t)data[2];
d = (uint8_t)data[3];
result = (a<<24) | (b<<16) | (c<<8) | d;
return (uint32_t)result;
}
static uint16_t fix_byte_order_16(uint16_t src)
{
uint16_t result;
uint16_t a, b;
int8_t data[2];
memcpy(data,&src,sizeof(src));
a = (uint8_t)data[0];
b = (uint8_t)data[1];
result = (a<<8) | b;
return (uint16_t)result;
}
typedef struct
{
void * data;
unsigned written;
unsigned allocated;
unsigned error;
} membuffer;
unsigned membuffer_write(membuffer * buf,const void * ptr,unsigned bytes)
{
unsigned dest_size = buf->written + bytes;
if (buf->error) return 0;
if (dest_size > buf->allocated)
{
do
{
buf->allocated <<= 1;
} while(dest_size > buf->allocated);
{
void * newptr = realloc(buf->data,buf->allocated);
if (newptr==0)
{
free(buf->data);
buf->data = 0;
buf->error = 1;
return 0;
}
buf->data = newptr;
}
}
if (ptr) memcpy((char*)buf->data + buf->written,ptr,bytes);
buf->written += bytes;
return bytes;
}
#define membuffer_write_data membuffer_write
unsigned membuffer_write_int32(membuffer * buf,uint32_t data)
{
uint8_t temp[4] = {(uint8_t)(data>>24),(uint8_t)(data>>16),(uint8_t)(data>>8),(uint8_t)data};
return membuffer_write_data(buf,temp,4);
}
unsigned membuffer_write_int24(membuffer * buf,uint32_t data)
{
uint8_t temp[3] = {(uint8_t)(data>>16),(uint8_t)(data>>8),(uint8_t)data};
return membuffer_write_data(buf,temp,3);
}
unsigned membuffer_write_int16(membuffer * buf,uint16_t data)
{
uint8_t temp[2] = {(uint8_t)(data>>8),(uint8_t)data};
return membuffer_write_data(buf,temp,2);
}
unsigned membuffer_write_atom_name(membuffer * buf,const char * data)
{
return membuffer_write_data(buf,data,4)==4 ? 1 : 0;
}
void membuffer_write_atom(membuffer * buf,const char * name,unsigned size,const void * data)
{
membuffer_write_int32(buf,size + 8);
membuffer_write_atom_name(buf,name);
membuffer_write_data(buf,data,size);
}
unsigned membuffer_write_string(membuffer * buf,const char * data)
{
return membuffer_write_data(buf,data,strlen(data));
}
unsigned membuffer_write_int8(membuffer * buf,uint8_t data)
{
return membuffer_write_data(buf,&data,1);
}
void * membuffer_get_ptr(const membuffer * buf)
{
return buf->data;
}
unsigned membuffer_get_size(const membuffer * buf)
{
return buf->written;
}
unsigned membuffer_error(const membuffer * buf)
{
return buf->error;
}
void membuffer_set_error(membuffer * buf) {buf->error = 1;}
unsigned membuffer_transfer_from_file(membuffer * buf,mp4ff_t * src,unsigned bytes)
{
unsigned oldsize;
void * bufptr;
oldsize = membuffer_get_size(buf);
if (membuffer_write_data(buf,0,bytes) != bytes) return 0;
bufptr = membuffer_get_ptr(buf);
if (bufptr==0) return 0;
if ((unsigned)mp4ff_read_data(src,(char*)bufptr + oldsize,bytes)!=bytes)
{
membuffer_set_error(buf);
return 0;
}
return bytes;
}
membuffer * membuffer_create()
{
const unsigned initial_size = 256;
membuffer * buf = (membuffer *) malloc(sizeof(membuffer));
buf->data = malloc(initial_size);
buf->written = 0;
buf->allocated = initial_size;
buf->error = buf->data == 0 ? 1 : 0;
return buf;
}
void membuffer_free(membuffer * buf)
{
if (buf->data) free(buf->data);
free(buf);
}
void * membuffer_detach(membuffer * buf)
{
void * ret;
if (buf->error) return 0;
ret = realloc(buf->data,buf->written);
if (ret == 0) free(buf->data);
buf->data = 0;
buf->error = 1;
return ret;
}
#if 0
/* metadata tag structure */
typedef struct
{
char *item;
char *value;
} mp4ff_tag_t;
/* metadata list structure */
typedef struct
{
mp4ff_tag_t *tags;
uint32_t count;
} mp4ff_metadata_t;
#endif
typedef struct
{
const char * atom;
const char * name;
} stdmeta_entry;
static stdmeta_entry stdmetas[] =
{
{"©nam","title"},
{"©ART","artist"},
{"©wrt","writer"},
{"©alb","album"},
{"©day","date"},
{"©too","tool"},
{"©cmt","comment"},
// {"©gen","genre"},
{"cpil","compilation"},
// {"trkn","track"},
// {"disk","disc"},
// {"gnre","genre"},
{"covr","cover"},
};
static const char* find_standard_meta(const char * name) //returns atom name if found, 0 if not
{
unsigned n;
for(n=0;n<sizeof(stdmetas)/sizeof(stdmetas[0]);n++)
{
if (!stricmp(name,stdmetas[n].name)) return stdmetas[n].atom;
}
return 0;
}
static void membuffer_write_track_tag(membuffer * buf,const char * name,uint32_t index,uint32_t total)
{
membuffer_write_int32(buf,8 /*atom header*/ + 8 /*data atom header*/ + 8 /*flags + reserved*/ + 8 /*actual data*/ );
membuffer_write_atom_name(buf,name);
membuffer_write_int32(buf,8 /*data atom header*/ + 8 /*flags + reserved*/ + 8 /*actual data*/ );
membuffer_write_atom_name(buf,"data");
membuffer_write_int32(buf,0);//flags
membuffer_write_int32(buf,0);//reserved
membuffer_write_int16(buf,0);
membuffer_write_int16(buf,(uint16_t)index);//track number
membuffer_write_int16(buf,(uint16_t)total);//total tracks
membuffer_write_int16(buf,0);
}
static void membuffer_write_int16_tag(membuffer * buf,const char * name,uint16_t value)
{
membuffer_write_int32(buf,8 /*atom header*/ + 8 /*data atom header*/ + 8 /*flags + reserved*/ + 2 /*actual data*/ );
membuffer_write_atom_name(buf,name);
membuffer_write_int32(buf,8 /*data atom header*/ + 8 /*flags + reserved*/ + 2 /*actual data*/ );
membuffer_write_atom_name(buf,"data");
membuffer_write_int32(buf,0);//flags
membuffer_write_int32(buf,0);//reserved
membuffer_write_int16(buf,value);//value
}
static void membuffer_write_std_tag(membuffer * buf,const char * name,const char * value)
{
membuffer_write_int32(buf,8 /*atom header*/ + 8 /*data atom header*/ + 8 /*flags + reserved*/ + strlen(value) );
membuffer_write_atom_name(buf,name);
membuffer_write_int32(buf,8 /*data atom header*/ + 8 /*flags + reserved*/ + strlen(value));
membuffer_write_atom_name(buf,"data");
membuffer_write_int32(buf,1);//flags
membuffer_write_int32(buf,0);//reserved
membuffer_write_data(buf,value,strlen(value));
}
static void membuffer_write_custom_tag(membuffer * buf,const char * name,const char * value)
{
membuffer_write_int32(buf,8 /*atom header*/ + 0x1C /*weirdo itunes atom*/ + 12 /*name atom header*/ + strlen(name) + 16 /*data atom header + flags*/ + strlen(value) );
membuffer_write_atom_name(buf,"----");
membuffer_write_int32(buf,0x1C);//weirdo itunes atom
membuffer_write_atom_name(buf,"mean");
membuffer_write_int32(buf,0);
membuffer_write_data(buf,"com.apple.iTunes",16);
membuffer_write_int32(buf,12 + strlen(name));
membuffer_write_atom_name(buf,"name");
membuffer_write_int32(buf,0);
membuffer_write_data(buf,name,strlen(name));
membuffer_write_int32(buf,8 /*data atom header*/ + 8 /*flags + reserved*/ + strlen(value));
membuffer_write_atom_name(buf,"data");
membuffer_write_int32(buf,1);//flags
membuffer_write_int32(buf,0);//reserved
membuffer_write_data(buf,value,strlen(value));
}
static uint32_t myatoi(const char * param)
{
return param ? atoi(param) : 0;
}
static uint32_t create_ilst(const mp4ff_metadata_t * data,void ** out_buffer,uint32_t * out_size)
{
membuffer * buf = membuffer_create();
unsigned metaptr;
char * mask = (char*)malloc(data->count);
memset(mask,0,data->count);
{
const char * tracknumber_ptr = 0, * totaltracks_ptr = 0;
const char * discnumber_ptr = 0, * totaldiscs_ptr = 0;
const char * genre_ptr = 0, * tempo_ptr = 0;
for(metaptr = 0; metaptr < data->count; metaptr++)
{
mp4ff_tag_t * tag = &data->tags[metaptr];
if (!stricmp(tag->item,"tracknumber") || !stricmp(tag->item,"track"))
{
if (tracknumber_ptr==0) tracknumber_ptr = tag->value;
mask[metaptr] = 1;
}
else if (!stricmp(tag->item,"totaltracks"))
{
if (totaltracks_ptr==0) totaltracks_ptr = tag->value;
mask[metaptr] = 1;
}
else if (!stricmp(tag->item,"discnumber") || !stricmp(tag->item,"disc"))
{
if (discnumber_ptr==0) discnumber_ptr = tag->value;
mask[metaptr] = 1;
}
else if (!stricmp(tag->item,"totaldiscs"))
{
if (totaldiscs_ptr==0) totaldiscs_ptr = tag->value;
mask[metaptr] = 1;
}
else if (!stricmp(tag->item,"genre"))
{
if (genre_ptr==0) genre_ptr = tag->value;
mask[metaptr] = 1;
}
else if (!stricmp(tag->item,"tempo"))
{
if (tempo_ptr==0) tempo_ptr = tag->value;
mask[metaptr] = 1;
}
}
if (tracknumber_ptr) membuffer_write_track_tag(buf,"trkn",myatoi(tracknumber_ptr),myatoi(totaltracks_ptr));
if (discnumber_ptr) membuffer_write_track_tag(buf,"disk",myatoi(discnumber_ptr),myatoi(totaldiscs_ptr));
if (tempo_ptr) membuffer_write_int16_tag(buf,"tmpo",(uint16_t)myatoi(tempo_ptr));
if (genre_ptr)
{
uint32_t index = mp4ff_meta_genre_to_index(genre_ptr);
if (index==0)
membuffer_write_std_tag(buf,"©gen",genre_ptr);
else
membuffer_write_int16_tag(buf,"gnre",(uint16_t)index);
}
}
for(metaptr = 0; metaptr < data->count; metaptr++)
{
if (!mask[metaptr])
{
mp4ff_tag_t * tag = &data->tags[metaptr];
const char * std_meta_atom = find_standard_meta(tag->item);
if (std_meta_atom)
{
membuffer_write_std_tag(buf,std_meta_atom,tag->value);
}
else
{
membuffer_write_custom_tag(buf,tag->item,tag->value);
}
}
}
free(mask);
if (membuffer_error(buf))
{
membuffer_free(buf);
return 0;
}
*out_size = membuffer_get_size(buf);
*out_buffer = membuffer_detach(buf);
membuffer_free(buf);
return 1;
}
static uint32_t find_atom(mp4ff_t * f,uint64_t base,uint32_t size,const char * name)
{
uint32_t remaining = size;
uint64_t atom_offset = base;
for(;;)
{
char atom_name[4];
uint32_t atom_size;
mp4ff_set_position(f,atom_offset);
if (remaining < 8) break;
atom_size = mp4ff_read_int32(f);
if (atom_size > remaining || atom_size < 8) break;
mp4ff_read_data(f,atom_name,4);
if (!memcmp(atom_name,name,4))
{
mp4ff_set_position(f,atom_offset);
return 1;
}
remaining -= atom_size;
atom_offset += atom_size;
}
return 0;
}
static uint32_t find_atom_v2(mp4ff_t * f,uint64_t base,uint32_t size,const char * name,uint32_t extraheaders,const char * name_inside)
{
uint64_t first_base = (uint64_t)(-1);
while(find_atom(f,base,size,name))//try to find atom <name> with atom <name_inside> in it
{
uint64_t mybase = mp4ff_position(f);
uint32_t mysize = mp4ff_read_int32(f);
if (first_base == (uint64_t)(-1)) first_base = mybase;
if (mysize < 8 + extraheaders) break;
if (find_atom(f,mybase+(8+extraheaders),mysize-(8+extraheaders),name_inside))
{
mp4ff_set_position(f,mybase);
return 2;
}
base += mysize;
if (size<=mysize) {size=0;break;}
size -= mysize;
}
if (first_base != (uint64_t)(-1))//wanted atom inside not found
{
mp4ff_set_position(f,first_base);
return 1;
}
else return 0;
}
static uint32_t create_meta(const mp4ff_metadata_t * data,void ** out_buffer,uint32_t * out_size)
{
membuffer * buf;
uint32_t ilst_size;
void * ilst_buffer;
if (!create_ilst(data,&ilst_buffer,&ilst_size)) return 0;
buf = membuffer_create();
membuffer_write_int32(buf,0);
membuffer_write_atom(buf,"ilst",ilst_size,ilst_buffer);
free(ilst_buffer);
*out_size = membuffer_get_size(buf);
*out_buffer = membuffer_detach(buf);
membuffer_free(buf);
return 1;
}
static uint32_t create_udta(const mp4ff_metadata_t * data,void ** out_buffer,uint32_t * out_size)
{
membuffer * buf;
uint32_t meta_size;
void * meta_buffer;
if (!create_meta(data,&meta_buffer,&meta_size)) return 0;
buf = membuffer_create();
membuffer_write_atom(buf,"meta",meta_size,meta_buffer);
free(meta_buffer);
*out_size = membuffer_get_size(buf);
*out_buffer = membuffer_detach(buf);
membuffer_free(buf);
return 1;
}
static uint32_t modify_moov(mp4ff_t * f,const mp4ff_metadata_t * data,void ** out_buffer,uint32_t * out_size)
{
uint64_t total_base = f->moov_offset + 8;
uint32_t total_size = (uint32_t)(f->moov_size - 8);
uint64_t udta_offset,meta_offset,ilst_offset;
uint32_t udta_size, meta_size, ilst_size;
uint32_t new_ilst_size;
void * new_ilst_buffer;
uint8_t * p_out;
int32_t size_delta;
if (!find_atom_v2(f,total_base,total_size,"udta",0,"meta"))
{
membuffer * buf;
void * new_udta_buffer;
uint32_t new_udta_size;
if (!create_udta(data,&new_udta_buffer,&new_udta_size)) return 0;
buf = membuffer_create();
mp4ff_set_position(f,total_base);
membuffer_transfer_from_file(buf,f,total_size);
membuffer_write_atom(buf,"udta",new_udta_size,new_udta_buffer);
free(new_udta_buffer);
*out_size = membuffer_get_size(buf);
*out_buffer = membuffer_detach(buf);
membuffer_free(buf);
return 1;
}
else
{
udta_offset = mp4ff_position(f);
udta_size = mp4ff_read_int32(f);
if (find_atom_v2(f,udta_offset+8,udta_size-8,"meta",4,"ilst")<2)
{
membuffer * buf;
void * new_meta_buffer;
uint32_t new_meta_size;
if (!create_meta(data,&new_meta_buffer,&new_meta_size)) return 0;
buf = membuffer_create();
mp4ff_set_position(f,total_base);
membuffer_transfer_from_file(buf,f,(uint32_t)(udta_offset - total_base));
membuffer_write_int32(buf,udta_size + 8 + new_meta_size);
membuffer_write_atom_name(buf,"udta");
membuffer_transfer_from_file(buf,f,udta_size);
membuffer_write_atom(buf,"meta",new_meta_size,new_meta_buffer);
free(new_meta_buffer);
*out_size = membuffer_get_size(buf);
*out_buffer = membuffer_detach(buf);
membuffer_free(buf);
return 1;
}
meta_offset = mp4ff_position(f);
meta_size = mp4ff_read_int32(f);
if (!find_atom(f,meta_offset+12,meta_size-12,"ilst")) return 0;//shouldn't happen, find_atom_v2 above takes care of it
ilst_offset = mp4ff_position(f);
ilst_size = mp4ff_read_int32(f);
if (!create_ilst(data,&new_ilst_buffer,&new_ilst_size)) return 0;
size_delta = new_ilst_size - (ilst_size - 8);
*out_size = total_size + size_delta;
*out_buffer = malloc(*out_size);
if (*out_buffer == 0)
{
free(new_ilst_buffer);
return 0;
}
p_out = (uint8_t*)*out_buffer;
mp4ff_set_position(f,total_base);
mp4ff_read_data(f,p_out,(uint32_t)(udta_offset - total_base )); p_out += (uint32_t)(udta_offset - total_base );
*(uint32_t*)p_out = fix_byte_order_32(mp4ff_read_int32(f) + size_delta); p_out += 4;
mp4ff_read_data(f,p_out,4); p_out += 4;
mp4ff_read_data(f,p_out,(uint32_t)(meta_offset - udta_offset - 8)); p_out += (uint32_t)(meta_offset - udta_offset - 8);
*(uint32_t*)p_out = fix_byte_order_32(mp4ff_read_int32(f) + size_delta); p_out += 4;
mp4ff_read_data(f,p_out,4); p_out += 4;
mp4ff_read_data(f,p_out,(uint32_t)(ilst_offset - meta_offset - 8)); p_out += (uint32_t)(ilst_offset - meta_offset - 8);
*(uint32_t*)p_out = fix_byte_order_32(mp4ff_read_int32(f) + size_delta); p_out += 4;
mp4ff_read_data(f,p_out,4); p_out += 4;
memcpy(p_out,new_ilst_buffer,new_ilst_size);
p_out += new_ilst_size;
mp4ff_set_position(f,ilst_offset + ilst_size);
mp4ff_read_data(f,p_out,(uint32_t)(total_size - (ilst_offset - total_base) - ilst_size));
free(new_ilst_buffer);
}
return 1;
}
int32_t mp4ff_meta_update(mp4ff_callback_t *f,const mp4ff_metadata_t * data)
{
void * new_moov_data;
uint32_t new_moov_size;
mp4ff_t *ff = malloc(sizeof(mp4ff_t));
memset(ff, 0, sizeof(mp4ff_t));
ff->stream = f;
mp4ff_set_position(ff,0);
parse_atoms(ff,1);
if (!modify_moov(ff,data,&new_moov_data,&new_moov_size))
{
mp4ff_close(ff);
return 0;
}
/* copy moov atom to end of the file */
if (ff->last_atom != ATOM_MOOV)
{
char *free_data = "free";
/* rename old moov to free */
mp4ff_set_position(ff, ff->moov_offset + 4);
mp4ff_write_data(ff, free_data, 4);
mp4ff_set_position(ff, ff->file_size);
mp4ff_write_int32(ff,new_moov_size + 8);
mp4ff_write_data(ff,"moov",4);
mp4ff_write_data(ff, new_moov_data, new_moov_size);
}
else
{
mp4ff_set_position(ff, ff->moov_offset);
mp4ff_write_int32(ff,new_moov_size + 8);
mp4ff_write_data(ff,"moov",4);
mp4ff_write_data(ff, new_moov_data, new_moov_size);
}
mp4ff_truncate(ff);
mp4ff_close(ff);
return 1;
}
#endif

View file

@ -0,0 +1,188 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mp4util.c 19 2005-06-07 04:16:15Z vspader $
**/
#include "mp4ffint.h"
#include <stdlib.h>
int32_t mp4ff_read_data(mp4ff_t *f, int8_t *data, uint32_t size)
{
int32_t result = 1;
result = f->stream->read(f->stream->user_data, data, size);
f->current_position += size;
return result;
}
int32_t mp4ff_truncate(mp4ff_t * f)
{
return f->stream->truncate(f->stream->user_data);
}
int32_t mp4ff_write_data(mp4ff_t *f, int8_t *data, uint32_t size)
{
int32_t result = 1;
result = f->stream->write(f->stream->user_data, data, size);
f->current_position += size;
return result;
}
int32_t mp4ff_write_int32(mp4ff_t *f,const uint32_t data)
{
uint32_t result;
uint32_t a, b, c, d;
int8_t temp[4];
*(uint32_t*)temp = data;
a = (uint8_t)temp[0];
b = (uint8_t)temp[1];
c = (uint8_t)temp[2];
d = (uint8_t)temp[3];
result = (a<<24) | (b<<16) | (c<<8) | d;
return mp4ff_write_data(f,(uint8_t*)&result,sizeof(result));
}
int32_t mp4ff_set_position(mp4ff_t *f, const int64_t position)
{
f->stream->seek(f->stream->user_data, position);
f->current_position = position;
return 0;
}
int64_t mp4ff_position(const mp4ff_t *f)
{
return f->current_position;
}
uint64_t mp4ff_read_int64(mp4ff_t *f)
{
uint8_t data[8];
uint64_t result = 0;
int8_t i;
mp4ff_read_data(f, data, 8);
for (i = 0; i < 8; i++)
{
result |= ((uint64_t)data[i]) << ((7 - i) * 8);
}
return result;
}
uint32_t mp4ff_read_int32(mp4ff_t *f)
{
uint32_t result;
uint32_t a, b, c, d;
int8_t data[4];
mp4ff_read_data(f, data, 4);
a = (uint8_t)data[0];
b = (uint8_t)data[1];
c = (uint8_t)data[2];
d = (uint8_t)data[3];
result = (a<<24) | (b<<16) | (c<<8) | d;
return (uint32_t)result;
}
uint32_t mp4ff_read_int24(mp4ff_t *f)
{
uint32_t result;
uint32_t a, b, c;
int8_t data[4];
mp4ff_read_data(f, data, 3);
a = (uint8_t)data[0];
b = (uint8_t)data[1];
c = (uint8_t)data[2];
result = (a<<16) | (b<<8) | c;
return (uint32_t)result;
}
uint16_t mp4ff_read_int16(mp4ff_t *f)
{
uint32_t result;
uint32_t a, b;
int8_t data[2];
mp4ff_read_data(f, data, 2);
a = (uint8_t)data[0];
b = (uint8_t)data[1];
result = (a<<8) | b;
return (uint16_t)result;
}
char * mp4ff_read_string(mp4ff_t * f,uint32_t length)
{
char * str = (char*)malloc(length + 1);
if (str!=0)
{
if ((uint32_t)mp4ff_read_data(f,str,length)!=length)
{
free(str);
str = 0;
}
else
{
str[length] = 0;
}
}
return str;
}
uint8_t mp4ff_read_char(mp4ff_t *f)
{
uint8_t output;
mp4ff_read_data(f, &output, 1);
return output;
}
uint32_t mp4ff_read_mp4_descr_length(mp4ff_t *f)
{
uint8_t b;
uint8_t numBytes = 0;
uint32_t length = 0;
do
{
b = mp4ff_read_char(f);
numBytes++;
length = (length << 7) | (b & 0x7F);
} while ((b & 0x80) && numBytes < 4);
return length;
}

View file

@ -0,0 +1,113 @@
/* config.h. Generated by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
/* Define if you want to use libfaad together with Digital Radio Mondiale
(DRM) */
/* #undef DRM */
#define DRM
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define if needed */
/* #undef HAVE_FLOAT32_T */
/* Define to 1 if you have the <float.h> header file. */
#define HAVE_FLOAT_H 1
/* Define to 1 if you have the `getpwuid' function. */
#define HAVE_GETPWUID 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define if you have the IOKit API */
#define HAVE_IOKIT_IOKITLIB_H 1
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the <mathf.h> header file. */
/* #undef HAVE_MATHF_H */
/* Define to 1 if you have the `memcpy' function. */
#define HAVE_MEMCPY 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strsep' function. */
#define HAVE_STRSEP 1
/* Define to 1 if you have the <sysfs/libsysfs.h> header file. */
/* #undef HAVE_SYSFS_LIBSYSFS_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Name of package */
#define PACKAGE "faad2"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Version number of package */
#define VERSION "2.0"
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#define WORDS_BIGENDIAN 1
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to `long' if <sys/types.h> does not define. */
/* #undef off_t */

View file

@ -0,0 +1,32 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: faad.h 3 2005-06-02 18:16:43Z vspader $
**/
/* warn people for update */
#pragma message("please update faad2 include filename and function names!")
/* Backwards compatible link */
#include "neaacdec.h"

View file

@ -0,0 +1,252 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: neaacdec.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __NEAACDEC_H__
#define __NEAACDEC_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#if 1
/* MACROS FOR BACKWARDS COMPATIBILITY */
/* structs */
#define faacDecHandle NeAACDecHandle
#define faacDecConfiguration NeAACDecConfiguration
#define faacDecConfigurationPtr NeAACDecConfigurationPtr
#define faacDecFrameInfo NeAACDecFrameInfo
/* functions */
#define faacDecGetErrorMessage NeAACDecGetErrorMessage
#define faacDecSetConfiguration NeAACDecSetConfiguration
#define faacDecGetCurrentConfiguration NeAACDecGetCurrentConfiguration
#define faacDecInit NeAACDecInit
#define faacDecInit2 NeAACDecInit2
#define faacDecInitDRM NeAACDecInitDRM
#define faacDecPostSeekReset NeAACDecPostSeekReset
#define faacDecOpen NeAACDecOpen
#define faacDecClose NeAACDecClose
#define faacDecDecode NeAACDecDecode
#define AudioSpecificConfig NeAACDecAudioSpecificConfig
#endif
#ifdef _WIN32
#pragma pack(push, 8)
#ifndef NEAACDECAPI
#define NEAACDECAPI __cdecl
#endif
#else
#ifndef NEAACDECAPI
#define NEAACDECAPI
#endif
#endif
#define FAAD2_VERSION "2.1 beta"
/* object types for AAC */
#define MAIN 1
#define LC 2
#define SSR 3
#define LTP 4
#define HE_AAC 5
#define ER_LC 17
#define ER_LTP 19
#define LD 23
#define DRM_ER_LC 27 /* special object type for DRM */
/* header types */
#define RAW 0
#define ADIF 1
#define ADTS 2
/* SBR signalling */
#define NO_SBR 0
#define SBR_UPSAMPLED 1
#define SBR_DOWNSAMPLED 2
#define NO_SBR_UPSAMPLED 3
/* library output formats */
#define FAAD_FMT_16BIT 1
#define FAAD_FMT_24BIT 2
#define FAAD_FMT_32BIT 3
#define FAAD_FMT_FLOAT 4
#define FAAD_FMT_FIXED FAAD_FMT_FLOAT
#define FAAD_FMT_DOUBLE 5
/* Capabilities */
#define LC_DEC_CAP (1<<0) /* Can decode LC */
#define MAIN_DEC_CAP (1<<1) /* Can decode MAIN */
#define LTP_DEC_CAP (1<<2) /* Can decode LTP */
#define LD_DEC_CAP (1<<3) /* Can decode LD */
#define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */
#define FIXED_POINT_CAP (1<<5) /* Fixed point */
/* Channel definitions */
#define FRONT_CHANNEL_CENTER (1)
#define FRONT_CHANNEL_LEFT (2)
#define FRONT_CHANNEL_RIGHT (3)
#define SIDE_CHANNEL_LEFT (4)
#define SIDE_CHANNEL_RIGHT (5)
#define BACK_CHANNEL_LEFT (6)
#define BACK_CHANNEL_RIGHT (7)
#define BACK_CHANNEL_CENTER (8)
#define LFE_CHANNEL (9)
#define UNKNOWN_CHANNEL (0)
/* DRM channel definitions */
#define DRMCH_MONO 1
#define DRMCH_STEREO 2
#define DRMCH_SBR_MONO 3
#define DRMCH_SBR_STEREO 4
#define DRMCH_SBR_PS_STEREO 5
/* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
so at least so much bytes per channel should be available in this stream */
#define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
typedef void *NeAACDecHandle;
typedef struct mp4AudioSpecificConfig
{
/* Audio Specific Info */
unsigned char objectTypeIndex;
unsigned char samplingFrequencyIndex;
unsigned long samplingFrequency;
unsigned char channelsConfiguration;
/* GA Specific Info */
unsigned char frameLengthFlag;
unsigned char dependsOnCoreCoder;
unsigned short coreCoderDelay;
unsigned char extensionFlag;
unsigned char aacSectionDataResilienceFlag;
unsigned char aacScalefactorDataResilienceFlag;
unsigned char aacSpectralDataResilienceFlag;
unsigned char epConfig;
char sbr_present_flag;
char forceUpSampling;
char downSampledSBR;
} mp4AudioSpecificConfig;
typedef struct NeAACDecConfiguration
{
unsigned char defObjectType;
unsigned long defSampleRate;
unsigned char outputFormat;
unsigned char downMatrix;
unsigned char useOldADTSFormat;
unsigned char dontUpSampleImplicitSBR;
} NeAACDecConfiguration, *NeAACDecConfigurationPtr;
typedef struct NeAACDecFrameInfo
{
unsigned long bytesconsumed;
unsigned long samples;
unsigned char channels;
unsigned char error;
unsigned long samplerate;
/* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
unsigned char sbr;
/* MPEG-4 ObjectType */
unsigned char object_type;
/* AAC header type; MP4 will be signalled as RAW also */
unsigned char header_type;
/* multichannel configuration */
unsigned char num_front_channels;
unsigned char num_side_channels;
unsigned char num_back_channels;
unsigned char num_lfe_channels;
unsigned char channel_position[64];
/* PS: 0: off, 1: on */
unsigned char ps;
} NeAACDecFrameInfo;
char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
NeAACDecConfigurationPtr config);
/* Init the library based on info from the AAC file (ADTS/ADIF) */
long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
unsigned char *buffer,
unsigned long buffer_size,
unsigned long *samplerate,
unsigned char *channels);
/* Init the library using a DecoderSpecificInfo */
char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, unsigned char *pBuffer,
unsigned long SizeOfDecoderSpecificInfo,
unsigned long *samplerate, unsigned char *channels);
/* Init the library for DRM */
char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate,
unsigned char channels);
void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size);
void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size,
void **sample_buffer,
unsigned long sample_buffer_size);
char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
unsigned long buffer_size,
mp4AudioSpecificConfig *mp4ASC);
#ifdef _WIN32
#pragma pack(pop)
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

View file

@ -0,0 +1,26 @@
lib_LTLIBRARIES = libfaad.la
include_HEADERS = $(top_srcdir)/include/faad.h \
$(top_srcdir)/include/neaacdec.h
libfaad_la_LDFLAGS = -lm
libfaad_la_SOURCES = bits.c cfft.c decoder.c drc.c \
drm_dec.c error.c filtbank.c \
ic_predict.c is.c lt_predict.c mdct.c mp4.c ms.c output.c pns.c \
ps_dec.c ps_syntax.c \
pulse.c specrec.c syntax.c tns.c hcr.c huffman.c \
rvlc.c ssr.c ssr_fb.c ssr_ipqf.c common.c \
sbr_dct.c sbr_e_nf.c sbr_fbt.c sbr_hfadj.c sbr_hfgen.c \
sbr_huff.c sbr_qmf.c sbr_syntax.c sbr_tf_grid.c sbr_dec.c \
analysis.h bits.h cfft.h cfft_tab.h common.h \
decoder.h drc.h drm_dec.h error.h fixed.h filtbank.h \
huffman.h ic_predict.h iq_table.h is.h kbd_win.h lt_predict.h mdct.h mp4.h \
ms.h output.h pns.h pulse.h rvlc.h sine_win.h ssr.h ssr_fb.h ssr_ipqf.h \
ssr_win.h specrec.h syntax.h structs.h tns.h \
sbr_dct.h sbr_dec.h sbr_e_nf.h sbr_fbt.h sbr_hfadj.h sbr_hfgen.h \
sbr_huff.h sbr_noise.h sbr_qmf.h sbr_syntax.h sbr_tf_grid.h \
sbr_qmf_c.h codebook/hcb.h \
codebook/hcb_1.h codebook/hcb_2.h codebook/hcb_3.h codebook/hcb_4.h \
codebook/hcb_5.h codebook/hcb_6.h codebook/hcb_7.h codebook/hcb_8.h \
codebook/hcb_9.h codebook/hcb_10.h codebook/hcb_11.h codebook/hcb_sf.h

View file

@ -0,0 +1,49 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: analysis.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __ANALYSIS_H__
#define __ANALYSIS_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef ANALYSIS
#define DEBUGDEC ,uint8_t print,uint16_t var,uint8_t *dbg
#define DEBUGVAR(A,B,C) ,A,B,C
extern uint16_t dbg_count;
#else
#define DEBUGDEC
#define DEBUGVAR(A,B,C)
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,213 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: bits.c 3 2005-06-02 18:16:43Z vspader $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include <string.h>
#include "bits.h"
/* initialize buffer, call once before first getbits or showbits */
void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size)
{
uint32_t tmp;
if (ld == NULL)
return;
memset(ld, 0, sizeof(bitfile));
if (buffer_size == 0 || _buffer == NULL)
{
ld->error = 1;
ld->no_more_reading = 1;
return;
}
ld->buffer = faad_malloc((buffer_size+12)*sizeof(uint8_t));
memset(ld->buffer, 0, (buffer_size+12)*sizeof(uint8_t));
memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t));
ld->buffer_size = buffer_size;
tmp = getdword((uint32_t*)ld->buffer);
ld->bufa = tmp;
tmp = getdword((uint32_t*)ld->buffer + 1);
ld->bufb = tmp;
ld->start = (uint32_t*)ld->buffer;
ld->tail = ((uint32_t*)ld->buffer + 2);
ld->bits_left = 32;
ld->bytes_used = 0;
ld->no_more_reading = 0;
ld->error = 0;
}
void faad_endbits(bitfile *ld)
{
if (ld)
{
if (ld->buffer)
{
faad_free(ld->buffer);
ld->buffer = NULL;
}
}
}
uint32_t faad_get_processed_bits(bitfile *ld)
{
return (uint32_t)(8 * (4*(ld->tail - ld->start) - 4) - (ld->bits_left));
}
uint8_t faad_byte_align(bitfile *ld)
{
uint8_t remainder = (uint8_t)((32 - ld->bits_left) % 8);
if (remainder)
{
faad_flushbits(ld, 8 - remainder);
return (8 - remainder);
}
return 0;
}
void faad_flushbits_ex(bitfile *ld, uint32_t bits)
{
uint32_t tmp;
ld->bufa = ld->bufb;
if (ld->no_more_reading == 0)
{
tmp = getdword(ld->tail);
ld->tail++;
} else {
tmp = 0;
}
ld->bufb = tmp;
ld->bits_left += (32 - bits);
ld->bytes_used += 4;
if (ld->bytes_used == ld->buffer_size)
ld->no_more_reading = 1;
if (ld->bytes_used > ld->buffer_size)
ld->error = 1;
}
/* rewind to beginning */
void faad_rewindbits(bitfile *ld)
{
uint32_t tmp;
tmp = ld->start[0];
#ifndef ARCH_IS_BIG_ENDIAN
BSWAP(tmp);
#endif
ld->bufa = tmp;
tmp = ld->start[1];
#ifndef ARCH_IS_BIG_ENDIAN
BSWAP(tmp);
#endif
ld->bufb = tmp;
ld->bits_left = 32;
ld->tail = &ld->start[2];
ld->bytes_used = 0;
ld->no_more_reading = 0;
}
uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
DEBUGDEC)
{
uint16_t i;
uint8_t temp;
uint16_t bytes = (uint16_t)bits / 8;
uint8_t remainder = (uint8_t)bits % 8;
uint8_t *buffer = (uint8_t*)faad_malloc((bytes+1)*sizeof(uint8_t));
for (i = 0; i < bytes; i++)
{
buffer[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(print,var,dbg));
}
if (remainder)
{
temp = (uint8_t)faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder);
buffer[bytes] = temp;
}
return buffer;
}
#ifdef DRM
/* return the original data buffer */
void *faad_origbitbuffer(bitfile *ld)
{
return (void*)ld->start;
}
/* return the original data buffer size */
uint32_t faad_origbitbuffer_size(bitfile *ld)
{
return ld->buffer_size;
}
#endif
/* reversed bit reading routines, used for RVLC and HCR */
void faad_initbits_rev(bitfile *ld, void *buffer,
uint32_t bits_in_buffer)
{
uint32_t tmp;
int32_t index;
ld->buffer_size = bit2byte(bits_in_buffer);
index = (bits_in_buffer+31)/32 - 1;
ld->start = (uint32_t*)buffer + index - 2;
tmp = getdword((uint32_t*)buffer + index);
ld->bufa = tmp;
tmp = getdword((uint32_t*)buffer + index - 1);
ld->bufb = tmp;
ld->tail = (uint32_t*)buffer + index;
ld->bits_left = bits_in_buffer % 32;
if (ld->bits_left == 0)
ld->bits_left = 32;
ld->bytes_used = 0;
ld->no_more_reading = 0;
ld->error = 0;
}

View file

@ -0,0 +1,382 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: bits.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __BITS_H__
#define __BITS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "analysis.h"
#ifdef ANALYSIS
#include <stdio.h>
#endif
#define BYTE_NUMBIT 8
#define bit2byte(a) ((a+7)/BYTE_NUMBIT)
typedef struct _bitfile
{
/* bit input */
uint32_t bufa;
uint32_t bufb;
uint32_t bits_left;
uint32_t buffer_size; /* size of the buffer in bytes */
uint32_t bytes_used;
uint8_t no_more_reading;
uint8_t error;
uint32_t *tail;
uint32_t *start;
void *buffer;
} bitfile;
#if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__)
#define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax
#elif defined(LINUX) || defined(DJGPP) || defined(__MINGW32__)
#define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) )
#else
#define BSWAP(a) \
((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff))
#endif
static uint32_t bitmask[] = {
0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF,
0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF,
0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF,
0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF,
0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF
/* added bitmask 32, correct?!?!?! */
, 0xFFFFFFFF
};
void faad_initbits(bitfile *ld, const void *buffer, const uint32_t buffer_size);
void faad_endbits(bitfile *ld);
void faad_initbits_rev(bitfile *ld, void *buffer,
uint32_t bits_in_buffer);
uint8_t faad_byte_align(bitfile *ld);
uint32_t faad_get_processed_bits(bitfile *ld);
void faad_flushbits_ex(bitfile *ld, uint32_t bits);
void faad_rewindbits(bitfile *ld);
uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
DEBUGDEC);
#ifdef DRM
void *faad_origbitbuffer(bitfile *ld);
uint32_t faad_origbitbuffer_size(bitfile *ld);
#endif
/* circumvent memory alignment errors on ARM */
static INLINE uint32_t getdword(void *mem)
{
#ifdef ARM
uint32_t tmp;
#ifndef ARCH_IS_BIG_ENDIAN
((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[3];
((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2];
((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1];
((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0];
#else
((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0];
((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1];
((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2];
((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3];
#endif
return tmp;
#else
uint32_t tmp;
tmp = *(uint32_t*)mem;
#ifndef ARCH_IS_BIG_ENDIAN
BSWAP(tmp);
#endif
return tmp;
#endif
}
static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits)
{
if (bits <= ld->bits_left)
{
return (ld->bufa >> (ld->bits_left - bits)) & bitmask[bits];
}
bits -= ld->bits_left;
return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits));
}
static INLINE void faad_flushbits(bitfile *ld, uint32_t bits)
{
/* do nothing if error */
if (ld->error != 0)
return;
if (bits < ld->bits_left)
{
ld->bits_left -= bits;
} else {
faad_flushbits_ex(ld, bits);
}
}
/* return next n bits (right adjusted) */
static INLINE uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC)
{
uint32_t ret;
if (ld->no_more_reading || n == 0)
return 0;
ret = faad_showbits(ld, n);
faad_flushbits(ld, n);
#ifdef ANALYSIS
if (print)
fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
#endif
return ret;
}
static INLINE uint8_t faad_get1bit(bitfile *ld DEBUGDEC)
{
uint8_t r;
if (ld->bits_left > 0)
{
ld->bits_left--;
r = (uint8_t)((ld->bufa >> ld->bits_left) & 1);
return r;
}
/* bits_left == 0 */
#if 0
r = (uint8_t)(ld->bufb >> 31);
faad_flushbits_ex(ld, 1);
#else
r = (uint8_t)faad_getbits(ld, 1);
#endif
return r;
}
/* reversed bitreading routines */
static INLINE uint32_t faad_showbits_rev(bitfile *ld, uint32_t bits)
{
uint8_t i;
uint32_t B = 0;
if (bits <= ld->bits_left)
{
for (i = 0; i < bits; i++)
{
if (ld->bufa & (1 << (i + (32 - ld->bits_left))))
B |= (1 << (bits - i - 1));
}
return B;
} else {
for (i = 0; i < ld->bits_left; i++)
{
if (ld->bufa & (1 << (i + (32 - ld->bits_left))))
B |= (1 << (bits - i - 1));
}
for (i = 0; i < bits - ld->bits_left; i++)
{
if (ld->bufb & (1 << (i + (32-ld->bits_left))))
B |= (1 << (bits - ld->bits_left - i - 1));
}
return B;
}
}
static INLINE void faad_flushbits_rev(bitfile *ld, uint32_t bits)
{
/* do nothing if error */
if (ld->error != 0)
return;
if (bits < ld->bits_left)
{
ld->bits_left -= bits;
} else {
uint32_t tmp;
ld->bufa = ld->bufb;
tmp = getdword(ld->start);
ld->bufb = tmp;
ld->start--;
ld->bits_left += (32 - bits);
ld->bytes_used += 4;
if (ld->bytes_used == ld->buffer_size)
ld->no_more_reading = 1;
if (ld->bytes_used > ld->buffer_size)
ld->error = 1;
}
}
static INLINE uint32_t faad_getbits_rev(bitfile *ld, uint32_t n
DEBUGDEC)
{
uint32_t ret;
if (ld->no_more_reading)
return 0;
if (n == 0)
return 0;
ret = faad_showbits_rev(ld, n);
faad_flushbits_rev(ld, n);
#ifdef ANALYSIS
if (print)
fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
#endif
return ret;
}
#ifdef DRM
static uint8_t faad_check_CRC(bitfile *ld, uint16_t len)
{
uint8_t CRC;
uint16_t r=255; /* Initialize to all ones */
/* CRC polynome used x^8 + x^4 + x^3 + x^2 +1 */
#define GPOLY 0435
faad_rewindbits(ld);
CRC = (uint8_t) ~faad_getbits(ld, 8
DEBUGVAR(1,999,"faad_check_CRC(): CRC")); /* CRC is stored inverted */
for (; len>0; len--)
{
r = ( (r << 1) ^ (( ( faad_get1bit(ld
DEBUGVAR(1,998,"")) & 1) ^ ((r >> 7) & 1)) * GPOLY )) & 0xFF;
}
if (r != CRC)
{
return 8;
} else {
return 0;
}
}
static uint8_t tabFlipbits[256] = {
0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,
8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,
4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,
12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,
2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,
10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,
6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,
14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,
1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,
9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,
5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,
13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,
3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,
11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,
7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,
15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255
};
#endif
#ifdef ERROR_RESILIENCE
/* Modified bit reading functions for HCR */
typedef struct
{
/* bit input */
uint32_t bufa;
uint32_t bufb;
int8_t len;
} bits_t;
static INLINE uint32_t showbits_hcr(bits_t *ld, uint8_t bits)
{
if (bits == 0) return 0;
if (ld->len <= 32)
{
/* huffman_spectral_data_2 needs to read more than may be available, bits maybe
> ld->len, deliver 0 than */
if (ld->len >= bits)
return ((ld->bufa >> (ld->len - bits)) & (0xFFFFFFFF >> (32 - bits)));
else
return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits)));
} else {
if ((ld->len - bits) < 32)
{
return ( (ld->bufb & (0xFFFFFFFF >> (64 - ld->len))) << (bits - ld->len + 32)) |
(ld->bufa >> (ld->len - bits));
} else {
return ((ld->bufb >> (ld->len - bits - 32)) & (0xFFFFFFFF >> (32 - bits)));
}
}
}
/* return 1 if position is outside of buffer, 0 otherwise */
static INLINE int8_t flushbits_hcr( bits_t *ld, uint8_t bits)
{
ld->len -= bits;
if (ld->len <0)
{
ld->len = 0;
return 1;
} else {
return 0;
}
}
static INLINE int8_t getbits_hcr(bits_t *ld, uint8_t n, uint32_t *result)
{
*result = showbits_hcr(ld, n);
return flushbits_hcr(ld, n);
}
static INLINE int8_t get1bit_hcr(bits_t *ld, uint8_t *result)
{
uint32_t res;
int8_t ret;
ret = getbits_hcr(ld, 1, &res);
*result = (int8_t)(res & 1);
return ret;
}
#endif
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,53 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: cfft.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __CFFT_H__
#define __CFFT_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
uint16_t n;
uint16_t ifac[15];
complex_t *work;
complex_t *tab;
} cfft_info;
void cfftf(cfft_info *cfft, complex_t *c);
void cfftb(cfft_info *cfft, complex_t *c);
cfft_info *cffti(uint16_t n);
void cfftu(cfft_info *cfft);
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,142 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __HCB_H__
#define __HCB_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
* Optimal huffman decoding for AAC taken from:
* "SELECTING AN OPTIMAL HUFFMAN DECODER FOR AAC" by
* VLADIMIR Z. MESAROVIC , RAGHUNATH RAO, MIROSLAV V. DOKIC, and SACHIN DEO
* AES paper 5436
*
* 2 methods are used for huffman decoding:
* - binary search
* - 2-step table lookup
*
* The choice of the "optimal" method is based on the fact that if the
* memory size for the Two-step is exorbitantly high then the decision
* is Binary search for that codebook. However, for marginally more memory
* size, if Twostep outperforms even the best case of Binary then the
* decision is Two-step for that codebook.
*
* The following methods are used for the different tables.
* codebook "optimal" method
* HCB_1 2-Step
* HCB_2 2-Step
* HCB_3 Binary
* HCB_4 2-Step
* HCB_5 Binary
* HCB_6 2-Step
* HCB_7 Binary
* HCB_8 2-Step
* HCB_9 Binary
* HCB_10 2-Step
* HCB_11 2-Step
* HCB_SF Binary
*
*/
#define ZERO_HCB 0
#define FIRST_PAIR_HCB 5
#define ESC_HCB 11
#define QUAD_LEN 4
#define PAIR_LEN 2
#define NOISE_HCB 13
#define INTENSITY_HCB2 14
#define INTENSITY_HCB 15
/* 1st step table */
typedef struct
{
uint8_t offset;
uint8_t extra_bits;
} hcb;
/* 2nd step table with quadruple data */
typedef struct
{
uint8_t bits;
int8_t x;
int8_t y;
} hcb_2_pair;
typedef struct
{
uint8_t bits;
int8_t x;
int8_t y;
int8_t v;
int8_t w;
} hcb_2_quad;
/* binary search table */
typedef struct
{
uint8_t is_leaf;
int8_t data[4];
} hcb_bin_quad;
typedef struct
{
uint8_t is_leaf;
int8_t data[2];
} hcb_bin_pair;
hcb *hcb_table[];
hcb_2_quad *hcb_2_quad_table[];
hcb_2_pair *hcb_2_pair_table[];
hcb_bin_pair *hcb_bin_table[];
uint8_t hcbN[];
uint8_t unsigned_cb[];
int hcb_2_quad_table_size[];
int hcb_2_pair_table_size[];
int hcb_bin_table_size[];
#include "codebook/hcb_1.h"
#include "codebook/hcb_2.h"
#include "codebook/hcb_3.h"
#include "codebook/hcb_4.h"
#include "codebook/hcb_5.h"
#include "codebook/hcb_6.h"
#include "codebook/hcb_7.h"
#include "codebook/hcb_8.h"
#include "codebook/hcb_9.h"
#include "codebook/hcb_10.h"
#include "codebook/hcb_11.h"
#include "codebook/hcb_sf.h"
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,183 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_1.h 3 2005-06-02 18:16:43Z vspader $
**/
/* 2-step huffman table HCB_1 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb1_1[] = {
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* 10000 */ 1, 0 },
{ /* 10001 */ 2, 0 },
{ /* 10010 */ 3, 0 },
{ /* 10011 */ 4, 0 },
{ /* 10100 */ 5, 0 },
{ /* 10101 */ 6, 0 },
{ /* 10110 */ 7, 0 },
{ /* 10111 */ 8, 0 },
/* 7 bit codewords */
{ /* 11000 */ 9, 2 },
{ /* 11001 */ 13, 2 },
{ /* 11010 */ 17, 2 },
{ /* 11011 */ 21, 2 },
{ /* 11100 */ 25, 2 },
{ /* 11101 */ 29, 2 },
/* 9 bit codewords */
{ /* 11110 */ 33, 4 },
/* 9/10/11 bit codewords */
{ /* 11111 */ 49, 6 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_quad hcb1_2[] = {
/* 1 bit codeword */
{ 1, 0, 0, 0, 0 },
/* 5 bit codewords */
{ 5, 1, 0, 0, 0 },
{ 5, -1, 0, 0, 0 },
{ 5, 0, 0, 0, -1 },
{ 5, 0, 1, 0, 0 },
{ 5, 0, 0, 0, 1 },
{ 5, 0, 0, -1, 0 },
{ 5, 0, 0, 1, 0 },
{ 5, 0, -1, 0, 0 },
/* 7 bit codewords */
/* first 5 bits: 11000 */
{ 7, 1, -1, 0, 0 },
{ 7, -1, 1, 0, 0 },
{ 7, 0, 0, -1, 1 },
{ 7, 0, 1, -1, 0 },
/* first 5 bits: 11001 */
{ 7, 0, -1, 1, 0 },
{ 7, 0, 0, 1, -1 },
{ 7, 1, 1, 0, 0 },
{ 7, 0, 0, -1, -1 },
/* first 5 bits: 11010 */
{ 7, -1, -1, 0, 0 },
{ 7, 0, -1, -1, 0 },
{ 7, 1, 0, -1, 0 },
{ 7, 0, 1, 0, -1 },
/* first 5 bits: 11011 */
{ 7, -1, 0, 1, 0 },
{ 7, 0, 0, 1, 1 },
{ 7, 1, 0, 1, 0 },
{ 7, 0, -1, 0, 1 },
/* first 5 bits: 11100 */
{ 7, 0, 1, 1, 0 },
{ 7, 0, 1, 0, 1 },
{ 7, -1, 0, -1, 0 },
{ 7, 1, 0, 0, 1 },
/* first 5 bits: 11101 */
{ 7, -1, 0, 0, -1 },
{ 7, 1, 0, 0, -1 },
{ 7, -1, 0, 0, 1 },
{ 7, 0, -1, 0, -1 },
/* 9 bit codeword */
/* first 5 bits: 11110 */
{ 9, 1, 1, -1, 0 },
{ 9, -1, 1, -1, 0 },
{ 9, 1, -1, 1, 0 },
{ 9, 0, 1, 1, -1 },
{ 9, 0, 1, -1, 1 },
{ 9, 0, -1, 1, 1 },
{ 9, 0, -1, 1, -1 },
{ 9, 1, -1, -1, 0 },
{ 9, 1, 0, -1, 1 },
{ 9, 0, 1, -1, -1 },
{ 9, -1, 1, 1, 0 },
{ 9, -1, 0, 1, -1 },
{ 9, -1, -1, 1, 0 },
{ 9, 0, -1, -1, 1 },
{ 9, 1, -1, 0, 1 },
{ 9, 1, -1, 0, -1 },
/* 9/10/11 bit codewords */
/* first 5 bits: 11111 */
/* 9 bit: reading 11 bits -> 2 too much so 4 entries for each codeword */
{ 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 },
{ 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 },
{ 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 },
{ 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 },
{ 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 },
{ 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 },
{ 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 },
{ 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 },
/* 10 bit: reading 11 bits -> 1 too much so 2 entries for each codeword */
{ 10, -1, -1, 0, 1 }, { 10, -1, -1, 0, 1 },
{ 10, -1, 0, -1, -1 }, { 10, -1, 0, -1, -1 },
{ 10, 1, 1, 0, -1 }, { 10, 1, 1, 0, -1 },
{ 10, 1, 0, -1, -1 }, { 10, 1, 0, -1, -1 },
{ 10, -1, 0, -1, 1 }, { 10, -1, 0, -1, 1 },
{ 10, -1, -1, 0, -1 }, { 10, -1, -1, 0, -1 },
{ 10, -1, 0, 1, 1 }, { 10, -1, 0, 1, 1 },
{ 10, 1, 0, 1, 1 }, { 10, 1, 0, 1, 1 },
/* 11 bit */
{ 11, 1, -1, 1, -1 },
{ 11, -1, 1, -1, 1 },
{ 11, -1, 1, 1, -1 },
{ 11, 1, -1, -1, 1 },
{ 11, 1, 1, 1, 1 },
{ 11, -1, -1, 1, 1 },
{ 11, 1, 1, -1, -1 },
{ 11, -1, -1, 1, -1 },
{ 11, -1, -1, -1, -1 },
{ 11, 1, 1, -1, 1 },
{ 11, 1, -1, 1, 1 },
{ 11, -1, 1, 1, 1 },
{ 11, -1, 1, -1, -1 },
{ 11, -1, -1, -1, 1 },
{ 11, 1, -1, -1, -1 },
{ 11, 1, 1, 1, -1 }
};

View file

@ -0,0 +1,309 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_10.h 3 2005-06-02 18:16:43Z vspader $
**/
/* 2-step huffman table HCB_10 */
/* 1st step: 6 bits
* 2^6 = 64 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb10_1[] = {
/* 4 bit codewords */
{ /* 000000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* 000100 */ 1, 0 },
{ /* */ 1, 0 },
{ /* */ 1, 0 },
{ /* */ 1, 0 },
{ /* 001000 */ 2, 0 },
{ /* */ 2, 0 },
{ /* */ 2, 0 },
{ /* */ 2, 0 },
/* 5 bit codewords */
{ /* 001100 */ 3, 0 },
{ /* */ 3, 0 },
{ /* 001110 */ 4, 0 },
{ /* */ 4, 0 },
{ /* 010000 */ 5, 0 },
{ /* */ 5, 0 },
{ /* 010010 */ 6, 0 },
{ /* */ 6, 0 },
{ /* 010100 */ 7, 0 },
{ /* */ 7, 0 },
{ /* 010110 */ 8, 0 },
{ /* */ 8, 0 },
{ /* 011000 */ 9, 0 },
{ /* */ 9, 0 },
{ /* 011010 */ 10, 0 },
{ /* */ 10, 0 },
/* 6 bit codewords */
{ /* 011100 */ 11, 0 },
{ /* 011101 */ 12, 0 },
{ /* 011110 */ 13, 0 },
{ /* 011111 */ 14, 0 },
{ /* 100000 */ 15, 0 },
{ /* 100001 */ 16, 0 },
{ /* 100010 */ 17, 0 },
{ /* 100011 */ 18, 0 },
{ /* 100100 */ 19, 0 },
{ /* 100101 */ 20, 0 },
{ /* 100110 */ 21, 0 },
{ /* 100111 */ 22, 0 },
{ /* 101000 */ 23, 0 },
{ /* 101001 */ 24, 0 },
/* 7 bit codewords */
{ /* 101010 */ 25, 1 },
{ /* 101011 */ 27, 1 },
{ /* 101100 */ 29, 1 },
{ /* 101101 */ 31, 1 },
{ /* 101110 */ 33, 1 },
{ /* 101111 */ 35, 1 },
{ /* 110000 */ 37, 1 },
{ /* 110001 */ 39, 1 },
/* 7/8 bit codewords */
{ /* 110010 */ 41, 2 },
/* 8 bit codewords */
{ /* 110011 */ 45, 2 },
{ /* 110100 */ 49, 2 },
{ /* 110101 */ 53, 2 },
{ /* 110110 */ 57, 2 },
{ /* 110111 */ 61, 2 },
/* 8/9 bit codewords */
{ /* 111000 */ 65, 3 },
/* 9 bit codewords */
{ /* 111001 */ 73, 3 },
{ /* 111010 */ 81, 3 },
{ /* 111011 */ 89, 3 },
/* 9/10 bit codewords */
{ /* 111100 */ 97, 4 },
/* 10 bit codewords */
{ /* 111101 */ 113, 4 },
{ /* 111110 */ 129, 4 },
/* 10/11/12 bit codewords */
{ /* 111111 */ 145, 6 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_pair hcb10_2[] = {
/* 4 bit codewords */
{ 4, 1, 1 },
{ 4, 1, 2 },
{ 4, 2, 1 },
/* 5 bit codewords */
{ 5, 2, 2 },
{ 5, 1, 0 },
{ 5, 0, 1 },
{ 5, 1, 3 },
{ 5, 3, 2 },
{ 5, 3, 1 },
{ 5, 2, 3 },
{ 5, 3, 3 },
/* 6 bit codewords */
{ 6, 2, 0 },
{ 6, 0, 2 },
{ 6, 2, 4 },
{ 6, 4, 2 },
{ 6, 1, 4 },
{ 6, 4, 1 },
{ 6, 0, 0 },
{ 6, 4, 3 },
{ 6, 3, 4 },
{ 6, 3, 0 },
{ 6, 0, 3 },
{ 6, 4, 4 },
{ 6, 2, 5 },
{ 6, 5, 2 },
/* 7 bit codewords */
{ 7, 1, 5 },
{ 7, 5, 1 },
{ 7, 5, 3 },
{ 7, 3, 5 },
{ 7, 5, 4 },
{ 7, 4, 5 },
{ 7, 6, 2 },
{ 7, 2, 6 },
{ 7, 6, 3 },
{ 7, 4, 0 },
{ 7, 6, 1 },
{ 7, 0, 4 },
{ 7, 1, 6 },
{ 7, 3, 6 },
{ 7, 5, 5 },
{ 7, 6, 4 },
/* 7/8 bit codewords */
{ 7, 4, 6 }, { 7, 4, 6 },
{ 8, 6, 5 },
{ 8, 7, 2 },
/* 8 bit codewords */
{ 8, 3, 7 },
{ 8, 2, 7 },
{ 8, 5, 6 },
{ 8, 8, 2 },
{ 8, 7, 3 },
{ 8, 5, 0 },
{ 8, 7, 1 },
{ 8, 0, 5 },
{ 8, 8, 1 },
{ 8, 1, 7 },
{ 8, 8, 3 },
{ 8, 7, 4 },
{ 8, 4, 7 },
{ 8, 2, 8 },
{ 8, 6, 6 },
{ 8, 7, 5 },
{ 8, 1, 8 },
{ 8, 3, 8 },
{ 8, 8, 4 },
{ 8, 4, 8 },
/* 8/9 bit codewords */
{ 8, 5, 7 }, { 8, 5, 7 },
{ 8, 8, 5 }, { 8, 8, 5 },
{ 8, 5, 8 }, { 8, 5, 8 },
{ 9, 7, 6 },
{ 9, 6, 7 },
/* 9 bit codewords */
{ 9, 9, 2 },
{ 9, 6, 0 },
{ 9, 6, 8 },
{ 9, 9, 3 },
{ 9, 3, 9 },
{ 9, 9, 1 },
{ 9, 2, 9 },
{ 9, 0, 6 },
{ 9, 8, 6 },
{ 9, 9, 4 },
{ 9, 4, 9 },
{ 9, 10, 2 },
{ 9, 1, 9 },
{ 9, 7, 7 },
{ 9, 8, 7 },
{ 9, 9, 5 },
{ 9, 7, 8 },
{ 9, 10, 3 },
{ 9, 5, 9 },
{ 9, 10, 4 },
{ 9, 2, 10 },
{ 9, 10, 1 },
{ 9, 3, 10 },
{ 9, 9, 6 },
/* 9/10 bit codewords */
{ 9, 6, 9 }, { 9, 6, 9 },
{ 9, 8, 0 }, { 9, 8, 0 },
{ 9, 4, 10 }, { 9, 4, 10 },
{ 9, 7, 0 }, { 9, 7, 0 },
{ 9, 11, 2 }, { 9, 11, 2 },
{ 10, 7, 9 },
{ 10, 11, 3 },
{ 10, 10, 6 },
{ 10, 1, 10 },
{ 10, 11, 1 },
{ 10, 9, 7 },
/* 10 bit codewords */
{ 10, 0, 7 },
{ 10, 8, 8 },
{ 10, 10, 5 },
{ 10, 3, 11 },
{ 10, 5, 10 },
{ 10, 8, 9 },
{ 10, 11, 5 },
{ 10, 0, 8 },
{ 10, 11, 4 },
{ 10, 2, 11 },
{ 10, 7, 10 },
{ 10, 6, 10 },
{ 10, 10, 7 },
{ 10, 4, 11 },
{ 10, 1, 11 },
{ 10, 12, 2 },
{ 10, 9, 8 },
{ 10, 12, 3 },
{ 10, 11, 6 },
{ 10, 5, 11 },
{ 10, 12, 4 },
{ 10, 11, 7 },
{ 10, 12, 5 },
{ 10, 3, 12 },
{ 10, 6, 11 },
{ 10, 9, 0 },
{ 10, 10, 8 },
{ 10, 10, 0 },
{ 10, 12, 1 },
{ 10, 0, 9 },
{ 10, 4, 12 },
{ 10, 9, 9 },
/* 10/11/12 bit codewords */
{ 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 },
{ 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 },
{ 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 },
{ 11, 9, 10 }, { 11, 9, 10 },
{ 11, 1, 12 }, { 11, 1, 12 },
{ 11, 11, 8 }, { 11, 11, 8 },
{ 11, 12, 7 }, { 11, 12, 7 },
{ 11, 7, 11 }, { 11, 7, 11 },
{ 11, 5, 12 }, { 11, 5, 12 },
{ 11, 6, 12 }, { 11, 6, 12 },
{ 11, 10, 9 }, { 11, 10, 9 },
{ 11, 8, 11 }, { 11, 8, 11 },
{ 11, 12, 8 }, { 11, 12, 8 },
{ 11, 0, 10 }, { 11, 0, 10 },
{ 11, 7, 12 }, { 11, 7, 12 },
{ 11, 11, 0 }, { 11, 11, 0 },
{ 11, 10, 10 }, { 11, 10, 10 },
{ 11, 11, 9 }, { 11, 11, 9 },
{ 11, 11, 10 }, { 11, 11, 10 },
{ 11, 0, 11 }, { 11, 0, 11 },
{ 11, 11, 11 }, { 11, 11, 11 },
{ 11, 9, 11 }, { 11, 9, 11 },
{ 11, 10, 11 }, { 11, 10, 11 },
{ 11, 12, 0 }, { 11, 12, 0 },
{ 11, 8, 12 }, { 11, 8, 12 },
{ 12, 12, 9 },
{ 12, 10, 12 },
{ 12, 9, 12 },
{ 12, 11, 12 },
{ 12, 12, 11 },
{ 12, 0, 12 },
{ 12, 12, 10 },
{ 12, 12, 12 }
};

View file

@ -0,0 +1,412 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_11.h 3 2005-06-02 18:16:43Z vspader $
**/
/* 2-step huffman table HCB_11 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb11_1[] = {
/* 4 bits */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* 00010 */ 1, 0 },
{ /* */ 1, 0 },
/* 5 bits */
{ /* 00100 */ 2, 0 },
{ /* 00101 */ 3, 0 },
{ /* 00110 */ 4, 0 },
{ /* 00111 */ 5, 0 },
{ /* 01000 */ 6, 0 },
{ /* 01001 */ 7, 0 },
/* 6 bits */
{ /* 01010 */ 8, 1 },
{ /* 01011 */ 10, 1 },
{ /* 01100 */ 12, 1 },
/* 6/7 bits */
{ /* 01101 */ 14, 2 },
/* 7 bits */
{ /* 01110 */ 18, 2 },
{ /* 01111 */ 22, 2 },
{ /* 10000 */ 26, 2 },
/* 7/8 bits */
{ /* 10001 */ 30, 3 },
/* 8 bits */
{ /* 10010 */ 38, 3 },
{ /* 10011 */ 46, 3 },
{ /* 10100 */ 54, 3 },
{ /* 10101 */ 62, 3 },
{ /* 10110 */ 70, 3 },
{ /* 10111 */ 78, 3 },
/* 8/9 bits */
{ /* 11000 */ 86, 4 },
/* 9 bits */
{ /* 11001 */ 102, 4 },
{ /* 11010 */ 118, 4 },
{ /* 11011 */ 134, 4 },
/* 9/10 bits */
{ /* 11100 */ 150, 5 },
/* 10 bits */
{ /* 11101 */ 182, 5 },
{ /* 11110 */ 214, 5 },
/* 10/11/12 bits */
{ /* 11111 */ 246, 7 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_pair hcb11_2[] = {
/* 4 */
{ 4, 0, 0 },
{ 4, 1, 1 },
/* 5 */
{ 5, 16, 16 },
{ 5, 1, 0 },
{ 5, 0, 1 },
{ 5, 2, 1 },
{ 5, 1, 2 },
{ 5, 2, 2 },
/* 6 */
{ 6, 1, 3 },
{ 6, 3, 1 },
{ 6, 3, 2 },
{ 6, 2, 0 },
{ 6, 2, 3 },
{ 6, 0, 2 },
/* 6/7 */
{ 6, 3, 3 }, { 6, 3, 3 },
{ 7, 4, 1 },
{ 7, 1, 4 },
/* 7 */
{ 7, 4, 2 },
{ 7, 2, 4 },
{ 7, 4, 3 },
{ 7, 3, 4 },
{ 7, 3, 0 },
{ 7, 0, 3 },
{ 7, 5, 1 },
{ 7, 5, 2 },
{ 7, 2, 5 },
{ 7, 4, 4 },
{ 7, 1, 5 },
{ 7, 5, 3 },
/* 7/8 */
{ 7, 3, 5 }, { 7, 3, 5 },
{ 7, 5, 4 }, { 7, 5, 4 },
{ 8, 4, 5 },
{ 8, 6, 2 },
{ 8, 2, 6 },
{ 8, 6, 1 },
/* 8 */
{ 8, 6, 3 },
{ 8, 3, 6 },
{ 8, 1, 6 },
{ 8, 4, 16 },
{ 8, 3, 16 },
{ 8, 16, 5 },
{ 8, 16, 3 },
{ 8, 16, 4 },
{ 8, 6, 4 },
{ 8, 16, 6 },
{ 8, 4, 0 },
{ 8, 4, 6 },
{ 8, 0, 4 },
{ 8, 2, 16 },
{ 8, 5, 5 },
{ 8, 5, 16 },
{ 8, 16, 7 },
{ 8, 16, 2 },
{ 8, 16, 8 },
{ 8, 2, 7 },
{ 8, 7, 2 },
{ 8, 3, 7 },
{ 8, 6, 5 },
{ 8, 5, 6 },
{ 8, 6, 16 },
{ 8, 16, 10 },
{ 8, 7, 3 },
{ 8, 7, 1 },
{ 8, 16, 9 },
{ 8, 7, 16 },
{ 8, 1, 16 },
{ 8, 1, 7 },
{ 8, 4, 7 },
{ 8, 16, 11 },
{ 8, 7, 4 },
{ 8, 16, 12 },
{ 8, 8, 16 },
{ 8, 16, 1 },
{ 8, 6, 6 },
{ 8, 9, 16 },
{ 8, 2, 8 },
{ 8, 5, 7 },
{ 8, 10, 16 },
{ 8, 16, 13 },
{ 8, 8, 3 },
{ 8, 8, 2 },
{ 8, 3, 8 },
{ 8, 5, 0 },
/* 8/9 */
{ 8, 16, 14 }, { 8, 16, 14 },
{ 8, 11, 16 }, { 8, 11, 16 },
{ 8, 7, 5 }, { 8, 7, 5 },
{ 8, 4, 8 }, { 8, 4, 8 },
{ 8, 6, 7 }, { 8, 6, 7 },
{ 8, 7, 6 }, { 8, 7, 6 },
{ 8, 0, 5 }, { 8, 0, 5 },
{ 9, 8, 4 },
{ 9, 16, 15 },
/* 9 */
{ 9, 12, 16 },
{ 9, 1, 8 },
{ 9, 8, 1 },
{ 9, 14, 16 },
{ 9, 5, 8 },
{ 9, 13, 16 },
{ 9, 3, 9 },
{ 9, 8, 5 },
{ 9, 7, 7 },
{ 9, 2, 9 },
{ 9, 8, 6 },
{ 9, 9, 2 },
{ 9, 9, 3 },
{ 9, 15, 16 },
{ 9, 4, 9 },
{ 9, 6, 8 },
{ 9, 6, 0 },
{ 9, 9, 4 },
{ 9, 5, 9 },
{ 9, 8, 7 },
{ 9, 7, 8 },
{ 9, 1, 9 },
{ 9, 10, 3 },
{ 9, 0, 6 },
{ 9, 10, 2 },
{ 9, 9, 1 },
{ 9, 9, 5 },
{ 9, 4, 10 },
{ 9, 2, 10 },
{ 9, 9, 6 },
{ 9, 3, 10 },
{ 9, 6, 9 },
{ 9, 10, 4 },
{ 9, 8, 8 },
{ 9, 10, 5 },
{ 9, 9, 7 },
{ 9, 11, 3 },
{ 9, 1, 10 },
{ 9, 7, 0 },
{ 9, 10, 6 },
{ 9, 7, 9 },
{ 9, 3, 11 },
{ 9, 5, 10 },
{ 9, 10, 1 },
{ 9, 4, 11 },
{ 9, 11, 2 },
{ 9, 13, 2 },
{ 9, 6, 10 },
/* 9/10 */
{ 9, 13, 3 }, { 9, 13, 3 },
{ 9, 2, 11 }, { 9, 2, 11 },
{ 9, 16, 0 }, { 9, 16, 0 },
{ 9, 5, 11 }, { 9, 5, 11 },
{ 9, 11, 5 }, { 9, 11, 5 },
{ 10, 11, 4 },
{ 10, 9, 8 },
{ 10, 7, 10 },
{ 10, 8, 9 },
{ 10, 0, 16 },
{ 10, 4, 13 },
{ 10, 0, 7 },
{ 10, 3, 13 },
{ 10, 11, 6 },
{ 10, 13, 1 },
{ 10, 13, 4 },
{ 10, 12, 3 },
{ 10, 2, 13 },
{ 10, 13, 5 },
{ 10, 8, 10 },
{ 10, 6, 11 },
{ 10, 10, 8 },
{ 10, 10, 7 },
{ 10, 14, 2 },
{ 10, 12, 4 },
{ 10, 1, 11 },
{ 10, 4, 12 },
/* 10 */
{ 10, 11, 1 },
{ 10, 3, 12 },
{ 10, 1, 13 },
{ 10, 12, 2 },
{ 10, 7, 11 },
{ 10, 3, 14 },
{ 10, 5, 12 },
{ 10, 5, 13 },
{ 10, 14, 4 },
{ 10, 4, 14 },
{ 10, 11, 7 },
{ 10, 14, 3 },
{ 10, 12, 5 },
{ 10, 13, 6 },
{ 10, 12, 6 },
{ 10, 8, 0 },
{ 10, 11, 8 },
{ 10, 2, 12 },
{ 10, 9, 9 },
{ 10, 14, 5 },
{ 10, 6, 13 },
{ 10, 10, 10 },
{ 10, 15, 2 },
{ 10, 8, 11 },
{ 10, 9, 10 },
{ 10, 14, 6 },
{ 10, 10, 9 },
{ 10, 5, 14 },
{ 10, 11, 9 },
{ 10, 14, 1 },
{ 10, 2, 14 },
{ 10, 6, 12 },
{ 10, 1, 12 },
{ 10, 13, 8 },
{ 10, 0, 8 },
{ 10, 13, 7 },
{ 10, 7, 12 },
{ 10, 12, 7 },
{ 10, 7, 13 },
{ 10, 15, 3 },
{ 10, 12, 1 },
{ 10, 6, 14 },
{ 10, 2, 15 },
{ 10, 15, 5 },
{ 10, 15, 4 },
{ 10, 1, 14 },
{ 10, 9, 11 },
{ 10, 4, 15 },
{ 10, 14, 7 },
{ 10, 8, 13 },
{ 10, 13, 9 },
{ 10, 8, 12 },
{ 10, 5, 15 },
{ 10, 3, 15 },
{ 10, 10, 11 },
{ 10, 11, 10 },
{ 10, 12, 8 },
{ 10, 15, 6 },
{ 10, 15, 7 },
{ 10, 8, 14 },
{ 10, 15, 1 },
{ 10, 7, 14 },
{ 10, 9, 0 },
{ 10, 0, 9 },
/* 10/11/12 */
{ 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 },
{ 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 },
{ 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 },
{ 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 },
{ 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 },
{ 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 },
{ 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 },
{ 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 },
{ 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 },
{ 11, 9, 14 }, { 11, 9, 14 },
{ 11, 15, 8 }, { 11, 15, 8 },
{ 11, 11, 11 }, { 11, 11, 11 },
{ 11, 11, 14 }, { 11, 11, 14 },
{ 11, 1, 15 }, { 11, 1, 15 },
{ 11, 10, 12 }, { 11, 10, 12 },
{ 11, 10, 14 }, { 11, 10, 14 },
{ 11, 13, 11 }, { 11, 13, 11 },
{ 11, 13, 10 }, { 11, 13, 10 },
{ 11, 11, 13 }, { 11, 11, 13 },
{ 11, 11, 12 }, { 11, 11, 12 },
{ 11, 8, 15 }, { 11, 8, 15 },
{ 11, 14, 11 }, { 11, 14, 11 },
{ 11, 13, 12 }, { 11, 13, 12 },
{ 11, 12, 13 }, { 11, 12, 13 },
{ 11, 15, 9 }, { 11, 15, 9 },
{ 11, 14, 10 }, { 11, 14, 10 },
{ 11, 10, 0 }, { 11, 10, 0 },
{ 11, 12, 11 }, { 11, 12, 11 },
{ 11, 9, 15 }, { 11, 9, 15 },
{ 11, 0, 10 }, { 11, 0, 10 },
{ 11, 12, 12 }, { 11, 12, 12 },
{ 11, 11, 0 }, { 11, 11, 0 },
{ 11, 12, 14 }, { 11, 12, 14 },
{ 11, 10, 15 }, { 11, 10, 15 },
{ 11, 13, 13 }, { 11, 13, 13 },
{ 11, 0, 13 }, { 11, 0, 13 },
{ 11, 14, 12 }, { 11, 14, 12 },
{ 11, 15, 10 }, { 11, 15, 10 },
{ 11, 15, 11 }, { 11, 15, 11 },
{ 11, 11, 15 }, { 11, 11, 15 },
{ 11, 14, 13 }, { 11, 14, 13 },
{ 11, 13, 0 }, { 11, 13, 0 },
{ 11, 0, 11 }, { 11, 0, 11 },
{ 11, 13, 14 }, { 11, 13, 14 },
{ 11, 15, 12 }, { 11, 15, 12 },
{ 11, 15, 13 }, { 11, 15, 13 },
{ 11, 12, 15 }, { 11, 12, 15 },
{ 11, 14, 0 }, { 11, 14, 0 },
{ 11, 14, 14 }, { 11, 14, 14 },
{ 11, 13, 15 }, { 11, 13, 15 },
{ 11, 12, 0 }, { 11, 12, 0 },
{ 11, 14, 15 }, { 11, 14, 15 },
{ 12, 0, 14 },
{ 12, 0, 12 },
{ 12, 15, 14 },
{ 12, 15, 0 },
{ 12, 0, 15 },
{ 12, 15, 15 }
};

View file

@ -0,0 +1,182 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_2.h 3 2005-06-02 18:16:43Z vspader $
**/
/* 2-step huffman table HCB_2 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb2_1[] = {
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* 00100 */ 1, 0 },
{ /* */ 1, 0 },
{ /* 00110 */ 2, 0 },
{ /* 00111 */ 3, 0 },
{ /* 01000 */ 4, 0 },
{ /* 01001 */ 5, 0 },
{ /* 01010 */ 6, 0 },
{ /* 01011 */ 7, 0 },
{ /* 01100 */ 8, 0 },
/* 6 bit codewords */
{ /* 01101 */ 9, 1 },
{ /* 01110 */ 11, 1 },
{ /* 01111 */ 13, 1 },
{ /* 10000 */ 15, 1 },
{ /* 10001 */ 17, 1 },
{ /* 10010 */ 19, 1 },
{ /* 10011 */ 21, 1 },
{ /* 10100 */ 23, 1 },
{ /* 10101 */ 25, 1 },
{ /* 10110 */ 27, 1 },
{ /* 10111 */ 29, 1 },
{ /* 11000 */ 31, 1 },
/* 7 bit codewords */
{ /* 11001 */ 33, 2 },
{ /* 11010 */ 37, 2 },
{ /* 11011 */ 41, 2 },
/* 7/8 bit codewords */
{ /* 11100 */ 45, 3 },
/* 8 bit codewords */
{ /* 11101 */ 53, 3 },
{ /* 11110 */ 61, 3 },
/* 8/9 bit codewords */
{ /* 11111 */ 69, 4 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_quad hcb2_2[] = {
/* 3 bit codeword */
{ 3, 0, 0, 0, 0 },
/* 4 bit codeword */
{ 4, 1, 0, 0, 0 },
/* 5 bit codewords */
{ 5, -1, 0, 0, 0 },
{ 5, 0, 0, 0, 1 },
{ 5, 0, 0, -1, 0 },
{ 5, 0, 0, 0, -1 },
{ 5, 0, -1, 0, 0 },
{ 5, 0, 0, 1, 0 },
{ 5, 0, 1, 0, 0 },
/* 6 bit codewords */
{ 6, 0, -1, 1, 0 },
{ 6, -1, 1, 0, 0 },
{ 6, 0, 1, -1, 0 },
{ 6, 0, 0, 1, -1 },
{ 6, 0, 1, 0, -1 },
{ 6, 0, 0, -1, 1 },
{ 6, -1, 0, 0, -1 },
{ 6, 1, -1, 0, 0 },
{ 6, 1, 0, -1, 0 },
{ 6, -1, -1, 0, 0 },
{ 6, 0, 0, -1, -1 },
{ 6, 1, 0, 1, 0 },
{ 6, 1, 0, 0, 1 },
{ 6, 0, -1, 0, 1 },
{ 6, -1, 0, 1, 0 },
{ 6, 0, 1, 0, 1 },
{ 6, 0, -1, -1, 0 },
{ 6, -1, 0, 0, 1 },
{ 6, 0, -1, 0, -1 },
{ 6, -1, 0, -1, 0 },
{ 6, 1, 1, 0, 0 },
{ 6, 0, 1, 1, 0 },
{ 6, 0, 0, 1, 1 },
{ 6, 1, 0, 0, -1 },
/* 7 bit codewords */
{ 7, 0, 1, -1, 1 },
{ 7, 1, 0, -1, 1 },
{ 7, -1, 1, -1, 0 },
{ 7, 0, -1, 1, -1 },
{ 7, 1, -1, 1, 0 },
{ 7, 1, 1, 0, -1 },
{ 7, 1, 0, 1, 1 },
{ 7, -1, 1, 1, 0 },
{ 7, 0, -1, -1, 1 },
{ 7, 1, 1, 1, 0 },
{ 7, -1, 0, 1, -1 },
{ 7, -1, -1, -1, 0 },
/* 7/8 bit codewords */
{ 7, -1, 0, -1, 1 }, { 7, -1, 0, -1, 1 },
{ 7, 1, -1, -1, 0 }, { 7, 1, -1, -1, 0 },
{ 7, 1, 1, -1, 0 }, { 7, 1, 1, -1, 0 },
{ 8, 1, -1, 0, 1 },
{ 8, -1, 1, 0, -1 },
/* 8 bit codewords */
{ 8, -1, -1, 1, 0 },
{ 8, -1, 0, 1, 1 },
{ 8, -1, -1, 0, 1 },
{ 8, -1, -1, 0, -1 },
{ 8, 0, -1, -1, -1 },
{ 8, 1, 0, 1, -1 },
{ 8, 1, 0, -1, -1 },
{ 8, 0, 1, -1, -1 },
{ 8, 0, 1, 1, 1 },
{ 8, -1, 1, 0, 1 },
{ 8, -1, 0, -1, -1 },
{ 8, 0, 1, 1, -1 },
{ 8, 1, -1, 0, -1 },
{ 8, 0, -1, 1, 1 },
{ 8, 1, 1, 0, 1 },
{ 8, 1, -1, 1, -1 },
/* 8/9 bit codewords */
{ 8, -1, 1, -1, 1 }, { 8, -1, 1, -1, 1 },
{ 9, 1, -1, -1, 1 },
{ 9, -1, -1, -1, -1 },
{ 9, -1, 1, 1, -1 },
{ 9, -1, 1, 1, 1 },
{ 9, 1, 1, 1, 1 },
{ 9, -1, -1, 1, -1 },
{ 9, 1, -1, 1, 1 },
{ 9, -1, 1, -1, -1 },
{ 9, -1, -1, 1, 1 },
{ 9, 1, 1, -1, -1 },
{ 9, 1, -1, -1, -1 },
{ 9, -1, -1, -1, 1 },
{ 9, 1, 1, -1, 1 },
{ 9, 1, 1, 1, -1 }
};

View file

@ -0,0 +1,193 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_3.h 3 2005-06-02 18:16:43Z vspader $
**/
/* Binary search huffman table HCB_3 */
static hcb_bin_quad hcb3[] = {
{ /* 0 */ 0, { 1, 2, 0, 0 } },
{ /* 1 */ 1, { 0, 0, 0, 0 } }, /* 0 */
{ /* 2 */ 0, { 1, 2, 0, 0 } },
{ /* 3 */ 0, { 2, 3, 0, 0 } },
{ /* 4 */ 0, { 3, 4, 0, 0 } },
{ /* 5 */ 0, { 4, 5, 0, 0 } },
{ /* 6 */ 0, { 5, 6, 0, 0 } },
{ /* 7 */ 0, { 6, 7, 0, 0 } },
{ /* 8 */ 0, { 7, 8, 0, 0 } },
{ /* 9 */ 1, { 1, 0, 0, 0 } }, /* 1000 */
{ /* 10 */ 1, { 0, 0, 0, 1 } }, /* 1001 */
{ /* 11 */ 1, { 0, 1, 0, 0 } }, /* 1010 */
{ /* 12 */ 1, { 0, 0, 1, 0 } }, /* 1011 */
{ /* 13 */ 0, { 4, 5, 0, 0 } },
{ /* 14 */ 0, { 5, 6, 0, 0 } },
{ /* 15 */ 0, { 6, 7, 0, 0 } },
{ /* 16 */ 0, { 7, 8, 0, 0 } },
{ /* 17 */ 1, { 1, 1, 0, 0 } },
{ /* 18 */ 1, { 0, 0, 1, 1 } },
{ /* 19 */ 0, { 6, 7, 0, 0 } },
{ /* 20 */ 0, { 7, 8, 0, 0 } },
{ /* 21 */ 0, { 8, 9, 0, 0 } },
{ /* 22 */ 0, { 9, 10, 0, 0 } },
{ /* 23 */ 0, { 10, 11, 0, 0 } },
{ /* 24 */ 0, { 11, 12, 0, 0 } },
{ /* 25 */ 1, { 0, 1, 1, 0 } }, /* 110100 */
{ /* 26 */ 1, { 0, 1, 0, 1 } }, /* 110101 */
{ /* 27 */ 1, { 1, 0, 1, 0 } }, /* 110110 */
{ /* 28 */ 1, { 0, 1, 1, 1 } }, /* 110111 */
{ /* 29 */ 1, { 1, 0, 0, 1 } }, /* 111000 */
{ /* 30 */ 1, { 1, 1, 1, 0 } }, /* 111001 */
{ /* 31 */ 0, { 6, 7, 0, 0 } },
{ /* 32 */ 0, { 7, 8, 0, 0 } },
{ /* 33 */ 0, { 8, 9, 0, 0 } },
{ /* 34 */ 0, { 9, 10, 0, 0 } },
{ /* 35 */ 0, { 10, 11, 0, 0 } },
{ /* 36 */ 0, { 11, 12, 0, 0 } },
{ /* 37 */ 1, { 1, 1, 1, 1 } }, /* 1110100 */
{ /* 38 */ 1, { 1, 0, 1, 1 } }, /* 1110101 */
{ /* 39 */ 1, { 1, 1, 0, 1 } }, /* 1110110 */
{ /* 40 */ 0, { 9, 10, 0, 0 } },
{ /* 41 */ 0, { 10, 11, 0, 0 } },
{ /* 42 */ 0, { 11, 12, 0, 0 } },
{ /* 43 */ 0, { 12, 13, 0, 0 } },
{ /* 44 */ 0, { 13, 14, 0, 0 } },
{ /* 45 */ 0, { 14, 15, 0, 0 } },
{ /* 46 */ 0, { 15, 16, 0, 0 } },
{ /* 47 */ 0, { 16, 17, 0, 0 } },
{ /* 48 */ 0, { 17, 18, 0, 0 } },
{ /* 49 */ 1, { 2, 0, 0, 0 } }, /* 11101110 */
{ /* 50 */ 1, { 0, 0, 0, 2 } }, /* 11101111 */
{ /* 51 */ 1, { 0, 0, 1, 2 } }, /* 11110000 */
{ /* 52 */ 1, { 2, 1, 0, 0 } }, /* 11110001 */
{ /* 53 */ 1, { 1, 2, 1, 0 } }, /* 11110010 */
{ /* 54 */ 0, { 13, 14, 0, 0 } },
{ /* 55 */ 0, { 14, 15, 0, 0 } },
{ /* 56 */ 0, { 15, 16, 0, 0 } },
{ /* 57 */ 0, { 16, 17, 0, 0 } },
{ /* 58 */ 0, { 17, 18, 0, 0 } },
{ /* 59 */ 0, { 18, 19, 0, 0 } },
{ /* 60 */ 0, { 19, 20, 0, 0 } },
{ /* 61 */ 0, { 20, 21, 0, 0 } },
{ /* 62 */ 0, { 21, 22, 0, 0 } },
{ /* 63 */ 0, { 22, 23, 0, 0 } },
{ /* 64 */ 0, { 23, 24, 0, 0 } },
{ /* 65 */ 0, { 24, 25, 0, 0 } },
{ /* 66 */ 0, { 25, 26, 0, 0 } },
{ /* 67 */ 1, { 0, 0, 2, 1 } },
{ /* 68 */ 1, { 0, 1, 2, 1 } },
{ /* 69 */ 1, { 1, 2, 0, 0 } },
{ /* 70 */ 1, { 0, 1, 1, 2 } },
{ /* 71 */ 1, { 2, 1, 1, 0 } },
{ /* 72 */ 1, { 0, 0, 2, 0 } },
{ /* 73 */ 1, { 0, 2, 1, 0 } },
{ /* 74 */ 1, { 0, 1, 2, 0 } },
{ /* 75 */ 1, { 0, 2, 0, 0 } },
{ /* 76 */ 1, { 0, 1, 0, 2 } },
{ /* 77 */ 1, { 2, 0, 1, 0 } },
{ /* 78 */ 1, { 1, 2, 1, 1 } },
{ /* 79 */ 1, { 0, 2, 1, 1 } },
{ /* 80 */ 1, { 1, 1, 2, 0 } },
{ /* 81 */ 1, { 1, 1, 2, 1 } },
{ /* 82 */ 0, { 11, 12, 0, 0 } },
{ /* 83 */ 0, { 12, 13, 0, 0 } },
{ /* 84 */ 0, { 13, 14, 0, 0 } },
{ /* 85 */ 0, { 14, 15, 0, 0 } },
{ /* 86 */ 0, { 15, 16, 0, 0 } },
{ /* 87 */ 0, { 16, 17, 0, 0 } },
{ /* 88 */ 0, { 17, 18, 0, 0 } },
{ /* 89 */ 0, { 18, 19, 0, 0 } },
{ /* 90 */ 0, { 19, 20, 0, 0 } },
{ /* 91 */ 0, { 20, 21, 0, 0 } },
{ /* 92 */ 0, { 21, 22, 0, 0 } },
{ /* 93 */ 1, { 1, 2, 0, 1 } }, /* 1111101010 */
{ /* 94 */ 1, { 1, 0, 2, 0 } }, /* 1111101011 */
{ /* 95 */ 1, { 1, 0, 2, 1 } }, /* 1111101100 */
{ /* 96 */ 1, { 0, 2, 0, 1 } }, /* 1111101101 */
{ /* 97 */ 1, { 2, 1, 1, 1 } }, /* 1111101110 */
{ /* 98 */ 1, { 1, 1, 1, 2 } }, /* 1111101111 */
{ /* 99 */ 1, { 2, 1, 0, 1 } }, /* 1111110000 */
{ /* 00 */ 1, { 1, 0, 1, 2 } }, /* 1111110001 */
{ /* 01 */ 1, { 0, 0, 2, 2 } }, /* 1111110010 */
{ /* 02 */ 1, { 0, 1, 2, 2 } }, /* 1111110011 */
{ /* 03 */ 1, { 2, 2, 1, 0 } }, /* 1111110100 */
{ /* 04 */ 1, { 1, 2, 2, 0 } }, /* 1111110101 */
{ /* 05 */ 1, { 1, 0, 0, 2 } }, /* 1111110110 */
{ /* 06 */ 1, { 2, 0, 0, 1 } }, /* 1111110111 */
{ /* 07 */ 1, { 0, 2, 2, 1 } }, /* 1111111000 */
{ /* 08 */ 0, { 7, 8, 0, 0 } },
{ /* 09 */ 0, { 8, 9, 0, 0 } },
{ /* 10 */ 0, { 9, 10, 0, 0 } },
{ /* 11 */ 0, { 10, 11, 0, 0 } },
{ /* 12 */ 0, { 11, 12, 0, 0 } },
{ /* 13 */ 0, { 12, 13, 0, 0 } },
{ /* 14 */ 0, { 13, 14, 0, 0 } },
{ /* 15 */ 1, { 2, 2, 0, 0 } }, /* 11111110010 */
{ /* 16 */ 1, { 1, 2, 2, 1 } }, /* 11111110011 */
{ /* 17 */ 1, { 1, 1, 0, 2 } }, /* 11111110100 */
{ /* 18 */ 1, { 2, 0, 1, 1 } }, /* 11111110101 */
{ /* 19 */ 1, { 1, 1, 2, 2 } }, /* 11111110110 */
{ /* 20 */ 1, { 2, 2, 1, 1 } }, /* 11111110111 */
{ /* 21 */ 1, { 0, 2, 2, 0 } }, /* 11111111000 */
{ /* 22 */ 1, { 0, 2, 1, 2 } }, /* 11111111001 */
{ /* 23 */ 0, { 6, 7, 0, 0 } },
{ /* 24 */ 0, { 7, 8, 0, 0 } },
{ /* 25 */ 0, { 8, 9, 0, 0 } },
{ /* 26 */ 0, { 9, 10, 0, 0 } },
{ /* 27 */ 0, { 10, 11, 0, 0 } },
{ /* 28 */ 0, { 11, 12, 0, 0 } },
{ /* 29 */ 1, { 1, 0, 2, 2 } }, /* 111111110100 */
{ /* 30 */ 1, { 2, 2, 0, 1 } }, /* 111111110101 */
{ /* 31 */ 1, { 2, 1, 2, 0 } }, /* 111111110110 */
{ /* 32 */ 1, { 2, 2, 2, 0 } }, /* 111111110111 */
{ /* 33 */ 1, { 0, 2, 2, 2 } }, /* 111111111000 */
{ /* 34 */ 1, { 2, 2, 2, 1 } }, /* 111111111001 */
{ /* 35 */ 1, { 2, 1, 2, 1 } }, /* 111111111010 */
{ /* 36 */ 1, { 1, 2, 1, 2 } }, /* 111111111011 */
{ /* 37 */ 1, { 1, 2, 2, 2 } }, /* 111111111100 */
{ /* 38 */ 0, { 3, 4, 0, 0 } },
{ /* 39 */ 0, { 4, 5, 0, 0 } },
{ /* 40 */ 0, { 5, 6, 0, 0 } },
{ /* 41 */ 1, { 0, 2, 0, 2 } }, /* 1111111111010 */
{ /* 42 */ 1, { 2, 0, 2, 0 } }, /* 1111111111011 */
{ /* 43 */ 1, { 1, 2, 0, 2 } }, /* 1111111111100 */
{ /* 44 */ 0, { 3, 4, 0, 0 } },
{ /* 45 */ 0, { 4, 5, 0, 0 } },
{ /* 46 */ 0, { 5, 6, 0, 0 } },
{ /* 47 */ 1, { 2, 0, 2, 1 } }, /* 11111111111010 */
{ /* 48 */ 1, { 2, 1, 1, 2 } }, /* 11111111111011 */
{ /* 49 */ 1, { 2, 1, 0, 2 } }, /* 11111111111100 */
{ /* 50 */ 0, { 3, 4, 0, 0 } },
{ /* 51 */ 0, { 4, 5, 0, 0 } },
{ /* 52 */ 0, { 5, 6, 0, 0 } },
{ /* 53 */ 1, { 2, 2, 2, 2 } }, /* 111111111111010 */
{ /* 54 */ 1, { 2, 2, 1, 2 } }, /* 111111111111011 */
{ /* 55 */ 1, { 2, 1, 2, 2 } }, /* 111111111111100 */
{ /* 56 */ 1, { 2, 0, 1, 2 } }, /* 111111111111101 */
{ /* 57 */ 1, { 2, 0, 0, 2 } }, /* 111111111111110 */
{ /* 58 */ 0, { 1, 2, 0, 0 } },
{ /* 59 */ 1, { 2, 2, 0, 2 } }, /* 1111111111111110 */
{ /* 60 */ 1, { 2, 0, 2, 2 } } /* 1111111111111111 */
};

View file

@ -0,0 +1,196 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_4.h 3 2005-06-02 18:16:43Z vspader $
**/
/* 2-step huffman table HCB_4 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb4_1[] = {
/* 4 bit codewords */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* 00010 */ 1, 0 },
{ /* */ 1, 0 },
{ /* 00100 */ 2, 0 },
{ /* */ 2, 0 },
{ /* 00110 */ 3, 0 },
{ /* */ 3, 0 },
{ /* 01000 */ 4, 0 },
{ /* */ 4, 0 },
{ /* 01010 */ 5, 0 },
{ /* */ 5, 0 },
{ /* 01100 */ 6, 0 },
{ /* */ 6, 0 },
{ /* 01110 */ 7, 0 },
{ /* */ 7, 0 },
{ /* 10000 */ 8, 0 },
{ /* */ 8, 0 },
{ /* 10010 */ 9, 0 },
{ /* */ 9, 0 },
/* 5 bit codewords */
{ /* 10100 */ 10, 0 },
{ /* 10101 */ 11, 0 },
{ /* 10110 */ 12, 0 },
{ /* 10111 */ 13, 0 },
{ /* 11000 */ 14, 0 },
{ /* 11001 */ 15, 0 },
/* 7 bit codewords */
{ /* 11010 */ 16, 2 },
{ /* 11011 */ 20, 2 },
/* 7/8 bit codewords */
{ /* 11100 */ 24, 3 },
/* 8 bit codewords */
{ /* 11101 */ 32, 3 },
/* 8/9 bit codewords */
{ /* 11110 */ 40, 4 },
/* 9/10/11/12 bit codewords */
{ /* 11111 */ 56, 7 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_quad hcb4_2[] = {
/* 4 bit codewords */
{ 4, 1, 1, 1, 1 },
{ 4, 0, 1, 1, 1 },
{ 4, 1, 1, 0, 1 },
{ 4, 1, 1, 1, 0 },
{ 4, 1, 0, 1, 1 },
{ 4, 1, 0, 0, 0 },
{ 4, 1, 1, 0, 0 },
{ 4, 0, 0, 0, 0 },
{ 4, 0, 0, 1, 1 },
{ 4, 1, 0, 1, 0 },
/* 5 bit codewords */
{ 5, 1, 0, 0, 1 },
{ 5, 0, 1, 1, 0 },
{ 5, 0, 0, 0, 1 },
{ 5, 0, 1, 0, 1 },
{ 5, 0, 0, 1, 0 },
{ 5, 0, 1, 0, 0 },
/* 7 bit codewords */
/* first 5 bits: 11010 */
{ 7, 2, 1, 1, 1 },
{ 7, 1, 1, 2, 1 },
{ 7, 1, 2, 1, 1 },
{ 7, 1, 1, 1, 2 },
/* first 5 bits: 11011 */
{ 7, 2, 1, 1, 0 },
{ 7, 2, 1, 0, 1 },
{ 7, 1, 2, 1, 0 },
{ 7, 2, 0, 1, 1 },
/* 7/8 bit codewords */
/* first 5 bits: 11100 */
{ 7, 0, 1, 2, 1 }, { 7, 0, 1, 2, 1 },
{ 8, 0, 1, 1, 2 },
{ 8, 1, 1, 2, 0 },
{ 8, 0, 2, 1, 1 },
{ 8, 1, 0, 1, 2 },
{ 8, 1, 2, 0, 1 },
{ 8, 1, 1, 0, 2 },
/* 8 bit codewords */
{ 8, 1, 0, 2, 1 },
{ 8, 2, 1, 0, 0 },
{ 8, 2, 0, 1, 0 },
{ 8, 1, 2, 0, 0 },
{ 8, 2, 0, 0, 1 },
{ 8, 0, 1, 0, 2 },
{ 8, 0, 2, 1, 0 },
{ 8, 0, 0, 1, 2 },
/* 8/9 bit codewords */
{ 8, 0, 1, 2, 0 }, { 8, 0, 1, 2, 0 },
{ 8, 0, 2, 0, 1 }, { 8, 0, 2, 0, 1 },
{ 8, 1, 0, 0, 2 }, { 8, 1, 0, 0, 2 },
{ 8, 0, 0, 2, 1 }, { 8, 0, 0, 2, 1 },
{ 8, 1, 0, 2, 0 }, { 8, 1, 0, 2, 0 },
{ 8, 2, 0, 0, 0 }, { 8, 2, 0, 0, 0 },
{ 8, 0, 0, 0, 2 }, { 8, 0, 0, 0, 2 },
{ 9, 0, 2, 0, 0 },
{ 9, 0, 0, 2, 0 },
/* 9/10/11 bit codewords */
/* 9 bit codewords repeated 2^3 = 8 times */
{ 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 },
{ 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 },
{ 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 },
{ 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 },
{ 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 },
{ 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 },
{ 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 },
{ 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 },
{ 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 },
{ 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 },
{ 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 },
{ 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 },
/* 10 bit codewords repeated 2^2 = 4 times */
{ 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 },
{ 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 },
{ 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 },
{ 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 },
{ 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 },
{ 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 },
{ 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 },
{ 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 },
{ 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 },
{ 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 },
{ 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 },
{ 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 },
{ 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 },
{ 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 },
/* 11 bit codewords repeated 2^1 = 2 times */
{ 11, 2, 1, 2, 2 }, { 11, 2, 1, 2, 2 },
{ 11, 2, 2, 1, 2 }, { 11, 2, 2, 1, 2 },
{ 11, 0, 2, 2, 0 }, { 11, 0, 2, 2, 0 },
{ 11, 2, 2, 0, 0 }, { 11, 2, 2, 0, 0 },
{ 11, 0, 0, 2, 2 }, { 11, 0, 0, 2, 2 },
{ 11, 2, 0, 2, 0 }, { 11, 2, 0, 2, 0 },
{ 11, 0, 2, 0, 2 }, { 11, 0, 2, 0, 2 },
{ 11, 2, 0, 0, 2 }, { 11, 2, 0, 0, 2 },
{ 11, 2, 2, 2, 2 }, { 11, 2, 2, 2, 2 },
{ 11, 0, 2, 2, 2 }, { 11, 0, 2, 2, 2 },
{ 11, 2, 2, 2, 0 }, { 11, 2, 2, 2, 0 },
/* 12 bit codewords */
{ 12, 2, 2, 0, 2 },
{ 12, 2, 0, 2, 2 },
};

View file

@ -0,0 +1,193 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_5.h 3 2005-06-02 18:16:43Z vspader $
**/
/* Binary search huffman table HCB_5 */
static hcb_bin_pair hcb5[] = {
{ /* 0 */ 0, { 1, 2 } },
{ /* 1 */ 1, { 0, 0 } }, /* 0 */
{ /* 2 */ 0, { 1, 2 } },
{ /* 3 */ 0, { 2, 3 } },
{ /* 4 */ 0, { 3, 4 } },
{ /* 5 */ 0, { 4, 5 } },
{ /* 6 */ 0, { 5, 6 } },
{ /* 7 */ 0, { 6, 7 } },
{ /* 8 */ 0, { 7, 8 } },
{ /* 9 */ 1, { -1, 0 } }, /* 1000 */
{ /* 10 */ 1, { 1, 0 } }, /* 1001 */
{ /* 11 */ 1, { 0, 1 } }, /* 1010 */
{ /* 12 */ 1, { 0, -1 } }, /* 1011 */
{ /* 13 */ 0, { 4, 5 } },
{ /* 14 */ 0, { 5, 6 } },
{ /* 15 */ 0, { 6, 7 } },
{ /* 16 */ 0, { 7, 8 } },
{ /* 17 */ 1, { 1, -1 } },
{ /* 18 */ 1, { -1, 1 } },
{ /* 19 */ 1, { -1, -1 } },
{ /* 20 */ 1, { 1, 1 } },
{ /* 21 */ 0, { 4, 5 } },
{ /* 22 */ 0, { 5, 6 } },
{ /* 23 */ 0, { 6, 7 } },
{ /* 24 */ 0, { 7, 8 } },
{ /* 25 */ 0, { 8, 9 } },
{ /* 26 */ 0, { 9, 10 } },
{ /* 27 */ 0, { 10, 11 } },
{ /* 28 */ 0, { 11, 12 } },
{ /* 29 */ 0, { 12, 13 } },
{ /* 30 */ 0, { 13, 14 } },
{ /* 31 */ 0, { 14, 15 } },
{ /* 32 */ 0, { 15, 16 } },
{ /* 33 */ 1, { -2, 0 } },
{ /* 34 */ 1, { 0, 2 } },
{ /* 35 */ 1, { 2, 0 } },
{ /* 36 */ 1, { 0, -2 } },
{ /* 37 */ 0, { 12, 13 } },
{ /* 38 */ 0, { 13, 14 } },
{ /* 39 */ 0, { 14, 15 } },
{ /* 40 */ 0, { 15, 16 } },
{ /* 41 */ 0, { 16, 17 } },
{ /* 42 */ 0, { 17, 18 } },
{ /* 43 */ 0, { 18, 19 } },
{ /* 44 */ 0, { 19, 20 } },
{ /* 45 */ 0, { 20, 21 } },
{ /* 46 */ 0, { 21, 22 } },
{ /* 47 */ 0, { 22, 23 } },
{ /* 48 */ 0, { 23, 24 } },
{ /* 49 */ 1, { -2, -1 } },
{ /* 50 */ 1, { 2, 1 } },
{ /* 51 */ 1, { -1, -2 } },
{ /* 52 */ 1, { 1, 2 } },
{ /* 53 */ 1, { -2, 1 } },
{ /* 54 */ 1, { 2, -1 } },
{ /* 55 */ 1, { -1, 2 } },
{ /* 56 */ 1, { 1, -2 } },
{ /* 57 */ 1, { -3, 0 } },
{ /* 58 */ 1, { 3, 0 } },
{ /* 59 */ 1, { 0, -3 } },
{ /* 60 */ 1, { 0, 3 } },
{ /* 61 */ 0, { 12, 13 } },
{ /* 62 */ 0, { 13, 14 } },
{ /* 63 */ 0, { 14, 15 } },
{ /* 64 */ 0, { 15, 16 } },
{ /* 65 */ 0, { 16, 17 } },
{ /* 66 */ 0, { 17, 18 } },
{ /* 67 */ 0, { 18, 19 } },
{ /* 68 */ 0, { 19, 20 } },
{ /* 69 */ 0, { 20, 21 } },
{ /* 70 */ 0, { 21, 22 } },
{ /* 71 */ 0, { 22, 23 } },
{ /* 72 */ 0, { 23, 24 } },
{ /* 73 */ 1, { -3, -1 } },
{ /* 74 */ 1, { 1, 3 } },
{ /* 75 */ 1, { 3, 1 } },
{ /* 76 */ 1, { -1, -3 } },
{ /* 77 */ 1, { -3, 1 } },
{ /* 78 */ 1, { 3, -1 } },
{ /* 79 */ 1, { 1, -3 } },
{ /* 80 */ 1, { -1, 3 } },
{ /* 81 */ 1, { -2, 2 } },
{ /* 82 */ 1, { 2, 2 } },
{ /* 83 */ 1, { -2, -2 } },
{ /* 84 */ 1, { 2, -2 } },
{ /* 85 */ 0, { 12, 13 } },
{ /* 86 */ 0, { 13, 14 } },
{ /* 87 */ 0, { 14, 15 } },
{ /* 88 */ 0, { 15, 16 } },
{ /* 89 */ 0, { 16, 17 } },
{ /* 90 */ 0, { 17, 18 } },
{ /* 91 */ 0, { 18, 19 } },
{ /* 92 */ 0, { 19, 20 } },
{ /* 93 */ 0, { 20, 21 } },
{ /* 94 */ 0, { 21, 22 } },
{ /* 95 */ 0, { 22, 23 } },
{ /* 96 */ 0, { 23, 24 } },
{ /* 97 */ 1, { -3, -2 } },
{ /* 98 */ 1, { 3, -2 } },
{ /* 99 */ 1, { -2, 3 } },
{ /* 00 */ 1, { 2, -3 } },
{ /* 01 */ 1, { 3, 2 } },
{ /* 02 */ 1, { 2, 3 } },
{ /* 03 */ 1, { -3, 2 } },
{ /* 04 */ 1, { -2, -3 } },
{ /* 05 */ 1, { 0, -4 } },
{ /* 06 */ 1, { -4, 0 } },
{ /* 07 */ 1, { 4, 1 } },
{ /* 08 */ 1, { 4, 0 } },
{ /* 09 */ 0, { 12, 13 } },
{ /* 10 */ 0, { 13, 14 } },
{ /* 11 */ 0, { 14, 15 } },
{ /* 12 */ 0, { 15, 16 } },
{ /* 13 */ 0, { 16, 17 } },
{ /* 14 */ 0, { 17, 18 } },
{ /* 15 */ 0, { 18, 19 } },
{ /* 16 */ 0, { 19, 20 } },
{ /* 17 */ 0, { 20, 21 } },
{ /* 18 */ 0, { 21, 22 } },
{ /* 19 */ 0, { 22, 23 } },
{ /* 20 */ 0, { 23, 24 } },
{ /* 21 */ 1, { -4, -1 } },
{ /* 22 */ 1, { 0, 4 } },
{ /* 23 */ 1, { 4, -1 } },
{ /* 24 */ 1, { -1, -4 } },
{ /* 25 */ 1, { 1, 4 } },
{ /* 26 */ 1, { -1, 4 } },
{ /* 27 */ 1, { -4, 1 } },
{ /* 28 */ 1, { 1, -4 } },
{ /* 29 */ 1, { 3, -3 } },
{ /* 30 */ 1, { -3, -3 } },
{ /* 31 */ 1, { -3, 3 } },
{ /* 32 */ 1, { -2, 4 } },
{ /* 33 */ 1, { -4, -2 } },
{ /* 34 */ 1, { 4, 2 } },
{ /* 35 */ 1, { 2, -4 } },
{ /* 36 */ 1, { 2, 4 } },
{ /* 37 */ 1, { 3, 3 } },
{ /* 38 */ 1, { -4, 2 } },
{ /* 39 */ 0, { 6, 7 } },
{ /* 40 */ 0, { 7, 8 } },
{ /* 41 */ 0, { 8, 9 } },
{ /* 42 */ 0, { 9, 10 } },
{ /* 43 */ 0, { 10, 11 } },
{ /* 44 */ 0, { 11, 12 } },
{ /* 45 */ 1, { -2, -4 } },
{ /* 46 */ 1, { 4, -2 } },
{ /* 47 */ 1, { 3, -4 } },
{ /* 48 */ 1, { -4, -3 } },
{ /* 49 */ 1, { -4, 3 } },
{ /* 50 */ 1, { 3, 4 } },
{ /* 51 */ 1, { -3, 4 } },
{ /* 52 */ 1, { 4, 3 } },
{ /* 53 */ 1, { 4, -3 } },
{ /* 54 */ 1, { -3, -4 } },
{ /* 55 */ 0, { 2, 3 } },
{ /* 56 */ 0, { 3, 4 } },
{ /* 57 */ 1, { 4, -4 } },
{ /* 58 */ 1, { -4, 4 } },
{ /* 59 */ 1, { 4, 4 } },
{ /* 60 */ 1, { -4, -4 } }
};

View file

@ -0,0 +1,179 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_6.h 3 2005-06-02 18:16:43Z vspader $
**/
/* 2-step huffman table HCB_6 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb6_1[] = {
/* 4 bit codewords */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* 00010 */ 1, 0 },
{ /* */ 1, 0 },
{ /* 00100 */ 2, 0 },
{ /* */ 2, 0 },
{ /* 00110 */ 3, 0 },
{ /* */ 3, 0 },
{ /* 01000 */ 4, 0 },
{ /* */ 4, 0 },
{ /* 01010 */ 5, 0 },
{ /* */ 5, 0 },
{ /* 01100 */ 6, 0 },
{ /* */ 6, 0 },
{ /* 01110 */ 7, 0 },
{ /* */ 7, 0 },
{ /* 10000 */ 8, 0 },
{ /* */ 8, 0 },
/* 6 bit codewords */
{ /* 10010 */ 9, 1 },
{ /* 10011 */ 11, 1 },
{ /* 10100 */ 13, 1 },
{ /* 10101 */ 15, 1 },
{ /* 10110 */ 17, 1 },
{ /* 10111 */ 19, 1 },
{ /* 11000 */ 21, 1 },
{ /* 11001 */ 23, 1 },
/* 7 bit codewords */
{ /* 11010 */ 25, 2 },
{ /* 11011 */ 29, 2 },
{ /* 11100 */ 33, 2 },
/* 7/8 bit codewords */
{ /* 11101 */ 37, 3 },
/* 8/9 bit codewords */
{ /* 11110 */ 45, 4 },
/* 9/10/11 bit codewords */
{ /* 11111 */ 61, 6 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_pair hcb6_2[] = {
/* 4 bit codewords */
{ 4, 0, 0 },
{ 4, 1, 0 },
{ 4, 0, -1 },
{ 4, 0, 1 },
{ 4, -1, 0 },
{ 4, 1, 1 },
{ 4, -1, 1 },
{ 4, 1, -1 },
{ 4, -1, -1 },
/* 6 bit codewords */
{ 6, 2, -1 },
{ 6, 2, 1 },
{ 6, -2, 1 },
{ 6, -2, -1 },
{ 6, -2, 0 },
{ 6, -1, 2 },
{ 6, 2, 0 },
{ 6, 1, -2 },
{ 6, 1, 2 },
{ 6, 0, -2 },
{ 6, -1, -2 },
{ 6, 0, 2 },
{ 6, 2, -2 },
{ 6, -2, 2 },
{ 6, -2, -2 },
{ 6, 2, 2 },
/* 7 bit codewords */
{ 7, -3, 1 },
{ 7, 3, 1 },
{ 7, 3, -1 },
{ 7, -1, 3 },
{ 7, -3, -1 },
{ 7, 1, 3 },
{ 7, 1, -3 },
{ 7, -1, -3 },
{ 7, 3, 0 },
{ 7, -3, 0 },
{ 7, 0, -3 },
{ 7, 0, 3 },
/* 7/8 bit codewords */
{ 7, 3, 2 }, { 7, 3, 2 },
{ 8, -3, -2 },
{ 8, -2, 3 },
{ 8, 2, 3 },
{ 8, 3, -2 },
{ 8, 2, -3 },
{ 8, -2, -3 },
/* 8 bit codewords */
{ 8, -3, 2 }, { 8, -3, 2 },
{ 8, 3, 3 }, { 8, 3, 3 },
{ 9, 3, -3 },
{ 9, -3, -3 },
{ 9, -3, 3 },
{ 9, 1, -4 },
{ 9, -1, -4 },
{ 9, 4, 1 },
{ 9, -4, 1 },
{ 9, -4, -1 },
{ 9, 1, 4 },
{ 9, 4, -1 },
{ 9, -1, 4 },
{ 9, 0, -4 },
/* 9/10/11 bit codewords */
{ 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 },
{ 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 },
{ 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 },
{ 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 },
{ 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 },
{ 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 },
{ 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 },
{ 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 },
{ 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 },
{ 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 },
{ 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 },
{ 10, -3, -4 }, { 10, -3, -4 },
{ 10, -3, 4 }, { 10, -3, 4 },
{ 10, 3, -4 }, { 10, 3, -4 },
{ 10, 4, -3 }, { 10, 4, -3 },
{ 10, 3, 4 }, { 10, 3, 4 },
{ 10, 4, 3 }, { 10, 4, 3 },
{ 10, -4, 3 }, { 10, -4, 3 },
{ 10, -4, -3 }, { 10, -4, -3 },
{ 11, 4, 4 },
{ 11, -4, 4 },
{ 11, -4, -4 },
{ 11, 4, -4 }
};

View file

@ -0,0 +1,159 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_7.h 3 2005-06-02 18:16:43Z vspader $
**/
/* Binary search huffman table HCB_7 */
static hcb_bin_pair hcb7[] = {
{ /* 0 */ 0, { 1, 2 } },
{ /* 1 */ 1, { 0, 0 } },
{ /* 2 */ 0, { 1, 2 } },
{ /* 3 */ 0, { 2, 3 } },
{ /* 4 */ 0, { 3, 4 } },
{ /* 5 */ 1, { 1, 0 } },
{ /* 6 */ 1, { 0, 1 } },
{ /* 7 */ 0, { 2, 3 } },
{ /* 8 */ 0, { 3, 4 } },
{ /* 9 */ 1, { 1, 1 } },
{ /* 10 */ 0, { 3, 4 } },
{ /* 11 */ 0, { 4, 5 } },
{ /* 12 */ 0, { 5, 6 } },
{ /* 13 */ 0, { 6, 7 } },
{ /* 14 */ 0, { 7, 8 } },
{ /* 15 */ 0, { 8, 9 } },
{ /* 16 */ 0, { 9, 10 } },
{ /* 17 */ 0, { 10, 11 } },
{ /* 18 */ 0, { 11, 12 } },
{ /* 19 */ 1, { 2, 1 } },
{ /* 20 */ 1, { 1, 2 } },
{ /* 21 */ 1, { 2, 0 } },
{ /* 22 */ 1, { 0, 2 } },
{ /* 23 */ 0, { 8, 9 } },
{ /* 24 */ 0, { 9, 10 } },
{ /* 25 */ 0, { 10, 11 } },
{ /* 26 */ 0, { 11, 12 } },
{ /* 27 */ 0, { 12, 13 } },
{ /* 28 */ 0, { 13, 14 } },
{ /* 29 */ 0, { 14, 15 } },
{ /* 30 */ 0, { 15, 16 } },
{ /* 31 */ 1, { 3, 1 } },
{ /* 32 */ 1, { 1, 3 } },
{ /* 33 */ 1, { 2, 2 } },
{ /* 34 */ 1, { 3, 0 } },
{ /* 35 */ 1, { 0, 3 } },
{ /* 36 */ 0, { 11, 12 } },
{ /* 37 */ 0, { 12, 13 } },
{ /* 38 */ 0, { 13, 14 } },
{ /* 39 */ 0, { 14, 15 } },
{ /* 40 */ 0, { 15, 16 } },
{ /* 41 */ 0, { 16, 17 } },
{ /* 42 */ 0, { 17, 18 } },
{ /* 43 */ 0, { 18, 19 } },
{ /* 44 */ 0, { 19, 20 } },
{ /* 45 */ 0, { 20, 21 } },
{ /* 46 */ 0, { 21, 22 } },
{ /* 47 */ 1, { 2, 3 } },
{ /* 48 */ 1, { 3, 2 } },
{ /* 49 */ 1, { 1, 4 } },
{ /* 50 */ 1, { 4, 1 } },
{ /* 51 */ 1, { 1, 5 } },
{ /* 52 */ 1, { 5, 1 } },
{ /* 53 */ 1, { 3, 3 } },
{ /* 54 */ 1, { 2, 4 } },
{ /* 55 */ 1, { 0, 4 } },
{ /* 56 */ 1, { 4, 0 } },
{ /* 57 */ 0, { 12, 13 } },
{ /* 58 */ 0, { 13, 14 } },
{ /* 59 */ 0, { 14, 15 } },
{ /* 60 */ 0, { 15, 16 } },
{ /* 61 */ 0, { 16, 17 } },
{ /* 62 */ 0, { 17, 18 } },
{ /* 63 */ 0, { 18, 19 } },
{ /* 64 */ 0, { 19, 20 } },
{ /* 65 */ 0, { 20, 21 } },
{ /* 66 */ 0, { 21, 22 } },
{ /* 67 */ 0, { 22, 23 } },
{ /* 68 */ 0, { 23, 24 } },
{ /* 69 */ 1, { 4, 2 } },
{ /* 70 */ 1, { 2, 5 } },
{ /* 71 */ 1, { 5, 2 } },
{ /* 72 */ 1, { 0, 5 } },
{ /* 73 */ 1, { 6, 1 } },
{ /* 74 */ 1, { 5, 0 } },
{ /* 75 */ 1, { 1, 6 } },
{ /* 76 */ 1, { 4, 3 } },
{ /* 77 */ 1, { 3, 5 } },
{ /* 78 */ 1, { 3, 4 } },
{ /* 79 */ 1, { 5, 3 } },
{ /* 80 */ 1, { 2, 6 } },
{ /* 81 */ 1, { 6, 2 } },
{ /* 82 */ 1, { 1, 7 } },
{ /* 83 */ 0, { 10, 11 } },
{ /* 84 */ 0, { 11, 12 } },
{ /* 85 */ 0, { 12, 13 } },
{ /* 86 */ 0, { 13, 14 } },
{ /* 87 */ 0, { 14, 15 } },
{ /* 88 */ 0, { 15, 16 } },
{ /* 89 */ 0, { 16, 17 } },
{ /* 90 */ 0, { 17, 18 } },
{ /* 91 */ 0, { 18, 19 } },
{ /* 92 */ 0, { 19, 20 } },
{ /* 93 */ 1, { 3, 6 } },
{ /* 94 */ 1, { 0, 6 } },
{ /* 95 */ 1, { 6, 0 } },
{ /* 96 */ 1, { 4, 4 } },
{ /* 97 */ 1, { 7, 1 } },
{ /* 98 */ 1, { 4, 5 } },
{ /* 99 */ 1, { 7, 2 } },
{ /* 00 */ 1, { 5, 4 } },
{ /* 01 */ 1, { 6, 3 } },
{ /* 02 */ 1, { 2, 7 } },
{ /* 03 */ 1, { 7, 3 } },
{ /* 04 */ 1, { 6, 4 } },
{ /* 05 */ 1, { 5, 5 } },
{ /* 06 */ 1, { 4, 6 } },
{ /* 07 */ 1, { 3, 7 } },
{ /* 08 */ 0, { 5, 6 } },
{ /* 09 */ 0, { 6, 7 } },
{ /* 10 */ 0, { 7, 8 } },
{ /* 11 */ 0, { 8, 9 } },
{ /* 12 */ 0, { 9, 10 } },
{ /* 13 */ 1, { 7, 0 } },
{ /* 14 */ 1, { 0, 7 } },
{ /* 15 */ 1, { 6, 5 } },
{ /* 16 */ 1, { 5, 6 } },
{ /* 17 */ 1, { 7, 4 } },
{ /* 18 */ 1, { 4, 7 } },
{ /* 19 */ 1, { 5, 7 } },
{ /* 20 */ 1, { 7, 5 } },
{ /* 21 */ 0, { 2, 3 } },
{ /* 22 */ 0, { 3, 4 } },
{ /* 23 */ 1, { 7, 6 } },
{ /* 24 */ 1, { 6, 6 } },
{ /* 25 */ 1, { 6, 7 } },
{ /* 26 */ 1, { 7, 7 } }
};

View file

@ -0,0 +1,170 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_8.h 3 2005-06-02 18:16:43Z vspader $
**/
/* 2-step huffman table HCB_8 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb8_1[] = {
/* 3 bit codeword */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
/* 4 bit codewords */
{ /* 00100 */ 1, 0 },
{ /* */ 1, 0 },
{ /* 00110 */ 2, 0 },
{ /* */ 2, 0 },
{ /* 01000 */ 3, 0 },
{ /* */ 3, 0 },
{ /* 01010 */ 4, 0 },
{ /* */ 4, 0 },
{ /* 01100 */ 5, 0 },
{ /* */ 5, 0 },
/* 5 bit codewords */
{ /* 01110 */ 6, 0 },
{ /* 01111 */ 7, 0 },
{ /* 10000 */ 8, 0 },
{ /* 10001 */ 9, 0 },
{ /* 10010 */ 10, 0 },
{ /* 10011 */ 11, 0 },
{ /* 10100 */ 12, 0 },
/* 6 bit codewords */
{ /* 10101 */ 13, 1 },
{ /* 10110 */ 15, 1 },
{ /* 10111 */ 17, 1 },
{ /* 11000 */ 19, 1 },
{ /* 11001 */ 21, 1 },
/* 7 bit codewords */
{ /* 11010 */ 23, 2 },
{ /* 11011 */ 27, 2 },
{ /* 11100 */ 31, 2 },
/* 7/8 bit codewords */
{ /* 11101 */ 35, 3 },
/* 8 bit codewords */
{ /* 11110 */ 43, 3 },
/* 8/9/10 bit codewords */
{ /* 11111 */ 51, 5 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_pair hcb8_2[] = {
/* 3 bit codeword */
{ 3, 1, 1 },
/* 4 bit codewords */
{ 4, 2, 1 },
{ 4, 1, 0 },
{ 4, 1, 2 },
{ 4, 0, 1 },
{ 4, 2, 2 },
/* 5 bit codewords */
{ 5, 0, 0 },
{ 5, 2, 0 },
{ 5, 0, 2 },
{ 5, 3, 1 },
{ 5, 1, 3 },
{ 5, 3, 2 },
{ 5, 2, 3 },
/* 6 bit codewords */
{ 6, 3, 3 },
{ 6, 4, 1 },
{ 6, 1, 4 },
{ 6, 4, 2 },
{ 6, 2, 4 },
{ 6, 3, 0 },
{ 6, 0, 3 },
{ 6, 4, 3 },
{ 6, 3, 4 },
{ 6, 5, 2 },
/* 7 bit codewords */
{ 7, 5, 1 },
{ 7, 2, 5 },
{ 7, 1, 5 },
{ 7, 5, 3 },
{ 7, 3, 5 },
{ 7, 4, 4 },
{ 7, 5, 4 },
{ 7, 0, 4 },
{ 7, 4, 5 },
{ 7, 4, 0 },
{ 7, 2, 6 },
{ 7, 6, 2 },
/* 7/8 bit codewords */
{ 7, 6, 1 }, { 7, 6, 1 },
{ 7, 1, 6 }, { 7, 1, 6 },
{ 8, 3, 6 },
{ 8, 6, 3 },
{ 8, 5, 5 },
{ 8, 5, 0 },
/* 8 bit codewords */
{ 8, 6, 4 },
{ 8, 0, 5 },
{ 8, 4, 6 },
{ 8, 7, 1 },
{ 8, 7, 2 },
{ 8, 2, 7 },
{ 8, 6, 5 },
{ 8, 7, 3 },
/* 8/9/10 bit codewords */
{ 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 },
{ 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 },
{ 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 },
{ 9, 6, 6 }, { 9, 6, 6 },
{ 9, 7, 4 }, { 9, 7, 4 },
{ 9, 6, 0 }, { 9, 6, 0 },
{ 9, 4, 7 }, { 9, 4, 7 },
{ 9, 0, 6 }, { 9, 0, 6 },
{ 9, 7, 5 }, { 9, 7, 5 },
{ 9, 7, 6 }, { 9, 7, 6 },
{ 9, 6, 7 }, { 9, 6, 7 },
{ 10, 5, 7 },
{ 10, 7, 0 },
{ 10, 0, 7 },
{ 10, 7, 7 }
};

View file

@ -0,0 +1,369 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_9.h 3 2005-06-02 18:16:43Z vspader $
**/
/* Binary search huffman table HCB_9 */
static hcb_bin_pair hcb9[] = {
{ /* 0 */ 0, { 1, 2 } },
{ /* 1 */ 1, { 0, 0 } },
{ /* 2 */ 0, { 1, 2 } },
{ /* 3 */ 0, { 2, 3 } },
{ /* 4 */ 0, { 3, 4 } },
{ /* 5 */ 1, { 1, 0 } },
{ /* 6 */ 1, { 0, 1 } },
{ /* 7 */ 0, { 2, 3 } },
{ /* 8 */ 0, { 3, 4 } },
{ /* 9 */ 1, { 1, 1 } },
{ /* 10 */ 0, { 3, 4 } },
{ /* 11 */ 0, { 4, 5 } },
{ /* 12 */ 0, { 5, 6 } },
{ /* 13 */ 0, { 6, 7 } },
{ /* 14 */ 0, { 7, 8 } },
{ /* 15 */ 0, { 8, 9 } },
{ /* 16 */ 0, { 9, 10 } },
{ /* 17 */ 0, { 10, 11 } },
{ /* 18 */ 0, { 11, 12 } },
{ /* 19 */ 1, { 2, 1 } },
{ /* 20 */ 1, { 1, 2 } },
{ /* 21 */ 1, { 2, 0 } },
{ /* 22 */ 1, { 0, 2 } },
{ /* 23 */ 0, { 8, 9 } },
{ /* 24 */ 0, { 9, 10 } },
{ /* 25 */ 0, { 10, 11 } },
{ /* 26 */ 0, { 11, 12 } },
{ /* 27 */ 0, { 12, 13 } },
{ /* 28 */ 0, { 13, 14 } },
{ /* 29 */ 0, { 14, 15 } },
{ /* 30 */ 0, { 15, 16 } },
{ /* 31 */ 1, { 3, 1 } },
{ /* 32 */ 1, { 2, 2 } },
{ /* 33 */ 1, { 1, 3 } },
{ /* 34 */ 0, { 13, 14 } },
{ /* 35 */ 0, { 14, 15 } },
{ /* 36 */ 0, { 15, 16 } },
{ /* 37 */ 0, { 16, 17 } },
{ /* 38 */ 0, { 17, 18 } },
{ /* 39 */ 0, { 18, 19 } },
{ /* 40 */ 0, { 19, 20 } },
{ /* 41 */ 0, { 20, 21 } },
{ /* 42 */ 0, { 21, 22 } },
{ /* 43 */ 0, { 22, 23 } },
{ /* 44 */ 0, { 23, 24 } },
{ /* 45 */ 0, { 24, 25 } },
{ /* 46 */ 0, { 25, 26 } },
{ /* 47 */ 1, { 3, 0 } },
{ /* 48 */ 1, { 0, 3 } },
{ /* 49 */ 1, { 2, 3 } },
{ /* 50 */ 1, { 3, 2 } },
{ /* 51 */ 1, { 1, 4 } },
{ /* 52 */ 1, { 4, 1 } },
{ /* 53 */ 1, { 2, 4 } },
{ /* 54 */ 1, { 1, 5 } },
{ /* 55 */ 0, { 18, 19 } },
{ /* 56 */ 0, { 19, 20 } },
{ /* 57 */ 0, { 20, 21 } },
{ /* 58 */ 0, { 21, 22 } },
{ /* 59 */ 0, { 22, 23 } },
{ /* 60 */ 0, { 23, 24 } },
{ /* 61 */ 0, { 24, 25 } },
{ /* 62 */ 0, { 25, 26 } },
{ /* 63 */ 0, { 26, 27 } },
{ /* 64 */ 0, { 27, 28 } },
{ /* 65 */ 0, { 28, 29 } },
{ /* 66 */ 0, { 29, 30 } },
{ /* 67 */ 0, { 30, 31 } },
{ /* 68 */ 0, { 31, 32 } },
{ /* 69 */ 0, { 32, 33 } },
{ /* 70 */ 0, { 33, 34 } },
{ /* 71 */ 0, { 34, 35 } },
{ /* 72 */ 0, { 35, 36 } },
{ /* 73 */ 1, { 4, 2 } },
{ /* 74 */ 1, { 3, 3 } },
{ /* 75 */ 1, { 0, 4 } },
{ /* 76 */ 1, { 4, 0 } },
{ /* 77 */ 1, { 5, 1 } },
{ /* 78 */ 1, { 2, 5 } },
{ /* 79 */ 1, { 1, 6 } },
{ /* 80 */ 1, { 3, 4 } },
{ /* 81 */ 1, { 5, 2 } },
{ /* 82 */ 1, { 6, 1 } },
{ /* 83 */ 1, { 4, 3 } },
{ /* 84 */ 0, { 25, 26 } },
{ /* 85 */ 0, { 26, 27 } },
{ /* 86 */ 0, { 27, 28 } },
{ /* 87 */ 0, { 28, 29 } },
{ /* 88 */ 0, { 29, 30 } },
{ /* 89 */ 0, { 30, 31 } },
{ /* 90 */ 0, { 31, 32 } },
{ /* 91 */ 0, { 32, 33 } },
{ /* 92 */ 0, { 33, 34 } },
{ /* 93 */ 0, { 34, 35 } },
{ /* 94 */ 0, { 35, 36 } },
{ /* 95 */ 0, { 36, 37 } },
{ /* 96 */ 0, { 37, 38 } },
{ /* 97 */ 0, { 38, 39 } },
{ /* 98 */ 0, { 39, 40 } },
{ /* 99 */ 0, { 40, 41 } },
{ /* 00 */ 0, { 41, 42 } },
{ /* 01 */ 0, { 42, 43 } },
{ /* 02 */ 0, { 43, 44 } },
{ /* 03 */ 0, { 44, 45 } },
{ /* 04 */ 0, { 45, 46 } },
{ /* 05 */ 0, { 46, 47 } },
{ /* 06 */ 0, { 47, 48 } },
{ /* 07 */ 0, { 48, 49 } },
{ /* 08 */ 0, { 49, 50 } },
{ /* 09 */ 1, { 0, 5 } },
{ /* 10 */ 1, { 2, 6 } },
{ /* 11 */ 1, { 5, 0 } },
{ /* 12 */ 1, { 1, 7 } },
{ /* 13 */ 1, { 3, 5 } },
{ /* 14 */ 1, { 1, 8 } },
{ /* 15 */ 1, { 8, 1 } },
{ /* 16 */ 1, { 4, 4 } },
{ /* 17 */ 1, { 5, 3 } },
{ /* 18 */ 1, { 6, 2 } },
{ /* 19 */ 1, { 7, 1 } },
{ /* 20 */ 1, { 0, 6 } },
{ /* 21 */ 1, { 8, 2 } },
{ /* 22 */ 1, { 2, 8 } },
{ /* 23 */ 1, { 3, 6 } },
{ /* 24 */ 1, { 2, 7 } },
{ /* 25 */ 1, { 4, 5 } },
{ /* 26 */ 1, { 9, 1 } },
{ /* 27 */ 1, { 1, 9 } },
{ /* 28 */ 1, { 7, 2 } },
{ /* 29 */ 0, { 30, 31 } },
{ /* 30 */ 0, { 31, 32 } },
{ /* 31 */ 0, { 32, 33 } },
{ /* 32 */ 0, { 33, 34 } },
{ /* 33 */ 0, { 34, 35 } },
{ /* 34 */ 0, { 35, 36 } },
{ /* 35 */ 0, { 36, 37 } },
{ /* 36 */ 0, { 37, 38 } },
{ /* 37 */ 0, { 38, 39 } },
{ /* 38 */ 0, { 39, 40 } },
{ /* 39 */ 0, { 40, 41 } },
{ /* 40 */ 0, { 41, 42 } },
{ /* 41 */ 0, { 42, 43 } },
{ /* 42 */ 0, { 43, 44 } },
{ /* 43 */ 0, { 44, 45 } },
{ /* 44 */ 0, { 45, 46 } },
{ /* 45 */ 0, { 46, 47 } },
{ /* 46 */ 0, { 47, 48 } },
{ /* 47 */ 0, { 48, 49 } },
{ /* 48 */ 0, { 49, 50 } },
{ /* 49 */ 0, { 50, 51 } },
{ /* 50 */ 0, { 51, 52 } },
{ /* 51 */ 0, { 52, 53 } },
{ /* 52 */ 0, { 53, 54 } },
{ /* 53 */ 0, { 54, 55 } },
{ /* 54 */ 0, { 55, 56 } },
{ /* 55 */ 0, { 56, 57 } },
{ /* 56 */ 0, { 57, 58 } },
{ /* 57 */ 0, { 58, 59 } },
{ /* 58 */ 0, { 59, 60 } },
{ /* 59 */ 1, { 6, 0 } },
{ /* 60 */ 1, { 5, 4 } },
{ /* 61 */ 1, { 6, 3 } },
{ /* 62 */ 1, { 8, 3 } },
{ /* 63 */ 1, { 0, 7 } },
{ /* 64 */ 1, { 9, 2 } },
{ /* 65 */ 1, { 3, 8 } },
{ /* 66 */ 1, { 4, 6 } },
{ /* 67 */ 1, { 3, 7 } },
{ /* 68 */ 1, { 0, 8 } },
{ /* 69 */ 1, { 10, 1 } },
{ /* 70 */ 1, { 6, 4 } },
{ /* 71 */ 1, { 2, 9 } },
{ /* 72 */ 1, { 5, 5 } },
{ /* 73 */ 1, { 8, 0 } },
{ /* 74 */ 1, { 7, 0 } },
{ /* 75 */ 1, { 7, 3 } },
{ /* 76 */ 1, { 10, 2 } },
{ /* 77 */ 1, { 9, 3 } },
{ /* 78 */ 1, { 8, 4 } },
{ /* 79 */ 1, { 1, 10 } },
{ /* 80 */ 1, { 7, 4 } },
{ /* 81 */ 1, { 6, 5 } },
{ /* 82 */ 1, { 5, 6 } },
{ /* 83 */ 1, { 4, 8 } },
{ /* 84 */ 1, { 4, 7 } },
{ /* 85 */ 1, { 3, 9 } },
{ /* 86 */ 1, { 11, 1 } },
{ /* 87 */ 1, { 5, 8 } },
{ /* 88 */ 1, { 9, 0 } },
{ /* 89 */ 1, { 8, 5 } },
{ /* 90 */ 0, { 29, 30 } },
{ /* 91 */ 0, { 30, 31 } },
{ /* 92 */ 0, { 31, 32 } },
{ /* 93 */ 0, { 32, 33 } },
{ /* 94 */ 0, { 33, 34 } },
{ /* 95 */ 0, { 34, 35 } },
{ /* 96 */ 0, { 35, 36 } },
{ /* 97 */ 0, { 36, 37 } },
{ /* 98 */ 0, { 37, 38 } },
{ /* 99 */ 0, { 38, 39 } },
{ /* 00 */ 0, { 39, 40 } },
{ /* 01 */ 0, { 40, 41 } },
{ /* 02 */ 0, { 41, 42 } },
{ /* 03 */ 0, { 42, 43 } },
{ /* 04 */ 0, { 43, 44 } },
{ /* 05 */ 0, { 44, 45 } },
{ /* 06 */ 0, { 45, 46 } },
{ /* 07 */ 0, { 46, 47 } },
{ /* 08 */ 0, { 47, 48 } },
{ /* 09 */ 0, { 48, 49 } },
{ /* 10 */ 0, { 49, 50 } },
{ /* 11 */ 0, { 50, 51 } },
{ /* 12 */ 0, { 51, 52 } },
{ /* 13 */ 0, { 52, 53 } },
{ /* 14 */ 0, { 53, 54 } },
{ /* 15 */ 0, { 54, 55 } },
{ /* 16 */ 0, { 55, 56 } },
{ /* 17 */ 0, { 56, 57 } },
{ /* 18 */ 0, { 57, 58 } },
{ /* 19 */ 1, { 10, 3 } },
{ /* 20 */ 1, { 2, 10 } },
{ /* 21 */ 1, { 0, 9 } },
{ /* 22 */ 1, { 11, 2 } },
{ /* 23 */ 1, { 9, 4 } },
{ /* 24 */ 1, { 6, 6 } },
{ /* 25 */ 1, { 12, 1 } },
{ /* 26 */ 1, { 4, 9 } },
{ /* 27 */ 1, { 8, 6 } },
{ /* 28 */ 1, { 1, 11 } },
{ /* 29 */ 1, { 9, 5 } },
{ /* 30 */ 1, { 10, 4 } },
{ /* 31 */ 1, { 5, 7 } },
{ /* 32 */ 1, { 7, 5 } },
{ /* 33 */ 1, { 2, 11 } },
{ /* 34 */ 1, { 1, 12 } },
{ /* 35 */ 1, { 12, 2 } },
{ /* 36 */ 1, { 11, 3 } },
{ /* 37 */ 1, { 3, 10 } },
{ /* 38 */ 1, { 5, 9 } },
{ /* 39 */ 1, { 6, 7 } },
{ /* 40 */ 1, { 8, 7 } },
{ /* 41 */ 1, { 11, 4 } },
{ /* 42 */ 1, { 0, 10 } },
{ /* 43 */ 1, { 7, 6 } },
{ /* 44 */ 1, { 12, 3 } },
{ /* 45 */ 1, { 10, 0 } },
{ /* 46 */ 1, { 10, 5 } },
{ /* 47 */ 1, { 4, 10 } },
{ /* 48 */ 1, { 6, 8 } },
{ /* 49 */ 1, { 2, 12 } },
{ /* 50 */ 1, { 9, 6 } },
{ /* 51 */ 1, { 9, 7 } },
{ /* 52 */ 1, { 4, 11 } },
{ /* 53 */ 1, { 11, 0 } },
{ /* 54 */ 1, { 6, 9 } },
{ /* 55 */ 1, { 3, 11 } },
{ /* 56 */ 1, { 5, 10 } },
{ /* 57 */ 0, { 20, 21 } },
{ /* 58 */ 0, { 21, 22 } },
{ /* 59 */ 0, { 22, 23 } },
{ /* 60 */ 0, { 23, 24 } },
{ /* 61 */ 0, { 24, 25 } },
{ /* 62 */ 0, { 25, 26 } },
{ /* 63 */ 0, { 26, 27 } },
{ /* 64 */ 0, { 27, 28 } },
{ /* 65 */ 0, { 28, 29 } },
{ /* 66 */ 0, { 29, 30 } },
{ /* 67 */ 0, { 30, 31 } },
{ /* 68 */ 0, { 31, 32 } },
{ /* 69 */ 0, { 32, 33 } },
{ /* 70 */ 0, { 33, 34 } },
{ /* 71 */ 0, { 34, 35 } },
{ /* 72 */ 0, { 35, 36 } },
{ /* 73 */ 0, { 36, 37 } },
{ /* 74 */ 0, { 37, 38 } },
{ /* 75 */ 0, { 38, 39 } },
{ /* 76 */ 0, { 39, 40 } },
{ /* 77 */ 1, { 8, 8 } },
{ /* 78 */ 1, { 7, 8 } },
{ /* 79 */ 1, { 12, 5 } },
{ /* 80 */ 1, { 3, 12 } },
{ /* 81 */ 1, { 11, 5 } },
{ /* 82 */ 1, { 7, 7 } },
{ /* 83 */ 1, { 12, 4 } },
{ /* 84 */ 1, { 11, 6 } },
{ /* 85 */ 1, { 10, 6 } },
{ /* 86 */ 1, { 4, 12 } },
{ /* 87 */ 1, { 7, 9 } },
{ /* 88 */ 1, { 5, 11 } },
{ /* 89 */ 1, { 0, 11 } },
{ /* 90 */ 1, { 12, 6 } },
{ /* 91 */ 1, { 6, 10 } },
{ /* 92 */ 1, { 12, 0 } },
{ /* 93 */ 1, { 10, 7 } },
{ /* 94 */ 1, { 5, 12 } },
{ /* 95 */ 1, { 7, 10 } },
{ /* 96 */ 1, { 9, 8 } },
{ /* 97 */ 1, { 0, 12 } },
{ /* 98 */ 1, { 11, 7 } },
{ /* 99 */ 1, { 8, 9 } },
{ /* 00 */ 1, { 9, 9 } },
{ /* 01 */ 1, { 10, 8 } },
{ /* 02 */ 1, { 7, 11 } },
{ /* 03 */ 1, { 12, 7 } },
{ /* 04 */ 1, { 6, 11 } },
{ /* 05 */ 1, { 8, 11 } },
{ /* 06 */ 1, { 11, 8 } },
{ /* 07 */ 1, { 7, 12 } },
{ /* 08 */ 1, { 6, 12 } },
{ /* 09 */ 0, { 8, 9 } },
{ /* 10 */ 0, { 9, 10 } },
{ /* 11 */ 0, { 10, 11 } },
{ /* 12 */ 0, { 11, 12 } },
{ /* 13 */ 0, { 12, 13 } },
{ /* 14 */ 0, { 13, 14 } },
{ /* 15 */ 0, { 14, 15 } },
{ /* 16 */ 0, { 15, 16 } },
{ /* 17 */ 1, { 8, 10 } },
{ /* 18 */ 1, { 10, 9 } },
{ /* 19 */ 1, { 8, 12 } },
{ /* 20 */ 1, { 9, 10 } },
{ /* 21 */ 1, { 9, 11 } },
{ /* 22 */ 1, { 9, 12 } },
{ /* 23 */ 1, { 10, 11 } },
{ /* 24 */ 1, { 12, 9 } },
{ /* 25 */ 1, { 10, 10 } },
{ /* 26 */ 1, { 11, 9 } },
{ /* 27 */ 1, { 12, 8 } },
{ /* 28 */ 1, { 11, 10 } },
{ /* 29 */ 1, { 12, 10 } },
{ /* 30 */ 1, { 12, 11 } },
{ /* 31 */ 0, { 2, 3 } },
{ /* 32 */ 0, { 3, 4 } },
{ /* 33 */ 1, { 10, 12 } },
{ /* 34 */ 1, { 11, 11 } },
{ /* 35 */ 1, { 11, 12 } },
{ /* 36 */ 1, { 12, 12 } }
};

View file

@ -0,0 +1,273 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_sf.h 3 2005-06-02 18:16:43Z vspader $
**/
/* Binary search huffman table HCB_SF */
static uint8_t hcb_sf[][2] = {
{ /* 0 */ 1, 2 },
{ /* 1 */ 60, 0 },
{ /* 2 */ 1, 2 },
{ /* 3 */ 2, 3 },
{ /* 4 */ 3, 4 },
{ /* 5 */ 59, 0 },
{ /* 6 */ 3, 4 },
{ /* 7 */ 4, 5 },
{ /* 8 */ 5, 6 },
{ /* 9 */ 61, 0 },
{ /* 10 */ 58, 0 },
{ /* 11 */ 62, 0 },
{ /* 12 */ 3, 4 },
{ /* 13 */ 4, 5 },
{ /* 14 */ 5, 6 },
{ /* 15 */ 57, 0 },
{ /* 16 */ 63, 0 },
{ /* 17 */ 4, 5 },
{ /* 18 */ 5, 6 },
{ /* 19 */ 6, 7 },
{ /* 20 */ 7, 8 },
{ /* 21 */ 56, 0 },
{ /* 22 */ 64, 0 },
{ /* 23 */ 55, 0 },
{ /* 24 */ 65, 0 },
{ /* 25 */ 4, 5 },
{ /* 26 */ 5, 6 },
{ /* 27 */ 6, 7 },
{ /* 28 */ 7, 8 },
{ /* 29 */ 66, 0 },
{ /* 30 */ 54, 0 },
{ /* 31 */ 67, 0 },
{ /* 32 */ 5, 6 },
{ /* 33 */ 6, 7 },
{ /* 34 */ 7, 8 },
{ /* 35 */ 8, 9 },
{ /* 36 */ 9, 10 },
{ /* 37 */ 53, 0 },
{ /* 38 */ 68, 0 },
{ /* 39 */ 52, 0 },
{ /* 40 */ 69, 0 },
{ /* 41 */ 51, 0 },
{ /* 42 */ 5, 6 },
{ /* 43 */ 6, 7 },
{ /* 44 */ 7, 8 },
{ /* 45 */ 8, 9 },
{ /* 46 */ 9, 10 },
{ /* 47 */ 70, 0 },
{ /* 48 */ 50, 0 },
{ /* 49 */ 49, 0 },
{ /* 50 */ 71, 0 },
{ /* 51 */ 6, 7 },
{ /* 52 */ 7, 8 },
{ /* 53 */ 8, 9 },
{ /* 54 */ 9, 10 },
{ /* 55 */ 10, 11 },
{ /* 56 */ 11, 12 },
{ /* 57 */ 72, 0 },
{ /* 58 */ 48, 0 },
{ /* 59 */ 73, 0 },
{ /* 60 */ 47, 0 },
{ /* 61 */ 74, 0 },
{ /* 62 */ 46, 0 },
{ /* 63 */ 6, 7 },
{ /* 64 */ 7, 8 },
{ /* 65 */ 8, 9 },
{ /* 66 */ 9, 10 },
{ /* 67 */ 10, 11 },
{ /* 68 */ 11, 12 },
{ /* 69 */ 76, 0 },
{ /* 70 */ 75, 0 },
{ /* 71 */ 77, 0 },
{ /* 72 */ 78, 0 },
{ /* 73 */ 45, 0 },
{ /* 74 */ 43, 0 },
{ /* 75 */ 6, 7 },
{ /* 76 */ 7, 8 },
{ /* 77 */ 8, 9 },
{ /* 78 */ 9, 10 },
{ /* 79 */ 10, 11 },
{ /* 80 */ 11, 12 },
{ /* 81 */ 44, 0 },
{ /* 82 */ 79, 0 },
{ /* 83 */ 42, 0 },
{ /* 84 */ 41, 0 },
{ /* 85 */ 80, 0 },
{ /* 86 */ 40, 0 },
{ /* 87 */ 6, 7 },
{ /* 88 */ 7, 8 },
{ /* 89 */ 8, 9 },
{ /* 90 */ 9, 10 },
{ /* 91 */ 10, 11 },
{ /* 92 */ 11, 12 },
{ /* 93 */ 81, 0 },
{ /* 94 */ 39, 0 },
{ /* 95 */ 82, 0 },
{ /* 96 */ 38, 0 },
{ /* 97 */ 83, 0 },
{ /* 98 */ 7, 8 },
{ /* 99 */ 8, 9 },
{ /* 00 */ 9, 10 },
{ /* 01 */ 10, 11 },
{ /* 02 */ 11, 12 },
{ /* 03 */ 12, 13 },
{ /* 04 */ 13, 14 },
{ /* 05 */ 37, 0 },
{ /* 06 */ 35, 0 },
{ /* 07 */ 85, 0 },
{ /* 08 */ 33, 0 },
{ /* 09 */ 36, 0 },
{ /* 10 */ 34, 0 },
{ /* 11 */ 84, 0 },
{ /* 12 */ 32, 0 },
{ /* 13 */ 6, 7 },
{ /* 14 */ 7, 8 },
{ /* 15 */ 8, 9 },
{ /* 16 */ 9, 10 },
{ /* 17 */ 10, 11 },
{ /* 18 */ 11, 12 },
{ /* 19 */ 87, 0 },
{ /* 20 */ 89, 0 },
{ /* 21 */ 30, 0 },
{ /* 22 */ 31, 0 },
{ /* 23 */ 8, 9 },
{ /* 24 */ 9, 10 },
{ /* 25 */ 10, 11 },
{ /* 26 */ 11, 12 },
{ /* 27 */ 12, 13 },
{ /* 28 */ 13, 14 },
{ /* 29 */ 14, 15 },
{ /* 30 */ 15, 16 },
{ /* 31 */ 86, 0 },
{ /* 32 */ 29, 0 },
{ /* 33 */ 26, 0 },
{ /* 34 */ 27, 0 },
{ /* 35 */ 28, 0 },
{ /* 36 */ 24, 0 },
{ /* 37 */ 88, 0 },
{ /* 38 */ 9, 10 },
{ /* 39 */ 10, 11 },
{ /* 40 */ 11, 12 },
{ /* 41 */ 12, 13 },
{ /* 42 */ 13, 14 },
{ /* 43 */ 14, 15 },
{ /* 44 */ 15, 16 },
{ /* 45 */ 16, 17 },
{ /* 46 */ 17, 18 },
{ /* 47 */ 25, 0 },
{ /* 48 */ 22, 0 },
{ /* 49 */ 23, 0 },
{ /* 50 */ 15, 16 },
{ /* 51 */ 16, 17 },
{ /* 52 */ 17, 18 },
{ /* 53 */ 18, 19 },
{ /* 54 */ 19, 20 },
{ /* 55 */ 20, 21 },
{ /* 56 */ 21, 22 },
{ /* 57 */ 22, 23 },
{ /* 58 */ 23, 24 },
{ /* 59 */ 24, 25 },
{ /* 60 */ 25, 26 },
{ /* 61 */ 26, 27 },
{ /* 62 */ 27, 28 },
{ /* 63 */ 28, 29 },
{ /* 64 */ 29, 30 },
{ /* 65 */ 90, 0 },
{ /* 66 */ 21, 0 },
{ /* 67 */ 19, 0 },
{ /* 68 */ 3, 0 },
{ /* 69 */ 1, 0 },
{ /* 70 */ 2, 0 },
{ /* 71 */ 0, 0 },
{ /* 72 */ 23, 24 },
{ /* 73 */ 24, 25 },
{ /* 74 */ 25, 26 },
{ /* 75 */ 26, 27 },
{ /* 76 */ 27, 28 },
{ /* 77 */ 28, 29 },
{ /* 78 */ 29, 30 },
{ /* 79 */ 30, 31 },
{ /* 80 */ 31, 32 },
{ /* 81 */ 32, 33 },
{ /* 82 */ 33, 34 },
{ /* 83 */ 34, 35 },
{ /* 84 */ 35, 36 },
{ /* 85 */ 36, 37 },
{ /* 86 */ 37, 38 },
{ /* 87 */ 38, 39 },
{ /* 88 */ 39, 40 },
{ /* 89 */ 40, 41 },
{ /* 90 */ 41, 42 },
{ /* 91 */ 42, 43 },
{ /* 92 */ 43, 44 },
{ /* 93 */ 44, 45 },
{ /* 94 */ 45, 46 },
{ /* 95 */ 98, 0 },
{ /* 96 */ 99, 0 },
{ /* 97 */ 100, 0 },
{ /* 98 */ 101, 0 },
{ /* 99 */ 102, 0 },
{ /* 00 */ 117, 0 },
{ /* 01 */ 97, 0 },
{ /* 02 */ 91, 0 },
{ /* 03 */ 92, 0 },
{ /* 04 */ 93, 0 },
{ /* 05 */ 94, 0 },
{ /* 06 */ 95, 0 },
{ /* 07 */ 96, 0 },
{ /* 08 */ 104, 0 },
{ /* 09 */ 111, 0 },
{ /* 10 */ 112, 0 },
{ /* 11 */ 113, 0 },
{ /* 12 */ 114, 0 },
{ /* 13 */ 115, 0 },
{ /* 14 */ 116, 0 },
{ /* 15 */ 110, 0 },
{ /* 16 */ 105, 0 },
{ /* 17 */ 106, 0 },
{ /* 18 */ 107, 0 },
{ /* 19 */ 108, 0 },
{ /* 20 */ 109, 0 },
{ /* 21 */ 118, 0 },
{ /* 22 */ 6, 0 },
{ /* 23 */ 8, 0 },
{ /* 24 */ 9, 0 },
{ /* 25 */ 10, 0 },
{ /* 26 */ 5, 0 },
{ /* 27 */ 103, 0 },
{ /* 28 */ 120, 0 },
{ /* 29 */ 119, 0 },
{ /* 30 */ 4, 0 },
{ /* 31 */ 7, 0 },
{ /* 32 */ 15, 0 },
{ /* 33 */ 16, 0 },
{ /* 34 */ 18, 0 },
{ /* 35 */ 20, 0 },
{ /* 36 */ 17, 0 },
{ /* 37 */ 11, 0 },
{ /* 38 */ 12, 0 },
{ /* 39 */ 14, 0 },
{ /* 40 */ 13, 0 }
};

View file

@ -0,0 +1,519 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: common.c 3 2005-06-02 18:16:43Z vspader $
**/
/* just some common functions that could be used anywhere */
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include "syntax.h"
/* Returns the sample rate index based on the samplerate */
uint8_t get_sr_index(const uint32_t samplerate)
{
if (92017 <= samplerate) return 0;
if (75132 <= samplerate) return 1;
if (55426 <= samplerate) return 2;
if (46009 <= samplerate) return 3;
if (37566 <= samplerate) return 4;
if (27713 <= samplerate) return 5;
if (23004 <= samplerate) return 6;
if (18783 <= samplerate) return 7;
if (13856 <= samplerate) return 8;
if (11502 <= samplerate) return 9;
if (9391 <= samplerate) return 10;
if (16428320 <= samplerate) return 11;
return 11;
}
/* Returns the sample rate based on the sample rate index */
uint32_t get_sample_rate(const uint8_t sr_index)
{
static const uint32_t sample_rates[] =
{
96000, 88200, 64000, 48000, 44100, 32000,
24000, 22050, 16000, 12000, 11025, 8000
};
if (sr_index < 12)
return sample_rates[sr_index];
return 0;
}
uint8_t max_pred_sfb(const uint8_t sr_index)
{
static const uint8_t pred_sfb_max[] =
{
33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34
};
if (sr_index < 12)
return pred_sfb_max[sr_index];
return 0;
}
uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
const uint8_t is_short)
{
/* entry for each sampling rate
* 1 Main/LC long window
* 2 Main/LC short window
* 3 SSR long window
* 4 SSR short window
*/
static const uint8_t tns_sbf_max[][4] =
{
{31, 9, 28, 7}, /* 96000 */
{31, 9, 28, 7}, /* 88200 */
{34, 10, 27, 7}, /* 64000 */
{40, 14, 26, 6}, /* 48000 */
{42, 14, 26, 6}, /* 44100 */
{51, 14, 26, 6}, /* 32000 */
{46, 14, 29, 7}, /* 24000 */
{46, 14, 29, 7}, /* 22050 */
{42, 14, 23, 8}, /* 16000 */
{42, 14, 23, 8}, /* 12000 */
{42, 14, 23, 8}, /* 11025 */
{39, 14, 19, 7}, /* 8000 */
{39, 14, 19, 7}, /* 7350 */
{0,0,0,0},
{0,0,0,0},
{0,0,0,0}
};
uint8_t i = 0;
if (is_short) i++;
if (object_type == SSR) i += 2;
return tns_sbf_max[sr_index][i];
}
/* Returns 0 if an object type is decodable, otherwise returns -1 */
int8_t can_decode_ot(const uint8_t object_type)
{
switch (object_type)
{
case LC:
return 0;
case MAIN:
#ifdef MAIN_DEC
return 0;
#else
return -1;
#endif
case SSR:
#ifdef SSR_DEC
return 0;
#else
return -1;
#endif
case LTP:
#ifdef LTP_DEC
return 0;
#else
return -1;
#endif
/* ER object types */
#ifdef ERROR_RESILIENCE
case ER_LC:
#ifdef DRM
case DRM_ER_LC:
#endif
return 0;
case ER_LTP:
#ifdef LTP_DEC
return 0;
#else
return -1;
#endif
case LD:
#ifdef LD_DEC
return 0;
#else
return -1;
#endif
#endif
}
return -1;
}
void *faad_malloc(size_t size)
{
#if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
return _aligned_malloc(size, 16);
#else // #ifdef 0
return malloc(size);
#endif // #ifdef 0
}
/* common free function */
void faad_free(void *b)
{
#if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
_aligned_free(b);
#else
free(b);
}
#endif
static const uint8_t Parity [256] = { // parity
0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
};
static uint32_t __r1 = 1;
static uint32_t __r2 = 1;
/*
* This is a simple random number generator with good quality for audio purposes.
* It consists of two polycounters with opposite rotation direction and different
* periods. The periods are coprime, so the total period is the product of both.
*
* -------------------------------------------------------------------------------------------------
* +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0|
* | -------------------------------------------------------------------------------------------------
* | | | | | | |
* | +--+--+--+-XOR-+--------+
* | |
* +--------------------------------------------------------------------------------------+
*
* -------------------------------------------------------------------------------------------------
* |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+
* ------------------------------------------------------------------------------------------------- |
* | | | | |
* +--+----XOR----+--+ |
* | |
* +----------------------------------------------------------------------------------------+
*
*
* The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481,
* which gives a period of 18.410.713.077.675.721.215. The result is the
* XORed values of both generators.
*/
uint32_t random_int(void)
{
uint32_t t1, t2, t3, t4;
t3 = t1 = __r1; t4 = t2 = __r2; // Parity calculation is done via table lookup, this is also available
t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable
t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations.
t1 <<= 31; t2 = Parity [t2];
return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 );
}
uint32_t ones32(uint32_t x)
{
x -= ((x >> 1) & 0x55555555);
x = (((x >> 2) & 0x33333333) + (x & 0x33333333));
x = (((x >> 4) + x) & 0x0f0f0f0f);
x += (x >> 8);
x += (x >> 16);
return (x & 0x0000003f);
}
uint32_t floor_log2(uint32_t x)
{
#if 1
x |= (x >> 1);
x |= (x >> 2);
x |= (x >> 4);
x |= (x >> 8);
x |= (x >> 16);
return (ones32(x) - 1);
#else
uint32_t count = 0;
while (x >>= 1)
count++;
return count;
#endif
}
/* returns position of first bit that is not 0 from msb,
* starting count at lsb */
uint32_t wl_min_lzc(uint32_t x)
{
#if 1
x |= (x >> 1);
x |= (x >> 2);
x |= (x >> 4);
x |= (x >> 8);
x |= (x >> 16);
return (ones32(x));
#else
uint32_t count = 0;
while (x >>= 1)
count++;
return (count + 1);
#endif
}
#ifdef FIXED_POINT
#define TABLE_BITS 6
/* just take the maximum number of bits for interpolation */
#define INTERP_BITS (REAL_BITS-TABLE_BITS)
static const real_t pow2_tab[] = {
REAL_CONST(1.000000000000000), REAL_CONST(1.010889286051701), REAL_CONST(1.021897148654117),
REAL_CONST(1.033024879021228), REAL_CONST(1.044273782427414), REAL_CONST(1.055645178360557),
REAL_CONST(1.067140400676824), REAL_CONST(1.078760797757120), REAL_CONST(1.090507732665258),
REAL_CONST(1.102382583307841), REAL_CONST(1.114386742595892), REAL_CONST(1.126521618608242),
REAL_CONST(1.138788634756692), REAL_CONST(1.151189229952983), REAL_CONST(1.163724858777578),
REAL_CONST(1.176396991650281), REAL_CONST(1.189207115002721), REAL_CONST(1.202156731452703),
REAL_CONST(1.215247359980469), REAL_CONST(1.228480536106870), REAL_CONST(1.241857812073484),
REAL_CONST(1.255380757024691), REAL_CONST(1.269050957191733), REAL_CONST(1.282870016078778),
REAL_CONST(1.296839554651010), REAL_CONST(1.310961211524764), REAL_CONST(1.325236643159741),
REAL_CONST(1.339667524053303), REAL_CONST(1.354255546936893), REAL_CONST(1.369002422974591),
REAL_CONST(1.383909881963832), REAL_CONST(1.398979672538311), REAL_CONST(1.414213562373095),
REAL_CONST(1.429613338391970), REAL_CONST(1.445180806977047), REAL_CONST(1.460917794180647),
REAL_CONST(1.476826145939499), REAL_CONST(1.492907728291265), REAL_CONST(1.509164427593423),
REAL_CONST(1.525598150744538), REAL_CONST(1.542210825407941), REAL_CONST(1.559004400237837),
REAL_CONST(1.575980845107887), REAL_CONST(1.593142151342267), REAL_CONST(1.610490331949254),
REAL_CONST(1.628027421857348), REAL_CONST(1.645755478153965), REAL_CONST(1.663676580326736),
REAL_CONST(1.681792830507429), REAL_CONST(1.700106353718524), REAL_CONST(1.718619298122478),
REAL_CONST(1.737333835273706), REAL_CONST(1.756252160373300), REAL_CONST(1.775376492526521),
REAL_CONST(1.794709075003107), REAL_CONST(1.814252175500399), REAL_CONST(1.834008086409342),
REAL_CONST(1.853979125083386), REAL_CONST(1.874167634110300), REAL_CONST(1.894575981586966),
REAL_CONST(1.915206561397147), REAL_CONST(1.936061793492294), REAL_CONST(1.957144124175400),
REAL_CONST(1.978456026387951), REAL_CONST(2.000000000000000)
};
static const real_t log2_tab[] = {
REAL_CONST(0.000000000000000), REAL_CONST(0.022367813028455), REAL_CONST(0.044394119358453),
REAL_CONST(0.066089190457772), REAL_CONST(0.087462841250339), REAL_CONST(0.108524456778169),
REAL_CONST(0.129283016944966), REAL_CONST(0.149747119504682), REAL_CONST(0.169925001442312),
REAL_CONST(0.189824558880017), REAL_CONST(0.209453365628950), REAL_CONST(0.228818690495881),
REAL_CONST(0.247927513443585), REAL_CONST(0.266786540694901), REAL_CONST(0.285402218862248),
REAL_CONST(0.303780748177103), REAL_CONST(0.321928094887362), REAL_CONST(0.339850002884625),
REAL_CONST(0.357552004618084), REAL_CONST(0.375039431346925), REAL_CONST(0.392317422778760),
REAL_CONST(0.409390936137702), REAL_CONST(0.426264754702098), REAL_CONST(0.442943495848728),
REAL_CONST(0.459431618637297), REAL_CONST(0.475733430966398), REAL_CONST(0.491853096329675),
REAL_CONST(0.507794640198696), REAL_CONST(0.523561956057013), REAL_CONST(0.539158811108031),
REAL_CONST(0.554588851677637), REAL_CONST(0.569855608330948), REAL_CONST(0.584962500721156),
REAL_CONST(0.599912842187128), REAL_CONST(0.614709844115208), REAL_CONST(0.629356620079610),
REAL_CONST(0.643856189774725), REAL_CONST(0.658211482751795), REAL_CONST(0.672425341971496),
REAL_CONST(0.686500527183218), REAL_CONST(0.700439718141092), REAL_CONST(0.714245517666123),
REAL_CONST(0.727920454563199), REAL_CONST(0.741466986401147), REAL_CONST(0.754887502163469),
REAL_CONST(0.768184324776926), REAL_CONST(0.781359713524660), REAL_CONST(0.794415866350106),
REAL_CONST(0.807354922057604), REAL_CONST(0.820178962415188), REAL_CONST(0.832890014164742),
REAL_CONST(0.845490050944375), REAL_CONST(0.857980995127572), REAL_CONST(0.870364719583405),
REAL_CONST(0.882643049361841), REAL_CONST(0.894817763307943), REAL_CONST(0.906890595608519),
REAL_CONST(0.918863237274595), REAL_CONST(0.930737337562886), REAL_CONST(0.942514505339240),
REAL_CONST(0.954196310386875), REAL_CONST(0.965784284662087), REAL_CONST(0.977279923499917),
REAL_CONST(0.988684686772166), REAL_CONST(1.000000000000000)
};
real_t pow2_fix(real_t val)
{
uint32_t x1, x2;
uint32_t errcorr;
uint32_t index_frac;
real_t retval;
int32_t whole = (val >> REAL_BITS);
/* rest = [0..1] */
int32_t rest = val - (whole << REAL_BITS);
/* index into pow2_tab */
int32_t index = rest >> (REAL_BITS-TABLE_BITS);
if (val == 0)
return (1<<REAL_BITS);
/* leave INTERP_BITS bits */
index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
index_frac = index_frac & ((1<<INTERP_BITS)-1);
if (whole > 0)
{
retval = 1 << whole;
} else {
retval = REAL_CONST(1) >> -whole;
}
x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
errcorr = ( (index_frac*(x2-x1))) >> INTERP_BITS;
if (whole > 0)
{
retval = retval * (errcorr + x1);
} else {
retval = MUL_R(retval, (errcorr + x1));
}
return retval;
}
int32_t pow2_int(real_t val)
{
uint32_t x1, x2;
uint32_t errcorr;
uint32_t index_frac;
real_t retval;
int32_t whole = (val >> REAL_BITS);
/* rest = [0..1] */
int32_t rest = val - (whole << REAL_BITS);
/* index into pow2_tab */
int32_t index = rest >> (REAL_BITS-TABLE_BITS);
if (val == 0)
return 1;
/* leave INTERP_BITS bits */
index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
index_frac = index_frac & ((1<<INTERP_BITS)-1);
if (whole > 0)
retval = 1 << whole;
else
retval = 0;
x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
errcorr = ( (index_frac*(x2-x1))) >> INTERP_BITS;
retval = MUL_R(retval, (errcorr + x1));
return retval;
}
/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
int32_t log2_int(uint32_t val)
{
uint32_t frac;
uint32_t whole = (val);
int32_t exp = 0;
uint32_t index;
uint32_t index_frac;
uint32_t x1, x2;
uint32_t errcorr;
/* error */
if (val == 0)
return -10000;
exp = floor_log2(val);
exp -= REAL_BITS;
/* frac = [1..2] */
if (exp >= 0)
frac = val >> exp;
else
frac = val << -exp;
/* index in the log2 table */
index = frac >> (REAL_BITS-TABLE_BITS);
/* leftover part for linear interpolation */
index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1);
/* leave INTERP_BITS bits */
index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
/* linear interpolation */
/* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
return ((exp+REAL_BITS) << REAL_BITS) + errcorr + x1;
}
/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
real_t log2_fix(uint32_t val)
{
uint32_t frac;
uint32_t whole = (val >> REAL_BITS);
int8_t exp = 0;
uint32_t index;
uint32_t index_frac;
uint32_t x1, x2;
uint32_t errcorr;
/* error */
if (val == 0)
return -100000;
exp = floor_log2(val);
exp -= REAL_BITS;
/* frac = [1..2] */
if (exp >= 0)
frac = val >> exp;
else
frac = val << -exp;
/* index in the log2 table */
index = frac >> (REAL_BITS-TABLE_BITS);
/* leftover part for linear interpolation */
index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1);
/* leave INTERP_BITS bits */
index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
/* linear interpolation */
/* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
return (exp << REAL_BITS) + errcorr + x1;
}
#endif

View file

@ -0,0 +1,426 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: common.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __COMMON_H__
#define __COMMON_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef HAVE_CONFIG_H
# include "../config.h"
#endif
#define INLINE __inline
#if 0 //defined(_WIN32) && !defined(_WIN32_WCE)
#define ALIGN __declspec(align(16))
#else
#define ALIGN
#endif
#ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif
/* COMPILE TIME DEFINITIONS */
/* use double precision */
/* #define USE_DOUBLE_PRECISION */
/* use fixed point reals */
//#define FIXED_POINT
//#define BIG_IQ_TABLE
/* Use if target platform has address generators with autoincrement */
//#define PREFER_POINTERS
#ifdef _WIN32_WCE
#define FIXED_POINT
#endif
#define ERROR_RESILIENCE
/* Allow decoding of MAIN profile AAC */
#define MAIN_DEC
/* Allow decoding of SSR profile AAC */
//#define SSR_DEC
/* Allow decoding of LTP profile AAC */
#define LTP_DEC
/* Allow decoding of LD profile AAC */
#define LD_DEC
/* Allow decoding of scalable profiles */
//#define SCALABLE_DEC
/* Allow decoding of Digital Radio Mondiale (DRM) */
//#define DRM
//#define DRM_PS
/* LD can't do without LTP */
#ifdef LD_DEC
#ifndef ERROR_RESILIENCE
#define ERROR_RESILIENCE
#endif
#ifndef LTP_DEC
#define LTP_DEC
#endif
#endif
#define ALLOW_SMALL_FRAMELENGTH
// Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC and PS_DEC)
//#define LC_ONLY_DECODER
#ifdef LC_ONLY_DECODER
#undef LD_DEC
#undef LTP_DEC
#undef MAIN_DEC
#undef SSR_DEC
#undef DRM
#undef ALLOW_SMALL_FRAMELENGTH
#undef ERROR_RESILIENCE
#endif
#define SBR_DEC
//#define SBR_LOW_POWER
#define PS_DEC
/* FIXED POINT: No MAIN decoding */
#ifdef FIXED_POINT
# ifdef MAIN_DEC
# undef MAIN_DEC
# endif
#endif // FIXED_POINT
#ifdef DRM
# ifndef SCALABLE_DEC
# define SCALABLE_DEC
# endif
#endif
#ifdef FIXED_POINT
#define DIV_R(A, B) (((int64_t)A << REAL_BITS)/B)
#define DIV_C(A, B) (((int64_t)A << COEF_BITS)/B)
#else
#define DIV_R(A, B) ((A)/(B))
#define DIV_C(A, B) ((A)/(B))
#endif
#ifndef SBR_LOW_POWER
#define qmf_t complex_t
#define QMF_RE(A) RE(A)
#define QMF_IM(A) IM(A)
#else
#define qmf_t real_t
#define QMF_RE(A) (A)
#define QMF_IM(A)
#endif
/* END COMPILE TIME DEFINITIONS */
#if defined(_WIN32) && !defined(__MINGW32__)
#include <stdlib.h>
typedef unsigned __int64 uint64_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t;
typedef __int64 int64_t;
typedef __int32 int32_t;
typedef __int16 int16_t;
typedef __int8 int8_t;
typedef float float32_t;
#else
#include <stdio.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H
# include <strings.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#else
# if HAVE_STDINT_H
# include <stdint.h>
# else
/* we need these... */
typedef unsigned long long uint64_t;
typedef unsigned long uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
typedef long long int64_t;
typedef long int32_t;
typedef short int16_t;
typedef char int8_t;
# endif
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifndef HAVE_FLOAT32_T
typedef float float32_t;
#endif
#if STDC_HEADERS
# include <string.h>
#else
# if !HAVE_STRCHR
# define strchr index
# define strrchr rindex
# endif
char *strchr(), *strrchr();
# if !HAVE_MEMCPY
# define memcpy(d, s, n) bcopy((s), (d), (n))
# define memmove(d, s, n) bcopy((s), (d), (n))
# endif
#endif
#endif
#ifdef WORDS_BIGENDIAN
#define ARCH_IS_BIG_ENDIAN
#endif
/* FIXED_POINT doesn't work with MAIN and SSR yet */
#ifdef FIXED_POINT
#undef MAIN_DEC
#undef SSR_DEC
#endif
#if defined(FIXED_POINT)
#include "fixed.h"
#elif defined(USE_DOUBLE_PRECISION)
typedef double real_t;
#include <math.h>
#define MUL_R(A,B) ((A)*(B))
#define MUL_C(A,B) ((A)*(B))
#define MUL_F(A,B) ((A)*(B))
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
*y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
}
#define REAL_CONST(A) ((real_t)(A))
#define COEF_CONST(A) ((real_t)(A))
#define Q2_CONST(A) ((real_t)(A))
#define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
#else /* Normal floating point operation */
typedef float real_t;
#define MUL_R(A,B) ((A)*(B))
#define MUL_C(A,B) ((A)*(B))
#define MUL_F(A,B) ((A)*(B))
#define REAL_CONST(A) ((real_t)(A))
#define COEF_CONST(A) ((real_t)(A))
#define Q2_CONST(A) ((real_t)(A))
#define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
*y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
}
#if defined(_WIN32) && !defined(__MINGW32__)
#define HAS_LRINTF
static INLINE int lrintf(float f)
{
int i;
__asm
{
fld f
fistp i
}
return i;
}
#elif (defined(__i386__) && defined(__GNUC__))
#define HAS_LRINTF
// from http://www.stereopsis.com/FPU.html
/* static INLINE int lrintf(float f)
{
int i;
__asm__ __volatile__ (
"flds %1 \n\t"
"fistpl %0 \n\t"
: "=m" (i)
: "m" (f));
return i;
}
*/
#endif
#ifdef __ICL /* only Intel C compiler has fmath ??? */
#include <mathf.h>
#define sin sinf
#define cos cosf
#define log logf
#define floor floorf
#define ceil ceilf
#define sqrt sqrtf
#else
#ifdef HAVE_LRINTF
# define HAS_LRINTF
# define _ISOC9X_SOURCE 1
# define _ISOC99_SOURCE 1
# define __USE_ISOC9X 1
# define __USE_ISOC99 1
#endif
#include <math.h>
#ifdef HAVE_SINF
# define sin sinf
#error
#endif
#ifdef HAVE_COSF
# define cos cosf
#endif
#ifdef HAVE_LOGF
# define log logf
#endif
#ifdef HAVE_EXPF
# define exp expf
#endif
#ifdef HAVE_FLOORF
# define floor floorf
#endif
#ifdef HAVE_CEILF
# define ceil ceilf
#endif
#ifdef HAVE_SQRTF
# define sqrt sqrtf
#endif
#endif
#endif
#ifndef HAS_LRINTF
/* standard cast */
#define lrintf(f) ((int32_t)(f))
#endif
typedef real_t complex_t[2];
#define RE(A) A[0]
#define IM(A) A[1]
/* common functions */
uint8_t cpu_has_sse(void);
uint32_t random_int(void);
uint32_t ones32(uint32_t x);
uint32_t floor_log2(uint32_t x);
uint32_t wl_min_lzc(uint32_t x);
#ifdef FIXED_POINT
#define LOG2_MIN_INF REAL_CONST(-10000)
int32_t log2_int(uint32_t val);
int32_t log2_fix(uint32_t val);
int32_t pow2_int(real_t val);
real_t pow2_fix(real_t val);
#endif
uint8_t get_sr_index(const uint32_t samplerate);
uint8_t max_pred_sfb(const uint8_t sr_index);
uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
const uint8_t is_short);
uint32_t get_sample_rate(const uint8_t sr_index);
int8_t can_decode_ot(const uint8_t object_type);
void *faad_malloc(size_t size);
void faad_free(void *b);
//#define PROFILE
#ifdef PROFILE
static int64_t faad_get_ts()
{
__asm
{
rdtsc
}
}
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_PI_2 /* PI/2 */
#define M_PI_2 1.57079632679489661923
#endif
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,121 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: decoder.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __DECODER_H__
#define __DECODER_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WIN32
#pragma pack(push, 8)
#ifndef NEAACDECAPI
#define NEAACDECAPI __cdecl
#endif
#else
#ifndef NEAACDECAPI
#define NEAACDECAPI
#endif
#endif
/* library output formats */
#define FAAD_FMT_16BIT 1
#define FAAD_FMT_24BIT 2
#define FAAD_FMT_32BIT 3
#define FAAD_FMT_FLOAT 4
#define FAAD_FMT_FIXED FAAD_FMT_FLOAT
#define FAAD_FMT_DOUBLE 5
#define LC_DEC_CAP (1<<0)
#define MAIN_DEC_CAP (1<<1)
#define LTP_DEC_CAP (1<<2)
#define LD_DEC_CAP (1<<3)
#define ERROR_RESILIENCE_CAP (1<<4)
#define FIXED_POINT_CAP (1<<5)
#define FRONT_CHANNEL_CENTER (1)
#define FRONT_CHANNEL_LEFT (2)
#define FRONT_CHANNEL_RIGHT (3)
#define SIDE_CHANNEL_LEFT (4)
#define SIDE_CHANNEL_RIGHT (5)
#define BACK_CHANNEL_LEFT (6)
#define BACK_CHANNEL_RIGHT (7)
#define BACK_CHANNEL_CENTER (8)
#define LFE_CHANNEL (9)
#define UNKNOWN_CHANNEL (0)
char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode);
uint32_t NEAACDECAPI NeAACDecGetCapabilities(void);
NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
NeAACDecConfigurationPtr config);
/* Init the library based on info from the AAC file (ADTS/ADIF) */
int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
uint8_t *buffer,
uint32_t buffer_size,
uint32_t *samplerate,
uint8_t *channels);
/* Init the library using a DecoderSpecificInfo */
int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer,
uint32_t SizeOfDecoderSpecificInfo,
uint32_t *samplerate, uint8_t *channels);
/* Init the library for DRM */
int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate,
uint8_t channels);
void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame);
void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
NeAACDecFrameInfo *hInfo,
uint8_t *buffer,
uint32_t buffer_size);
void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
NeAACDecFrameInfo *hInfo,
uint8_t *buffer, uint32_t buffer_size,
void **sample_buffer, uint32_t sample_buffer_size);
#ifdef _WIN32
#pragma pack(pop)
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,170 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: drc.c 3 2005-06-02 18:16:43Z vspader $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include <string.h>
#include "syntax.h"
#include "drc.h"
drc_info *drc_init(real_t cut, real_t boost)
{
drc_info *drc = (drc_info*)faad_malloc(sizeof(drc_info));
memset(drc, 0, sizeof(drc_info));
drc->ctrl1 = cut;
drc->ctrl2 = boost;
drc->num_bands = 1;
drc->band_top[0] = 1024/4 - 1;
drc->dyn_rng_sgn[0] = 1;
drc->dyn_rng_ctl[0] = 0;
return drc;
}
void drc_end(drc_info *drc)
{
if (drc) faad_free(drc);
}
#ifdef FIXED_POINT
static real_t drc_pow2_table[] =
{
COEF_CONST(0.5146511183),
COEF_CONST(0.5297315472),
COEF_CONST(0.5452538663),
COEF_CONST(0.5612310242),
COEF_CONST(0.5776763484),
COEF_CONST(0.5946035575),
COEF_CONST(0.6120267717),
COEF_CONST(0.6299605249),
COEF_CONST(0.6484197773),
COEF_CONST(0.6674199271),
COEF_CONST(0.6869768237),
COEF_CONST(0.7071067812),
COEF_CONST(0.7278265914),
COEF_CONST(0.7491535384),
COEF_CONST(0.7711054127),
COEF_CONST(0.7937005260),
COEF_CONST(0.8169577266),
COEF_CONST(0.8408964153),
COEF_CONST(0.8655365610),
COEF_CONST(0.8908987181),
COEF_CONST(0.9170040432),
COEF_CONST(0.9438743127),
COEF_CONST(0.9715319412),
COEF_CONST(1.0000000000),
COEF_CONST(1.0293022366),
COEF_CONST(1.0594630944),
COEF_CONST(1.0905077327),
COEF_CONST(1.1224620483),
COEF_CONST(1.1553526969),
COEF_CONST(1.1892071150),
COEF_CONST(1.2240535433),
COEF_CONST(1.2599210499),
COEF_CONST(1.2968395547),
COEF_CONST(1.3348398542),
COEF_CONST(1.3739536475),
COEF_CONST(1.4142135624),
COEF_CONST(1.4556531828),
COEF_CONST(1.4983070769),
COEF_CONST(1.5422108254),
COEF_CONST(1.5874010520),
COEF_CONST(1.6339154532),
COEF_CONST(1.6817928305),
COEF_CONST(1.7310731220),
COEF_CONST(1.7817974363),
COEF_CONST(1.8340080864),
COEF_CONST(1.8877486254),
COEF_CONST(1.9430638823)
};
#endif
void drc_decode(drc_info *drc, real_t *spec)
{
uint16_t i, bd, top;
#ifdef FIXED_POINT
int32_t exp, frac;
#else
real_t factor, exp;
#endif
uint16_t bottom = 0;
if (drc->num_bands == 1)
drc->band_top[0] = 1024/4 - 1;
for (bd = 0; bd < drc->num_bands; bd++)
{
top = 4 * (drc->band_top[bd] + 1);
#ifndef FIXED_POINT
/* Decode DRC gain factor */
if (drc->dyn_rng_sgn[bd]) /* compress */
exp = -drc->ctrl1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
else /* boost */
exp = drc->ctrl2 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
factor = (real_t)pow(2.0, exp);
/* Apply gain factor */
for (i = bottom; i < top; i++)
spec[i] *= factor;
#else
/* Decode DRC gain factor */
if (drc->dyn_rng_sgn[bd]) /* compress */
{
exp = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24;
frac = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24;
} else { /* boost */
exp = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24;
frac = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24;
}
/* Apply gain factor */
if (exp < 0)
{
for (i = bottom; i < top; i++)
{
spec[i] >>= -exp;
if (frac)
spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]);
}
} else {
for (i = bottom; i < top; i++)
{
spec[i] <<= exp;
if (frac)
spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]);
}
}
#endif
bottom = top;
}
}

View file

@ -0,0 +1,46 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: drc.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __DRC_H__
#define __DRC_H__
#ifdef __cplusplus
extern "C" {
#endif
#define DRC_REF_LEVEL 20*4 /* -20 dB */
drc_info *drc_init(real_t cut, real_t boost);
void drc_end(drc_info *drc);
void drc_decode(drc_info *drc, real_t *spec);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,990 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR and PS decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: drm_dec.c 3 2005-06-02 18:16:43Z vspader $
**/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "common.h"
#ifdef DRM
#include "sbr_dec.h"
#include "drm_dec.h"
#include "bits.h"
/* constants */
#define DECAY_CUTOFF 3
#define DECAY_SLOPE 0.05f
/* type definitaions */
typedef const int8_t (*drm_ps_huff_tab)[2];
/* binary search huffman tables */
static const int8_t f_huffman_sa[][2] =
{
{ /*0*/ -15, 1 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 1x */
{ /*7*/ -8, 4 }, /* index 2: 3 bits: 10x */
{ 5, 6 }, /* index 3: 3 bits: 11x */
{ /*1*/ -14, /*-1*/ -16 }, /* index 4: 4 bits: 101x */
{ /*-2*/ -17, 7 }, /* index 5: 4 bits: 110x */
{ 8, 9 }, /* index 6: 4 bits: 111x */
{ /*2*/ -13, /*-3*/ -18 }, /* index 7: 5 bits: 1101x */
{ /*3*/ -12, 10 }, /* index 8: 5 bits: 1110x */
{ 11, 12 }, /* index 9: 5 bits: 1111x */
{ /*4*/ -11, /*5*/ -10 }, /* index 10: 6 bits: 11101x */
{ /*-4*/ -19, /*-5*/ -20 }, /* index 11: 6 bits: 11110x */
{ /*6*/ -9, 13 }, /* index 12: 6 bits: 11111x */
{ /*-7*/ -22, /*-6*/ -21 } /* index 13: 7 bits: 111111x */
};
static const int8_t t_huffman_sa[][2] =
{
{ /*0*/ -15, 1 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 1x */
{ /*-1*/ -16, /*1*/ -14 }, /* index 2: 3 bits: 10x */
{ 4, 5 }, /* index 3: 3 bits: 11x */
{ /*-2*/ -17, /*2*/ -13 }, /* index 4: 4 bits: 110x */
{ 6, 7 }, /* index 5: 4 bits: 111x */
{ /*-3*/ -18, /*3*/ -12 }, /* index 6: 5 bits: 1110x */
{ 8, 9 }, /* index 7: 5 bits: 1111x */
{ /*-4*/ -19, /*4*/ -11 }, /* index 8: 6 bits: 11110x */
{ 10, 11 }, /* index 9: 6 bits: 11111x */
{ /*-5*/ -20, /*5*/ -10 }, /* index 10: 7 bits: 111110x */
{ /*-6*/ -21, 12 }, /* index 11: 7 bits: 111111x */
{ /*-7*/ -22, 13 }, /* index 12: 8 bits: 1111111x */
{ /*6*/ -9, /*7*/ -8 } /* index 13: 9 bits: 11111111x */
};
static const int8_t f_huffman_pan[][2] =
{
{ /*0*/ -15, 1 }, /* index 0: 1 bits: x */
{ /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */
{ /*1*/ -14, 3 }, /* index 2: 3 bits: 11x */
{ 4, 5 }, /* index 3: 4 bits: 111x */
{ /*-2*/ -17, /*2*/ -13 }, /* index 4: 5 bits: 1110x */
{ 6, 7 }, /* index 5: 5 bits: 1111x */
{ /*-3*/ -18, /*3*/ -12 }, /* index 6: 6 bits: 11110x */
{ 8, 9 }, /* index 7: 6 bits: 11111x */
{ /*-4*/ -19, /*4*/ -11 }, /* index 8: 7 bits: 111110x */
{ 10, 11 }, /* index 9: 7 bits: 111111x */
{ /*-5*/ -20, /*5*/ -10 }, /* index 10: 8 bits: 1111110x */
{ 12, 13 }, /* index 11: 8 bits: 1111111x */
{ /*-6*/ -21, /*6*/ -9 }, /* index 12: 9 bits: 11111110x */
{ /*-7*/ -22, 14 }, /* index 13: 9 bits: 11111111x */
{ /*7*/ -8, 15 }, /* index 14: 10 bits: 111111111x */
{ 16, 17 }, /* index 15: 11 bits: 1111111111x */
{ /*-8*/ -23, /*8*/ -7 }, /* index 16: 12 bits: 11111111110x */
{ 18, 19 }, /* index 17: 12 bits: 11111111111x */
{ /*-10*/ -25, 20 }, /* index 18: 13 bits: 111111111110x */
{ 21, 22 }, /* index 19: 13 bits: 111111111111x */
{ /*-9*/ -24, /*9*/ -6 }, /* index 20: 14 bits: 1111111111101x */
{ /*10*/ -5, 23 }, /* index 21: 14 bits: 1111111111110x */
{ 24, 25 }, /* index 22: 14 bits: 1111111111111x */
{ /*-13*/ -28, /*-11*/ -26 }, /* index 23: 15 bits: 11111111111101x */
{ /*11*/ -4, /*13*/ -2 }, /* index 24: 15 bits: 11111111111110x */
{ 26, 27 }, /* index 25: 15 bits: 11111111111111x */
{ /*-14*/ -29, /*-12*/ -27 }, /* index 26: 16 bits: 111111111111110x */
{ /*12*/ -3, /*14*/ -1 } /* index 27: 16 bits: 111111111111111x */
};
static const int8_t t_huffman_pan[][2] =
{
{ /*0*/ -15, 1 }, /* index 0: 1 bits: x */
{ /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */
{ /*1*/ -14, 3 }, /* index 2: 3 bits: 11x */
{ /*-2*/ -17, 4 }, /* index 3: 4 bits: 111x */
{ /*2*/ -13, 5 }, /* index 4: 5 bits: 1111x */
{ /*-3*/ -18, 6 }, /* index 5: 6 bits: 11111x */
{ /*3*/ -12, 7 }, /* index 6: 7 bits: 111111x */
{ /*-4*/ -19, 8 }, /* index 7: 8 bits: 1111111x */
{ /*4*/ -11, 9 }, /* index 8: 9 bits: 11111111x */
{ 10, 11 }, /* index 9: 10 bits: 111111111x */
{ /*-5*/ -20, /*5*/ -10 }, /* index 10: 11 bits: 1111111110x */
{ 12, 13 }, /* index 11: 11 bits: 1111111111x */
{ /*-6*/ -21, /*6*/ -9 }, /* index 12: 12 bits: 11111111110x */
{ 14, 15 }, /* index 13: 12 bits: 11111111111x */
{ /*-7*/ -22, /*7*/ -8 }, /* index 14: 13 bits: 111111111110x */
{ 16, 17 }, /* index 15: 13 bits: 111111111111x */
{ /*-8*/ -23, /*8*/ -7 }, /* index 16: 14 bits: 1111111111110x */
{ 18, 19 }, /* index 17: 14 bits: 1111111111111x */
{ /*-10*/ -25, /*10*/ -5 }, /* index 18: 15 bits: 11111111111110x */
{ 20, 21 }, /* index 19: 15 bits: 11111111111111x */
{ /*-9*/ -24, /*9*/ -6 }, /* index 20: 16 bits: 111111111111110x */
{ 22, 23 }, /* index 21: 16 bits: 111111111111111x */
{ 24, 25 }, /* index 22: 17 bits: 1111111111111110x */
{ 26, 27 }, /* index 23: 17 bits: 1111111111111111x */
{ /*-14*/ -29, /*-13*/ -28 }, /* index 24: 18 bits: 11111111111111100x */
{ /*-12*/ -27, /*-11*/ -26 }, /* index 25: 18 bits: 11111111111111101x */
{ /*11*/ -4, /*12*/ -3 }, /* index 26: 18 bits: 11111111111111110x */
{ /*13*/ -2, /*14*/ -1 } /* index 27: 18 bits: 11111111111111111x */
};
/* There are 3 classes in the standard but the last 2 are identical */
static const real_t sa_quant[8][2] =
{
{ FRAC_CONST(0.0000), FRAC_CONST(0.0000) },
{ FRAC_CONST(0.0501), FRAC_CONST(0.1778) },
{ FRAC_CONST(0.0706), FRAC_CONST(0.2818) },
{ FRAC_CONST(0.0995), FRAC_CONST(0.4467) },
{ FRAC_CONST(0.1399), FRAC_CONST(0.5623) },
{ FRAC_CONST(0.1957), FRAC_CONST(0.7079) },
{ FRAC_CONST(0.2713), FRAC_CONST(0.8913) },
{ FRAC_CONST(0.3699), FRAC_CONST(1.0000) },
};
/* We don't need the actual quantizer values */
#if 0
static const real_t pan_quant[8][5] =
{
{ COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000) },
{ COEF_CONST(0.1661), COEF_CONST(0.1661), COEF_CONST(0.3322), COEF_CONST(0.3322), COEF_CONST(0.3322) },
{ COEF_CONST(0.3322), COEF_CONST(0.3322), COEF_CONST(0.6644), COEF_CONST(0.8305), COEF_CONST(0.8305) },
{ COEF_CONST(0.4983), COEF_CONST(0.6644), COEF_CONST(0.9966), COEF_CONST(1.4949), COEF_CONST(1.6610) },
{ COEF_CONST(0.6644), COEF_CONST(0.9966), COEF_CONST(1.4949), COEF_CONST(2.1593), COEF_CONST(2.4914) },
{ COEF_CONST(0.8305), COEF_CONST(1.3288), COEF_CONST(2.1593), COEF_CONST(2.9897), COEF_CONST(3.4880) },
{ COEF_CONST(0.9966), COEF_CONST(1.8271), COEF_CONST(2.8236), COEF_CONST(3.8202), COEF_CONST(4.6507) },
{ COEF_CONST(1.3288), COEF_CONST(2.3253), COEF_CONST(3.4880), COEF_CONST(4.6507), COEF_CONST(5.8134) },
};
#endif
/* 2^(pan_quant[x][y] */
static const real_t pan_pow_2_pos[8][5] = {
{ REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000) },
{ REAL_CONST(1.1220021), REAL_CONST(1.1220021), REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.2589312) },
{ REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.5849090), REAL_CONST(1.7783016), REAL_CONST(1.7783016) },
{ REAL_CONST(1.4125481), REAL_CONST(1.5849090), REAL_CONST(1.9952921), REAL_CONST(2.8184461), REAL_CONST(3.1623565) },
{ REAL_CONST(1.5849090), REAL_CONST(1.9952922), REAL_CONST(2.8184461), REAL_CONST(4.4669806), REAL_CONST(5.6232337) },
{ REAL_CONST(1.7783016), REAL_CONST(2.5119365), REAL_CONST(4.4669806), REAL_CONST(7.9430881), REAL_CONST(11.219994) },
{ REAL_CONST(1.9952921), REAL_CONST(3.5482312), REAL_CONST(7.0792671), REAL_CONST(14.125206), REAL_CONST(25.118876) },
{ REAL_CONST(2.5119365), REAL_CONST(5.0116998), REAL_CONST(11.219994), REAL_CONST(25.118876), REAL_CONST(56.235140) }
};
/* 2^(-pan_quant[x][y] */
static const real_t pan_pow_2_neg[8][5] = {
{ REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1) },
{ REAL_CONST(0.8912487), REAL_CONST(0.8912487), REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.7943242) },
{ REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.6309511), REAL_CONST(0.5623344), REAL_CONST(0.5623344) },
{ REAL_CONST(0.7079405), REAL_CONST(0.6309511), REAL_CONST(0.5011797), REAL_CONST(0.3548054), REAL_CONST(0.3162199) },
{ REAL_CONST(0.6309511), REAL_CONST(0.5011797), REAL_CONST(0.3548054), REAL_CONST(0.2238649), REAL_CONST(0.1778336) },
{ REAL_CONST(0.5623343), REAL_CONST(0.3980992), REAL_CONST(0.2238649), REAL_CONST(0.1258956), REAL_CONST(0.0891266) },
{ REAL_CONST(0.5011797), REAL_CONST(0.2818306), REAL_CONST(0.1412576), REAL_CONST(0.0707954), REAL_CONST(0.0398107) },
{ REAL_CONST(0.3980992), REAL_CONST(0.1995331), REAL_CONST(0.0891267), REAL_CONST(0.0398107), REAL_CONST(0.0177825) }
};
/* 2^(pan_quant[x][y]/30) */
static const real_t pan_pow_2_30_pos[8][5] = {
{ COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) },
{ COEF_CONST(1.003845098), COEF_CONST(1.003845098), COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.007704982) },
{ COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.01546933), COEF_CONST(1.019373909), COEF_CONST(1.019373909) },
{ COEF_CONST(1.011579706), COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.039123167) },
{ COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.051155908), COEF_CONST(1.059252598) },
{ COEF_CONST(1.019373909), COEF_CONST(1.03117796), COEF_CONST(1.051155908), COEF_CONST(1.071518432), COEF_CONST(1.0839263) },
{ COEF_CONST(1.023293502), COEF_CONST(1.043118698), COEF_CONST(1.067414119), COEF_CONST(1.092277933), COEF_CONST(1.113439626) },
{ COEF_CONST(1.03117796), COEF_CONST(1.055195268), COEF_CONST(1.0839263), COEF_CONST(1.113439626), COEF_CONST(1.143756546) }
};
/* 2^(-pan_quant[x][y]/30) */
static const real_t pan_pow_2_30_neg[8][5] = {
{ COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) },
{ COEF_CONST(0.99616963), COEF_CONST(0.99616963), COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.99235393) },
{ COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.984766325), COEF_CONST(0.980994305), COEF_CONST(0.980994305) },
{ COEF_CONST(0.988552848), COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.962349827) },
{ COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.951333663), COEF_CONST(0.944061881) },
{ COEF_CONST(0.980994305), COEF_CONST(0.969764715), COEF_CONST(0.951333663), COEF_CONST(0.933255062), COEF_CONST(0.922571949) },
{ COEF_CONST(0.977236734), COEF_CONST(0.958663671), COEF_CONST(0.936843519), COEF_CONST(0.915517901), COEF_CONST(0.898117847) },
{ COEF_CONST(0.969764715), COEF_CONST(0.947691892), COEF_CONST(0.922571949), COEF_CONST(0.898117847), COEF_CONST(0.874311936) }
};
static const real_t g_decayslope[MAX_SA_BAND] = {
FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.95),FRAC_CONST(0.9), FRAC_CONST(0.85), FRAC_CONST(0.8),
FRAC_CONST(0.75),FRAC_CONST(0.7), FRAC_CONST(0.65),FRAC_CONST(0.6), FRAC_CONST(0.55),FRAC_CONST(0.5), FRAC_CONST(0.45),
FRAC_CONST(0.4), FRAC_CONST(0.35),FRAC_CONST(0.3), FRAC_CONST(0.25),FRAC_CONST(0.2), FRAC_CONST(0.15), FRAC_CONST(0.1),
FRAC_CONST(0.05),FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0)
};
static const real_t sa_sqrt_1_minus[8][2] = {
{ FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(0.998744206), FRAC_CONST(0.984066644) },
{ FRAC_CONST(0.997504707), FRAC_CONST(0.959473168) },
{ FRAC_CONST(0.995037562), FRAC_CONST(0.894683804) },
{ FRAC_CONST(0.990165638), FRAC_CONST(0.826933317) },
{ FRAC_CONST(0.980663811), FRAC_CONST(0.706312672) },
{ FRAC_CONST(0.962494836), FRAC_CONST(0.45341406) },
{ FRAC_CONST(0.929071574), FRAC_CONST(0) }
};
static const uint8_t sa_freq_scale[9][2] =
{
{ 0, 0},
{ 1, 1},
{ 2, 2},
{ 3, 3},
{ 5, 5},
{ 7, 7},
{10,10},
{13,13},
{46,23}
};
static const uint8_t pan_freq_scale[21] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 18, 22, 26, 32, 64
};
static const uint8_t pan_quant_class[20] =
{
0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 3, 3, 3, 4, 4, 4
};
/* Inverse mapping lookup */
static const uint8_t pan_inv_freq[64] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19
};
static const uint8_t sa_inv_freq[MAX_SA_BAND] = {
0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7
};
static const real_t filter_coeff[] =
{
FRAC_CONST(0.65143905754106),
FRAC_CONST(0.56471812200776),
FRAC_CONST(0.48954165955695)
};
static const uint8_t delay_length[][2] =
{
{ 1, 3 }, { 2, 4 }, { 3, 5 }
};
static const real_t delay_fraction[] =
{
FRAC_CONST(0.43), FRAC_CONST(0.75), FRAC_CONST(0.347)
};
static const real_t peak_decay[2] =
{
FRAC_CONST(0.58664621951003), FRAC_CONST(0.76592833836465)
};
static const real_t smooth_coeff[2] =
{
FRAC_CONST(0.6), FRAC_CONST(0.25)
};
/* Please note that these are the same tables as in plain PS */
static const complex_t Q_Fract_allpass_Qmf[][3] = {
{ { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } },
{ { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } },
{ { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } },
{ { FRAC_CONST(0.0157073960), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7814115286), FRAC_CONST(-0.6240159869) } },
{ { FRAC_CONST(0.9792228341), FRAC_CONST(-0.2027871907) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.1920081824), FRAC_CONST(-0.9813933372) } },
{ { FRAC_CONST(0.4115142524), FRAC_CONST(0.9114032984) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9589683414), FRAC_CONST(-0.2835132182) } },
{ { FRAC_CONST(-0.7996847630), FRAC_CONST(0.6004201174) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.6947838664), FRAC_CONST(0.7192186117) } },
{ { FRAC_CONST(-0.7604058385), FRAC_CONST(-0.6494481564) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3164770305), FRAC_CONST(0.9486001730) } },
{ { FRAC_CONST(0.4679299891), FRAC_CONST(-0.8837655187) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9874414206), FRAC_CONST(0.1579856575) } },
{ { FRAC_CONST(0.9645573497), FRAC_CONST(0.2638732493) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.5966450572), FRAC_CONST(-0.8025052547) } },
{ { FRAC_CONST(-0.0471066870), FRAC_CONST(0.9988898635) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.4357025325), FRAC_CONST(-0.9000906944) } },
{ { FRAC_CONST(-0.9851093888), FRAC_CONST(0.1719288528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9995546937), FRAC_CONST(-0.0298405960) } },
{ { FRAC_CONST(-0.3826831877), FRAC_CONST(-0.9238796234) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.4886211455), FRAC_CONST(0.8724960685) } },
{ { FRAC_CONST(0.8181498647), FRAC_CONST(-0.5750049949) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.5477093458), FRAC_CONST(0.8366686702) } },
{ { FRAC_CONST(0.7396308780), FRAC_CONST(0.6730127335) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9951074123), FRAC_CONST(-0.0987988561) } },
{ { FRAC_CONST(-0.4954589605), FRAC_CONST(0.8686313629) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3725017905), FRAC_CONST(-0.9280315042) } },
{ { FRAC_CONST(-0.9557929039), FRAC_CONST(-0.2940406799) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.6506417990), FRAC_CONST(-0.7593847513) } },
{ { FRAC_CONST(0.0784594864), FRAC_CONST(-0.9969173074) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9741733670), FRAC_CONST(0.2258014232) } },
{ { FRAC_CONST(0.9900237322), FRAC_CONST(-0.1409008205) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.2502108514), FRAC_CONST(0.9681913853) } },
{ { FRAC_CONST(0.3534744382), FRAC_CONST(0.9354441762) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7427945137), FRAC_CONST(0.6695194840) } },
{ { FRAC_CONST(-0.8358076215), FRAC_CONST(0.5490224361) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9370992780), FRAC_CONST(-0.3490629196) } },
{ { FRAC_CONST(-0.7181259394), FRAC_CONST(-0.6959131360) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.1237744763), FRAC_CONST(-0.9923103452) } },
{ { FRAC_CONST(0.5224990249), FRAC_CONST(-0.8526399136) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.8226406574), FRAC_CONST(-0.5685616732) } },
{ { FRAC_CONST(0.9460852146), FRAC_CONST(0.3239179254) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.8844994903), FRAC_CONST(0.4665412009) } },
{ { FRAC_CONST(-0.1097348556), FRAC_CONST(0.9939609170) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.0047125919), FRAC_CONST(0.9999889135) } },
{ { FRAC_CONST(-0.9939610362), FRAC_CONST(0.1097337380) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8888573647), FRAC_CONST(0.4581840038) } },
{ { FRAC_CONST(-0.3239168525), FRAC_CONST(-0.9460855722) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8172453642), FRAC_CONST(-0.5762898922) } },
{ { FRAC_CONST(0.8526405096), FRAC_CONST(-0.5224980116) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.1331215799), FRAC_CONST(-0.9910997152) } },
{ { FRAC_CONST(0.6959123611), FRAC_CONST(0.7181267142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9403476119), FRAC_CONST(-0.3402152061) } },
{ { FRAC_CONST(-0.5490233898), FRAC_CONST(0.8358070254) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7364512086), FRAC_CONST(0.6764906645) } },
{ { FRAC_CONST(-0.9354437590), FRAC_CONST(-0.3534754813) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2593250275), FRAC_CONST(0.9657900929) } },
{ { FRAC_CONST(0.1409019381), FRAC_CONST(-0.9900235534) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9762582779), FRAC_CONST(0.2166097313) } },
{ { FRAC_CONST(0.9969173670), FRAC_CONST(-0.0784583688) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.6434556246), FRAC_CONST(-0.7654833794) } },
{ { FRAC_CONST(0.2940396070), FRAC_CONST(0.9557932615) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3812320232), FRAC_CONST(-0.9244794250) } },
{ { FRAC_CONST(-0.8686318994), FRAC_CONST(0.4954580069) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9959943891), FRAC_CONST(-0.0894154981) } },
{ { FRAC_CONST(-0.6730118990), FRAC_CONST(-0.7396316528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.5397993922), FRAC_CONST(0.8417937160) } },
{ { FRAC_CONST(0.5750059485), FRAC_CONST(-0.8181492686) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.4968227744), FRAC_CONST(0.8678520322) } },
{ { FRAC_CONST(0.9238792062), FRAC_CONST(0.3826842010) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9992290139), FRAC_CONST(-0.0392601527) } },
{ { FRAC_CONST(-0.1719299555), FRAC_CONST(0.9851091504) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4271997511), FRAC_CONST(-0.9041572809) } },
{ { FRAC_CONST(-0.9988899231), FRAC_CONST(0.0471055657) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.6041822433), FRAC_CONST(-0.7968461514) } },
{ { FRAC_CONST(-0.2638721764), FRAC_CONST(-0.9645576477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9859085083), FRAC_CONST(0.1672853529) } },
{ { FRAC_CONST(0.8837660551), FRAC_CONST(-0.4679289758) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3075223565), FRAC_CONST(0.9515408874) } },
{ { FRAC_CONST(0.6494473219), FRAC_CONST(0.7604066133) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.7015317082), FRAC_CONST(0.7126382589) } },
{ { FRAC_CONST(-0.6004210114), FRAC_CONST(0.7996840477) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9562535882), FRAC_CONST(-0.2925389707) } },
{ { FRAC_CONST(-0.9114028811), FRAC_CONST(-0.4115152657) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.1827499419), FRAC_CONST(-0.9831594229) } },
{ { FRAC_CONST(0.2027882934), FRAC_CONST(-0.9792225957) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7872582674), FRAC_CONST(-0.6166234016) } },
{ { FRAC_CONST(0.9998766780), FRAC_CONST(-0.0157062728) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9107555747), FRAC_CONST(0.4129458666) } },
{ { FRAC_CONST(0.2334443331), FRAC_CONST(0.9723701477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.0549497530), FRAC_CONST(0.9984891415) } },
{ { FRAC_CONST(-0.8980280757), FRAC_CONST(0.4399381876) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.8599416018), FRAC_CONST(0.5103924870) } },
{ { FRAC_CONST(-0.6252418160), FRAC_CONST(-0.7804310918) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8501682281), FRAC_CONST(-0.5265110731) } },
{ { FRAC_CONST(0.6252435446), FRAC_CONST(-0.7804297209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.0737608299), FRAC_CONST(-0.9972759485) } },
{ { FRAC_CONST(0.8980270624), FRAC_CONST(0.4399402142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9183775187), FRAC_CONST(-0.3957053721) } },
{ { FRAC_CONST(-0.2334465086), FRAC_CONST(0.9723696709) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.7754954696), FRAC_CONST(0.6313531399) } },
{ { FRAC_CONST(-0.9998766184), FRAC_CONST(-0.0157085191) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2012493610), FRAC_CONST(0.9795400500) } },
{ { FRAC_CONST(-0.2027861029), FRAC_CONST(-0.9792230725) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9615978599), FRAC_CONST(0.2744622827) } },
{ { FRAC_CONST(0.9114037752), FRAC_CONST(-0.4115132093) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.6879743338), FRAC_CONST(-0.7257350087) } },
{ { FRAC_CONST(0.6004192233), FRAC_CONST(0.7996854186) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.3254036009), FRAC_CONST(-0.9455752373) } },
{ { FRAC_CONST(-0.6494490504), FRAC_CONST(0.7604051232) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9888865948), FRAC_CONST(-0.1486719251) } },
{ { FRAC_CONST(-0.8837650418), FRAC_CONST(-0.4679309726) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.5890548825), FRAC_CONST(0.8080930114) } },
{ { FRAC_CONST(0.2638743520), FRAC_CONST(-0.9645570517) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.4441666007), FRAC_CONST(0.8959442377) } },
{ { FRAC_CONST(0.9988898039), FRAC_CONST(0.0471078083) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9997915030), FRAC_CONST(0.0204183888) } },
{ { FRAC_CONST(0.1719277352), FRAC_CONST(0.9851095676) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4803760946), FRAC_CONST(-0.8770626187) } },
{ { FRAC_CONST(-0.9238800406), FRAC_CONST(0.3826821446) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.5555707216), FRAC_CONST(-0.8314692974) } },
{ { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } }
};
static const complex_t Phi_Fract_Qmf[] = {
{ FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) },
{ FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) },
{ FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) },
{ FRAC_CONST(-0.4115143716), FRAC_CONST(-0.9114032984) },
{ FRAC_CONST(0.7181262970), FRAC_CONST(-0.6959127784) },
{ FRAC_CONST(0.8980275989), FRAC_CONST(0.4399391711) },
{ FRAC_CONST(-0.1097343117), FRAC_CONST(0.9939609766) },
{ FRAC_CONST(-0.9723699093), FRAC_CONST(0.2334453613) },
{ FRAC_CONST(-0.5490227938), FRAC_CONST(-0.8358073831) },
{ FRAC_CONST(0.6004202366), FRAC_CONST(-0.7996846437) },
{ FRAC_CONST(0.9557930231), FRAC_CONST(0.2940403223) },
{ FRAC_CONST(0.0471064523), FRAC_CONST(0.9988898635) },
{ FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) },
{ FRAC_CONST(-0.6730124950), FRAC_CONST(-0.7396311164) },
{ FRAC_CONST(0.4679298103), FRAC_CONST(-0.8837656379) },
{ FRAC_CONST(0.9900236726), FRAC_CONST(0.1409012377) },
{ FRAC_CONST(0.2027872950), FRAC_CONST(0.9792228341) },
{ FRAC_CONST(-0.8526401520), FRAC_CONST(0.5224985480) },
{ FRAC_CONST(-0.7804304361), FRAC_CONST(-0.6252426505) },
{ FRAC_CONST(0.3239174187), FRAC_CONST(-0.9460853338) },
{ FRAC_CONST(0.9998766184), FRAC_CONST(-0.0157073177) },
{ FRAC_CONST(0.3534748554), FRAC_CONST(0.9354440570) },
{ FRAC_CONST(-0.7604059577), FRAC_CONST(0.6494480371) },
{ FRAC_CONST(-0.8686315417), FRAC_CONST(-0.4954586625) },
{ FRAC_CONST(0.1719291061), FRAC_CONST(-0.9851093292) },
{ FRAC_CONST(0.9851093292), FRAC_CONST(-0.1719291061) },
{ FRAC_CONST(0.4954586625), FRAC_CONST(0.8686315417) },
{ FRAC_CONST(-0.6494480371), FRAC_CONST(0.7604059577) },
{ FRAC_CONST(-0.9354440570), FRAC_CONST(-0.3534748554) },
{ FRAC_CONST(0.0157073177), FRAC_CONST(-0.9998766184) },
{ FRAC_CONST(0.9460853338), FRAC_CONST(-0.3239174187) },
{ FRAC_CONST(0.6252426505), FRAC_CONST(0.7804304361) },
{ FRAC_CONST(-0.5224985480), FRAC_CONST(0.8526401520) },
{ FRAC_CONST(-0.9792228341), FRAC_CONST(-0.2027872950) },
{ FRAC_CONST(-0.1409012377), FRAC_CONST(-0.9900236726) },
{ FRAC_CONST(0.8837656379), FRAC_CONST(-0.4679298103) },
{ FRAC_CONST(0.7396311164), FRAC_CONST(0.6730124950) },
{ FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) },
{ FRAC_CONST(-0.9988898635), FRAC_CONST(-0.0471064523) },
{ FRAC_CONST(-0.2940403223), FRAC_CONST(-0.9557930231) },
{ FRAC_CONST(0.7996846437), FRAC_CONST(-0.6004202366) },
{ FRAC_CONST(0.8358073831), FRAC_CONST(0.5490227938) },
{ FRAC_CONST(-0.2334453613), FRAC_CONST(0.9723699093) },
{ FRAC_CONST(-0.9939609766), FRAC_CONST(0.1097343117) },
{ FRAC_CONST(-0.4399391711), FRAC_CONST(-0.8980275989) },
{ FRAC_CONST(0.6959127784), FRAC_CONST(-0.7181262970) },
{ FRAC_CONST(0.9114032984), FRAC_CONST(0.4115143716) },
{ FRAC_CONST(-0.0784590989), FRAC_CONST(0.9969173074) },
{ FRAC_CONST(-0.9645574093), FRAC_CONST(0.2638730407) },
{ FRAC_CONST(-0.5750052333), FRAC_CONST(-0.8181497455) },
{ FRAC_CONST(0.5750052333), FRAC_CONST(-0.8181497455) },
{ FRAC_CONST(0.9645574093), FRAC_CONST(0.2638730407) },
{ FRAC_CONST(0.0784590989), FRAC_CONST(0.9969173074) },
{ FRAC_CONST(-0.9114032984), FRAC_CONST(0.4115143716) },
{ FRAC_CONST(-0.6959127784), FRAC_CONST(-0.7181262970) },
{ FRAC_CONST(0.4399391711), FRAC_CONST(-0.8980275989) },
{ FRAC_CONST(0.9939609766), FRAC_CONST(0.1097343117) },
{ FRAC_CONST(0.2334453613), FRAC_CONST(0.9723699093) },
{ FRAC_CONST(-0.8358073831), FRAC_CONST(0.5490227938) },
{ FRAC_CONST(-0.7996846437), FRAC_CONST(-0.6004202366) },
{ FRAC_CONST(0.2940403223), FRAC_CONST(-0.9557930231) },
{ FRAC_CONST(0.9988898635), FRAC_CONST(-0.0471064523) },
{ FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) },
{ FRAC_CONST(-0.7396311164), FRAC_CONST(0.6730124950) }
};
/* static function declarations */
static void drm_ps_sa_element(drm_ps_info *ps, bitfile *ld);
static void drm_ps_pan_element(drm_ps_info *ps, bitfile *ld);
static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff);
uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld)
{
uint16_t bits = (uint16_t)faad_get_processed_bits(ld);
ps->drm_ps_data_available = 1;
ps->bs_enable_sa = faad_get1bit(ld);
ps->bs_enable_pan = faad_get1bit(ld);
if (ps->bs_enable_sa)
{
drm_ps_sa_element(ps, ld);
}
if (ps->bs_enable_pan)
{
drm_ps_pan_element(ps, ld);
}
bits = (uint16_t)faad_get_processed_bits(ld) - bits;
return bits;
}
static void drm_ps_sa_element(drm_ps_info *ps, bitfile *ld)
{
drm_ps_huff_tab huff;
uint8_t band;
ps->bs_sa_dt_flag = faad_get1bit(ld);
if (ps->bs_sa_dt_flag)
{
huff = t_huffman_sa;
} else {
huff = f_huffman_sa;
}
for (band = 0; band < DRM_NUM_SA_BANDS; band++)
{
ps->bs_sa_data[band] = huff_dec(ld, huff);
}
}
static void drm_ps_pan_element(drm_ps_info *ps, bitfile *ld)
{
drm_ps_huff_tab huff;
uint8_t band;
ps->bs_pan_dt_flag = faad_get1bit(ld);
if (ps->bs_pan_dt_flag)
{
huff = t_huffman_pan;
} else {
huff = f_huffman_pan;
}
for (band = 0; band < DRM_NUM_PAN_BANDS; band++)
{
ps->bs_pan_data[band] = huff_dec(ld, huff);
}
}
/* binary search huffman decoding */
static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff)
{
uint8_t bit;
int16_t index = 0;
while (index >= 0)
{
bit = (uint8_t)faad_get1bit(ld);
index = huff[index][bit];
}
return index + 15;
}
static int8_t sa_delta_clip(drm_ps_info *ps, int8_t i)
{
if (i < 0) {
/* printf(" SAminclip %d", i); */
ps->sa_decode_error = 1;
return 0;
} else if (i > 7) {
/* printf(" SAmaxclip %d", i); */
ps->sa_decode_error = 1;
return 7;
} else
return i;
}
static int8_t pan_delta_clip(drm_ps_info *ps, int8_t i)
{
if (i < -7) {
/* printf(" PANminclip %d", i); */
ps->pan_decode_error = 1;
return -7;
} else if (i > 7) {
/* printf(" PANmaxclip %d", i); */
ps->pan_decode_error = 1;
return 7;
} else
return i;
}
static void drm_ps_delta_decode(drm_ps_info *ps)
{
uint8_t band;
if (ps->bs_enable_sa)
{
if (ps->bs_sa_dt_flag && !ps->g_last_had_sa)
{
for (band = 0; band < DRM_NUM_SA_BANDS; band++)
{
ps->g_prev_sa_index[band] = 0;
}
}
if (ps->bs_sa_dt_flag)
{
ps->g_sa_index[0] = sa_delta_clip(ps, ps->g_prev_sa_index[0]+ps->bs_sa_data[0]);
} else {
ps->g_sa_index[0] = sa_delta_clip(ps,ps->bs_sa_data[0]);
}
for (band = 1; band < DRM_NUM_SA_BANDS; band++)
{
if (ps->bs_sa_dt_flag)
{
ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_prev_sa_index[band] + ps->bs_sa_data[band]);
} else {
ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_sa_index[band-1] + ps->bs_sa_data[band]);
}
}
}
/* An error during SA decoding implies PAN data will be undecodable, too */
/* Also, we don't like on/off switching in PS, so we force to last settings */
if (ps->sa_decode_error) {
ps->pan_decode_error = 1;
ps->bs_enable_pan = ps->g_last_had_pan;
ps->bs_enable_sa = ps->g_last_had_sa;
}
if (ps->bs_enable_sa)
{
if (ps->sa_decode_error) {
for (band = 0; band < DRM_NUM_SA_BANDS; band++)
{
ps->g_sa_index[band] = ps->g_last_good_sa_index[band];
}
} else {
for (band = 0; band < DRM_NUM_SA_BANDS; band++)
{
ps->g_last_good_sa_index[band] = ps->g_sa_index[band];
}
}
}
if (ps->bs_enable_pan)
{
if (ps->bs_pan_dt_flag && !ps->g_last_had_pan)
{
/* The DRM PS spec doesn't say anything about this case. (deltacoded in time without a previous frame)
AAC PS spec you must tread previous frame as 0, so that's what we try.
*/
for (band = 0; band < DRM_NUM_PAN_BANDS; band++)
{
ps->g_prev_pan_index[band] = 0;
}
}
if (ps->bs_pan_dt_flag)
{
ps->g_pan_index[0] = pan_delta_clip(ps, ps->g_prev_pan_index[0]+ps->bs_pan_data[0]);
} else {
ps->g_pan_index[0] = pan_delta_clip(ps, ps->bs_pan_data[0]);
}
for (band = 1; band < DRM_NUM_PAN_BANDS; band++)
{
if (ps->bs_pan_dt_flag)
{
ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_prev_pan_index[band] + ps->bs_pan_data[band]);
} else {
ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_pan_index[band-1] + ps->bs_pan_data[band]);
}
}
if (ps->pan_decode_error) {
for (band = 0; band < DRM_NUM_PAN_BANDS; band++)
{
ps->g_pan_index[band] = ps->g_last_good_pan_index[band];
}
} else {
for (band = 0; band < DRM_NUM_PAN_BANDS; band++)
{
ps->g_last_good_pan_index[band] = ps->g_pan_index[band];
}
}
}
}
static void drm_calc_sa_side_signal(drm_ps_info *ps, qmf_t X[38][64], uint8_t rateselect)
{
uint8_t s, b, k;
complex_t qfrac, tmp0, tmp, in, R0;
real_t peakdiff;
real_t nrg;
real_t power;
real_t transratio;
real_t new_delay_slopes[NUM_OF_LINKS];
uint8_t temp_delay_ser[NUM_OF_LINKS];
complex_t Phi_Fract;
#ifdef FIXED_POINT
uint32_t in_re, in_im;
#endif
for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS][rateselect]; b++)
{
/* set delay indices */
for (k = 0; k < NUM_OF_LINKS; k++)
temp_delay_ser[k] = ps->delay_buf_index_ser[k];
RE(Phi_Fract) = RE(Phi_Fract_Qmf[b]);
IM(Phi_Fract) = IM(Phi_Fract_Qmf[b]);
for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
{
const real_t gamma = REAL_CONST(1.5);
const real_t sigma = REAL_CONST(1.5625);
RE(in) = QMF_RE(X[s][b]);
IM(in) = QMF_IM(X[s][b]);
#ifdef FIXED_POINT
/* NOTE: all input is scaled by 2^(-5) because of fixed point QMF
* meaning that P will be scaled by 2^(-10) compared to floating point version
*/
in_re = ((abs(RE(in))+(1<<(REAL_BITS-1)))>>REAL_BITS);
in_im = ((abs(IM(in))+(1<<(REAL_BITS-1)))>>REAL_BITS);
power = in_re*in_re + in_im*in_im;
#else
power = MUL_R(RE(in),RE(in)) + MUL_R(IM(in),IM(in));
#endif
ps->peakdecay_fast[b] = MUL_F(ps->peakdecay_fast[b], peak_decay[rateselect]);
if (ps->peakdecay_fast[b] < power)
ps->peakdecay_fast[b] = power;
peakdiff = ps->prev_peakdiff[b];
peakdiff += MUL_F((ps->peakdecay_fast[b] - power - ps->prev_peakdiff[b]), smooth_coeff[rateselect]);
ps->prev_peakdiff[b] = peakdiff;
nrg = ps->prev_nrg[b];
nrg += MUL_F((power - ps->prev_nrg[b]), smooth_coeff[rateselect]);
ps->prev_nrg[b] = nrg;
if (MUL_R(peakdiff, gamma) <= nrg) {
transratio = sigma;
} else {
transratio = MUL_R(DIV_R(nrg, MUL_R(peakdiff, gamma)), sigma);
}
for (k = 0; k < NUM_OF_LINKS; k++)
{
new_delay_slopes[k] = MUL_F(g_decayslope[b], filter_coeff[k]);
}
RE(tmp0) = RE(ps->d_buff[0][b]);
IM(tmp0) = IM(ps->d_buff[0][b]);
RE(ps->d_buff[0][b]) = RE(ps->d_buff[1][b]);
IM(ps->d_buff[0][b]) = IM(ps->d_buff[1][b]);
RE(ps->d_buff[1][b]) = RE(in);
IM(ps->d_buff[1][b]) = IM(in);
ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Phi_Fract), IM(Phi_Fract));
RE(R0) = RE(tmp);
IM(R0) = IM(tmp);
for (k = 0; k < NUM_OF_LINKS; k++)
{
RE(qfrac) = RE(Q_Fract_allpass_Qmf[b][k]);
IM(qfrac) = IM(Q_Fract_allpass_Qmf[b][k]);
RE(tmp0) = RE(ps->d2_buff[k][temp_delay_ser[k]][b]);
IM(tmp0) = IM(ps->d2_buff[k][temp_delay_ser[k]][b]);
ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(qfrac), IM(qfrac));
RE(tmp) += -MUL_F(new_delay_slopes[k], RE(R0));
IM(tmp) += -MUL_F(new_delay_slopes[k], IM(R0));
RE(ps->d2_buff[k][temp_delay_ser[k]][b]) = RE(R0) + MUL_F(new_delay_slopes[k], RE(tmp));
IM(ps->d2_buff[k][temp_delay_ser[k]][b]) = IM(R0) + MUL_F(new_delay_slopes[k], IM(tmp));
RE(R0) = RE(tmp);
IM(R0) = IM(tmp);
}
QMF_RE(ps->SA[s][b]) = MUL_R(RE(R0), transratio);
QMF_IM(ps->SA[s][b]) = MUL_R(IM(R0), transratio);
for (k = 0; k < NUM_OF_LINKS; k++)
{
if (++temp_delay_ser[k] >= delay_length[k][rateselect])
temp_delay_ser[k] = 0;
}
}
}
for (k = 0; k < NUM_OF_LINKS; k++)
ps->delay_buf_index_ser[k] = temp_delay_ser[k];
}
static void drm_add_ambiance(drm_ps_info *ps, uint8_t rateselect, qmf_t X_left[38][64], qmf_t X_right[38][64])
{
uint8_t s, b, ifreq, qclass;
real_t sa_map[MAX_SA_BAND], sa_dir_map[MAX_SA_BAND], k_sa_map[MAX_SA_BAND], k_sa_dir_map[MAX_SA_BAND];
real_t new_dir_map, new_sa_map;
if (ps->bs_enable_sa)
{
/* Instead of dequantization and mapping, we use an inverse mapping
to look up all the values we need */
for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS][rateselect]; b++)
{
const real_t inv_f_num_of_subsamples = FRAC_CONST(0.03333333333);
ifreq = sa_inv_freq[b];
qclass = (b != 0);
sa_map[b] = sa_quant[ps->g_prev_sa_index[ifreq]][qclass];
new_sa_map = sa_quant[ps->g_sa_index[ifreq]][qclass];
k_sa_map[b] = MUL_F(inv_f_num_of_subsamples, (new_sa_map - sa_map[b]));
sa_dir_map[b] = sa_sqrt_1_minus[ps->g_prev_sa_index[ifreq]][qclass];
new_dir_map = sa_sqrt_1_minus[ps->g_sa_index[ifreq]][qclass];
k_sa_dir_map[b] = MUL_F(inv_f_num_of_subsamples, (new_dir_map - sa_dir_map[b]));
}
for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
{
for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS][rateselect]; b++)
{
QMF_RE(X_right[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]);
QMF_IM(X_right[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]);
QMF_RE(X_left[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]);
QMF_IM(X_left[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]);
sa_map[b] += k_sa_map[b];
sa_dir_map[b] += k_sa_dir_map[b];
}
for (b = sa_freq_scale[DRM_NUM_SA_BANDS][rateselect]; b < NUM_OF_QMF_CHANNELS; b++)
{
QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]);
QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]);
}
}
}
else {
for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
{
for (b = 0; b < NUM_OF_QMF_CHANNELS; b++)
{
QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]);
QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]);
}
}
}
}
static void drm_add_pan(drm_ps_info *ps, uint8_t rateselect, qmf_t X_left[38][64], qmf_t X_right[38][64])
{
uint8_t s, b, qclass, ifreq;
real_t tmp, coeff1, coeff2;
real_t pan_base[MAX_PAN_BAND];
real_t pan_delta[MAX_PAN_BAND];
qmf_t temp_l, temp_r;
if (ps->bs_enable_pan)
{
for (b = 0; b < NUM_OF_QMF_CHANNELS; b++)
{
/* Instead of dequantization, 20->64 mapping and 2^G(x,y) we do an
inverse mapping 64->20 and look up the 2^G(x,y) values directly */
ifreq = pan_inv_freq[b];
qclass = pan_quant_class[ifreq];
if (ps->g_prev_pan_index[ifreq] >= 0)
{
pan_base[b] = pan_pow_2_pos[ps->g_prev_pan_index[ifreq]][qclass];
} else {
pan_base[b] = pan_pow_2_neg[-ps->g_prev_pan_index[ifreq]][qclass];
}
/* 2^((a-b)/30) = 2^(a/30) * 1/(2^(b/30)) */
/* a en b can be negative so we may need to inverse parts */
if (ps->g_pan_index[ifreq] >= 0)
{
if (ps->g_prev_pan_index[ifreq] >= 0)
{
pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass],
pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]);
} else {
pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass],
pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]);
}
} else {
if (ps->g_prev_pan_index[ifreq] >= 0)
{
pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass],
pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]);
} else {
pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass],
pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]);
}
}
}
for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
{
/* PAN always uses all 64 channels */
for (b = 0; b < NUM_OF_QMF_CHANNELS; b++)
{
tmp = pan_base[b];
coeff2 = DIV_R(REAL_CONST(2.0), (REAL_CONST(1.0) + tmp));
coeff1 = MUL_R(coeff2, tmp);
QMF_RE(temp_l) = QMF_RE(X_left[s][b]);
QMF_IM(temp_l) = QMF_IM(X_left[s][b]);
QMF_RE(temp_r) = QMF_RE(X_right[s][b]);
QMF_IM(temp_r) = QMF_IM(X_right[s][b]);
QMF_RE(X_left[s][b]) = MUL_R(QMF_RE(temp_l), coeff1);
QMF_IM(X_left[s][b]) = MUL_R(QMF_IM(temp_l), coeff1);
QMF_RE(X_right[s][b]) = MUL_R(QMF_RE(temp_r), coeff2);
QMF_IM(X_right[s][b]) = MUL_R(QMF_IM(temp_r), coeff2);
/* 2^(a+k*b) = 2^a * 2^b * ... * 2^b */
/* ^^^^^^^^^^^^^^^ k times */
pan_base[b] = MUL_C(pan_base[b], pan_delta[b]);
}
}
}
}
drm_ps_info *drm_ps_init(void)
{
drm_ps_info *ps = (drm_ps_info*)faad_malloc(sizeof(drm_ps_info));
memset(ps, 0, sizeof(drm_ps_info));
return ps;
}
void drm_ps_free(drm_ps_info *ps)
{
faad_free(ps);
}
/* main DRM PS decoding function */
uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, uint32_t samplerate, qmf_t X_left[38][64], qmf_t X_right[38][64])
{
uint8_t rateselect = (samplerate >= 24000);
if (ps == NULL)
{
memcpy(X_right, X_left, sizeof(qmf_t)*30*64);
return 0;
}
if (!ps->drm_ps_data_available && !guess)
{
memcpy(X_right, X_left, sizeof(qmf_t)*30*64);
memset(ps->g_prev_sa_index, 0, sizeof(ps->g_prev_sa_index));
memset(ps->g_prev_pan_index, 0, sizeof(ps->g_prev_pan_index));
return 0;
}
/* if SBR CRC doesn't match out, we can assume decode errors to start with,
and we'll guess what the parameters should be */
if (!guess)
{
ps->sa_decode_error = 0;
ps->pan_decode_error = 0;
drm_ps_delta_decode(ps);
} else
{
ps->sa_decode_error = 1;
ps->pan_decode_error = 1;
/* don't even bother decoding */
}
ps->drm_ps_data_available = 0;
drm_calc_sa_side_signal(ps, X_left, rateselect);
drm_add_ambiance(ps, rateselect, X_left, X_right);
if (ps->bs_enable_sa)
{
ps->g_last_had_sa = 1;
memcpy(ps->g_prev_sa_index, ps->g_sa_index, sizeof(int8_t) * DRM_NUM_SA_BANDS);
} else {
ps->g_last_had_sa = 0;
}
if (ps->bs_enable_pan)
{
drm_add_pan(ps, rateselect, X_left, X_right);
ps->g_last_had_pan = 1;
memcpy(ps->g_prev_pan_index, ps->g_pan_index, sizeof(int8_t) * DRM_NUM_PAN_BANDS);
} else {
ps->g_last_had_pan = 0;
}
return 0;
}
#endif

View file

@ -0,0 +1,97 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: drm_dec.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __DRM_DEC_H__
#define __DRM_DEC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "bits.h"
#define DRM_PARAMETRIC_STEREO 0
#define DRM_NUM_SA_BANDS 8
#define DRM_NUM_PAN_BANDS 20
#define NUM_OF_LINKS 3
#define NUM_OF_QMF_CHANNELS 64
#define NUM_OF_SUBSAMPLES 30
#define MAX_SA_BAND 46
#define MAX_PAN_BAND 64
#define MAX_DELAY 5
typedef struct
{
uint8_t drm_ps_data_available;
uint8_t bs_enable_sa;
uint8_t bs_enable_pan;
uint8_t bs_sa_dt_flag;
uint8_t bs_pan_dt_flag;
uint8_t g_last_had_sa;
uint8_t g_last_had_pan;
int8_t bs_sa_data[DRM_NUM_SA_BANDS];
int8_t bs_pan_data[DRM_NUM_PAN_BANDS];
int8_t g_sa_index[DRM_NUM_SA_BANDS];
int8_t g_pan_index[DRM_NUM_PAN_BANDS];
int8_t g_prev_sa_index[DRM_NUM_SA_BANDS];
int8_t g_prev_pan_index[DRM_NUM_PAN_BANDS];
int8_t sa_decode_error;
int8_t pan_decode_error;
int8_t g_last_good_sa_index[DRM_NUM_SA_BANDS];
int8_t g_last_good_pan_index[DRM_NUM_PAN_BANDS];
qmf_t SA[NUM_OF_SUBSAMPLES][MAX_SA_BAND];
complex_t d_buff[2][MAX_SA_BAND];
complex_t d2_buff[NUM_OF_LINKS][MAX_DELAY][MAX_SA_BAND];
uint8_t delay_buf_index_ser[NUM_OF_LINKS];
real_t prev_nrg[MAX_SA_BAND];
real_t prev_peakdiff[MAX_SA_BAND];
real_t peakdecay_fast[MAX_SA_BAND];
} drm_ps_info;
uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld);
drm_ps_info *drm_ps_init(void);
void drm_ps_free(drm_ps_info *ps);
uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, uint32_t samplerate, qmf_t X_left[38][64], qmf_t X_right[38][64]);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,61 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: error.c 3 2005-06-02 18:16:43Z vspader $
**/
#include "common.h"
#include "error.h"
char *err_msg[] = {
"No error",
"Gain control not yet implemented",
"Pulse coding not allowed in short blocks",
"Invalid huffman codebook",
"Scalefactor out of range",
"Unable to find ADTS syncword",
"Channel coupling not yet implemented",
"Channel configuration not allowed in error resilient frame",
"Bit error in error resilient scalefactor decoding",
"Error decoding huffman scalefactor (bitstream error)",
"Error decoding huffman codeword (bitstream error)",
"Non existent huffman codebook number found",
"Invalid number of channels",
"Maximum number of bitstream elements exceeded",
"Input data buffer too small",
"Array index out of range",
"Maximum number of scalefactor bands exceeded",
"Quantised value out of range",
"LTP lag out of range",
"Invalid SBR parameter decoded",
"SBR called without being initialised",
"Unexpected channel configuration change",
"Error in program_config_element",
"First SBR frame is not the same as first AAC frame",
"Unexpected fill element with SBR data",
"Not all elements were provided with SBR data",
"LTP decoding not available",
"Output data buffer too small"
};

View file

@ -0,0 +1,41 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: error.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __ERROR_H__
#define __ERROR_H__
#ifdef __cplusplus
extern "C" {
#endif
#define NUM_ERROR_MESSAGES 28
extern char *err_msg[];
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,404 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: filtbank.c 3 2005-06-02 18:16:43Z vspader $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32_WCE
#define assert(x)
#else
#include <assert.h>
#endif
#include "filtbank.h"
#include "decoder.h"
#include "syntax.h"
#include "kbd_win.h"
#include "sine_win.h"
#include "mdct.h"
fb_info *filter_bank_init(uint16_t frame_len)
{
uint16_t nshort = frame_len/8;
#ifdef LD_DEC
uint16_t frame_len_ld = frame_len/2;
#endif
fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info));
memset(fb, 0, sizeof(fb_info));
/* normal */
fb->mdct256 = faad_mdct_init(2*nshort);
fb->mdct2048 = faad_mdct_init(2*frame_len);
#ifdef LD_DEC
/* LD */
fb->mdct1024 = faad_mdct_init(2*frame_len_ld);
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
if (frame_len == 1024)
{
#endif
fb->long_window[0] = sine_long_1024;
fb->short_window[0] = sine_short_128;
fb->long_window[1] = kbd_long_1024;
fb->short_window[1] = kbd_short_128;
#ifdef LD_DEC
fb->ld_window[0] = sine_mid_512;
fb->ld_window[1] = ld_mid_512;
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
} else /* (frame_len == 960) */ {
fb->long_window[0] = sine_long_960;
fb->short_window[0] = sine_short_120;
fb->long_window[1] = kbd_long_960;
fb->short_window[1] = kbd_short_120;
#ifdef LD_DEC
fb->ld_window[0] = sine_mid_480;
fb->ld_window[1] = ld_mid_480;
#endif
}
#endif
return fb;
}
void filter_bank_end(fb_info *fb)
{
if (fb != NULL)
{
#ifdef PROFILE
printf("FB: %I64d cycles\n", fb->cycles);
#endif
faad_mdct_end(fb->mdct256);
faad_mdct_end(fb->mdct2048);
#ifdef LD_DEC
faad_mdct_end(fb->mdct1024);
#endif
faad_free(fb);
}
}
static INLINE void imdct_long(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
{
#ifdef LD_DEC
mdct_info *mdct = NULL;
switch (len)
{
case 2048:
case 1920:
mdct = fb->mdct2048;
break;
case 1024:
case 960:
mdct = fb->mdct1024;
break;
}
faad_imdct(mdct, in_data, out_data);
#else
faad_imdct(fb->mdct2048, in_data, out_data);
#endif
}
#ifdef LTP_DEC
static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
{
mdct_info *mdct = NULL;
switch (len)
{
case 2048:
case 1920:
mdct = fb->mdct2048;
break;
case 256:
case 240:
mdct = fb->mdct256;
break;
#ifdef LD_DEC
case 1024:
case 960:
mdct = fb->mdct1024;
break;
#endif
}
faad_mdct(mdct, in_data, out_data);
}
#endif
void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
uint8_t window_shape_prev, real_t *freq_in,
real_t *time_out, real_t *overlap,
uint8_t object_type, uint16_t frame_len)
{
int16_t i;
ALIGN real_t transf_buf[2*1024] = {0};
const real_t *window_long = NULL;
const real_t *window_long_prev = NULL;
const real_t *window_short = NULL;
const real_t *window_short_prev = NULL;
uint16_t nlong = frame_len;
uint16_t nshort = frame_len/8;
uint16_t trans = nshort/2;
uint16_t nflat_ls = (nlong-nshort)/2;
#ifdef PROFILE
int64_t count = faad_get_ts();
#endif
/* select windows of current frame and previous frame (Sine or KBD) */
#ifdef LD_DEC
if (object_type == LD)
{
window_long = fb->ld_window[window_shape];
window_long_prev = fb->ld_window[window_shape_prev];
} else {
#endif
window_long = fb->long_window[window_shape];
window_long_prev = fb->long_window[window_shape_prev];
window_short = fb->short_window[window_shape];
window_short_prev = fb->short_window[window_shape_prev];
#ifdef LD_DEC
}
#endif
#if 0
for (i = 0; i < 1024; i++)
{
printf("%d\n", freq_in[i]);
}
#endif
#if 0
printf("%d %d\n", window_sequence, window_shape);
#endif
switch (window_sequence)
{
case ONLY_LONG_SEQUENCE:
/* perform iMDCT */
imdct_long(fb, freq_in, transf_buf, 2*nlong);
/* add second half output of previous frame to windowed output of current frame */
for (i = 0; i < nlong; i+=4)
{
time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]);
time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
}
/* window the second half and save as overlap for next frame */
for (i = 0; i < nlong; i+=4)
{
overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
overlap[i+1] = MUL_F(transf_buf[nlong+i+1],window_long[nlong-2-i]);
overlap[i+2] = MUL_F(transf_buf[nlong+i+2],window_long[nlong-3-i]);
overlap[i+3] = MUL_F(transf_buf[nlong+i+3],window_long[nlong-4-i]);
}
break;
case LONG_START_SEQUENCE:
/* perform iMDCT */
imdct_long(fb, freq_in, transf_buf, 2*nlong);
/* add second half output of previous frame to windowed output of current frame */
for (i = 0; i < nlong; i+=4)
{
time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]);
time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
}
/* window the second half and save as overlap for next frame */
/* construct second half window using padding with 1's and 0's */
for (i = 0; i < nflat_ls; i++)
overlap[i] = transf_buf[nlong+i];
for (i = 0; i < nshort; i++)
overlap[nflat_ls+i] = MUL_F(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]);
for (i = 0; i < nflat_ls; i++)
overlap[nflat_ls+nshort+i] = 0;
break;
case EIGHT_SHORT_SEQUENCE:
/* perform iMDCT for each short block */
faad_imdct(fb->mdct256, freq_in+0*nshort, transf_buf+2*nshort*0);
faad_imdct(fb->mdct256, freq_in+1*nshort, transf_buf+2*nshort*1);
faad_imdct(fb->mdct256, freq_in+2*nshort, transf_buf+2*nshort*2);
faad_imdct(fb->mdct256, freq_in+3*nshort, transf_buf+2*nshort*3);
faad_imdct(fb->mdct256, freq_in+4*nshort, transf_buf+2*nshort*4);
faad_imdct(fb->mdct256, freq_in+5*nshort, transf_buf+2*nshort*5);
faad_imdct(fb->mdct256, freq_in+6*nshort, transf_buf+2*nshort*6);
faad_imdct(fb->mdct256, freq_in+7*nshort, transf_buf+2*nshort*7);
/* add second half output of previous frame to windowed output of current frame */
for (i = 0; i < nflat_ls; i++)
time_out[i] = overlap[i];
for(i = 0; i < nshort; i++)
{
time_out[nflat_ls+ i] = overlap[nflat_ls+ i] + MUL_F(transf_buf[nshort*0+i],window_short_prev[i]);
time_out[nflat_ls+1*nshort+i] = overlap[nflat_ls+nshort*1+i] + MUL_F(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*2+i],window_short[i]);
time_out[nflat_ls+2*nshort+i] = overlap[nflat_ls+nshort*2+i] + MUL_F(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*4+i],window_short[i]);
time_out[nflat_ls+3*nshort+i] = overlap[nflat_ls+nshort*3+i] + MUL_F(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*6+i],window_short[i]);
if (i < trans)
time_out[nflat_ls+4*nshort+i] = overlap[nflat_ls+nshort*4+i] + MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
}
/* window the second half and save as overlap for next frame */
for(i = 0; i < nshort; i++)
{
if (i >= trans)
overlap[nflat_ls+4*nshort+i-nlong] = MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
overlap[nflat_ls+5*nshort+i-nlong] = MUL_F(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*10+i],window_short[i]);
overlap[nflat_ls+6*nshort+i-nlong] = MUL_F(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*12+i],window_short[i]);
overlap[nflat_ls+7*nshort+i-nlong] = MUL_F(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*14+i],window_short[i]);
overlap[nflat_ls+8*nshort+i-nlong] = MUL_F(transf_buf[nshort*15+i],window_short[nshort-1-i]);
}
for (i = 0; i < nflat_ls; i++)
overlap[nflat_ls+nshort+i] = 0;
break;
case LONG_STOP_SEQUENCE:
/* perform iMDCT */
imdct_long(fb, freq_in, transf_buf, 2*nlong);
/* add second half output of previous frame to windowed output of current frame */
/* construct first half window using padding with 1's and 0's */
for (i = 0; i < nflat_ls; i++)
time_out[i] = overlap[i];
for (i = 0; i < nshort; i++)
time_out[nflat_ls+i] = overlap[nflat_ls+i] + MUL_F(transf_buf[nflat_ls+i],window_short_prev[i]);
for (i = 0; i < nflat_ls; i++)
time_out[nflat_ls+nshort+i] = overlap[nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i];
/* window the second half and save as overlap for next frame */
for (i = 0; i < nlong; i++)
overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
break;
}
#if 0
for (i = 0; i < 1024; i++)
{
printf("%d\n", time_out[i]);
//printf("0x%.8X\n", time_out[i]);
}
#endif
#ifdef PROFILE
count = faad_get_ts() - count;
fb->cycles += count;
#endif
}
#ifdef LTP_DEC
/* only works for LTP -> no overlapping, no short blocks */
void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
uint8_t window_shape_prev, real_t *in_data, real_t *out_mdct,
uint8_t object_type, uint16_t frame_len)
{
int16_t i;
ALIGN real_t windowed_buf[2*1024] = {0};
const real_t *window_long = NULL;
const real_t *window_long_prev = NULL;
const real_t *window_short = NULL;
const real_t *window_short_prev = NULL;
uint16_t nlong = frame_len;
uint16_t nshort = frame_len/8;
uint16_t nflat_ls = (nlong-nshort)/2;
assert(window_sequence != EIGHT_SHORT_SEQUENCE);
#ifdef LD_DEC
if (object_type == LD)
{
window_long = fb->ld_window[window_shape];
window_long_prev = fb->ld_window[window_shape_prev];
} else {
#endif
window_long = fb->long_window[window_shape];
window_long_prev = fb->long_window[window_shape_prev];
window_short = fb->short_window[window_shape];
window_short_prev = fb->short_window[window_shape_prev];
#ifdef LD_DEC
}
#endif
switch(window_sequence)
{
case ONLY_LONG_SEQUENCE:
for (i = nlong-1; i >= 0; i--)
{
windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]);
windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]);
}
mdct(fb, windowed_buf, out_mdct, 2*nlong);
break;
case LONG_START_SEQUENCE:
for (i = 0; i < nlong; i++)
windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]);
for (i = 0; i < nflat_ls; i++)
windowed_buf[i+nlong] = in_data[i+nlong];
for (i = 0; i < nshort; i++)
windowed_buf[i+nlong+nflat_ls] = MUL_F(in_data[i+nlong+nflat_ls], window_short[nshort-1-i]);
for (i = 0; i < nflat_ls; i++)
windowed_buf[i+nlong+nflat_ls+nshort] = 0;
mdct(fb, windowed_buf, out_mdct, 2*nlong);
break;
case LONG_STOP_SEQUENCE:
for (i = 0; i < nflat_ls; i++)
windowed_buf[i] = 0;
for (i = 0; i < nshort; i++)
windowed_buf[i+nflat_ls] = MUL_F(in_data[i+nflat_ls], window_short_prev[i]);
for (i = 0; i < nflat_ls; i++)
windowed_buf[i+nflat_ls+nshort] = in_data[i+nflat_ls+nshort];
for (i = 0; i < nlong; i++)
windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]);
mdct(fb, windowed_buf, out_mdct, 2*nlong);
break;
}
}
#endif

View file

@ -0,0 +1,58 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: filtbank.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __FILTBANK_H__
#define __FILTBANK_H__
#ifdef __cplusplus
extern "C" {
#endif
fb_info *filter_bank_init(uint16_t frame_len);
void filter_bank_end(fb_info *fb);
#ifdef LTP_DEC
void filter_bank_ltp(fb_info *fb,
uint8_t window_sequence,
uint8_t window_shape,
uint8_t window_shape_prev,
real_t *in_data,
real_t *out_mdct,
uint8_t object_type,
uint16_t frame_len);
#endif
void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
uint8_t window_shape_prev, real_t *freq_in,
real_t *time_out, real_t *overlap,
uint8_t object_type, uint16_t frame_len);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,265 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: fixed.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __FIXED_H__
#define __FIXED_H__
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_WIN32_WCE) && defined(_ARM_)
#include <cmnintrin.h>
#endif
#define COEF_BITS 28
#define COEF_PRECISION (1 << COEF_BITS)
#define REAL_BITS 14 // MAXIMUM OF 14 FOR FIXED POINT SBR
#define REAL_PRECISION (1 << REAL_BITS)
/* FRAC is the fractional only part of the fixed point number [0.0..1.0) */
#define FRAC_SIZE 32 /* frac is a 32 bit integer */
#define FRAC_BITS 31
#define FRAC_PRECISION ((uint32_t)(1 << FRAC_BITS))
#define FRAC_MAX 0x7FFFFFFF
typedef int32_t real_t;
#define REAL_CONST(A) (((A) >= 0) ? ((real_t)((A)*(REAL_PRECISION)+0.5)) : ((real_t)((A)*(REAL_PRECISION)-0.5)))
#define COEF_CONST(A) (((A) >= 0) ? ((real_t)((A)*(COEF_PRECISION)+0.5)) : ((real_t)((A)*(COEF_PRECISION)-0.5)))
#define FRAC_CONST(A) (((A) == 1.00) ? ((real_t)FRAC_MAX) : (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5))))
//#define FRAC_CONST(A) (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5)))
#define Q2_BITS 22
#define Q2_PRECISION (1 << Q2_BITS)
#define Q2_CONST(A) (((A) >= 0) ? ((real_t)((A)*(Q2_PRECISION)+0.5)) : ((real_t)((A)*(Q2_PRECISION)-0.5)))
#if defined(_WIN32) && !defined(_WIN32_WCE)
/* multiply with real shift */
static INLINE real_t MUL_R(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,REAL_BITS
}
}
/* multiply with coef shift */
static INLINE real_t MUL_C(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,COEF_BITS
}
}
static INLINE real_t MUL_Q2(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,Q2_BITS
}
}
static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,6
}
}
static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,23
}
}
#if 1
static INLINE real_t _MulHigh(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
mov eax,edx
}
}
/* multiply with fractional shift */
static INLINE real_t MUL_F(real_t A, real_t B)
{
return _MulHigh(A,B) << (FRAC_SIZE-FRAC_BITS);
}
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
*y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
}
#else
static INLINE real_t MUL_F(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,FRAC_BITS
}
}
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
*y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
}
#endif
#elif defined(__GNUC__) && defined (__arm__)
/* taken from MAD */
#define arm_mul(x, y, SCALEBITS) \
({ \
uint32_t __hi; \
uint32_t __lo; \
uint32_t __result; \
asm("smull %0, %1, %3, %4\n\t" \
"movs %0, %0, lsr %5\n\t" \
"adc %2, %0, %1, lsl %6" \
: "=&r" (__lo), "=&r" (__hi), "=r" (__result) \
: "%r" (x), "r" (y), \
"M" (SCALEBITS), "M" (32 - (SCALEBITS)) \
: "cc"); \
__result; \
})
static INLINE real_t MUL_R(real_t A, real_t B)
{
return arm_mul(A, B, REAL_BITS);
}
static INLINE real_t MUL_C(real_t A, real_t B)
{
return arm_mul(A, B, COEF_BITS);
}
static INLINE real_t MUL_Q2(real_t A, real_t B)
{
return arm_mul(A, B, Q2_BITS);
}
static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
{
return arm_mul(A, B, 6);
}
static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
{
return arm_mul(A, B, 23);
}
static INLINE real_t _MulHigh(real_t x, real_t y)
{
uint32_t __lo;
uint32_t __hi;
asm("smull\t%0, %1, %2, %3"
: "=&r"(__lo),"=&r"(__hi)
: "%r"(x),"r"(y)
: "cc");
return __hi;
}
static INLINE real_t MUL_F(real_t A, real_t B)
{
return _MulHigh(A, B) << (FRAC_SIZE-FRAC_BITS);
}
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
int32_t tmp, yt1, yt2;
asm("smull %0, %1, %4, %6\n\t"
"smlal %0, %1, %5, %7\n\t"
"rsb %3, %4, #0\n\t"
"smull %0, %2, %5, %6\n\t"
"smlal %0, %2, %3, %7"
: "=&r" (tmp), "=&r" (yt1), "=&r" (yt2), "=r" (x1)
: "3" (x1), "r" (x2), "r" (c1), "r" (c2)
: "cc" );
*y1 = yt1 << (FRAC_SIZE-FRAC_BITS);
*y2 = yt2 << (FRAC_SIZE-FRAC_BITS);
}
#else
/* multiply with real shift */
#define MUL_R(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (REAL_BITS-1))) >> REAL_BITS)
/* multiply with coef shift */
#define MUL_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS)
/* multiply with fractional shift */
#if defined(_WIN32_WCE) && defined(_ARM_)
/* eVC for PocketPC has an intrinsic function that returns only the high 32 bits of a 32x32 bit multiply */
static INLINE real_t MUL_F(real_t A, real_t B)
{
return _MulHigh(A,B) << (32-FRAC_BITS);
}
#else
#define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE)
#define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS)
#endif
#define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS)
#define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6)
#define MUL_SHIFT23(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (23-1))) >> 23)
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
*y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
}
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,409 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2004 G.C. Pascutto, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcr.c 3 2005-06-02 18:16:43Z vspader $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include <string.h>
#include "specrec.h"
#include "huffman.h"
/* ISO/IEC 14496-3/Amd.1
* 8.5.3.3: Huffman Codeword Reordering for AAC spectral data (HCR)
*
* HCR devides the spectral data in known fixed size segments, and
* sorts it by the importance of the data. The importance is firstly
* the (lower) position in the spectrum, and secondly the largest
* value in the used codebook.
* The most important data is written at the start of each segment
* (at known positions), the remaining data is interleaved inbetween,
* with the writing direction alternating.
* Data length is not increased.
*/
#ifdef ERROR_RESILIENCE
/* 8.5.3.3.1 Pre-sorting */
#define NUM_CB 6
#define NUM_CB_ER 22
#define MAX_CB 32
#define VCB11_FIRST 16
#define VCB11_LAST 31
static const uint8_t PreSortCB_STD[NUM_CB] =
{ 11, 9, 7, 5, 3, 1};
static const uint8_t PreSortCB_ER[NUM_CB_ER] =
{ 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1};
/* 8.5.3.3.2 Derivation of segment width */
static const uint8_t maxCwLen[MAX_CB] = {0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49,
0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41};
#define segmentWidth(cb) min(maxCwLen[cb], ics->length_of_longest_codeword)
/* bit-twiddling helpers */
static const uint8_t S[] = {1, 2, 4, 8, 16};
static const uint32_t B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF};
typedef struct
{
uint8_t cb;
uint8_t decoded;
uint16_t sp_offset;
bits_t bits;
} codeword_t;
/* rewind and reverse */
/* 32 bit version */
static uint32_t rewrev_word(uint32_t v, const uint8_t len)
{
/* 32 bit reverse */
v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]);
v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]);
v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]);
v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]);
v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]);
/* shift off low bits */
v >>= (32 - len);
return v;
}
/* 64 bit version */
static void rewrev_lword(uint32_t *hi, uint32_t *lo, const uint8_t len)
{
if (len <= 32) {
*hi = 0;
*lo = rewrev_word(*lo, len);
} else
{
uint32_t t = *hi, v = *lo;
/* double 32 bit reverse */
v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]);
t = ((t >> S[0]) & B[0]) | ((t << S[0]) & ~B[0]);
v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]);
t = ((t >> S[1]) & B[1]) | ((t << S[1]) & ~B[1]);
v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]);
t = ((t >> S[2]) & B[2]) | ((t << S[2]) & ~B[2]);
v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]);
t = ((t >> S[3]) & B[3]) | ((t << S[3]) & ~B[3]);
v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]);
t = ((t >> S[4]) & B[4]) | ((t << S[4]) & ~B[4]);
/* last 32<>32 bit swap is implicit below */
/* shift off low bits (this is really only one 64 bit shift) */
*lo = (t >> (64 - len)) | (v << (len - 32));
*hi = v >> (64 - len);
}
}
/* bits_t version */
static void rewrev_bits(bits_t *bits)
{
if (bits->len == 0) return;
rewrev_lword(&bits->bufb, &bits->bufa, bits->len);
}
/* merge bits of a to b */
static void concat_bits(bits_t *b, bits_t *a)
{
uint32_t bl, bh, al, ah;
if (a->len == 0) return;
al = a->bufa;
ah = a->bufb;
if (b->len > 32)
{
/* maskoff superfluous high b bits */
bl = b->bufa;
bh = b->bufb & ((1 << (b->len-32)) - 1);
/* left shift a b->len bits */
ah = al << (b->len - 32);
al = 0;
} else {
bl = b->bufa & ((1 << (b->len)) - 1);
bh = 0;
ah = (ah << (b->len)) | (al >> (32 - b->len));
al = al << b->len;
}
/* merge */
b->bufa = bl | al;
b->bufb = bh | ah;
b->len += a->len;
}
uint8_t is_good_cb(uint8_t this_CB, uint8_t this_sec_CB)
{
/* only want spectral data CB's */
if ((this_sec_CB > ZERO_HCB && this_sec_CB <= ESC_HCB) || (this_sec_CB >= VCB11_FIRST && this_sec_CB <= VCB11_LAST))
{
if (this_CB < ESC_HCB)
{
/* normal codebook pairs */
return ((this_sec_CB == this_CB) || (this_sec_CB == this_CB + 1));
} else
{
/* escape codebook */
return (this_sec_CB == this_CB);
}
}
return 0;
}
void read_segment(bits_t *segment, uint8_t segwidth, bitfile *ld)
{
segment->len = segwidth;
if (segwidth > 32)
{
segment->bufb = faad_getbits(ld, segwidth - 32);
segment->bufa = faad_getbits(ld, 32);
} else {
segment->bufa = faad_getbits(ld, segwidth);
segment->bufb = 0;
}
}
void fill_in_codeword(codeword_t *codeword, uint16_t index, uint16_t sp, uint8_t cb)
{
codeword[index].sp_offset = sp;
codeword[index].cb = cb;
codeword[index].decoded = 0;
codeword[index].bits.len = 0;
}
uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics,
bitfile *ld, int16_t *spectral_data)
{
uint16_t PCWs_done;
uint16_t numberOfSegments, numberOfSets, numberOfCodewords;
codeword_t codeword[512];
bits_t segment[512];
uint16_t sp_offset[8];
uint16_t g, i, sortloop, set, bitsread;
uint8_t w_idx, sfb, this_CB, last_CB, this_sec_CB;
const uint16_t nshort = hDecoder->frameLength/8;
const uint16_t sp_data_len = ics->length_of_reordered_spectral_data;
const uint8_t *PreSortCb;
/* no data (e.g. silence) */
if (sp_data_len == 0)
return 0;
/* since there is spectral data, at least one codeword has nonzero length */
if (ics->length_of_longest_codeword == 0)
return 10;
if (sp_data_len < ics->length_of_longest_codeword)
return 10;
sp_offset[0] = 0;
for (g = 1; g < ics->num_window_groups; g++)
{
sp_offset[g] = sp_offset[g-1] + nshort*ics->window_group_length[g-1];
}
PCWs_done = 0;
numberOfSegments = 0;
numberOfCodewords = 0;
bitsread = 0;
/* VCB11 code books in use */
if (hDecoder->aacSectionDataResilienceFlag)
{
PreSortCb = PreSortCB_ER;
last_CB = NUM_CB_ER;
} else
{
PreSortCb = PreSortCB_STD;
last_CB = NUM_CB;
}
/* step 1: decode PCW's (set 0), and stuff data in easier-to-use format */
for (sortloop = 0; sortloop < last_CB; sortloop++)
{
/* select codebook to process this pass */
this_CB = PreSortCb[sortloop];
/* loop over sfbs */
for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
/* loop over all in this sfb, 4 lines per loop */
for (w_idx = 0; 4*w_idx < (ics->swb_offset[sfb+1] - ics->swb_offset[sfb]); w_idx++)
{
for(g = 0; g < ics->num_window_groups; g++)
{
for (i = 0; i < ics->num_sec[g]; i++)
{
/* check whether sfb used here is the one we want to process */
if ((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb))
{
/* check whether codebook used here is the one we want to process */
this_sec_CB = ics->sect_cb[g][i];
if (is_good_cb(this_CB, this_sec_CB))
{
/* precalculate some stuff */
uint16_t sect_sfb_size = ics->sect_sfb_offset[g][sfb+1] - ics->sect_sfb_offset[g][sfb];
uint8_t inc = (this_sec_CB < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN;
uint16_t group_cws_count = (4*ics->window_group_length[g])/inc;
uint8_t segwidth = segmentWidth(this_sec_CB);
uint16_t cws;
/* read codewords until end of sfb or end of window group (shouldn't only 1 trigger?) */
for (cws = 0; (cws < group_cws_count) && ((cws + w_idx*group_cws_count) < sect_sfb_size); cws++)
{
uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc * (cws + w_idx*group_cws_count);
/* read and decode PCW */
if (!PCWs_done)
{
/* read in normal segments */
if (bitsread + segwidth <= sp_data_len)
{
read_segment(&segment[numberOfSegments], segwidth, ld);
bitsread += segwidth;
huffman_spectral_data_2(this_sec_CB, &segment[numberOfSegments], &spectral_data[sp]);
/* keep leftover bits */
rewrev_bits(&segment[numberOfSegments]);
numberOfSegments++;
} else {
/* remaining stuff after last segment, we unfortunately couldn't read
this in earlier because it might not fit in 64 bits. since we already
decoded (and removed) the PCW it is now guaranteed to fit */
if (bitsread < sp_data_len)
{
const uint8_t additional_bits = sp_data_len - bitsread;
read_segment(&segment[numberOfSegments], additional_bits, ld);
segment[numberOfSegments].len += segment[numberOfSegments-1].len;
rewrev_bits(&segment[numberOfSegments]);
if (segment[numberOfSegments-1].len > 32)
{
segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb +
showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len - 32);
segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa +
showbits_hcr(&segment[numberOfSegments-1], 32);
} else {
segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa +
showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len);
segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb;
}
segment[numberOfSegments-1].len += additional_bits;
}
bitsread = sp_data_len;
PCWs_done = 1;
fill_in_codeword(codeword, 0, sp, this_sec_CB);
}
} else {
fill_in_codeword(codeword, numberOfCodewords - numberOfSegments, sp, this_sec_CB);
}
numberOfCodewords++;
}
}
}
}
}
}
}
}
if (numberOfSegments == 0)
return 10;
numberOfSets = numberOfCodewords / numberOfSegments;
/* step 2: decode nonPCWs */
for (set = 1; set <= numberOfSets; set++)
{
uint16_t trial;
for (trial = 0; trial < numberOfSegments; trial++)
{
uint16_t codewordBase;
for (codewordBase = 0; codewordBase < numberOfSegments; codewordBase++)
{
const uint16_t segment_idx = (trial + codewordBase) % numberOfSegments;
const uint16_t codeword_idx = codewordBase + set*numberOfSegments - numberOfSegments;
/* data up */
if (codeword_idx >= numberOfCodewords - numberOfSegments) break;
if (!codeword[codeword_idx].decoded && segment[segment_idx].len > 0)
{
uint8_t tmplen;
if (codeword[codeword_idx].bits.len != 0)
concat_bits(&segment[segment_idx], &codeword[codeword_idx].bits);
tmplen = segment[segment_idx].len;
if (huffman_spectral_data_2(codeword[codeword_idx].cb, &segment[segment_idx],
&spectral_data[codeword[codeword_idx].sp_offset]) >= 0)
{
codeword[codeword_idx].decoded = 1;
} else
{
codeword[codeword_idx].bits = segment[segment_idx];
codeword[codeword_idx].bits.len = tmplen;
}
}
}
}
for (i = 0; i < numberOfSegments; i++)
rewrev_bits(&segment[i]);
}
return 0;
}
#endif

View file

@ -0,0 +1,556 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: huffman.c 3 2005-06-02 18:16:43Z vspader $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#ifdef ANALYSIS
#include <stdio.h>
#endif
#include "bits.h"
#include "huffman.h"
#include "codebook/hcb.h"
/* static function declarations */
static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len);
static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp);
static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
static int16_t huffman_codebook(uint8_t i);
static void vcb11_check_LAV(uint8_t cb, int16_t *sp);
int8_t huffman_scale_factor(bitfile *ld)
{
uint16_t offset = 0;
while (hcb_sf[offset][1])
{
uint8_t b = faad_get1bit(ld
DEBUGVAR(1,255,"huffman_scale_factor()"));
offset += hcb_sf[offset][b];
if (offset > 240)
{
/* printf("ERROR: offset into hcb_sf = %d >240!\n", offset); */
return -1;
}
}
return hcb_sf[offset][0];
}
hcb *hcb_table[] = {
0, hcb1_1, hcb2_1, 0, hcb4_1, 0, hcb6_1, 0, hcb8_1, 0, hcb10_1, hcb11_1
};
hcb_2_quad *hcb_2_quad_table[] = {
0, hcb1_2, hcb2_2, 0, hcb4_2, 0, 0, 0, 0, 0, 0, 0
};
hcb_2_pair *hcb_2_pair_table[] = {
0, 0, 0, 0, 0, 0, hcb6_2, 0, hcb8_2, 0, hcb10_2, hcb11_2
};
hcb_bin_pair *hcb_bin_table[] = {
0, 0, 0, 0, 0, hcb5, 0, hcb7, 0, hcb9, 0, 0
};
uint8_t hcbN[] = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 };
/* defines whether a huffman codebook is unsigned or not */
/* Table 4.6.2 */
uint8_t unsigned_cb[] = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
/* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
int hcb_2_quad_table_size[] = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 };
int hcb_2_pair_table_size[] = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 };
int hcb_bin_table_size[] = { 0, 0, 0, 161, 0, 161, 0, 127, 0, 337, 0, 0 };
static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len)
{
uint8_t i;
for (i = 0; i < len; i++)
{
if(sp[i])
{
if(faad_get1bit(ld
DEBUGVAR(1,5,"huffman_sign_bits(): sign bit")) & 1)
{
sp[i] = -sp[i];
}
}
}
}
static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp)
{
uint8_t neg, i;
int16_t j;
int16_t off;
if (sp < 0)
{
if (sp != -16)
return sp;
neg = 1;
} else {
if (sp != 16)
return sp;
neg = 0;
}
for (i = 4; ; i++)
{
if (faad_get1bit(ld
DEBUGVAR(1,6,"huffman_getescape(): escape size")) == 0)
{
break;
}
}
off = (int16_t)faad_getbits(ld, i
DEBUGVAR(1,9,"huffman_getescape(): escape"));
j = off | (1<<i);
if (neg)
j = -j;
return j;
}
static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint32_t cw;
uint16_t offset = 0;
uint8_t extra_bits;
cw = faad_showbits(ld, hcbN[cb]);
offset = hcb_table[cb][cw].offset;
extra_bits = hcb_table[cb][cw].extra_bits;
if (extra_bits)
{
/* we know for sure it's more than hcbN[cb] bits long */
faad_flushbits(ld, hcbN[cb]);
offset += (uint16_t)faad_showbits(ld, extra_bits);
faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]);
} else {
faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits);
}
if (offset > hcb_2_quad_table_size[cb])
{
/* printf("ERROR: offset into hcb_2_quad_table = %d >%d!\n", offset,
hcb_2_quad_table_size[cb]); */
return 10;
}
sp[0] = hcb_2_quad_table[cb][offset].x;
sp[1] = hcb_2_quad_table[cb][offset].y;
sp[2] = hcb_2_quad_table[cb][offset].v;
sp[3] = hcb_2_quad_table[cb][offset].w;
return 0;
}
static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint8_t err = huffman_2step_quad(cb, ld, sp);
huffman_sign_bits(ld, sp, QUAD_LEN);
return err;
}
static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint32_t cw;
uint16_t offset = 0;
uint8_t extra_bits;
cw = faad_showbits(ld, hcbN[cb]);
offset = hcb_table[cb][cw].offset;
extra_bits = hcb_table[cb][cw].extra_bits;
if (extra_bits)
{
/* we know for sure it's more than hcbN[cb] bits long */
faad_flushbits(ld, hcbN[cb]);
offset += (uint16_t)faad_showbits(ld, extra_bits);
faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]);
} else {
faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits);
}
if (offset > hcb_2_pair_table_size[cb])
{
/* printf("ERROR: offset into hcb_2_pair_table = %d >%d!\n", offset,
hcb_2_pair_table_size[cb]); */
return 10;
}
sp[0] = hcb_2_pair_table[cb][offset].x;
sp[1] = hcb_2_pair_table[cb][offset].y;
return 0;
}
static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint8_t err = huffman_2step_pair(cb, ld, sp);
huffman_sign_bits(ld, sp, PAIR_LEN);
return err;
}
static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint16_t offset = 0;
while (!hcb3[offset].is_leaf)
{
uint8_t b = faad_get1bit(ld
DEBUGVAR(1,255,"huffman_spectral_data():3"));
offset += hcb3[offset].data[b];
}
if (offset > hcb_bin_table_size[cb])
{
/* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset,
hcb_bin_table_size[cb]); */
return 10;
}
sp[0] = hcb3[offset].data[0];
sp[1] = hcb3[offset].data[1];
sp[2] = hcb3[offset].data[2];
sp[3] = hcb3[offset].data[3];
return 0;
}
static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint8_t err = huffman_binary_quad(cb, ld, sp);
huffman_sign_bits(ld, sp, QUAD_LEN);
return err;
}
static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint16_t offset = 0;
while (!hcb_bin_table[cb][offset].is_leaf)
{
uint8_t b = faad_get1bit(ld
DEBUGVAR(1,255,"huffman_spectral_data():9"));
offset += hcb_bin_table[cb][offset].data[b];
}
if (offset > hcb_bin_table_size[cb])
{
/* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset,
hcb_bin_table_size[cb]); */
return 10;
}
sp[0] = hcb_bin_table[cb][offset].data[0];
sp[1] = hcb_bin_table[cb][offset].data[1];
return 0;
}
static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint8_t err = huffman_binary_pair(cb, ld, sp);
huffman_sign_bits(ld, sp, PAIR_LEN);
return err;
}
static int16_t huffman_codebook(uint8_t i)
{
static const uint32_t data = 16428320;
if (i == 0) return (int16_t)(data >> 16) & 0xFFFF;
else return (int16_t)data & 0xFFFF;
}
static void vcb11_check_LAV(uint8_t cb, int16_t *sp)
{
static const uint16_t vcb11_LAV_tab[] = {
16, 31, 47, 63, 95, 127, 159, 191, 223,
255, 319, 383, 511, 767, 1023, 2047
};
uint16_t max = 0;
if (cb < 16 || cb > 31)
return;
max = vcb11_LAV_tab[cb - 16];
if ((abs(sp[0]) > max) || (abs(sp[1]) > max))
{
sp[0] = 0;
sp[1] = 0;
}
}
uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp)
{
switch (cb)
{
case 1: /* 2-step method for data quadruples */
case 2:
return huffman_2step_quad(cb, ld, sp);
case 3: /* binary search for data quadruples */
return huffman_binary_quad_sign(cb, ld, sp);
case 4: /* 2-step method for data quadruples */
return huffman_2step_quad_sign(cb, ld, sp);
case 5: /* binary search for data pairs */
return huffman_binary_pair(cb, ld, sp);
case 6: /* 2-step method for data pairs */
return huffman_2step_pair(cb, ld, sp);
case 7: /* binary search for data pairs */
case 9:
return huffman_binary_pair_sign(cb, ld, sp);
case 8: /* 2-step method for data pairs */
case 10:
return huffman_2step_pair_sign(cb, ld, sp);
case 12: {
uint8_t err = huffman_2step_pair(11, ld, sp);
sp[0] = huffman_codebook(0); sp[1] = huffman_codebook(1);
return err; }
case 11:
{
uint8_t err = huffman_2step_pair_sign(11, ld, sp);
sp[0] = huffman_getescape(ld, sp[0]);
sp[1] = huffman_getescape(ld, sp[1]);
return err;
}
#ifdef ERROR_RESILIENCE
/* VCB11 uses codebook 11 */
case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
{
uint8_t err = huffman_2step_pair_sign(11, ld, sp);
sp[0] = huffman_getescape(ld, sp[0]);
sp[1] = huffman_getescape(ld, sp[1]);
/* check LAV (Largest Absolute Value) */
/* this finds errors in the ESCAPE signal */
vcb11_check_LAV(cb, sp);
return err;
}
#endif
default:
/* Non existent codebook number, something went wrong */
return 11;
}
return 0;
}
#ifdef ERROR_RESILIENCE
/* Special version of huffman_spectral_data
Will not read from a bitfile but a bits_t structure.
Will keep track of the bits decoded and return the number of bits remaining.
Do not read more than ld->len, return -1 if codeword would be longer */
int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp)
{
uint32_t cw;
uint16_t offset = 0;
uint8_t extra_bits;
uint8_t i, vcb11 = 0;
switch (cb)
{
case 1: /* 2-step method for data quadruples */
case 2:
case 4:
cw = showbits_hcr(ld, hcbN[cb]);
offset = hcb_table[cb][cw].offset;
extra_bits = hcb_table[cb][cw].extra_bits;
if (extra_bits)
{
/* we know for sure it's more than hcbN[cb] bits long */
if ( flushbits_hcr(ld, hcbN[cb]) ) return -1;
offset += (uint16_t)showbits_hcr(ld, extra_bits);
if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]) ) return -1;
} else {
if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits) ) return -1;
}
sp[0] = hcb_2_quad_table[cb][offset].x;
sp[1] = hcb_2_quad_table[cb][offset].y;
sp[2] = hcb_2_quad_table[cb][offset].v;
sp[3] = hcb_2_quad_table[cb][offset].w;
break;
case 6: /* 2-step method for data pairs */
case 8:
case 10:
case 11:
/* VCB11 uses codebook 11 */
case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
if (cb >= 16)
{
/* store the virtual codebook */
vcb11 = cb;
cb = 11;
}
cw = showbits_hcr(ld, hcbN[cb]);
offset = hcb_table[cb][cw].offset;
extra_bits = hcb_table[cb][cw].extra_bits;
if (extra_bits)
{
/* we know for sure it's more than hcbN[cb] bits long */
if ( flushbits_hcr(ld, hcbN[cb]) ) return -1;
offset += (uint16_t)showbits_hcr(ld, extra_bits);
if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]) ) return -1;
} else {
if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits) ) return -1;
}
sp[0] = hcb_2_pair_table[cb][offset].x;
sp[1] = hcb_2_pair_table[cb][offset].y;
break;
case 3: /* binary search for data quadruples */
while (!hcb3[offset].is_leaf)
{
uint8_t b;
if ( get1bit_hcr(ld, &b) ) return -1;
offset += hcb3[offset].data[b];
}
sp[0] = hcb3[offset].data[0];
sp[1] = hcb3[offset].data[1];
sp[2] = hcb3[offset].data[2];
sp[3] = hcb3[offset].data[3];
break;
case 5: /* binary search for data pairs */
case 7:
case 9:
while (!hcb_bin_table[cb][offset].is_leaf)
{
uint8_t b;
if (get1bit_hcr(ld, &b) ) return -1;
offset += hcb_bin_table[cb][offset].data[b];
}
sp[0] = hcb_bin_table[cb][offset].data[0];
sp[1] = hcb_bin_table[cb][offset].data[1];
break;
}
/* decode sign bits */
if (unsigned_cb[cb])
{
for(i = 0; i < ((cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN); i++)
{
if(sp[i])
{
uint8_t b;
if ( get1bit_hcr(ld, &b) ) return -1;
if (b != 0) {
sp[i] = -sp[i];
}
}
}
}
/* decode huffman escape bits */
if ((cb == ESC_HCB) || (cb >= 16))
{
uint8_t k;
for (k = 0; k < 2; k++)
{
if ((sp[k] == 16) || (sp[k] == -16))
{
uint8_t neg, i;
int32_t j;
uint32_t off;
neg = (sp[k] < 0) ? 1 : 0;
for (i = 4; ; i++)
{
uint8_t b;
if (get1bit_hcr(ld, &b))
return -1;
if (b == 0)
break;
}
if (getbits_hcr(ld, i, &off))
return -1;
j = off + (1<<i);
sp[k] = (int16_t)((neg) ? -j : j);
}
}
if (vcb11 != 0)
{
/* check LAV (Largest Absolute Value) */
/* this finds errors in the ESCAPE signal */
vcb11_check_LAV(vcb11, sp);
}
}
return ld->len;
}
#endif

View file

@ -0,0 +1,44 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: huffman.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __HUFFMAN_H__
#define __HUFFMAN_H__
#ifdef __cplusplus
extern "C" {
#endif
int8_t huffman_scale_factor(bitfile *ld);
uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp);
#ifdef ERROR_RESILIENCE
int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp);
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,267 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: ic_predict.c 3 2005-06-02 18:16:43Z vspader $
**/
#include "common.h"
#include "structs.h"
#ifdef MAIN_DEC
#include "syntax.h"
#include "ic_predict.h"
#include "pns.h"
static void flt_round(float32_t *pf)
{
int32_t flg;
uint32_t tmp, tmp1, tmp2;
tmp = *(uint32_t*)pf;
flg = tmp & (uint32_t)0x00008000;
tmp &= (uint32_t)0xffff0000;
tmp1 = tmp;
/* round 1/2 lsb toward infinity */
if (flg)
{
tmp &= (uint32_t)0xff800000; /* extract exponent and sign */
tmp |= (uint32_t)0x00010000; /* insert 1 lsb */
tmp2 = tmp; /* add 1 lsb and elided one */
tmp &= (uint32_t)0xff800000; /* extract exponent and sign */
*pf = *(float32_t*)&tmp1 + *(float32_t*)&tmp2 - *(float32_t*)&tmp;
} else {
*pf = *(float32_t*)&tmp;
}
}
static int16_t quant_pred(float32_t x)
{
int16_t q;
uint32_t *tmp = (uint32_t*)&x;
q = (int16_t)(*tmp>>16);
return q;
}
static float32_t inv_quant_pred(int16_t q)
{
float32_t x;
uint32_t *tmp = (uint32_t*)&x;
*tmp = ((uint32_t)q)<<16;
return x;
}
static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t pred)
{
uint16_t tmp;
int16_t i, j;
real_t dr1, predictedvalue;
real_t e0, e1;
real_t k1, k2;
real_t r[2];
real_t COR[2];
real_t VAR[2];
r[0] = inv_quant_pred(state->r[0]);
r[1] = inv_quant_pred(state->r[1]);
COR[0] = inv_quant_pred(state->COR[0]);
COR[1] = inv_quant_pred(state->COR[1]);
VAR[0] = inv_quant_pred(state->VAR[0]);
VAR[1] = inv_quant_pred(state->VAR[1]);
#if 1
tmp = state->VAR[0];
j = (tmp >> 7);
i = tmp & 0x7f;
if (j >= 128)
{
j -= 128;
k1 = COR[0] * exp_table[j] * mnt_table[i];
} else {
k1 = REAL_CONST(0);
}
#else
{
#define B 0.953125
real_t c = COR[0];
real_t v = VAR[0];
real_t tmp;
if (c == 0 || v <= 1)
{
k1 = 0;
} else {
tmp = B / v;
flt_round(&tmp);
k1 = c * tmp;
}
}
#endif
if (pred)
{
#if 1
tmp = state->VAR[1];
j = (tmp >> 7);
i = tmp & 0x7f;
if (j >= 128)
{
j -= 128;
k2 = COR[1] * exp_table[j] * mnt_table[i];
} else {
k2 = REAL_CONST(0);
}
#else
#define B 0.953125
real_t c = COR[1];
real_t v = VAR[1];
real_t tmp;
if (c == 0 || v <= 1)
{
k2 = 0;
} else {
tmp = B / v;
flt_round(&tmp);
k2 = c * tmp;
}
#endif
predictedvalue = k1*r[0] + k2*r[1];
flt_round(&predictedvalue);
*output = input + predictedvalue;
}
/* calculate new state data */
e0 = *output;
e1 = e0 - k1*r[0];
dr1 = k1*e0;
VAR[0] = ALPHA*VAR[0] + 0.5f * (r[0]*r[0] + e0*e0);
COR[0] = ALPHA*COR[0] + r[0]*e0;
VAR[1] = ALPHA*VAR[1] + 0.5f * (r[1]*r[1] + e1*e1);
COR[1] = ALPHA*COR[1] + r[1]*e1;
r[1] = A * (r[0]-dr1);
r[0] = A * e0;
state->r[0] = quant_pred(r[0]);
state->r[1] = quant_pred(r[1]);
state->COR[0] = quant_pred(COR[0]);
state->COR[1] = quant_pred(COR[1]);
state->VAR[0] = quant_pred(VAR[0]);
state->VAR[1] = quant_pred(VAR[1]);
}
static void reset_pred_state(pred_state *state)
{
state->r[0] = 0;
state->r[1] = 0;
state->COR[0] = 0;
state->COR[1] = 0;
state->VAR[0] = 0x3F80;
state->VAR[1] = 0x3F80;
}
void pns_reset_pred_state(ic_stream *ics, pred_state *state)
{
uint8_t sfb, g, b;
uint16_t i, offs, offs2;
/* prediction only for long blocks */
if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
return;
for (g = 0; g < ics->num_window_groups; g++)
{
for (b = 0; b < ics->window_group_length[g]; b++)
{
for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
if (is_noise(ics, g, sfb))
{
offs = ics->swb_offset[sfb];
offs2 = ics->swb_offset[sfb+1];
for (i = offs; i < offs2; i++)
reset_pred_state(&state[i]);
}
}
}
}
}
void reset_all_predictors(pred_state *state, uint16_t frame_len)
{
uint16_t i;
for (i = 0; i < frame_len; i++)
reset_pred_state(&state[i]);
}
/* intra channel prediction */
void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state,
uint16_t frame_len, uint8_t sf_index)
{
uint8_t sfb;
uint16_t bin;
if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
{
reset_all_predictors(state, frame_len);
} else {
for (sfb = 0; sfb < max_pred_sfb(sf_index); sfb++)
{
uint16_t low = ics->swb_offset[sfb];
uint16_t high = ics->swb_offset[sfb+1];
for (bin = low; bin < high; bin++)
{
ic_predict(&state[bin], spec[bin], &spec[bin],
(ics->predictor_data_present && ics->pred.prediction_used[sfb]));
}
}
if (ics->predictor_data_present)
{
if (ics->pred.predictor_reset)
{
for (bin = ics->pred.predictor_reset_group_number - 1;
bin < frame_len; bin += 30)
{
reset_pred_state(&state[bin]);
}
}
}
}
}
#endif

View file

@ -0,0 +1,249 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: ic_predict.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifdef MAIN_DEC
#ifndef __IC_PREDICT_H__
#define __IC_PREDICT_H__
#ifdef __cplusplus
extern "C" {
#endif
#define ALPHA REAL_CONST(0.90625)
#define A REAL_CONST(0.953125)
void pns_reset_pred_state(ic_stream *ics, pred_state *state);
void reset_all_predictors(pred_state *state, uint16_t frame_len);
void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state,
uint16_t frame_len, uint8_t sf_index);
ALIGN static const real_t mnt_table[128] = {
COEF_CONST(0.9531250000), COEF_CONST(0.9453125000),
COEF_CONST(0.9375000000), COEF_CONST(0.9296875000),
COEF_CONST(0.9257812500), COEF_CONST(0.9179687500),
COEF_CONST(0.9101562500), COEF_CONST(0.9023437500),
COEF_CONST(0.8984375000), COEF_CONST(0.8906250000),
COEF_CONST(0.8828125000), COEF_CONST(0.8789062500),
COEF_CONST(0.8710937500), COEF_CONST(0.8671875000),
COEF_CONST(0.8593750000), COEF_CONST(0.8515625000),
COEF_CONST(0.8476562500), COEF_CONST(0.8398437500),
COEF_CONST(0.8359375000), COEF_CONST(0.8281250000),
COEF_CONST(0.8242187500), COEF_CONST(0.8203125000),
COEF_CONST(0.8125000000), COEF_CONST(0.8085937500),
COEF_CONST(0.8007812500), COEF_CONST(0.7968750000),
COEF_CONST(0.7929687500), COEF_CONST(0.7851562500),
COEF_CONST(0.7812500000), COEF_CONST(0.7773437500),
COEF_CONST(0.7734375000), COEF_CONST(0.7656250000),
COEF_CONST(0.7617187500), COEF_CONST(0.7578125000),
COEF_CONST(0.7539062500), COEF_CONST(0.7500000000),
COEF_CONST(0.7421875000), COEF_CONST(0.7382812500),
COEF_CONST(0.7343750000), COEF_CONST(0.7304687500),
COEF_CONST(0.7265625000), COEF_CONST(0.7226562500),
COEF_CONST(0.7187500000), COEF_CONST(0.7148437500),
COEF_CONST(0.7109375000), COEF_CONST(0.7070312500),
COEF_CONST(0.6992187500), COEF_CONST(0.6953125000),
COEF_CONST(0.6914062500), COEF_CONST(0.6875000000),
COEF_CONST(0.6835937500), COEF_CONST(0.6796875000),
COEF_CONST(0.6796875000), COEF_CONST(0.6757812500),
COEF_CONST(0.6718750000), COEF_CONST(0.6679687500),
COEF_CONST(0.6640625000), COEF_CONST(0.6601562500),
COEF_CONST(0.6562500000), COEF_CONST(0.6523437500),
COEF_CONST(0.6484375000), COEF_CONST(0.6445312500),
COEF_CONST(0.6406250000), COEF_CONST(0.6406250000),
COEF_CONST(0.6367187500), COEF_CONST(0.6328125000),
COEF_CONST(0.6289062500), COEF_CONST(0.6250000000),
COEF_CONST(0.6210937500), COEF_CONST(0.6210937500),
COEF_CONST(0.6171875000), COEF_CONST(0.6132812500),
COEF_CONST(0.6093750000), COEF_CONST(0.6054687500),
COEF_CONST(0.6054687500), COEF_CONST(0.6015625000),
COEF_CONST(0.5976562500), COEF_CONST(0.5937500000),
COEF_CONST(0.5937500000), COEF_CONST(0.5898437500),
COEF_CONST(0.5859375000), COEF_CONST(0.5820312500),
COEF_CONST(0.5820312500), COEF_CONST(0.5781250000),
COEF_CONST(0.5742187500), COEF_CONST(0.5742187500),
COEF_CONST(0.5703125000), COEF_CONST(0.5664062500),
COEF_CONST(0.5664062500), COEF_CONST(0.5625000000),
COEF_CONST(0.5585937500), COEF_CONST(0.5585937500),
COEF_CONST(0.5546875000), COEF_CONST(0.5507812500),
COEF_CONST(0.5507812500), COEF_CONST(0.5468750000),
COEF_CONST(0.5429687500), COEF_CONST(0.5429687500),
COEF_CONST(0.5390625000), COEF_CONST(0.5390625000),
COEF_CONST(0.5351562500), COEF_CONST(0.5312500000),
COEF_CONST(0.5312500000), COEF_CONST(0.5273437500),
COEF_CONST(0.5273437500), COEF_CONST(0.5234375000),
COEF_CONST(0.5195312500), COEF_CONST(0.5195312500),
COEF_CONST(0.5156250000), COEF_CONST(0.5156250000),
COEF_CONST(0.5117187500), COEF_CONST(0.5117187500),
COEF_CONST(0.5078125000), COEF_CONST(0.5078125000),
COEF_CONST(0.5039062500), COEF_CONST(0.5039062500),
COEF_CONST(0.5000000000), COEF_CONST(0.4980468750),
COEF_CONST(0.4960937500), COEF_CONST(0.4941406250),
COEF_CONST(0.4921875000), COEF_CONST(0.4902343750),
COEF_CONST(0.4882812500), COEF_CONST(0.4863281250),
COEF_CONST(0.4843750000), COEF_CONST(0.4824218750),
COEF_CONST(0.4804687500), COEF_CONST(0.4785156250)
};
ALIGN static const real_t exp_table[128] = {
COEF_CONST(0.50000000000000000000000000000000000000000000000000),
COEF_CONST(0.25000000000000000000000000000000000000000000000000),
COEF_CONST(0.12500000000000000000000000000000000000000000000000),
COEF_CONST(0.06250000000000000000000000000000000000000000000000),
COEF_CONST(0.03125000000000000000000000000000000000000000000000),
COEF_CONST(0.01562500000000000000000000000000000000000000000000),
COEF_CONST(0.00781250000000000000000000000000000000000000000000),
COEF_CONST(0.00390625000000000000000000000000000000000000000000),
COEF_CONST(0.00195312500000000000000000000000000000000000000000),
COEF_CONST(0.00097656250000000000000000000000000000000000000000),
COEF_CONST(0.00048828125000000000000000000000000000000000000000),
COEF_CONST(0.00024414062500000000000000000000000000000000000000),
COEF_CONST(0.00012207031250000000000000000000000000000000000000),
COEF_CONST(0.00006103515625000000000000000000000000000000000000),
COEF_CONST(0.00003051757812500000000000000000000000000000000000),
COEF_CONST(0.00001525878906250000000000000000000000000000000000),
COEF_CONST(0.00000762939453125000000000000000000000000000000000),
COEF_CONST(0.00000381469726562500000000000000000000000000000000),
COEF_CONST(0.00000190734863281250000000000000000000000000000000),
COEF_CONST(0.00000095367431640625000000000000000000000000000000),
COEF_CONST(0.00000047683715820312500000000000000000000000000000),
COEF_CONST(0.00000023841857910156250000000000000000000000000000),
COEF_CONST(0.00000011920928955078125000000000000000000000000000),
COEF_CONST(0.00000005960464477539062500000000000000000000000000),
COEF_CONST(0.00000002980232238769531300000000000000000000000000),
COEF_CONST(0.00000001490116119384765600000000000000000000000000),
COEF_CONST(0.00000000745058059692382810000000000000000000000000),
COEF_CONST(0.00000000372529029846191410000000000000000000000000),
COEF_CONST(0.00000000186264514923095700000000000000000000000000),
COEF_CONST(0.00000000093132257461547852000000000000000000000000),
COEF_CONST(0.00000000046566128730773926000000000000000000000000),
COEF_CONST(0.00000000023283064365386963000000000000000000000000),
COEF_CONST(0.00000000011641532182693481000000000000000000000000),
COEF_CONST(0.00000000005820766091346740700000000000000000000000),
COEF_CONST(0.00000000002910383045673370400000000000000000000000),
COEF_CONST(0.00000000001455191522836685200000000000000000000000),
COEF_CONST(0.00000000000727595761418342590000000000000000000000),
COEF_CONST(0.00000000000363797880709171300000000000000000000000),
COEF_CONST(0.00000000000181898940354585650000000000000000000000),
COEF_CONST(0.00000000000090949470177292824000000000000000000000),
COEF_CONST(0.00000000000045474735088646412000000000000000000000),
COEF_CONST(0.00000000000022737367544323206000000000000000000000),
COEF_CONST(0.00000000000011368683772161603000000000000000000000),
COEF_CONST(0.00000000000005684341886080801500000000000000000000),
COEF_CONST(0.00000000000002842170943040400700000000000000000000),
COEF_CONST(0.00000000000001421085471520200400000000000000000000),
COEF_CONST(0.00000000000000710542735760100190000000000000000000),
COEF_CONST(0.00000000000000355271367880050090000000000000000000),
COEF_CONST(0.00000000000000177635683940025050000000000000000000),
COEF_CONST(0.00000000000000088817841970012523000000000000000000),
COEF_CONST(0.00000000000000044408920985006262000000000000000000),
COEF_CONST(0.00000000000000022204460492503131000000000000000000),
COEF_CONST(0.00000000000000011102230246251565000000000000000000),
COEF_CONST(0.00000000000000005551115123125782700000000000000000),
COEF_CONST(0.00000000000000002775557561562891400000000000000000),
COEF_CONST(0.00000000000000001387778780781445700000000000000000),
COEF_CONST(0.00000000000000000693889390390722840000000000000000),
COEF_CONST(0.00000000000000000346944695195361420000000000000000),
COEF_CONST(0.00000000000000000173472347597680710000000000000000),
COEF_CONST(0.00000000000000000086736173798840355000000000000000),
COEF_CONST(0.00000000000000000043368086899420177000000000000000),
COEF_CONST(0.00000000000000000021684043449710089000000000000000),
COEF_CONST(0.00000000000000000010842021724855044000000000000000),
COEF_CONST(0.00000000000000000005421010862427522200000000000000),
COEF_CONST(0.00000000000000000002710505431213761100000000000000),
COEF_CONST(0.00000000000000000001355252715606880500000000000000),
COEF_CONST(0.00000000000000000000677626357803440270000000000000),
COEF_CONST(0.00000000000000000000338813178901720140000000000000),
COEF_CONST(0.00000000000000000000169406589450860070000000000000),
COEF_CONST(0.00000000000000000000084703294725430034000000000000),
COEF_CONST(0.00000000000000000000042351647362715017000000000000),
COEF_CONST(0.00000000000000000000021175823681357508000000000000),
COEF_CONST(0.00000000000000000000010587911840678754000000000000),
COEF_CONST(0.00000000000000000000005293955920339377100000000000),
COEF_CONST(0.00000000000000000000002646977960169688600000000000),
COEF_CONST(0.00000000000000000000001323488980084844300000000000),
COEF_CONST(0.00000000000000000000000661744490042422140000000000),
COEF_CONST(0.00000000000000000000000330872245021211070000000000),
COEF_CONST(0.00000000000000000000000165436122510605530000000000),
COEF_CONST(0.00000000000000000000000082718061255302767000000000),
COEF_CONST(0.00000000000000000000000041359030627651384000000000),
COEF_CONST(0.00000000000000000000000020679515313825692000000000),
COEF_CONST(0.00000000000000000000000010339757656912846000000000),
COEF_CONST(0.00000000000000000000000005169878828456423000000000),
COEF_CONST(0.00000000000000000000000002584939414228211500000000),
COEF_CONST(0.00000000000000000000000001292469707114105700000000),
COEF_CONST(0.00000000000000000000000000646234853557052870000000),
COEF_CONST(0.00000000000000000000000000323117426778526440000000),
COEF_CONST(0.00000000000000000000000000161558713389263220000000),
COEF_CONST(0.00000000000000000000000000080779356694631609000000),
COEF_CONST(0.00000000000000000000000000040389678347315804000000),
COEF_CONST(0.00000000000000000000000000020194839173657902000000),
COEF_CONST(0.00000000000000000000000000010097419586828951000000),
COEF_CONST(0.00000000000000000000000000005048709793414475600000),
COEF_CONST(0.00000000000000000000000000002524354896707237800000),
COEF_CONST(0.00000000000000000000000000001262177448353618900000),
COEF_CONST(0.00000000000000000000000000000631088724176809440000),
COEF_CONST(0.00000000000000000000000000000315544362088404720000),
COEF_CONST(0.00000000000000000000000000000157772181044202360000),
COEF_CONST(0.00000000000000000000000000000078886090522101181000),
COEF_CONST(0.00000000000000000000000000000039443045261050590000),
COEF_CONST(0.00000000000000000000000000000019721522630525295000),
COEF_CONST(0.00000000000000000000000000000009860761315262647600),
COEF_CONST(0.00000000000000000000000000000004930380657631323800),
COEF_CONST(0.00000000000000000000000000000002465190328815661900),
COEF_CONST(0.00000000000000000000000000000001232595164407830900),
COEF_CONST(0.00000000000000000000000000000000616297582203915470),
COEF_CONST(0.00000000000000000000000000000000308148791101957740),
COEF_CONST(0.00000000000000000000000000000000154074395550978870),
COEF_CONST(0.00000000000000000000000000000000077037197775489434),
COEF_CONST(0.00000000000000000000000000000000038518598887744717),
COEF_CONST(0.00000000000000000000000000000000019259299443872359),
COEF_CONST(0.00000000000000000000000000000000009629649721936179),
COEF_CONST(0.00000000000000000000000000000000004814824860968090),
COEF_CONST(0.00000000000000000000000000000000002407412430484045),
COEF_CONST(0.00000000000000000000000000000000001203706215242022),
COEF_CONST(0.00000000000000000000000000000000000601853107621011),
COEF_CONST(0.00000000000000000000000000000000000300926553810506),
COEF_CONST(0.00000000000000000000000000000000000150463276905253),
COEF_CONST(0.00000000000000000000000000000000000075231638452626),
COEF_CONST(0.00000000000000000000000000000000000037615819226313),
COEF_CONST(0.00000000000000000000000000000000000018807909613157),
COEF_CONST(0.00000000000000000000000000000000000009403954806578),
COEF_CONST(0.00000000000000000000000000000000000004701977403289),
COEF_CONST(0.00000000000000000000000000000000000002350988701645),
COEF_CONST(0.00000000000000000000000000000000000001175494350822),
COEF_CONST(0.0 /* 0000000000000000000000000000000000000587747175411 "floating point underflow" */),
COEF_CONST(0.0)
};
#ifdef __cplusplus
}
#endif
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,106 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: is.c 3 2005-06-02 18:16:43Z vspader $
**/
#include "common.h"
#include "structs.h"
#include "syntax.h"
#include "is.h"
#ifdef FIXED_POINT
static real_t pow05_table[] = {
COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */
COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */
COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */
COEF_CONST(1.0), /* 0.5^( 0/4) */
COEF_CONST(0.84089641525371), /* 0.5^(+1/4) */
COEF_CONST(0.70710678118655), /* 0.5^(+2/4) */
COEF_CONST(0.59460355750136) /* 0.5^(+3/4) */
};
#endif
void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
uint16_t frame_len)
{
uint8_t g, sfb, b;
uint16_t i;
#ifndef FIXED_POINT
real_t scale;
#else
int32_t exp, frac;
#endif
uint16_t nshort = frame_len/8;
uint8_t group = 0;
for (g = 0; g < icsr->num_window_groups; g++)
{
/* Do intensity stereo decoding */
for (b = 0; b < icsr->window_group_length[g]; b++)
{
for (sfb = 0; sfb < icsr->max_sfb; sfb++)
{
if (is_intensity(icsr, g, sfb))
{
#ifdef MAIN_DEC
/* For scalefactor bands coded in intensity stereo the
corresponding predictors in the right channel are
switched to "off".
*/
ics->pred.prediction_used[sfb] = 0;
icsr->pred.prediction_used[sfb] = 0;
#endif
#ifndef FIXED_POINT
scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb]));
#else
exp = icsr->scale_factors[g][sfb] >> 2;
frac = icsr->scale_factors[g][sfb] & 3;
#endif
/* Scale from left to right channel,
do not touch left channel */
for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++)
{
#ifndef FIXED_POINT
r_spec[(group*nshort)+i] = MUL_R(l_spec[(group*nshort)+i], scale);
#else
if (exp < 0)
r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] << -exp;
else
r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] >> exp;
r_spec[(group*nshort)+i] = MUL_C(r_spec[(group*nshort)+i], pow05_table[frac + 3]);
#endif
if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb))
r_spec[(group*nshort)+i] = -r_spec[(group*nshort)+i];
}
}
}
group++;
}
}
}

View file

@ -0,0 +1,64 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: is.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __IS_H__
#define __IS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "syntax.h"
void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
uint16_t frame_len);
static INLINE int8_t is_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
{
switch (ics->sfb_cb[group][sfb])
{
case INTENSITY_HCB:
return 1;
case INTENSITY_HCB2:
return -1;
default:
return 0;
}
}
static INLINE int8_t invert_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
{
if (ics->ms_mask_present == 1)
return (1-2*ics->ms_used[group][sfb]);
return 1;
}
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,484 @@
# Microsoft Developer Studio Project File - Name="libfaad" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=libfaad - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "libfaad.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "libfaad.mak" CFG="libfaad - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libfaad - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "libfaad - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "libfaad - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
MTL=midl.exe
F90=df.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x413 /d "NDEBUG"
# ADD RSC /l 0x413 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "libfaad - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
MTL=midl.exe
F90=df.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x413 /d "_DEBUG"
# ADD RSC /l 0x413 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "libfaad - Win32 Release"
# Name "libfaad - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\bits.c
# End Source File
# Begin Source File
SOURCE=.\cfft.c
# End Source File
# Begin Source File
SOURCE=.\common.c
# End Source File
# Begin Source File
SOURCE=.\decoder.c
# End Source File
# Begin Source File
SOURCE=.\drc.c
# End Source File
# Begin Source File
SOURCE=.\drm_dec.c
# End Source File
# Begin Source File
SOURCE=.\error.c
# End Source File
# Begin Source File
SOURCE=.\filtbank.c
# End Source File
# Begin Source File
SOURCE=.\hcr.c
# End Source File
# Begin Source File
SOURCE=.\huffman.c
# End Source File
# Begin Source File
SOURCE=.\ic_predict.c
# End Source File
# Begin Source File
SOURCE=.\is.c
# End Source File
# Begin Source File
SOURCE=.\lt_predict.c
# End Source File
# Begin Source File
SOURCE=.\mdct.c
# End Source File
# Begin Source File
SOURCE=.\mp4.c
# End Source File
# Begin Source File
SOURCE=.\ms.c
# End Source File
# Begin Source File
SOURCE=.\output.c
# End Source File
# Begin Source File
SOURCE=.\pns.c
# End Source File
# Begin Source File
SOURCE=.\ps_dec.c
# End Source File
# Begin Source File
SOURCE=.\ps_syntax.c
# End Source File
# Begin Source File
SOURCE=.\pulse.c
# End Source File
# Begin Source File
SOURCE=.\rvlc.c
# End Source File
# Begin Source File
SOURCE=.\sbr_dct.c
# End Source File
# Begin Source File
SOURCE=.\sbr_dec.c
# End Source File
# Begin Source File
SOURCE=.\sbr_e_nf.c
# End Source File
# Begin Source File
SOURCE=.\sbr_fbt.c
# End Source File
# Begin Source File
SOURCE=.\sbr_hfadj.c
# End Source File
# Begin Source File
SOURCE=.\sbr_hfgen.c
# End Source File
# Begin Source File
SOURCE=.\sbr_huff.c
# End Source File
# Begin Source File
SOURCE=.\sbr_qmf.c
# End Source File
# Begin Source File
SOURCE=.\sbr_syntax.c
# End Source File
# Begin Source File
SOURCE=.\sbr_tf_grid.c
# End Source File
# Begin Source File
SOURCE=.\specrec.c
# End Source File
# Begin Source File
SOURCE=.\ssr.c
# End Source File
# Begin Source File
SOURCE=.\ssr_fb.c
# End Source File
# Begin Source File
SOURCE=.\ssr_ipqf.c
# End Source File
# Begin Source File
SOURCE=.\syntax.c
# End Source File
# Begin Source File
SOURCE=.\tns.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Group "codebook"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\codebook\hcb_1.h
# End Source File
# Begin Source File
SOURCE=.\codebook\hcb_10.h
# End Source File
# Begin Source File
SOURCE=.\codebook\hcb_11.h
# End Source File
# Begin Source File
SOURCE=.\codebook\hcb_2.h
# End Source File
# Begin Source File
SOURCE=.\codebook\hcb_3.h
# End Source File
# Begin Source File
SOURCE=.\codebook\hcb_4.h
# End Source File
# Begin Source File
SOURCE=.\codebook\hcb_5.h
# End Source File
# Begin Source File
SOURCE=.\codebook\hcb_6.h
# End Source File
# Begin Source File
SOURCE=.\codebook\hcb_7.h
# End Source File
# Begin Source File
SOURCE=.\codebook\hcb_8.h
# End Source File
# Begin Source File
SOURCE=.\codebook\hcb_9.h
# End Source File
# Begin Source File
SOURCE=.\codebook\hcb_sf.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\analysis.h
# End Source File
# Begin Source File
SOURCE=.\bits.h
# End Source File
# Begin Source File
SOURCE=.\cfft.h
# End Source File
# Begin Source File
SOURCE=.\cfft_tab.h
# End Source File
# Begin Source File
SOURCE=.\common.h
# End Source File
# Begin Source File
SOURCE=.\decoder.h
# End Source File
# Begin Source File
SOURCE=.\drc.h
# End Source File
# Begin Source File
SOURCE=.\drm_dec.h
# End Source File
# Begin Source File
SOURCE=.\error.h
# End Source File
# Begin Source File
SOURCE=.\filtbank.h
# End Source File
# Begin Source File
SOURCE=.\fixed.h
# End Source File
# Begin Source File
SOURCE=.\codebook\hcb.h
# End Source File
# Begin Source File
SOURCE=.\huffman.h
# End Source File
# Begin Source File
SOURCE=.\ic_predict.h
# End Source File
# Begin Source File
SOURCE=.\iq_table.h
# End Source File
# Begin Source File
SOURCE=.\is.h
# End Source File
# Begin Source File
SOURCE=.\kbd_win.h
# End Source File
# Begin Source File
SOURCE=.\lt_predict.h
# End Source File
# Begin Source File
SOURCE=.\mdct.h
# End Source File
# Begin Source File
SOURCE=.\mdct_tab.h
# End Source File
# Begin Source File
SOURCE=.\mp4.h
# End Source File
# Begin Source File
SOURCE=.\ms.h
# End Source File
# Begin Source File
SOURCE=.\output.h
# End Source File
# Begin Source File
SOURCE=.\pns.h
# End Source File
# Begin Source File
SOURCE=.\ps_dec.h
# End Source File
# Begin Source File
SOURCE=.\ps_tables.h
# End Source File
# Begin Source File
SOURCE=.\pulse.h
# End Source File
# Begin Source File
SOURCE=.\rvlc.h
# End Source File
# Begin Source File
SOURCE=.\sbr_dct.h
# End Source File
# Begin Source File
SOURCE=.\sbr_dec.h
# End Source File
# Begin Source File
SOURCE=.\sbr_e_nf.h
# End Source File
# Begin Source File
SOURCE=.\sbr_fbt.h
# End Source File
# Begin Source File
SOURCE=.\sbr_hfadj.h
# End Source File
# Begin Source File
SOURCE=.\sbr_hfgen.h
# End Source File
# Begin Source File
SOURCE=.\sbr_huff.h
# End Source File
# Begin Source File
SOURCE=.\sbr_noise.h
# End Source File
# Begin Source File
SOURCE=.\sbr_qmf.h
# End Source File
# Begin Source File
SOURCE=.\sbr_qmf_c.h
# End Source File
# Begin Source File
SOURCE=.\sbr_syntax.h
# End Source File
# Begin Source File
SOURCE=.\sbr_tf_grid.h
# End Source File
# Begin Source File
SOURCE=.\sine_win.h
# End Source File
# Begin Source File
SOURCE=.\specrec.h
# End Source File
# Begin Source File
SOURCE=.\ssr.h
# End Source File
# Begin Source File
SOURCE=.\structs.h
# End Source File
# Begin Source File
SOURCE=.\syntax.h
# End Source File
# Begin Source File
SOURCE=.\tns.h
# End Source File
# End Group
# End Target
# End Project

View file

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "libfaad"=.\libfaad.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View file

@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "libfaad.vcproj", "{4274723E-6B9D-4B3E-A8BE-7566165AA169}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{4274723E-6B9D-4B3E-A8BE-7566165AA169}.Debug.ActiveCfg = Debug|Win32
{4274723E-6B9D-4B3E-A8BE-7566165AA169}.Debug.Build.0 = Debug|Win32
{4274723E-6B9D-4B3E-A8BE-7566165AA169}.Release.ActiveCfg = Release|Win32
{4274723E-6B9D-4B3E-A8BE-7566165AA169}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,14 @@
LIBRARY libfaad2.dll
EXPORTS
;
; libfaad exports
;
faacDecOpen @1
faacDecGetCurrentConfiguration @2
faacDecSetConfiguration @3
faacDecInit @4
faacDecInit2 @5
faacDecDecode @6
faacDecClose @7
faacDecGetErrorMessage @8
AudioSpecificConfig @9

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,29 @@
Microsoft eMbedded Visual Tools Workspace File, Format Version 3.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "libfaad2"=".\libfaad2.vcp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View file

@ -0,0 +1,355 @@
# Microsoft Developer Studio Project File - Name="libfaad2_dll" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=libfaad2_dll - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "libfaad2_dll.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "libfaad2_dll.mak" CFG="libfaad2_dll - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libfaad2_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "libfaad2_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "libfaad2_dll - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "libfaad2_dll___Win32_Release"
# PROP BASE Intermediate_Dir "libfaad2_dll___Win32_Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseDLL"
# PROP Intermediate_Dir "ReleaseDLL"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libfaad2_dll_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "fftw" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libfaad2_dll_EXPORTS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
# ADD RSC /l 0x407 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 /nologo /dll /machine:I386 /out:"ReleaseDLL/libfaad2.dll"
!ELSEIF "$(CFG)" == "libfaad2_dll - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "libfaad2_dll___Win32_Debug"
# PROP BASE Intermediate_Dir "libfaad2_dll___Win32_Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "DebugDLL"
# PROP Intermediate_Dir "DebugDLL"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libfaad2_dll_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "fftw" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libfaad2_dll_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "_DEBUG"
# ADD RSC /l 0x407 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"DebugDLL/libfaad2.dll" /pdbtype:sept
!ENDIF
# Begin Target
# Name "libfaad2_dll - Win32 Release"
# Name "libfaad2_dll - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\bits.c
# End Source File
# Begin Source File
SOURCE=.\cfft.c
# End Source File
# Begin Source File
SOURCE=.\common.c
# End Source File
# Begin Source File
SOURCE=.\decoder.c
# End Source File
# Begin Source File
SOURCE=.\dither.c
# End Source File
# Begin Source File
SOURCE=.\drc.c
# End Source File
# Begin Source File
SOURCE=.\error.c
# End Source File
# Begin Source File
SOURCE=.\filtbank.c
# End Source File
# Begin Source File
SOURCE=.\hcr.c
# End Source File
# Begin Source File
SOURCE=.\huffman.c
# End Source File
# Begin Source File
SOURCE=.\ic_predict.c
# End Source File
# Begin Source File
SOURCE=.\is.c
# End Source File
# Begin Source File
SOURCE=.\lt_predict.c
# End Source File
# Begin Source File
SOURCE=.\mdct.c
# End Source File
# Begin Source File
SOURCE=.\mp4.c
# End Source File
# Begin Source File
SOURCE=.\ms.c
# End Source File
# Begin Source File
SOURCE=.\output.c
# End Source File
# Begin Source File
SOURCE=.\pns.c
# End Source File
# Begin Source File
SOURCE=.\pulse.c
# End Source File
# Begin Source File
SOURCE=.\rvlc.c
# End Source File
# Begin Source File
SOURCE=.\sbr_dct.c
# End Source File
# Begin Source File
SOURCE=.\sbr_dec.c
# End Source File
# Begin Source File
SOURCE=.\sbr_e_nf.c
# End Source File
# Begin Source File
SOURCE=.\sbr_fbt.c
# End Source File
# Begin Source File
SOURCE=.\sbr_hfadj.c
# End Source File
# Begin Source File
SOURCE=.\sbr_hfgen.c
# End Source File
# Begin Source File
SOURCE=.\sbr_huff.c
# End Source File
# Begin Source File
SOURCE=.\sbr_qmf.c
# End Source File
# Begin Source File
SOURCE=.\sbr_syntax.c
# End Source File
# Begin Source File
SOURCE=.\sbr_tf_grid.c
# End Source File
# Begin Source File
SOURCE=.\specrec.c
# End Source File
# Begin Source File
SOURCE=.\ssr.c
# End Source File
# Begin Source File
SOURCE=.\ssr_fb.c
# End Source File
# Begin Source File
SOURCE=.\ssr_ipqf.c
# End Source File
# Begin Source File
SOURCE=.\syntax.c
# End Source File
# Begin Source File
SOURCE=.\tns.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\analysis.h
# End Source File
# Begin Source File
SOURCE=.\bits.h
# End Source File
# Begin Source File
SOURCE=.\cfft.h
# End Source File
# Begin Source File
SOURCE=.\common.h
# End Source File
# Begin Source File
SOURCE=.\data.h
# End Source File
# Begin Source File
SOURCE=.\decoder.h
# End Source File
# Begin Source File
SOURCE=.\dither.h
# End Source File
# Begin Source File
SOURCE=.\drc.h
# End Source File
# Begin Source File
SOURCE=.\error.h
# End Source File
# Begin Source File
SOURCE=.\filtbank.h
# End Source File
# Begin Source File
SOURCE=.\codebook\hcb.h
# End Source File
# Begin Source File
SOURCE=.\huffman.h
# End Source File
# Begin Source File
SOURCE=.\ic_predict.h
# End Source File
# Begin Source File
SOURCE=.\is.h
# End Source File
# Begin Source File
SOURCE=.\kbd_win.h
# End Source File
# Begin Source File
SOURCE=.\lt_predict.h
# End Source File
# Begin Source File
SOURCE=.\mdct.h
# End Source File
# Begin Source File
SOURCE=.\mp4.h
# End Source File
# Begin Source File
SOURCE=.\ms.h
# End Source File
# Begin Source File
SOURCE=.\output.h
# End Source File
# Begin Source File
SOURCE=.\pns.h
# End Source File
# Begin Source File
SOURCE=.\pulse.h
# End Source File
# Begin Source File
SOURCE=.\rvlc.h
# End Source File
# Begin Source File
SOURCE=.\specrec.h
# End Source File
# Begin Source File
SOURCE=.\ssr.h
# End Source File
# Begin Source File
SOURCE=.\syntax.h
# End Source File
# Begin Source File
SOURCE=.\Tns.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\libfaad2.def
# End Source File
# End Target
# End Project

View file

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "libfaad2_dll"=.\libfaad2_dll.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad2_dll", "libfaad2_dll.vcproj", "{482DA264-EE88-4575-B208-87C4CB80CD08}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{482DA264-EE88-4575-B208-87C4CB80CD08}.Debug.ActiveCfg = Debug|Win32
{482DA264-EE88-4575-B208-87C4CB80CD08}.Debug.Build.0 = Debug|Win32
{482DA264-EE88-4575-B208-87C4CB80CD08}.Release.ActiveCfg = Release|Win32
{482DA264-EE88-4575-B208-87C4CB80CD08}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,307 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="libfaad2_dll"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\DebugDLL"
IntermediateDirectory=".\DebugDLL"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="fftw"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;libfaad2_dll_EXPORTS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\DebugDLL/libfaad2_dll.pch"
AssemblerListingLocation=".\DebugDLL/"
ObjectFile=".\DebugDLL/"
ProgramDataBaseFileName=".\DebugDLL/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"
AdditionalOptions="">
<IntelOptions
Optimization="0"
MinimalRebuild="1"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
AllOptions="/c /I &quot;fftw&quot; /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_WINDOWS&quot; /D &quot;_USRDLL&quot; /D &quot;libfaad2_dll_EXPORTS&quot; /D &quot;_WINDLL&quot; /D &quot;_MBCS&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\DebugDLL/libfaad2_dll.pch&quot; /Fo&quot;.\DebugDLL/&quot; /Fd&quot;.\DebugDLL/&quot; /Gd"
MSOriginalAdditionalOptions=""/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib"
OutputFile="DebugDLL/libfaad2.dll"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\libfaad2.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\DebugDLL/libfaad2.pdb"
ImportLibrary=".\DebugDLL/libfaad2.lib">
<IntelOptions
AllOptions="/NOLOGO /DLL /OUT:&quot;DebugDLL/libfaad2.dll&quot; /INCREMENTAL odbc32.lib odbccp32.lib /DEF:&quot;.\libfaad2.def&quot; /DEBUG /PDB:&quot;.\DebugDLL/libfaad2.pdb&quot; /TLBID:1 /IMPLIB:&quot;.\DebugDLL/libfaad2.lib&quot; /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"
MSOriginalAdditionalOptions="/MACHINE:I386"/>
</Tool>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\DebugDLL/libfaad2_dll.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1031"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\ReleaseDLL"
IntermediateDirectory=".\ReleaseDLL"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OptimizeForProcessor="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;libfaad2_dll_EXPORTS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\ReleaseDLL/libfaad2_dll.pch"
AssemblerListingLocation=".\ReleaseDLL/"
ObjectFile=".\ReleaseDLL/"
ProgramDataBaseFileName=".\ReleaseDLL/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"
AdditionalOptions="">
<IntelOptions
Optimization="2"
GlobalOptimizations="1"
InlineFuncExpansion="1"
OmitFramePtrs="1"
StringPooling="1"
RuntimeLibrary="2"
BufferSecurityCheck="1"
FunctionLevelLinking="1"
AllOptions="/c /nologo /W3 /O2 /Og /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_WINDOWS&quot; /D &quot;_USRDLL&quot; /D &quot;libfaad2_dll_EXPORTS&quot; /D &quot;_WINDLL&quot; /D &quot;_MBCS&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\ReleaseDLL/libfaad2_dll.pch&quot; /Fo&quot;.\ReleaseDLL/&quot; /Fd&quot;.\ReleaseDLL/&quot; /Gd"
MSOriginalAdditionalOptions=""/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
OutputFile="ReleaseDLL/libfaad2.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\libfaad2.def"
ProgramDatabaseFile=".\ReleaseDLL/libfaad2.pdb"
ImportLibrary=".\ReleaseDLL/libfaad2.lib">
<IntelOptions
AllOptions="/NOLOGO /DLL /OUT:&quot;ReleaseDLL/libfaad2.dll&quot; /INCREMENTAL:NO /DEF:&quot;.\libfaad2.def&quot; /PDB:&quot;.\ReleaseDLL/libfaad2.pdb&quot; /TLBID:1 /IMPLIB:&quot;.\ReleaseDLL/libfaad2.lib&quot; /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"
MSOriginalAdditionalOptions="/MACHINE:I386"/>
</Tool>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\ReleaseDLL/libfaad2_dll.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1031"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\bits.c"/>
<File
RelativePath=".\cfft.c"/>
<File
RelativePath="common.c"/>
<File
RelativePath=".\data.c"/>
<File
RelativePath=".\decoder.c"/>
<File
RelativePath="dither.c"/>
<File
RelativePath=".\drc.c"/>
<File
RelativePath=".\error.c"/>
<File
RelativePath=".\filtbank.c"/>
<File
RelativePath="hcr.c"/>
<File
RelativePath=".\ic_predict.c"/>
<File
RelativePath=".\is.c"/>
<File
RelativePath=".\lt_predict.c"/>
<File
RelativePath=".\mdct.c"/>
<File
RelativePath=".\mp4.c"/>
<File
RelativePath=".\ms.c"/>
<File
RelativePath=".\output.c"/>
<File
RelativePath=".\pns.c"/>
<File
RelativePath=".\pulse.c"/>
<File
RelativePath="rvlc.c"/>
<File
RelativePath=".\specrec.c"/>
<File
RelativePath="ssr.c"/>
<File
RelativePath=".\syntax.c"/>
<File
RelativePath=".\tns.c"/>
<Filter
Name="codebook"
Filter="">
<File
RelativePath=".\codebook\hcb_1.c"/>
<File
RelativePath=".\codebook\hcb_10.c"/>
<File
RelativePath=".\codebook\hcb_11.c"/>
<File
RelativePath=".\codebook\hcb_2.c"/>
<File
RelativePath=".\codebook\hcb_3.c"/>
<File
RelativePath=".\codebook\hcb_4.c"/>
<File
RelativePath=".\codebook\hcb_5.c"/>
<File
RelativePath=".\codebook\hcb_6.c"/>
<File
RelativePath=".\codebook\hcb_7.c"/>
<File
RelativePath=".\codebook\hcb_8.c"/>
<File
RelativePath=".\codebook\hcb_9.c"/>
<File
RelativePath=".\codebook\hcb_sf.c"/>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\Tns.h"/>
<File
RelativePath=".\analysis.h"/>
<File
RelativePath=".\bits.h"/>
<File
RelativePath=".\cfft.h"/>
<File
RelativePath=".\common.h"/>
<File
RelativePath=".\data.h"/>
<File
RelativePath=".\decoder.h"/>
<File
RelativePath="dither.h"/>
<File
RelativePath=".\drc.h"/>
<File
RelativePath=".\error.h"/>
<File
RelativePath=".\filtbank.h"/>
<File
RelativePath=".\codebook\hcb.h"/>
<File
RelativePath=".\huffman.h"/>
<File
RelativePath=".\ic_predict.h"/>
<File
RelativePath=".\is.h"/>
<File
RelativePath=".\kbd_win.h"/>
<File
RelativePath=".\lt_predict.h"/>
<File
RelativePath=".\mdct.h"/>
<File
RelativePath=".\mp4.h"/>
<File
RelativePath=".\ms.h"/>
<File
RelativePath=".\output.h"/>
<File
RelativePath=".\pns.h"/>
<File
RelativePath=".\pulse.h"/>
<File
RelativePath="rvlc.h"/>
<File
RelativePath=".\specrec.h"/>
<File
RelativePath="ssr.h"/>
<File
RelativePath=".\syntax.h"/>
</Filter>
<File
RelativePath=".\libfaad2.def"/>
</Files>
<Globals/>
</VisualStudioProject>

View file

@ -0,0 +1,215 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: lt_predict.c 3 2005-06-02 18:16:43Z vspader $
**/
#include "common.h"
#include "structs.h"
#ifdef LTP_DEC
#include <stdlib.h>
#include "syntax.h"
#include "lt_predict.h"
#include "filtbank.h"
#include "tns.h"
/* static function declarations */
static int16_t real_to_int16(real_t sig_in);
/* check if the object type is an object type that can have LTP */
uint8_t is_ltp_ot(uint8_t object_type)
{
#ifdef LTP_DEC
if ((object_type == LTP)
#ifdef ERROR_RESILIENCE
|| (object_type == ER_LTP)
#endif
#ifdef LD_DEC
|| (object_type == LD)
#endif
#ifdef SCALABLE_DEC
|| (object_type == 6) /* TODO */
#endif
)
{
return 1;
}
#endif
return 0;
}
ALIGN static const real_t codebook[8] =
{
REAL_CONST(0.570829),
REAL_CONST(0.696616),
REAL_CONST(0.813004),
REAL_CONST(0.911304),
REAL_CONST(0.984900),
REAL_CONST(1.067894),
REAL_CONST(1.194601),
REAL_CONST(1.369533)
};
void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape,
uint8_t win_shape_prev, uint8_t sr_index,
uint8_t object_type, uint16_t frame_len)
{
uint8_t sfb;
uint16_t bin, i, num_samples;
ALIGN real_t x_est[2048];
ALIGN real_t X_est[2048];
if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
{
if (ltp->data_present)
{
num_samples = frame_len << 1;
for(i = 0; i < num_samples; i++)
{
/* The extra lookback M (N/2 for LD, 0 for LTP) is handled
in the buffer updating */
#if 0
x_est[i] = MUL_R_C(lt_pred_stat[num_samples + i - ltp->lag],
codebook[ltp->coef]);
#else
/* lt_pred_stat is a 16 bit int, multiplied with the fixed point real
this gives a real for x_est
*/
x_est[i] = (real_t)lt_pred_stat[num_samples + i - ltp->lag] * codebook[ltp->coef];
#endif
}
filter_bank_ltp(fb, ics->window_sequence, win_shape, win_shape_prev,
x_est, X_est, object_type, frame_len);
tns_encode_frame(ics, &(ics->tns), sr_index, object_type, X_est,
frame_len);
for (sfb = 0; sfb < ltp->last_band; sfb++)
{
if (ltp->long_used[sfb])
{
uint16_t low = ics->swb_offset[sfb];
uint16_t high = ics->swb_offset[sfb+1];
for (bin = low; bin < high; bin++)
{
spec[bin] += X_est[bin];
}
}
}
}
}
}
#ifdef FIXED_POINT
static INLINE int16_t real_to_int16(real_t sig_in)
{
if (sig_in >= 0)
{
sig_in += (1 << (REAL_BITS-1));
if (sig_in >= REAL_CONST(32768))
return 32767;
} else {
sig_in += -(1 << (REAL_BITS-1));
if (sig_in <= REAL_CONST(-32768))
return -32768;
}
return (sig_in >> REAL_BITS);
}
#else
static INLINE int16_t real_to_int16(real_t sig_in)
{
if (sig_in >= 0)
{
#ifndef HAS_LRINTF
sig_in += 0.5f;
#endif
if (sig_in >= 32768.0f)
return 32767;
} else {
#ifndef HAS_LRINTF
sig_in += -0.5f;
#endif
if (sig_in <= -32768.0f)
return -32768;
}
return lrintf(sig_in);
}
#endif
void lt_update_state(int16_t *lt_pred_stat, real_t *time, real_t *overlap,
uint16_t frame_len, uint8_t object_type)
{
uint16_t i;
/*
* The reference point for index i and the content of the buffer
* lt_pred_stat are arranged so that lt_pred_stat(0 ... N/2 - 1) contains the
* last aliased half window from the IMDCT, and lt_pred_stat(N/2 ... N-1)
* is always all zeros. The rest of lt_pred_stat (i<0) contains the previous
* fully reconstructed time domain samples, i.e., output of the decoder.
*
* These values are shifted up by N*2 to avoid (i<0)
*
* For the LD object type an extra 512 samples lookback is accomodated here.
*/
#ifdef LD_DEC
if (object_type == LD)
{
for (i = 0; i < frame_len; i++)
{
lt_pred_stat[i] /* extra 512 */ = lt_pred_stat[i + frame_len];
lt_pred_stat[frame_len + i] = lt_pred_stat[i + (frame_len * 2)];
lt_pred_stat[(frame_len * 2) + i] = real_to_int16(time[i]);
lt_pred_stat[(frame_len * 3) + i] = real_to_int16(overlap[i]);
}
} else {
#endif
for (i = 0; i < frame_len; i++)
{
lt_pred_stat[i] = lt_pred_stat[i + frame_len];
lt_pred_stat[frame_len + i] = real_to_int16(time[i]);
lt_pred_stat[(frame_len * 2) + i] = real_to_int16(overlap[i]);
#if 0 /* set to zero once upon initialisation */
lt_pred_stat[(frame_len * 3) + i] = 0;
#endif
}
#ifdef LD_DEC
}
#endif
}
#endif

View file

@ -0,0 +1,63 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: lt_predict.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifdef LTP_DEC
#ifndef __LT_PREDICT_H__
#define __LT_PREDICT_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "filtbank.h"
uint8_t is_ltp_ot(uint8_t object_type);
void lt_prediction(ic_stream *ics,
ltp_info *ltp,
real_t *spec,
int16_t *lt_pred_stat,
fb_info *fb,
uint8_t win_shape,
uint8_t win_shape_prev,
uint8_t sr_index,
uint8_t object_type,
uint16_t frame_len);
void lt_update_state(int16_t *lt_pred_stat,
real_t *time,
real_t *overlap,
uint16_t frame_len,
uint8_t object_type);
#ifdef __cplusplus
}
#endif
#endif
#endif

View file

@ -0,0 +1,298 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mdct.c 3 2005-06-02 18:16:43Z vspader $
**/
/*
* Fast (I)MDCT Implementation using (I)FFT ((Inverse) Fast Fourier Transform)
* and consists of three steps: pre-(I)FFT complex multiplication, complex
* (I)FFT, post-(I)FFT complex multiplication,
*
* As described in:
* P. Duhamel, Y. Mahieux, and J.P. Petit, "A Fast Algorithm for the
* Implementation of Filter Banks Based on 'Time Domain Aliasing
* Cancellation," IEEE Proc. on ICASSP91, 1991, pp. 2209-2212.
*
*
* As of April 6th 2002 completely rewritten.
* This (I)MDCT can now be used for any data size n, where n is divisible by 8.
*
*/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#ifdef _WIN32_WCE
#define assert(x)
#else
#include <assert.h>
#endif
#include "cfft.h"
#include "mdct.h"
#include "mdct_tab.h"
mdct_info *faad_mdct_init(uint16_t N)
{
mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info));
assert(N % 8 == 0);
mdct->N = N;
/* NOTE: For "small framelengths" in FIXED_POINT the coefficients need to be
* scaled by sqrt("(nearest power of 2) > N" / N) */
/* RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N));
* IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N)); */
/* scale is 1 for fixed point, sqrt(N) for floating point */
switch (N)
{
case 2048: mdct->sincos = (complex_t*)mdct_tab_2048; break;
case 256: mdct->sincos = (complex_t*)mdct_tab_256; break;
#ifdef LD_DEC
case 1024: mdct->sincos = (complex_t*)mdct_tab_1024; break;
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
case 1920: mdct->sincos = (complex_t*)mdct_tab_1920; break;
case 240: mdct->sincos = (complex_t*)mdct_tab_240; break;
#ifdef LD_DEC
case 960: mdct->sincos = (complex_t*)mdct_tab_960; break;
#endif
#endif
#ifdef SSR_DEC
case 512: mdct->sincos = (complex_t*)mdct_tab_512; break;
case 64: mdct->sincos = (complex_t*)mdct_tab_64; break;
#endif
}
/* initialise fft */
mdct->cfft = cffti(N/4);
#ifdef PROFILE
mdct->cycles = 0;
mdct->fft_cycles = 0;
#endif
return mdct;
}
void faad_mdct_end(mdct_info *mdct)
{
if (mdct != NULL)
{
#ifdef PROFILE
printf("MDCT[%.4d]: %I64d cycles\n", mdct->N, mdct->cycles);
printf("CFFT[%.4d]: %I64d cycles\n", mdct->N/4, mdct->fft_cycles);
#endif
cfftu(mdct->cfft);
faad_free(mdct);
}
}
void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
{
uint16_t k;
complex_t x;
#ifdef ALLOW_SMALL_FRAMELENGTH
#ifdef FIXED_POINT
real_t scale, b_scale = 0;
#endif
#endif
ALIGN complex_t Z1[512];
complex_t *sincos = mdct->sincos;
uint16_t N = mdct->N;
uint16_t N2 = N >> 1;
uint16_t N4 = N >> 2;
uint16_t N8 = N >> 3;
#ifdef PROFILE
int64_t count1, count2 = faad_get_ts();
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
#ifdef FIXED_POINT
/* detect non-power of 2 */
if (N & (N-1))
{
/* adjust scale for non-power of 2 MDCT */
/* 2048/1920 */
b_scale = 1;
scale = COEF_CONST(1.0666666666666667);
}
#endif
#endif
/* pre-IFFT complex multiplication */
for (k = 0; k < N4; k++)
{
ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
X_in[2*k], X_in[N2 - 1 - 2*k], RE(sincos[k]), IM(sincos[k]));
}
#ifdef PROFILE
count1 = faad_get_ts();
#endif
/* complex IFFT, any non-scaling FFT can be used here */
cfftb(mdct->cfft, Z1);
#ifdef PROFILE
count1 = faad_get_ts() - count1;
#endif
/* post-IFFT complex multiplication */
for (k = 0; k < N4; k++)
{
RE(x) = RE(Z1[k]);
IM(x) = IM(Z1[k]);
ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
IM(x), RE(x), RE(sincos[k]), IM(sincos[k]));
#ifdef ALLOW_SMALL_FRAMELENGTH
#ifdef FIXED_POINT
/* non-power of 2 MDCT scaling */
if (b_scale)
{
RE(Z1[k]) = MUL_C(RE(Z1[k]), scale);
IM(Z1[k]) = MUL_C(IM(Z1[k]), scale);
}
#endif
#endif
}
/* reordering */
for (k = 0; k < N8; k+=2)
{
X_out[ 2*k] = IM(Z1[N8 + k]);
X_out[ 2 + 2*k] = IM(Z1[N8 + 1 + k]);
X_out[ 1 + 2*k] = -RE(Z1[N8 - 1 - k]);
X_out[ 3 + 2*k] = -RE(Z1[N8 - 2 - k]);
X_out[N4 + 2*k] = RE(Z1[ k]);
X_out[N4 + + 2 + 2*k] = RE(Z1[ 1 + k]);
X_out[N4 + 1 + 2*k] = -IM(Z1[N4 - 1 - k]);
X_out[N4 + 3 + 2*k] = -IM(Z1[N4 - 2 - k]);
X_out[N2 + 2*k] = RE(Z1[N8 + k]);
X_out[N2 + + 2 + 2*k] = RE(Z1[N8 + 1 + k]);
X_out[N2 + 1 + 2*k] = -IM(Z1[N8 - 1 - k]);
X_out[N2 + 3 + 2*k] = -IM(Z1[N8 - 2 - k]);
X_out[N2 + N4 + 2*k] = -IM(Z1[ k]);
X_out[N2 + N4 + 2 + 2*k] = -IM(Z1[ 1 + k]);
X_out[N2 + N4 + 1 + 2*k] = RE(Z1[N4 - 1 - k]);
X_out[N2 + N4 + 3 + 2*k] = RE(Z1[N4 - 2 - k]);
}
#ifdef PROFILE
count2 = faad_get_ts() - count2;
mdct->fft_cycles += count1;
mdct->cycles += (count2 - count1);
#endif
}
#ifdef LTP_DEC
void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
{
uint16_t k;
complex_t x;
ALIGN complex_t Z1[512];
complex_t *sincos = mdct->sincos;
uint16_t N = mdct->N;
uint16_t N2 = N >> 1;
uint16_t N4 = N >> 2;
uint16_t N8 = N >> 3;
#ifndef FIXED_POINT
real_t scale = REAL_CONST(N);
#else
real_t scale = REAL_CONST(4.0/N);
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
#ifdef FIXED_POINT
/* detect non-power of 2 */
if (N & (N-1))
{
/* adjust scale for non-power of 2 MDCT */
/* *= sqrt(2048/1920) */
scale = MUL_C(scale, COEF_CONST(1.0327955589886444));
}
#endif
#endif
/* pre-FFT complex multiplication */
for (k = 0; k < N8; k++)
{
uint16_t n = k << 1;
RE(x) = X_in[N - N4 - 1 - n] + X_in[N - N4 + n];
IM(x) = X_in[ N4 + n] - X_in[ N4 - 1 - n];
ComplexMult(&RE(Z1[k]), &IM(Z1[k]),
RE(x), IM(x), RE(sincos[k]), IM(sincos[k]));
RE(Z1[k]) = MUL_R(RE(Z1[k]), scale);
IM(Z1[k]) = MUL_R(IM(Z1[k]), scale);
RE(x) = X_in[N2 - 1 - n] - X_in[ n];
IM(x) = X_in[N2 + n] + X_in[N - 1 - n];
ComplexMult(&RE(Z1[k + N8]), &IM(Z1[k + N8]),
RE(x), IM(x), RE(sincos[k + N8]), IM(sincos[k + N8]));
RE(Z1[k + N8]) = MUL_R(RE(Z1[k + N8]), scale);
IM(Z1[k + N8]) = MUL_R(IM(Z1[k + N8]), scale);
}
/* complex FFT, any non-scaling FFT can be used here */
cfftf(mdct->cfft, Z1);
/* post-FFT complex multiplication */
for (k = 0; k < N4; k++)
{
uint16_t n = k << 1;
ComplexMult(&RE(x), &IM(x),
RE(Z1[k]), IM(Z1[k]), RE(sincos[k]), IM(sincos[k]));
X_out[ n] = -RE(x);
X_out[N2 - 1 - n] = IM(x);
X_out[N2 + n] = -IM(x);
X_out[N - 1 - n] = RE(x);
}
}
#endif

View file

@ -0,0 +1,45 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mdct.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __MDCT_H__
#define __MDCT_H__
#ifdef __cplusplus
extern "C" {
#endif
mdct_info *faad_mdct_init(uint16_t N);
void faad_mdct_end(mdct_info *mdct);
void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,299 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mp4.c 3 2005-06-02 18:16:43Z vspader $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include "bits.h"
#include "mp4.h"
#include "syntax.h"
/* defines if an object type can be decoded by this library or not */
static uint8_t ObjectTypesTable[32] = {
0, /* 0 NULL */
#ifdef MAIN_DEC
1, /* 1 AAC Main */
#else
0, /* 1 AAC Main */
#endif
1, /* 2 AAC LC */
#ifdef SSR_DEC
1, /* 3 AAC SSR */
#else
0, /* 3 AAC SSR */
#endif
#ifdef LTP_DEC
1, /* 4 AAC LTP */
#else
0, /* 4 AAC LTP */
#endif
#ifdef SBR_DEC
1, /* 5 SBR */
#else
0, /* 5 SBR */
#endif
#ifdef SCALABLE_DEC
1, /* 6 AAC Scalable */
#else
0, /* 6 AAC Scalable */
#endif
0, /* 7 TwinVQ */
0, /* 8 CELP */
0, /* 9 HVXC */
0, /* 10 Reserved */
0, /* 11 Reserved */
0, /* 12 TTSI */
0, /* 13 Main synthetic */
0, /* 14 Wavetable synthesis */
0, /* 15 General MIDI */
0, /* 16 Algorithmic Synthesis and Audio FX */
/* MPEG-4 Version 2 */
#ifdef ERROR_RESILIENCE
1, /* 17 ER AAC LC */
0, /* 18 (Reserved) */
#ifdef LTP_DEC
1, /* 19 ER AAC LTP */
#else
0, /* 19 ER AAC LTP */
#endif
#ifdef SCALABLE_DEC
1, /* 20 ER AAC scalable */
#else
0, /* 20 ER AAC scalable */
#endif
0, /* 21 ER TwinVQ */
0, /* 22 ER BSAC */
#ifdef LD_DEC
1, /* 23 ER AAC LD */
#else
0, /* 23 ER AAC LD */
#endif
0, /* 24 ER CELP */
0, /* 25 ER HVXC */
0, /* 26 ER HILN */
0, /* 27 ER Parametric */
#else /* No ER defined */
0, /* 17 ER AAC LC */
0, /* 18 (Reserved) */
0, /* 19 ER AAC LTP */
0, /* 20 ER AAC scalable */
0, /* 21 ER TwinVQ */
0, /* 22 ER BSAC */
0, /* 23 ER AAC LD */
0, /* 24 ER CELP */
0, /* 25 ER HVXC */
0, /* 26 ER HILN */
0, /* 27 ER Parametric */
#endif
0, /* 28 (Reserved) */
0, /* 29 (Reserved) */
0, /* 30 (Reserved) */
0 /* 31 (Reserved) */
};
/* Table 1.6.1 */
int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer,
uint32_t buffer_size,
mp4AudioSpecificConfig *mp4ASC)
{
return AudioSpecificConfig2(pBuffer, buffer_size, mp4ASC, NULL);
}
int8_t AudioSpecificConfig2(uint8_t *pBuffer,
uint32_t buffer_size,
mp4AudioSpecificConfig *mp4ASC,
program_config *pce)
{
bitfile ld;
int8_t result = 0;
#ifdef SBR_DEC
int8_t bits_to_decode = 0;
#endif
if (pBuffer == NULL)
return -7;
if (mp4ASC == NULL)
return -8;
memset(mp4ASC, 0, sizeof(mp4AudioSpecificConfig));
faad_initbits(&ld, pBuffer, buffer_size);
faad_byte_align(&ld);
mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5
DEBUGVAR(1,1,"parse_audio_decoder_specific_info(): ObjectTypeIndex"));
mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
DEBUGVAR(1,2,"parse_audio_decoder_specific_info(): SamplingFrequencyIndex"));
mp4ASC->channelsConfiguration = (uint8_t)faad_getbits(&ld, 4
DEBUGVAR(1,3,"parse_audio_decoder_specific_info(): ChannelsConfiguration"));
mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
if (ObjectTypesTable[mp4ASC->objectTypeIndex] != 1)
{
faad_endbits(&ld);
return -1;
}
if (mp4ASC->samplingFrequency == 0)
{
faad_endbits(&ld);
return -2;
}
if (mp4ASC->channelsConfiguration > 7)
{
faad_endbits(&ld);
return -3;
}
#if (defined(PS_DEC) || defined(DRM_PS))
/* check if we have a mono file */
if (mp4ASC->channelsConfiguration == 1)
{
/* upMatrix to 2 channels for implicit signalling of PS */
mp4ASC->channelsConfiguration = 2;
}
#endif
#ifdef SBR_DEC
mp4ASC->sbr_present_flag = -1;
if (mp4ASC->objectTypeIndex == 5)
{
uint8_t tmp;
mp4ASC->sbr_present_flag = 1;
tmp = (uint8_t)faad_getbits(&ld, 4
DEBUGVAR(1,5,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
/* check for downsampled SBR */
if (tmp == mp4ASC->samplingFrequencyIndex)
mp4ASC->downSampledSBR = 1;
mp4ASC->samplingFrequencyIndex = tmp;
if (mp4ASC->samplingFrequencyIndex == 15)
{
mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
DEBUGVAR(1,6,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
} else {
mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
}
mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5
DEBUGVAR(1,7,"parse_audio_decoder_specific_info(): ObjectTypeIndex"));
}
#endif
/* get GASpecificConfig */
if (mp4ASC->objectTypeIndex == 1 || mp4ASC->objectTypeIndex == 2 ||
mp4ASC->objectTypeIndex == 3 || mp4ASC->objectTypeIndex == 4 ||
mp4ASC->objectTypeIndex == 6 || mp4ASC->objectTypeIndex == 7)
{
result = GASpecificConfig(&ld, mp4ASC, pce);
#ifdef ERROR_RESILIENCE
} else if (mp4ASC->objectTypeIndex >= ER_OBJECT_START) { /* ER */
result = GASpecificConfig(&ld, mp4ASC, pce);
mp4ASC->epConfig = (uint8_t)faad_getbits(&ld, 2
DEBUGVAR(1,143,"parse_audio_decoder_specific_info(): epConfig"));
if (mp4ASC->epConfig != 0)
result = -5;
#endif
} else {
result = -4;
}
#ifdef SSR_DEC
/* shorter frames not allowed for SSR */
if ((mp4ASC->objectTypeIndex == 4) && mp4ASC->frameLengthFlag)
return -6;
#endif
#ifdef SBR_DEC
bits_to_decode = (int8_t)(buffer_size*8 - faad_get_processed_bits(&ld));
if ((mp4ASC->objectTypeIndex != 5) && (bits_to_decode >= 16))
{
int16_t syncExtensionType = (int16_t)faad_getbits(&ld, 11
DEBUGVAR(1,9,"parse_audio_decoder_specific_info(): syncExtensionType"));
if (syncExtensionType == 0x2b7)
{
mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5
DEBUGVAR(1,10,"parse_audio_decoder_specific_info(): extensionAudioObjectType"));
if (mp4ASC->objectTypeIndex == 5)
{
mp4ASC->sbr_present_flag = (uint8_t)faad_get1bit(&ld
DEBUGVAR(1,11,"parse_audio_decoder_specific_info(): sbr_present_flag"));
if (mp4ASC->sbr_present_flag)
{
uint8_t tmp;
tmp = (uint8_t)faad_getbits(&ld, 4
DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
/* check for downsampled SBR */
if (tmp == mp4ASC->samplingFrequencyIndex)
mp4ASC->downSampledSBR = 1;
mp4ASC->samplingFrequencyIndex = tmp;
if (mp4ASC->samplingFrequencyIndex == 15)
{
mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
DEBUGVAR(1,13,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
} else {
mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
}
}
}
}
}
/* no SBR signalled, this could mean either implicit signalling or no SBR in this file */
/* MPEG specification states: assume SBR on files with samplerate <= 24000 Hz */
if (mp4ASC->sbr_present_flag == -1)
{
if (mp4ASC->samplingFrequency <= 24000)
{
mp4ASC->samplingFrequency *= 2;
mp4ASC->forceUpSampling = 1;
} else /* > 24000*/ {
mp4ASC->downSampledSBR = 1;
}
}
#endif
faad_endbits(&ld);
return result;
}

View file

@ -0,0 +1,49 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mp4.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __MP4_H__
#define __MP4_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "decoder.h"
int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer,
uint32_t buffer_size,
mp4AudioSpecificConfig *mp4ASC);
int8_t AudioSpecificConfig2(uint8_t *pBuffer,
uint32_t buffer_size,
mp4AudioSpecificConfig *mp4ASC,
program_config *pce);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,74 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: ms.c 3 2005-06-02 18:16:43Z vspader $
**/
#include "common.h"
#include "structs.h"
#include "syntax.h"
#include "ms.h"
#include "is.h"
#include "pns.h"
void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
uint16_t frame_len)
{
uint8_t g, b, sfb;
uint8_t group = 0;
uint16_t nshort = frame_len/8;
uint16_t i, k;
real_t tmp;
if (ics->ms_mask_present >= 1)
{
for (g = 0; g < ics->num_window_groups; g++)
{
for (b = 0; b < ics->window_group_length[g]; b++)
{
for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
/* If intensity stereo coding or noise substitution is on
for a particular scalefactor band, no M/S stereo decoding
is carried out.
*/
if ((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) &&
!is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb))
{
for (i = ics->swb_offset[sfb]; i < ics->swb_offset[sfb+1]; i++)
{
k = (group*nshort) + i;
tmp = l_spec[k] - r_spec[k];
l_spec[k] = l_spec[k] + r_spec[k];
r_spec[k] = tmp;
}
}
}
group++;
}
}
}
}

View file

@ -0,0 +1,41 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: ms.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __MS_H__
#define __MS_H__
#ifdef __cplusplus
extern "C" {
#endif
void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
uint16_t frame_len);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,557 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: output.c 3 2005-06-02 18:16:43Z vspader $
**/
#include "common.h"
#include "structs.h"
#include "output.h"
#include "decoder.h"
#ifndef FIXED_POINT
#define FLOAT_SCALE (1.0f/(1<<15))
#define DM_MUL REAL_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2))
#define RSQRT2 REAL_CONST(0.7071067811865475244) // 1/sqrt(2)
static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample,
uint8_t down_matrix, uint8_t *internal_channel)
{
if (!down_matrix)
return input[internal_channel[channel]][sample];
if (channel == 0)
{
return DM_MUL * (input[internal_channel[1]][sample] +
input[internal_channel[0]][sample] * RSQRT2 +
input[internal_channel[3]][sample] * RSQRT2);
} else {
return DM_MUL * (input[internal_channel[2]][sample] +
input[internal_channel[0]][sample] * RSQRT2 +
input[internal_channel[4]][sample] * RSQRT2);
}
}
#ifndef HAS_LRINTF
#define CLIP(sample, max, min) \
if (sample >= 0.0f) \
{ \
sample += 0.5f; \
if (sample >= max) \
sample = max; \
} else { \
sample += -0.5f; \
if (sample <= min) \
sample = min; \
}
#else
#define CLIP(sample, max, min) \
if (sample >= 0.0f) \
{ \
if (sample >= max) \
sample = max; \
} else { \
if (sample <= min) \
sample = min; \
}
#endif
#define CONV(a,b) ((a<<1)|(b&0x1))
static void to_PCM_16bit(NeAACDecHandle hDecoder, real_t **input,
uint8_t channels, uint16_t frame_len,
int16_t **sample_buffer)
{
uint8_t ch, ch1;
uint16_t i;
switch (CONV(channels,hDecoder->downMatrix))
{
case CONV(1,0):
case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
CLIP(inp, 32767.0f, -32768.0f);
(*sample_buffer)[i] = (int16_t)lrintf(inp);
}
break;
case CONV(2,0):
if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch][i];
CLIP(inp0, 32767.0f, -32768.0f);
(*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp0);
}
} else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch ][i];
real_t inp1 = input[ch1][i];
CLIP(inp0, 32767.0f, -32768.0f);
CLIP(inp1, 32767.0f, -32768.0f);
(*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1);
}
}
break;
default:
for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
CLIP(inp, 32767.0f, -32768.0f);
(*sample_buffer)[(i*channels)+ch] = (int16_t)lrintf(inp);
}
}
break;
}
}
static void to_PCM_24bit(NeAACDecHandle hDecoder, real_t **input,
uint8_t channels, uint16_t frame_len,
int32_t **sample_buffer)
{
uint8_t ch, ch1;
uint16_t i;
switch (CONV(channels,hDecoder->downMatrix))
{
case CONV(1,0):
case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
inp *= 256.0f;
CLIP(inp, 8388607.0f, -8388608.0f);
(*sample_buffer)[i] = (int32_t)lrintf(inp);
}
break;
case CONV(2,0):
if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch][i];
inp0 *= 256.0f;
CLIP(inp0, 8388607.0f, -8388608.0f);
(*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
}
} else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch ][i];
real_t inp1 = input[ch1][i];
inp0 *= 256.0f;
inp1 *= 256.0f;
CLIP(inp0, 8388607.0f, -8388608.0f);
CLIP(inp1, 8388607.0f, -8388608.0f);
(*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
}
}
break;
default:
for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
inp *= 256.0f;
CLIP(inp, 8388607.0f, -8388608.0f);
(*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
}
}
break;
}
}
static void to_PCM_32bit(NeAACDecHandle hDecoder, real_t **input,
uint8_t channels, uint16_t frame_len,
int32_t **sample_buffer)
{
uint8_t ch, ch1;
uint16_t i;
switch (CONV(channels,hDecoder->downMatrix))
{
case CONV(1,0):
case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
inp *= 65536.0f;
CLIP(inp, 2147483647.0f, -2147483648.0f);
(*sample_buffer)[i] = (int32_t)lrintf(inp);
}
break;
case CONV(2,0):
if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch][i];
inp0 *= 65536.0f;
CLIP(inp0, 2147483647.0f, -2147483648.0f);
(*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
}
} else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch ][i];
real_t inp1 = input[ch1][i];
inp0 *= 65536.0f;
inp1 *= 65536.0f;
CLIP(inp0, 2147483647.0f, -2147483648.0f);
CLIP(inp1, 2147483647.0f, -2147483648.0f);
(*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
}
}
break;
default:
for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
inp *= 65536.0f;
CLIP(inp, 2147483647.0f, -2147483648.0f);
(*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
}
}
break;
}
}
static void to_PCM_float(NeAACDecHandle hDecoder, real_t **input,
uint8_t channels, uint16_t frame_len,
float32_t **sample_buffer)
{
uint8_t ch, ch1;
uint16_t i;
switch (CONV(channels,hDecoder->downMatrix))
{
case CONV(1,0):
case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
(*sample_buffer)[i] = inp*FLOAT_SCALE;
}
break;
case CONV(2,0):
if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch][i];
(*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
(*sample_buffer)[(i*2)+1] = inp0*FLOAT_SCALE;
}
} else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch ][i];
real_t inp1 = input[ch1][i];
(*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
(*sample_buffer)[(i*2)+1] = inp1*FLOAT_SCALE;
}
}
break;
default:
for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
(*sample_buffer)[(i*channels)+ch] = inp*FLOAT_SCALE;
}
}
break;
}
}
static void to_PCM_double(NeAACDecHandle hDecoder, real_t **input,
uint8_t channels, uint16_t frame_len,
double **sample_buffer)
{
uint8_t ch, ch1;
uint16_t i;
switch (CONV(channels,hDecoder->downMatrix))
{
case CONV(1,0):
case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
(*sample_buffer)[i] = (double)inp*FLOAT_SCALE;
}
break;
case CONV(2,0):
if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch][i];
(*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
(*sample_buffer)[(i*2)+1] = (double)inp0*FLOAT_SCALE;
}
} else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch ][i];
real_t inp1 = input[ch1][i];
(*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
(*sample_buffer)[(i*2)+1] = (double)inp1*FLOAT_SCALE;
}
}
break;
default:
for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
(*sample_buffer)[(i*channels)+ch] = (double)inp*FLOAT_SCALE;
}
}
break;
}
}
void *output_to_PCM(NeAACDecHandle hDecoder,
real_t **input, void *sample_buffer, uint8_t channels,
uint16_t frame_len, uint8_t format)
{
int16_t *short_sample_buffer = (int16_t*)sample_buffer;
int32_t *int_sample_buffer = (int32_t*)sample_buffer;
float32_t *float_sample_buffer = (float32_t*)sample_buffer;
double *double_sample_buffer = (double*)sample_buffer;
#ifdef PROFILE
int64_t count = faad_get_ts();
#endif
/* Copy output to a standard PCM buffer */
switch (format)
{
case FAAD_FMT_16BIT:
to_PCM_16bit(hDecoder, input, channels, frame_len, &short_sample_buffer);
break;
case FAAD_FMT_24BIT:
to_PCM_24bit(hDecoder, input, channels, frame_len, &int_sample_buffer);
break;
case FAAD_FMT_32BIT:
to_PCM_32bit(hDecoder, input, channels, frame_len, &int_sample_buffer);
break;
case FAAD_FMT_FLOAT:
to_PCM_float(hDecoder, input, channels, frame_len, &float_sample_buffer);
break;
case FAAD_FMT_DOUBLE:
to_PCM_double(hDecoder, input, channels, frame_len, &double_sample_buffer);
break;
}
#ifdef PROFILE
count = faad_get_ts() - count;
hDecoder->output_cycles += count;
#endif
return sample_buffer;
}
#else
#define DM_MUL FRAC_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2))
#define RSQRT2 FRAC_CONST(0.7071067811865475244) // 1/sqrt(2)
static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample,
uint8_t down_matrix, uint8_t up_matrix,
uint8_t *internal_channel)
{
if (up_matrix == 1)
return input[internal_channel[0]][sample];
if (!down_matrix)
return input[internal_channel[channel]][sample];
if (channel == 0)
{
real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2);
real_t L_S = MUL_F(input[internal_channel[3]][sample], RSQRT2);
real_t cum = input[internal_channel[1]][sample] + C + L_S;
return MUL_F(cum, DM_MUL);
} else {
real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2);
real_t R_S = MUL_F(input[internal_channel[4]][sample], RSQRT2);
real_t cum = input[internal_channel[2]][sample] + C + R_S;
return MUL_F(cum, DM_MUL);
}
}
void* output_to_PCM(NeAACDecHandle hDecoder,
real_t **input, void *sample_buffer, uint8_t channels,
uint16_t frame_len, uint8_t format)
{
uint8_t ch;
uint16_t i;
int16_t *short_sample_buffer = (int16_t*)sample_buffer;
int32_t *int_sample_buffer = (int32_t*)sample_buffer;
/* Copy output to a standard PCM buffer */
for (ch = 0; ch < channels; ch++)
{
switch (format)
{
case FAAD_FMT_16BIT:
for(i = 0; i < frame_len; i++)
{
int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
hDecoder->internal_channel);
if (tmp >= 0)
{
tmp += (1 << (REAL_BITS-1));
if (tmp >= REAL_CONST(32767))
{
tmp = REAL_CONST(32767);
}
} else {
tmp += -(1 << (REAL_BITS-1));
if (tmp <= REAL_CONST(-32768))
{
tmp = REAL_CONST(-32768);
}
}
tmp >>= REAL_BITS;
short_sample_buffer[(i*channels)+ch] = (int16_t)tmp;
}
break;
case FAAD_FMT_24BIT:
for(i = 0; i < frame_len; i++)
{
int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
hDecoder->internal_channel);
if (tmp >= 0)
{
tmp += (1 << (REAL_BITS-9));
tmp >>= (REAL_BITS-8);
if (tmp >= 8388607)
{
tmp = 8388607;
}
} else {
tmp += -(1 << (REAL_BITS-9));
tmp >>= (REAL_BITS-8);
if (tmp <= -8388608)
{
tmp = -8388608;
}
}
int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
}
break;
case FAAD_FMT_32BIT:
for(i = 0; i < frame_len; i++)
{
int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
hDecoder->internal_channel);
if (tmp >= 0)
{
tmp += (1 << (16-REAL_BITS-1));
tmp <<= (16-REAL_BITS);
} else {
tmp += -(1 << (16-REAL_BITS-1));
tmp <<= (16-REAL_BITS);
}
int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
}
break;
case FAAD_FMT_FIXED:
for(i = 0; i < frame_len; i++)
{
real_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
hDecoder->internal_channel);
int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
}
break;
}
}
return sample_buffer;
}
#endif

View file

@ -0,0 +1,45 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: output.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __OUTPUT_H__
#define __OUTPUT_H__
#ifdef __cplusplus
extern "C" {
#endif
void* output_to_PCM(NeAACDecHandle hDecoder,
real_t **input,
void *samplebuffer,
uint8_t channels,
uint16_t frame_len,
uint8_t format);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,265 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: pns.c 3 2005-06-02 18:16:43Z vspader $
**/
#include "common.h"
#include "structs.h"
#include "pns.h"
/* static function declarations */
static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size,
uint8_t sub);
#ifdef FIXED_POINT
#define DIV(A, B) (((int64_t)A << REAL_BITS)/B)
#define step(shift) \
if ((0x40000000l >> shift) + root <= value) \
{ \
value -= (0x40000000l >> shift) + root; \
root = (root >> 1) | (0x40000000l >> shift); \
} else { \
root = root >> 1; \
}
/* fixed point square root approximation */
/* !!!! ONLY WORKS FOR EVEN %REAL_BITS% !!!! */
real_t fp_sqrt(real_t value)
{
real_t root = 0;
step( 0); step( 2); step( 4); step( 6);
step( 8); step(10); step(12); step(14);
step(16); step(18); step(20); step(22);
step(24); step(26); step(28); step(30);
if (root < value)
++root;
root <<= (REAL_BITS/2);
return root;
}
static real_t pow2_table[] =
{
COEF_CONST(1.0),
COEF_CONST(1.18920711500272),
COEF_CONST(1.41421356237310),
COEF_CONST(1.68179283050743)
};
#endif
/* The function gen_rand_vector(addr, size) generates a vector of length
<size> with signed random values of average energy MEAN_NRG per random
value. A suitable random number generator can be realized using one
multiplication/accumulation per random value.
*/
static INLINE void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size,
uint8_t sub)
{
#ifndef FIXED_POINT
uint16_t i;
real_t energy = 0.0;
real_t scale = (real_t)1.0/(real_t)size;
for (i = 0; i < size; i++)
{
real_t tmp = scale*(real_t)(int32_t)random_int();
spec[i] = tmp;
energy += tmp*tmp;
}
scale = (real_t)1.0/(real_t)sqrt(energy);
scale *= (real_t)pow(2.0, 0.25 * scale_factor);
for (i = 0; i < size; i++)
{
spec[i] *= scale;
}
#else
uint16_t i;
real_t energy = 0, scale;
int32_t exp, frac;
for (i = 0; i < size; i++)
{
/* this can be replaced by a 16 bit random generator!!!! */
real_t tmp = (int32_t)random_int();
if (tmp < 0)
tmp = -(tmp & ((1<<(REAL_BITS-1))-1));
else
tmp = (tmp & ((1<<(REAL_BITS-1))-1));
energy += MUL_R(tmp,tmp);
spec[i] = tmp;
}
energy = fp_sqrt(energy);
if (energy > 0)
{
scale = DIV(REAL_CONST(1),energy);
exp = scale_factor >> 2;
frac = scale_factor & 3;
/* IMDCT pre-scaling */
exp -= sub;
if (exp < 0)
scale >>= -exp;
else
scale <<= exp;
if (frac)
scale = MUL_C(scale, pow2_table[frac]);
for (i = 0; i < size; i++)
{
spec[i] = MUL_R(spec[i], scale);
}
}
#endif
}
void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
real_t *spec_left, real_t *spec_right, uint16_t frame_len,
uint8_t channel_pair, uint8_t object_type)
{
uint8_t g, sfb, b;
uint16_t size, offs;
uint8_t group = 0;
uint16_t nshort = frame_len >> 3;
uint8_t sub = 0;
#ifdef FIXED_POINT
/* IMDCT scaling */
if (object_type == LD)
{
sub = 9 /*9*/;
} else {
if (ics_left->window_sequence == EIGHT_SHORT_SEQUENCE)
sub = 7 /*7*/;
else
sub = 10 /*10*/;
}
#endif
for (g = 0; g < ics_left->num_window_groups; g++)
{
/* Do perceptual noise substitution decoding */
for (b = 0; b < ics_left->window_group_length[g]; b++)
{
for (sfb = 0; sfb < ics_left->max_sfb; sfb++)
{
if (is_noise(ics_left, g, sfb))
{
#ifdef LTP_DEC
/* Simultaneous use of LTP and PNS is not prevented in the
syntax. If both LTP, and PNS are enabled on the same
scalefactor band, PNS takes precedence, and no prediction
is applied to this band.
*/
ics_left->ltp.long_used[sfb] = 0;
ics_left->ltp2.long_used[sfb] = 0;
#endif
#ifdef MAIN_DEC
/* For scalefactor bands coded using PNS the corresponding
predictors are switched to "off".
*/
ics_left->pred.prediction_used[sfb] = 0;
#endif
offs = ics_left->swb_offset[sfb];
size = ics_left->swb_offset[sfb+1] - offs;
/* Generate random vector */
gen_rand_vector(&spec_left[(group*nshort)+offs],
ics_left->scale_factors[g][sfb], size, sub);
}
/* From the spec:
If the same scalefactor band and group is coded by perceptual noise
substitution in both channels of a channel pair, the correlation of
the noise signal can be controlled by means of the ms_used field: While
the default noise generation process works independently for each channel
(separate generation of random vectors), the same random vector is used
for both channels if ms_used[] is set for a particular scalefactor band
and group. In this case, no M/S stereo coding is carried out (because M/S
stereo coding and noise substitution coding are mutually exclusive).
If the same scalefactor band and group is coded by perceptual noise
substitution in only one channel of a channel pair the setting of ms_used[]
is not evaluated.
*/
if (channel_pair)
{
if (is_noise(ics_right, g, sfb))
{
if (((ics_left->ms_mask_present == 1) &&
(ics_left->ms_used[g][sfb])) ||
(ics_left->ms_mask_present == 2))
{
uint16_t c;
offs = ics_right->swb_offset[sfb];
size = ics_right->swb_offset[sfb+1] - offs;
for (c = 0; c < size; c++)
{
spec_right[(group*nshort) + offs + c] =
spec_left[(group*nshort) + offs + c];
}
} else /*if (ics_left->ms_mask_present == 0)*/ {
#ifdef LTP_DEC
ics_right->ltp.long_used[sfb] = 0;
ics_right->ltp2.long_used[sfb] = 0;
#endif
#ifdef MAIN_DEC
ics_right->pred.prediction_used[sfb] = 0;
#endif
offs = ics_right->swb_offset[sfb];
size = ics_right->swb_offset[sfb+1] - offs;
/* Generate random vector */
gen_rand_vector(&spec_right[(group*nshort)+offs],
ics_right->scale_factors[g][sfb], size, sub);
}
}
}
} /* sfb */
group++;
} /* b */
} /* g */
}

View file

@ -0,0 +1,53 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: pns.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __PNS_H__
#define __PNS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "syntax.h"
#define NOISE_OFFSET 90
void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
real_t *spec_left, real_t *spec_right, uint16_t frame_len,
uint8_t channel_pair, uint8_t object_type);
static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb)
{
if (ics->sfb_cb[group][sfb] == NOISE_HCB)
return 1;
return 0;
}
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,148 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: ps_dec.h 3 2005-06-02 18:16:43Z vspader $
**/
#ifndef __PS_DEC_H__
#define __PS_DEC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "bits.h"
#define EXTENSION_ID_PS 2
#define MAX_PS_ENVELOPES 5
#define NO_ALLPASS_LINKS 3
typedef struct
{
/* bitstream parameters */
uint8_t enable_iid;
uint8_t enable_icc;
uint8_t enable_ext;
uint8_t iid_mode;
uint8_t icc_mode;
uint8_t nr_iid_par;
uint8_t nr_ipdopd_par;
uint8_t nr_icc_par;
uint8_t frame_class;
uint8_t num_env;
uint8_t border_position[MAX_PS_ENVELOPES+1];
uint8_t iid_dt[MAX_PS_ENVELOPES];
uint8_t icc_dt[MAX_PS_ENVELOPES];
uint8_t enable_ipdopd;
uint8_t ipd_mode;
uint8_t ipd_dt[MAX_PS_ENVELOPES];
uint8_t opd_dt[MAX_PS_ENVELOPES];
/* indices */
int8_t iid_index_prev[34];
int8_t icc_index_prev[34];
int8_t ipd_index_prev[17];
int8_t opd_index_prev[17];
int8_t iid_index[MAX_PS_ENVELOPES][34];
int8_t icc_index[MAX_PS_ENVELOPES][34];
int8_t ipd_index[MAX_PS_ENVELOPES][17];
int8_t opd_index[MAX_PS_ENVELOPES][17];
int8_t ipd_index_1[17];
int8_t opd_index_1[17];
int8_t ipd_index_2[17];
int8_t opd_index_2[17];
/* ps data was correctly read */
uint8_t ps_data_available;
/* a header has been read */
uint8_t header_read;
/* hybrid filterbank parameters */
void *hyb;
uint8_t use34hybrid_bands;
/**/
uint8_t num_groups;
uint8_t num_hybrid_groups;
uint8_t nr_par_bands;
uint8_t nr_allpass_bands;
uint8_t decay_cutoff;
uint8_t *group_border;
uint16_t *map_group2bk;
/* filter delay handling */
uint8_t saved_delay;
uint8_t delay_buf_index_ser[NO_ALLPASS_LINKS];
uint8_t num_sample_delay_ser[NO_ALLPASS_LINKS];
uint8_t delay_D[64];
uint8_t delay_buf_index_delay[64];
complex_t delay_Qmf[14][64]; /* 14 samples delay max, 64 QMF channels */
complex_t delay_SubQmf[2][32]; /* 2 samples delay max (SubQmf is always allpass filtered) */
complex_t delay_Qmf_ser[NO_ALLPASS_LINKS][5][64]; /* 5 samples delay max (table 8.34), 64 QMF channels */
complex_t delay_SubQmf_ser[NO_ALLPASS_LINKS][5][32]; /* 5 samples delay max (table 8.34) */
/* transients */
real_t alpha_decay;
real_t alpha_smooth;
real_t P_PeakDecayNrg[34];
real_t P_prev[34];
real_t P_SmoothPeakDecayDiffNrg_prev[34];
/* mixing and phase */
complex_t h11_prev[50];
complex_t h12_prev[50];
complex_t h21_prev[50];
complex_t h22_prev[50];
uint8_t phase_hist;
complex_t ipd_prev[20][2];
complex_t opd_prev[20][2];
} ps_info;
/* ps_syntax.c */
uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header);
/* ps_dec.c */
ps_info *ps_init(uint8_t sr_index);
void ps_free(ps_info *ps);
uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]);
#ifdef __cplusplus
}
#endif
#endif

Some files were not shown because too many files have changed in this diff Show more