summaryrefslogtreecommitdiff
Diffstat
-rw-r--r--Android.mk1
-rwxr-xr-xamadec/Android.mk282
-rw-r--r--amadec/acodec_lib_50/libstagefright_soft_dcvdec.so80
-rw-r--r--amadec/acodec_lib_50/libstagefright_soft_dtshd.so85
-rw-r--r--amadec/acodec_lib_50/libstagefright_soft_truehddec.so41
-rw-r--r--amadec/acodec_lib_android_n/libstagefright_soft_dcvdec.so109
-rw-r--r--amadec/acodec_lib_android_n/libstagefright_soft_dtshd.so272
-rw-r--r--amadec/acodec_lib_android_n/libstagefright_soft_truehddec.so87
-rwxr-xr-xamadec/acodec_lib_mx/libstagefright_soft_ddpdec.so113
-rwxr-xr-xamadec/acodec_lib_mx/libstagefright_soft_dtshd.so121
-rw-r--r--amadec/adec-armdec-mgt.h57
-rw-r--r--amadec/adec-external-ctrl.c899
-rw-r--r--amadec/adec-ffmpeg-mgt.c1550
-rw-r--r--amadec/adec-internal-mgt.c772
-rw-r--r--amadec/adec-message.c156
-rw-r--r--amadec/adec-message.h61
-rwxr-xr-xamadec/adec-pts-mgt.c1107
-rw-r--r--amadec/adec-pts-mgt.h82
-rw-r--r--amadec/adec-wfd-out.cpp361
-rw-r--r--amadec/adec-wfd.c811
-rw-r--r--amadec/adec_omx_brige.c284
-rw-r--r--amadec/adec_omx_brige.h56
-rw-r--r--amadec/adec_read.c200
-rw-r--r--amadec/adec_reg.h76
-rw-r--r--amadec/adec_write.c189
-rw-r--r--amadec/adec_write.h42
-rw-r--r--amadec/audio-dec.h314
-rw-r--r--amadec/audio_out/alsa-out.c1082
-rw-r--r--amadec/audio_out/aml_resample.c708
-rw-r--r--amadec/audio_out/aml_resample.h86
-rwxr-xr-xamadec/audio_out/android-out.cpp1640
-rw-r--r--amadec/audiodsp_update_format.c188
-rw-r--r--amadec/dsp/audiodsp-ctl.c471
-rw-r--r--amadec/dts_enc.c209
-rw-r--r--amadec/dts_enc.h11
-rw-r--r--amadec/dts_transenc_api.c143
-rw-r--r--amadec/dts_transenc_api.h19
-rw-r--r--amadec/feeder.c231
-rw-r--r--amadec/feeder.h26
-rw-r--r--amadec/include/adec-external-ctrl.h63
-rwxr-xr-xamadec/include/adec-macros.h41
-rw-r--r--amadec/include/adec-types.h53
-rwxr-xr-xamadec/include/alsa-out.h26
-rw-r--r--amadec/include/audio-out.h41
-rw-r--r--amadec/include/audiodsp.h142
-rw-r--r--amadec/include/audiodsp_update_format.h25
-rw-r--r--amadec/include/log-print.h26
-rwxr-xr-xamadec/omx_audio/ALAC_mediasource.cpp205
-rw-r--r--amadec/omx_audio/ALAC_mediasource.h62
-rwxr-xr-xamadec/omx_audio/ASF_mediasource.cpp184
-rw-r--r--amadec/omx_audio/ASF_mediasource.h127
-rwxr-xr-xamadec/omx_audio/Android.mk34
-rwxr-xr-xamadec/omx_audio/DDP_mediasource.cpp528
-rw-r--r--amadec/omx_audio/DDP_mediasource.h141
-rw-r--r--amadec/omx_audio/DTSHD_mediasource.cpp316
-rw-r--r--amadec/omx_audio/DTSHD_mediasource.h74
-rwxr-xr-xamadec/omx_audio/MP3_mediasource.cpp579
-rw-r--r--amadec/omx_audio/MP3_mediasource.h80
-rw-r--r--amadec/omx_audio/THD_mediasource.cpp229
-rw-r--r--amadec/omx_audio/THD_mediasource.h74
-rwxr-xr-xamadec/omx_audio/Vorbis_mediasource.cpp245
-rw-r--r--amadec/omx_audio/Vorbis_mediasource.h58
-rw-r--r--amadec/omx_audio/adec_omx.cpp421
-rw-r--r--amadec/omx_audio/adec_omx.h71
-rwxr-xr-xamadec/omx_audio/audio_mediasource.cpp37
-rw-r--r--amadec/omx_audio/audio_mediasource.h46
-rw-r--r--amadec/omx_audio/audio_medissource.h137
-rw-r--r--amadec/pcmenc_api.c147
-rw-r--r--amadec/pcmenc_api.h25
-rw-r--r--amadec/spdif_api.c306
-rw-r--r--amadec/spdif_api.h26
-rwxr-xr-xaudio_codec/Android.mk1
-rw-r--r--audio_codec/config.mk10
-rwxr-xr-xaudio_codec/libadpcm/Android.mk12
-rw-r--r--audio_codec/libadpcm/adpcm.h346
-rw-r--r--audio_codec/libadpcm/adpcm_decode.c841
-rwxr-xr-xaudio_codec/libamr/Android.mk25
-rwxr-xr-xaudio_codec/libamr/Makefile5
-rw-r--r--audio_codec/libamr/amr_decode.c186
-rw-r--r--audio_codec/libamr/amr_decode.h8
-rwxr-xr-xaudio_codec/libamr/dec.h18
-rw-r--r--audio_codec/libamr/dec_acelp.c620
-rwxr-xr-xaudio_codec/libamr/dec_acelp.h17
-rw-r--r--audio_codec/libamr/dec_dtx.c683
-rw-r--r--audio_codec/libamr/dec_dtx.h49
-rw-r--r--audio_codec/libamr/dec_gain.c853
-rw-r--r--audio_codec/libamr/dec_gain.h28
-rw-r--r--audio_codec/libamr/dec_if.c834
-rwxr-xr-xaudio_codec/libamr/dec_if.h23
-rw-r--r--audio_codec/libamr/dec_lpc.c789
-rw-r--r--audio_codec/libamr/dec_lpc.h25
-rw-r--r--audio_codec/libamr/dec_main.c842
-rw-r--r--audio_codec/libamr/dec_main.h57
-rw-r--r--audio_codec/libamr/dec_rom.c2114
-rw-r--r--audio_codec/libamr/dec_util.c1304
-rw-r--r--audio_codec/libamr/dec_util.h33
-rw-r--r--audio_codec/libamr/if_rom.c1030
-rwxr-xr-xaudio_codec/libamr/if_rom.h70
-rw-r--r--audio_codec/libamr/interf_dec.c906
-rw-r--r--audio_codec/libamr/interf_dec.h56
-rw-r--r--audio_codec/libamr/interf_rom.h1788
-rw-r--r--audio_codec/libamr/rom_dec.h13274
-rw-r--r--audio_codec/libamr/sp_dec.c6078
-rw-r--r--audio_codec/libamr/sp_dec.h83
-rwxr-xr-xaudio_codec/libamr/typedef.h17
-rwxr-xr-xaudio_codec/libape/Android.mk28
-rw-r--r--audio_codec/libape/Ape_decoder.h216
-rw-r--r--audio_codec/libape/amlogic_r30813_audio_ape_lib.c1
-rw-r--r--audio_codec/libape/apedec.c1120
-rw-r--r--audio_codec/libcook/Android.mk28
-rw-r--r--audio_codec/libcook/aac_bitstream.h133
-rw-r--r--audio_codec/libcook/aac_decode.h148
-rw-r--r--audio_codec/libcook/aac_reorder.h53
-rw-r--r--audio_codec/libcook/assembly.h119
-rw-r--r--audio_codec/libcook/challenge.h132
-rw-r--r--audio_codec/libcook/codec_defines.h93
-rw-r--r--audio_codec/libcook/coder.h287
-rw-r--r--audio_codec/libcook/cook_codec.h30
-rw-r--r--audio_codec/libcook/cook_decode.c624
-rw-r--r--audio_codec/libcook/cook_decode.h35
-rw-r--r--audio_codec/libcook/ga_config.h86
-rw-r--r--audio_codec/libcook/gecko2codec.c833
-rw-r--r--audio_codec/libcook/gecko2codec.h60
-rw-r--r--audio_codec/libcook/helix_config.h92
-rw-r--r--audio_codec/libcook/helix_mime_types.h56
-rw-r--r--audio_codec/libcook/helix_result.h107
-rw-r--r--audio_codec/libcook/helix_types.h305
-rw-r--r--audio_codec/libcook/helix_utils.h106
-rw-r--r--audio_codec/libcook/md5.h113
-rw-r--r--audio_codec/libcook/memory_utils.c100
-rw-r--r--audio_codec/libcook/memory_utils.h58
-rw-r--r--audio_codec/libcook/pack_utils.c306
-rw-r--r--audio_codec/libcook/pack_utils.h93
-rw-r--r--audio_codec/libcook/packet_defines.h48
-rw-r--r--audio_codec/libcook/ra8lbr_decode.c378
-rw-r--r--audio_codec/libcook/ra8lbr_decode.h161
-rw-r--r--audio_codec/libcook/ra_backend.h94
-rw-r--r--audio_codec/libcook/ra_bitpack.c197
-rw-r--r--audio_codec/libcook/ra_buffers.c127
-rw-r--r--audio_codec/libcook/ra_category.c298
-rw-r--r--audio_codec/libcook/ra_couple.c224
-rw-r--r--audio_codec/libcook/ra_decode.c321
-rw-r--r--audio_codec/libcook/ra_decode.h183
-rw-r--r--audio_codec/libcook/ra_depack.c230
-rw-r--r--audio_codec/libcook/ra_depack.h177
-rw-r--r--audio_codec/libcook/ra_depack_internal.c1710
-rw-r--r--audio_codec/libcook/ra_depack_internal.h232
-rw-r--r--audio_codec/libcook/ra_envelope.c123
-rw-r--r--audio_codec/libcook/ra_fft.c368
-rw-r--r--audio_codec/libcook/ra_format_info.h60
-rw-r--r--audio_codec/libcook/ra_gainctrl.c584
-rw-r--r--audio_codec/libcook/ra_huffman.c86
-rw-r--r--audio_codec/libcook/ra_hufftabs.c244
-rw-r--r--audio_codec/libcook/ra_mlt.c357
-rw-r--r--audio_codec/libcook/ra_sqvh.c431
-rw-r--r--audio_codec/libcook/ra_trigtabs.c932
-rw-r--r--audio_codec/libcook/rasl.c376
-rw-r--r--audio_codec/libcook/rasl.h71
-rw-r--r--audio_codec/libcook/rdtpck.h153
-rw-r--r--audio_codec/libcook/rm_error.h54
-rw-r--r--audio_codec/libcook/rm_error_default.c58
-rw-r--r--audio_codec/libcook/rm_error_default.h53
-rw-r--r--audio_codec/libcook/rm_io_default.c101
-rw-r--r--audio_codec/libcook/rm_io_default.h49
-rw-r--r--audio_codec/libcook/rm_memory.h54
-rw-r--r--audio_codec/libcook/rm_memory_default.c54
-rw-r--r--audio_codec/libcook/rm_memory_default.h46
-rw-r--r--audio_codec/libcook/rm_packet.c117
-rw-r--r--audio_codec/libcook/rm_packet.h80
-rw-r--r--audio_codec/libcook/rm_parse.h302
-rw-r--r--audio_codec/libcook/rm_parser.c649
-rw-r--r--audio_codec/libcook/rm_parser_internal.c3342
-rw-r--r--audio_codec/libcook/rm_parser_internal.h420
-rw-r--r--audio_codec/libcook/rm_property.c105
-rw-r--r--audio_codec/libcook/rm_property.h107
-rw-r--r--audio_codec/libcook/rm_stream.c356
-rw-r--r--audio_codec/libcook/rm_stream.h115
-rw-r--r--audio_codec/libcook/rm_stream_internal.h77
-rw-r--r--audio_codec/libcook/rv20backend.h69
-rw-r--r--audio_codec/libcook/rv30backend.h68
-rw-r--r--audio_codec/libcook/rv_backend.h84
-rw-r--r--audio_codec/libcook/rv_backend_types.h198
-rw-r--r--audio_codec/libcook/rv_decode.h208
-rw-r--r--audio_codec/libcook/rv_decode_message.h492
-rw-r--r--audio_codec/libcook/rv_depack.c271
-rw-r--r--audio_codec/libcook/rv_depack.h162
-rw-r--r--audio_codec/libcook/rv_depack_internal.c1071
-rw-r--r--audio_codec/libcook/rv_depack_internal.h171
-rw-r--r--audio_codec/libcook/rv_format_info.h91
-rw-r--r--audio_codec/libcook/statname.h118
-rw-r--r--audio_codec/libcook/stream_hdr_structs.h66
-rw-r--r--audio_codec/libcook/stream_hdr_utils.c136
-rw-r--r--audio_codec/libcook/stream_hdr_utils.h77
-rw-r--r--audio_codec/libcook/string_utils.c87
-rw-r--r--audio_codec/libcook/string_utils.h62
-rw-r--r--audio_codec/libcook/tngpkt.h400
-rwxr-xr-xaudio_codec/libfaad/Android.mk101
-rwxr-xr-xaudio_codec/libfaad/Makefile130
-rw-r--r--audio_codec/libfaad/analysis.h52
-rwxr-xr-xaudio_codec/libfaad/audio.d3
-rw-r--r--audio_codec/libfaad/bits.c261
-rwxr-xr-xaudio_codec/libfaad/bits.d18
-rw-r--r--audio_codec/libfaad/bits.h446
-rw-r--r--audio_codec/libfaad/cfft.c988
-rw-r--r--audio_codec/libfaad/cfft.h55
-rw-r--r--audio_codec/libfaad/cfft_tab.h1816
-rw-r--r--audio_codec/libfaad/codebook/hcb.h140
-rw-r--r--audio_codec/libfaad/codebook/hcb_1.h186
-rw-r--r--audio_codec/libfaad/codebook/hcb_10.h312
-rw-r--r--audio_codec/libfaad/codebook/hcb_11.h415
-rw-r--r--audio_codec/libfaad/codebook/hcb_2.h185
-rw-r--r--audio_codec/libfaad/codebook/hcb_3.h196
-rw-r--r--audio_codec/libfaad/codebook/hcb_4.h199
-rw-r--r--audio_codec/libfaad/codebook/hcb_5.h196
-rw-r--r--audio_codec/libfaad/codebook/hcb_6.h182
-rw-r--r--audio_codec/libfaad/codebook/hcb_7.h162
-rw-r--r--audio_codec/libfaad/codebook/hcb_8.h173
-rw-r--r--audio_codec/libfaad/codebook/hcb_9.h372
-rw-r--r--audio_codec/libfaad/codebook/hcb_sf.h276
-rw-r--r--audio_codec/libfaad/common.c558
-rw-r--r--audio_codec/libfaad/common.h453
-rw-r--r--audio_codec/libfaad/decoder.c2266
-rw-r--r--audio_codec/libfaad/drc.c173
-rw-r--r--audio_codec/libfaad/drc.h49
-rw-r--r--audio_codec/libfaad/drm_dec.c912
-rw-r--r--audio_codec/libfaad/drm_dec.h99
-rw-r--r--audio_codec/libfaad/error.c72
-rw-r--r--audio_codec/libfaad/error.h44
-rw-r--r--audio_codec/libfaad/filtbank.c408
-rw-r--r--audio_codec/libfaad/filtbank.h61
-rw-r--r--audio_codec/libfaad/fixed.h287
-rw-r--r--audio_codec/libfaad/hcr.c422
-rw-r--r--audio_codec/libfaad/helixaac/aaccommon.h210
-rw-r--r--audio_codec/libfaad/helixaac/aacdec.c508
-rw-r--r--audio_codec/libfaad/helixaac/aacdec.h206
-rw-r--r--audio_codec/libfaad/helixaac/aactabs.c157
-rw-r--r--audio_codec/libfaad/helixaac/assembly.h631
-rw-r--r--audio_codec/libfaad/helixaac/assembly_mw.h743
-rw-r--r--audio_codec/libfaad/helixaac/bitstream.c261
-rw-r--r--audio_codec/libfaad/helixaac/bitstream.h74
-rw-r--r--audio_codec/libfaad/helixaac/buffers.c140
-rw-r--r--audio_codec/libfaad/helixaac/coder.h369
-rw-r--r--audio_codec/libfaad/helixaac/dct4.c337
-rw-r--r--audio_codec/libfaad/helixaac/decelmnt.c445
-rw-r--r--audio_codec/libfaad/helixaac/dequant.c379
-rw-r--r--audio_codec/libfaad/helixaac/fft.c391
-rw-r--r--audio_codec/libfaad/helixaac/filefmt.c539
-rw-r--r--audio_codec/libfaad/helixaac/huffman_helix.c450
-rw-r--r--audio_codec/libfaad/helixaac/hufftabs.c177
-rw-r--r--audio_codec/libfaad/helixaac/imdct.c596
-rw-r--r--audio_codec/libfaad/helixaac/noiseless.c513
-rw-r--r--audio_codec/libfaad/helixaac/pns_helix.c371
-rw-r--r--audio_codec/libfaad/helixaac/sbr.c433
-rw-r--r--audio_codec/libfaad/helixaac/sbr.h380
-rw-r--r--audio_codec/libfaad/helixaac/sbrfft.c368
-rw-r--r--audio_codec/libfaad/helixaac/sbrfreq.c673
-rw-r--r--audio_codec/libfaad/helixaac/sbrhfadj.c882
-rw-r--r--audio_codec/libfaad/helixaac/sbrhfgen.c655
-rw-r--r--audio_codec/libfaad/helixaac/sbrhuff.c494
-rw-r--r--audio_codec/libfaad/helixaac/sbrimdct.c447
-rw-r--r--audio_codec/libfaad/helixaac/sbrmath.c198
-rw-r--r--audio_codec/libfaad/helixaac/sbrqmf.c648
-rw-r--r--audio_codec/libfaad/helixaac/sbrside.c634
-rw-r--r--audio_codec/libfaad/helixaac/sbrtabs.c400
-rw-r--r--audio_codec/libfaad/helixaac/statname.h115
-rw-r--r--audio_codec/libfaad/helixaac/stproc.c251
-rw-r--r--audio_codec/libfaad/helixaac/tns_helix.c307
-rw-r--r--audio_codec/libfaad/helixaac/trigtabs.c1000
-rw-r--r--audio_codec/libfaad/helixaac/trigtabs_fltgen.c357
-rw-r--r--audio_codec/libfaad/huffman.c582
-rw-r--r--audio_codec/libfaad/huffman.h47
-rw-r--r--audio_codec/libfaad/ic_predict.c258
-rw-r--r--audio_codec/libfaad/ic_predict.h252
-rw-r--r--audio_codec/libfaad/iq_table.h16456
-rw-r--r--audio_codec/libfaad/is.c106
-rw-r--r--audio_codec/libfaad/is.h67
-rw-r--r--audio_codec/libfaad/kbd_win.h2294
-rw-r--r--audio_codec/libfaad/libaacdec.c544
-rw-r--r--audio_codec/libfaad/libaacdec.h64
-rwxr-xr-xaudio_codec/libfaad/libfaad2.def14
-rw-r--r--audio_codec/libfaad/lt_predict.c205
-rw-r--r--audio_codec/libfaad/lt_predict.h66
-rw-r--r--audio_codec/libfaad/mdct.c307
-rw-r--r--audio_codec/libfaad/mdct.h48
-rw-r--r--audio_codec/libfaad/mdct_tab.h3639
-rw-r--r--audio_codec/libfaad/mp4.c307
-rw-r--r--audio_codec/libfaad/mp4.h52
-rw-r--r--audio_codec/libfaad/ms.c71
-rw-r--r--audio_codec/libfaad/ms.h44
-rw-r--r--audio_codec/libfaad/neaacdec.h257
-rw-r--r--audio_codec/libfaad/output.c583
-rw-r--r--audio_codec/libfaad/output.h48
-rw-r--r--audio_codec/libfaad/pns.c273
-rw-r--r--audio_codec/libfaad/pns.h58
-rw-r--r--audio_codec/libfaad/ps_dec.c1905
-rw-r--r--audio_codec/libfaad/ps_dec.h151
-rw-r--r--audio_codec/libfaad/ps_syntax.c532
-rw-r--r--audio_codec/libfaad/ps_tables.h547
-rw-r--r--audio_codec/libfaad/pulse.c59
-rw-r--r--audio_codec/libfaad/pulse.h43
-rw-r--r--audio_codec/libfaad/rvlc.c524
-rw-r--r--audio_codec/libfaad/rvlc.h55
-rw-r--r--audio_codec/libfaad/sbr_dct.c2267
-rw-r--r--audio_codec/libfaad/sbr_dct.h52
-rw-r--r--audio_codec/libfaad/sbr_dec.c679
-rw-r--r--audio_codec/libfaad/sbr_dec.h253
-rw-r--r--audio_codec/libfaad/sbr_e_nf.c475
-rw-r--r--audio_codec/libfaad/sbr_e_nf.h50
-rw-r--r--audio_codec/libfaad/sbr_fbt.c737
-rw-r--r--audio_codec/libfaad/sbr_fbt.h55
-rw-r--r--audio_codec/libfaad/sbr_hfadj.c1644
-rw-r--r--audio_codec/libfaad/sbr_hfadj.h56
-rw-r--r--audio_codec/libfaad/sbr_hfgen.c647
-rw-r--r--audio_codec/libfaad/sbr_hfgen.h49
-rw-r--r--audio_codec/libfaad/sbr_huff.c344
-rw-r--r--audio_codec/libfaad/sbr_huff.h46
-rw-r--r--audio_codec/libfaad/sbr_noise.h564
-rw-r--r--audio_codec/libfaad/sbr_qmf.c614
-rw-r--r--audio_codec/libfaad/sbr_qmf.h55
-rw-r--r--audio_codec/libfaad/sbr_qmf_c.h368
-rw-r--r--audio_codec/libfaad/sbr_syntax.c893
-rw-r--r--audio_codec/libfaad/sbr_syntax.h68
-rw-r--r--audio_codec/libfaad/sbr_tf_grid.c247
-rw-r--r--audio_codec/libfaad/sbr_tf_grid.h47
-rw-r--r--audio_codec/libfaad/sine_win.h4296
-rw-r--r--audio_codec/libfaad/specrec.c1249
-rw-r--r--audio_codec/libfaad/specrec.h49
-rw-r--r--audio_codec/libfaad/ssr.c170
-rw-r--r--audio_codec/libfaad/ssr.h59
-rw-r--r--audio_codec/libfaad/ssr_fb.c191
-rw-r--r--audio_codec/libfaad/ssr_fb.h53
-rw-r--r--audio_codec/libfaad/ssr_ipqf.c171
-rw-r--r--audio_codec/libfaad/ssr_ipqf.h46
-rw-r--r--audio_codec/libfaad/ssr_win.h635
-rw-r--r--audio_codec/libfaad/structs.h513
-rw-r--r--audio_codec/libfaad/syntax.c2539
-rw-r--r--audio_codec/libfaad/syntax.h129
-rw-r--r--audio_codec/libfaad/tns.c304
-rw-r--r--audio_codec/libfaad/tns.h51
-rwxr-xr-xaudio_codec/libflac/Android.mk22
-rw-r--r--audio_codec/libflac/avcodec.h337
-rw-r--r--audio_codec/libflac/bswap.h94
-rw-r--r--audio_codec/libflac/codec.h36
-rw-r--r--audio_codec/libflac/codec_message.h109
-rw-r--r--audio_codec/libflac/common.h356
-rw-r--r--audio_codec/libflac/crc.c146
-rw-r--r--audio_codec/libflac/crc.h46
-rw-r--r--audio_codec/libflac/flac.c43
-rw-r--r--audio_codec/libflac/flac.h124
-rw-r--r--audio_codec/libflac/flac_decode.c943
-rw-r--r--audio_codec/libflac/flacdata.c38
-rw-r--r--audio_codec/libflac/flacdata.h29
-rw-r--r--audio_codec/libflac/get_bits.h564
-rw-r--r--audio_codec/libflac/golomb.h585
-rw-r--r--audio_codec/libflac/internal.h195
-rw-r--r--audio_codec/libflac/intreadwrite.h390
-rw-r--r--audio_codec/libflac/mathops.h78
-rw-r--r--audio_codec/libflac/types.h49
-rwxr-xr-xaudio_codec/liblpcm/Android.mk13
-rw-r--r--audio_codec/liblpcm/lpcm_decode.c437
-rwxr-xr-xaudio_codec/libmad/Android.mk13
-rwxr-xr-xaudio_codec/libmad/D.dat607
-rw-r--r--audio_codec/libmad/bit.c244
-rw-r--r--audio_codec/libmad/bit.h47
-rw-r--r--audio_codec/libmad/config.h133
-rw-r--r--audio_codec/libmad/decoder.c1102
-rw-r--r--audio_codec/libmad/decoder.h91
-rw-r--r--audio_codec/libmad/fixed.c85
-rw-r--r--audio_codec/libmad/fixed.h499
-rw-r--r--audio_codec/libmad/frame.c525
-rw-r--r--audio_codec/libmad/frame.h118
-rw-r--r--audio_codec/libmad/global.h58
-rw-r--r--audio_codec/libmad/huffman.c3109
-rw-r--r--audio_codec/libmad/huffman.h66
-rwxr-xr-xaudio_codec/libmad/imdct_l_arm.S1000
-rwxr-xr-xaudio_codec/libmad/imdct_s.dat62
-rw-r--r--audio_codec/libmad/layer12.c552
-rwxr-xr-xaudio_codec/libmad/layer12.h31
-rw-r--r--audio_codec/libmad/layer3.c2742
-rwxr-xr-xaudio_codec/libmad/layer3.h30
-rw-r--r--audio_codec/libmad/mad.h966
-rwxr-xr-xaudio_codec/libmad/qc_table.dat77
-rwxr-xr-xaudio_codec/libmad/rq_table.dat8747
-rwxr-xr-xaudio_codec/libmad/sf_table.dat106
-rw-r--r--audio_codec/libmad/stream.c185
-rw-r--r--audio_codec/libmad/stream.h111
-rw-r--r--audio_codec/libmad/synth.c921
-rw-r--r--audio_codec/libmad/synth.h69
-rw-r--r--audio_codec/libmad/timer.c493
-rw-r--r--audio_codec/libmad/timer.h100
-rw-r--r--audio_codec/libmad/version.c91
-rw-r--r--audio_codec/libmad/version.h47
-rwxr-xr-xaudio_codec/libpcm/Android.mk11
-rw-r--r--audio_codec/libpcm/intreadwrite.h390
-rw-r--r--audio_codec/libpcm/pcm_decode.c780
-rw-r--r--audio_codec/libraac/Android.mk51
-rw-r--r--audio_codec/libraac/aac_bitstream.c200
-rw-r--r--audio_codec/libraac/aac_bitstream.h133
-rw-r--r--audio_codec/libraac/aac_decode.h148
-rw-r--r--audio_codec/libraac/aac_decode_main.c396
-rw-r--r--audio_codec/libraac/aac_reorder.c85
-rw-r--r--audio_codec/libraac/aac_reorder.h53
-rw-r--r--audio_codec/libraac/aaccommon.h200
-rw-r--r--audio_codec/libraac/aacdec.c607
-rw-r--r--audio_codec/libraac/aacdec.h200
-rw-r--r--audio_codec/libraac/aactabs.c157
-rw-r--r--audio_codec/libraac/assembly.h147
-rw-r--r--audio_codec/libraac/bitstream.c451
-rw-r--r--audio_codec/libraac/bitstream.h76
-rw-r--r--audio_codec/libraac/buffers.c132
-rw-r--r--audio_codec/libraac/coder.h370
-rw-r--r--audio_codec/libraac/dct4.c339
-rw-r--r--audio_codec/libraac/decelmnt.c451
-rw-r--r--audio_codec/libraac/dequant.c382
-rw-r--r--audio_codec/libraac/fft.c393
-rw-r--r--audio_codec/libraac/filefmt.c531
-rw-r--r--audio_codec/libraac/ga_config.c209
-rw-r--r--audio_codec/libraac/ga_config.h86
-rw-r--r--audio_codec/libraac/huffman.c449
-rw-r--r--audio_codec/libraac/hufftabs.c177
-rw-r--r--audio_codec/libraac/imdct.c598
-rw-r--r--audio_codec/libraac/include/challenge.h132
-rw-r--r--audio_codec/libraac/include/codec_defines.h93
-rw-r--r--audio_codec/libraac/include/gecko2codec.h60
-rw-r--r--audio_codec/libraac/include/helix_config.h92
-rw-r--r--audio_codec/libraac/include/helix_mime_types.h56
-rw-r--r--audio_codec/libraac/include/helix_result.h107
-rw-r--r--audio_codec/libraac/include/helix_types.h305
-rw-r--r--audio_codec/libraac/include/helix_utils.h106
-rw-r--r--audio_codec/libraac/include/md5.h113
-rw-r--r--audio_codec/libraac/include/memory_utils.h58
-rw-r--r--audio_codec/libraac/include/pack_utils.h93
-rw-r--r--audio_codec/libraac/include/packet_defines.h48
-rw-r--r--audio_codec/libraac/include/ra8lbr_decode.h161
-rw-r--r--audio_codec/libraac/include/ra_backend.h94
-rw-r--r--audio_codec/libraac/include/ra_decode.h183
-rw-r--r--audio_codec/libraac/include/ra_depack.h177
-rw-r--r--audio_codec/libraac/include/ra_format_info.h60
-rw-r--r--audio_codec/libraac/include/rasl.h71
-rw-r--r--audio_codec/libraac/include/rdtpck.h153
-rw-r--r--audio_codec/libraac/include/rm_error.h54
-rw-r--r--audio_codec/libraac/include/rm_error_default.h53
-rw-r--r--audio_codec/libraac/include/rm_io_default.h49
-rw-r--r--audio_codec/libraac/include/rm_memory.h54
-rw-r--r--audio_codec/libraac/include/rm_memory_default.h46
-rw-r--r--audio_codec/libraac/include/rm_packet.h80
-rw-r--r--audio_codec/libraac/include/rm_parse.h302
-rw-r--r--audio_codec/libraac/include/rm_property.h107
-rw-r--r--audio_codec/libraac/include/rm_stream.h115
-rw-r--r--audio_codec/libraac/include/rm_stream_internal.h77
-rw-r--r--audio_codec/libraac/include/rv20backend.h69
-rw-r--r--audio_codec/libraac/include/rv30backend.h68
-rw-r--r--audio_codec/libraac/include/rv_backend.h84
-rw-r--r--audio_codec/libraac/include/rv_backend_types.h198
-rw-r--r--audio_codec/libraac/include/rv_decode.h208
-rw-r--r--audio_codec/libraac/include/rv_decode_message.h492
-rw-r--r--audio_codec/libraac/include/rv_depack.h162
-rw-r--r--audio_codec/libraac/include/rv_format_info.h91
-rw-r--r--audio_codec/libraac/include/statname.h118
-rw-r--r--audio_codec/libraac/include/stream_hdr_structs.h66
-rw-r--r--audio_codec/libraac/include/stream_hdr_utils.h77
-rw-r--r--audio_codec/libraac/include/string_utils.h62
-rw-r--r--audio_codec/libraac/include/tngpkt.h400
-rw-r--r--audio_codec/libraac/memory_utils.c100
-rw-r--r--audio_codec/libraac/noiseless.c503
-rw-r--r--audio_codec/libraac/pack_utils.c306
-rw-r--r--audio_codec/libraac/pns.c369
-rw-r--r--audio_codec/libraac/ra_depack.c230
-rw-r--r--audio_codec/libraac/ra_depack_internal.c1713
-rw-r--r--audio_codec/libraac/ra_depack_internal.h232
-rw-r--r--audio_codec/libraac/raac_decode.c854
-rw-r--r--audio_codec/libraac/raac_decode.h37
-rw-r--r--audio_codec/libraac/rm_error_default.c60
-rw-r--r--audio_codec/libraac/rm_io_default.c101
-rw-r--r--audio_codec/libraac/rm_memory_default.c54
-rw-r--r--audio_codec/libraac/rm_packet.c117
-rw-r--r--audio_codec/libraac/rm_parser.c649
-rw-r--r--audio_codec/libraac/rm_parser_internal.c3342
-rw-r--r--audio_codec/libraac/rm_parser_internal.h420
-rw-r--r--audio_codec/libraac/rm_property.c105
-rw-r--r--audio_codec/libraac/rm_stream.c356
-rw-r--r--audio_codec/libraac/rv_depack.c271
-rw-r--r--audio_codec/libraac/rv_depack_internal.c1071
-rw-r--r--audio_codec/libraac/rv_depack_internal.h171
-rw-r--r--audio_codec/libraac/sbr.c431
-rw-r--r--audio_codec/libraac/sbr.h381
-rwxr-xr-xaudio_codec/libraac/sbrcov.s164
-rw-r--r--audio_codec/libraac/sbrfft.c368
-rw-r--r--audio_codec/libraac/sbrfreq.c667
-rw-r--r--audio_codec/libraac/sbrhfadj.c877
-rw-r--r--audio_codec/libraac/sbrhfgen.c646
-rw-r--r--audio_codec/libraac/sbrhuff.c492
-rw-r--r--audio_codec/libraac/sbrimdct.c447
-rw-r--r--audio_codec/libraac/sbrmath.c198
-rw-r--r--audio_codec/libraac/sbrqmf.c643
-rwxr-xr-xaudio_codec/libraac/sbrqmfak.s182
-rwxr-xr-xaudio_codec/libraac/sbrqmfsk.s130
-rw-r--r--audio_codec/libraac/sbrside.c615
-rw-r--r--audio_codec/libraac/sbrtabs.c400
-rw-r--r--audio_codec/libraac/statname.h115
-rw-r--r--audio_codec/libraac/stproc.c252
-rw-r--r--audio_codec/libraac/stream_hdr_utils.c136
-rw-r--r--audio_codec/libraac/string_utils.c87
-rw-r--r--audio_codec/libraac/tns.c307
-rw-r--r--audio_codec/libraac/trigtabs.c1000
-rw-r--r--audio_codec/libraac/trigtabs_fltgen.c357
-rwxr-xr-xaudio_codec/wfd_aac_decoder/Android.mk23
-rw-r--r--audio_codec/wfd_aac_decoder/aaccommon.h210
-rw-r--r--audio_codec/wfd_aac_decoder/aacdec.c508
-rw-r--r--audio_codec/wfd_aac_decoder/aacdec.h206
-rw-r--r--audio_codec/wfd_aac_decoder/aactabs.c157
-rw-r--r--audio_codec/wfd_aac_decoder/assembly.h640
-rw-r--r--audio_codec/wfd_aac_decoder/assembly_mw.h743
-rw-r--r--audio_codec/wfd_aac_decoder/bitstream.c261
-rw-r--r--audio_codec/wfd_aac_decoder/bitstream.h74
-rw-r--r--audio_codec/wfd_aac_decoder/buffers.c140
-rw-r--r--audio_codec/wfd_aac_decoder/coder.h369
-rw-r--r--audio_codec/wfd_aac_decoder/dct4.c337
-rw-r--r--audio_codec/wfd_aac_decoder/decelmnt.c445
-rw-r--r--audio_codec/wfd_aac_decoder/dequant.c379
-rw-r--r--audio_codec/wfd_aac_decoder/fft.c391
-rw-r--r--audio_codec/wfd_aac_decoder/filefmt.c539
-rw-r--r--audio_codec/wfd_aac_decoder/helix_aac_decode.c548
-rw-r--r--audio_codec/wfd_aac_decoder/huffman.c450
-rw-r--r--audio_codec/wfd_aac_decoder/hufftabs.c177
-rw-r--r--audio_codec/wfd_aac_decoder/imdct.c596
-rw-r--r--audio_codec/wfd_aac_decoder/noiseless.c513
-rw-r--r--audio_codec/wfd_aac_decoder/pns.c371
-rw-r--r--audio_codec/wfd_aac_decoder/sbr.c434
-rw-r--r--audio_codec/wfd_aac_decoder/sbr.h380
-rw-r--r--audio_codec/wfd_aac_decoder/sbrfft.c368
-rw-r--r--audio_codec/wfd_aac_decoder/sbrfreq.c673
-rw-r--r--audio_codec/wfd_aac_decoder/sbrhfadj.c882
-rw-r--r--audio_codec/wfd_aac_decoder/sbrhfgen.c655
-rw-r--r--audio_codec/wfd_aac_decoder/sbrhuff.c494
-rw-r--r--audio_codec/wfd_aac_decoder/sbrimdct.c447
-rw-r--r--audio_codec/wfd_aac_decoder/sbrmath.c198
-rw-r--r--audio_codec/wfd_aac_decoder/sbrqmf.c648
-rw-r--r--audio_codec/wfd_aac_decoder/sbrside.c634
-rw-r--r--audio_codec/wfd_aac_decoder/sbrtabs.c400
-rw-r--r--audio_codec/wfd_aac_decoder/statname.h115
-rw-r--r--audio_codec/wfd_aac_decoder/stproc.c251
-rw-r--r--audio_codec/wfd_aac_decoder/tns.c307
-rw-r--r--audio_codec/wfd_aac_decoder/trigtabs.c1000
-rw-r--r--audio_codec/wfd_aac_decoder/trigtabs_fltgen.c357
545 files changed, 230976 insertions, 0 deletions
diff --git a/audio_codec/libfaad/sbr_fbt.c b/audio_codec/libfaad/sbr_fbt.c
new file mode 100644
index 0000000..6bf5d13
--- a/dev/null
+++ b/audio_codec/libfaad/sbr_fbt.c
@@ -0,0 +1,737 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Nero 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.
+**
+** The "appropriate copyright message" mentioned in section 2c of the GPLv2
+** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_fbt.c,v 1.21 2007/11/01 12:33:35 menno Exp $
+**/
+
+/* Calculate frequency band tables */
+#include <stdlib.h>
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include "sbr_syntax.h"
+#include "sbr_fbt.h"
+
+/* static function declarations */
+static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1);
+
+
+/* calculate the start QMF channel for the master frequency band table */
+/* parameter is also called k0 */
+uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
+ uint32_t sample_rate)
+{
+ static const uint8_t startMinTable[12] = { 7, 7, 10, 11, 12, 16, 16,
+ 17, 24, 32, 35, 48
+ };
+ static const uint8_t offsetIndexTable[12] = { 5, 5, 4, 4, 4, 3, 2, 1, 0,
+ 6, 6, 6
+ };
+ static const int8_t offset[7][16] = {
+ { -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 },
+ { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13 },
+ { -5, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 },
+ { -6, -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 },
+ { -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20 },
+ { -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24 },
+ { 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24, 28, 33 }
+ };
+ uint8_t startMin = startMinTable[get_sr_index(sample_rate)];
+ uint8_t offsetIndex = offsetIndexTable[get_sr_index(sample_rate)];
+
+#if 0 /* replaced with table (startMinTable) */
+ if (sample_rate >= 64000) {
+ startMin = (uint8_t)((5000.*128.) / (float)sample_rate + 0.5);
+ } else if (sample_rate < 32000) {
+ startMin = (uint8_t)((3000.*128.) / (float)sample_rate + 0.5);
+ } else {
+ startMin = (uint8_t)((4000.*128.) / (float)sample_rate + 0.5);
+ }
+#endif
+
+ if (bs_samplerate_mode) {
+ return startMin + offset[offsetIndex][bs_start_freq];
+
+#if 0 /* replaced by offsetIndexTable */
+ switch (sample_rate) {
+ case 16000:
+ return startMin + offset[0][bs_start_freq];
+ case 22050:
+ return startMin + offset[1][bs_start_freq];
+ case 24000:
+ return startMin + offset[2][bs_start_freq];
+ case 32000:
+ return startMin + offset[3][bs_start_freq];
+ default:
+ if (sample_rate > 64000) {
+ return startMin + offset[5][bs_start_freq];
+ } else { /* 44100 <= sample_rate <= 64000 */
+ return startMin + offset[4][bs_start_freq];
+ }
+ }
+#endif
+ } else {
+ return startMin + offset[6][bs_start_freq];
+ }
+}
+
+static int longcmp(const void *a, const void *b)
+{
+ return ((int)(*(int32_t*)a - * (int32_t*)b));
+}
+
+/* calculate the stop QMF channel for the master frequency band table */
+/* parameter is also called k2 */
+uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
+ uint8_t k0)
+{
+ if (bs_stop_freq == 15) {
+ return min(64, k0 * 3);
+ } else if (bs_stop_freq == 14) {
+ return min(64, k0 * 2);
+ } else {
+ static const uint8_t stopMinTable[12] = { 13, 15, 20, 21, 23,
+ 32, 32, 35, 48, 64, 70, 96
+ };
+ static const int8_t offset[12][14] = {
+ { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 37, 44, 51 },
+ { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 36, 42, 49 },
+ { 0, 2, 4, 6, 8, 11, 14, 17, 21, 25, 29, 34, 39, 44 },
+ { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 33, 38, 43 },
+ { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 32, 36, 41 },
+ { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 },
+ { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 },
+ { 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 20, 23, 26, 29 },
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, -1, -2, -3, -4, -5, -6, -6, -6, -6, -6, -6, -6, -6 },
+ { 0, -3, -6, -9, -12, -15, -18, -20, -22, -24, -26, -28, -30, -32 }
+ };
+#if 0
+ uint8_t i;
+ int32_t stopDk[13], stopDk_t[14], k2;
+#endif
+ uint8_t stopMin = stopMinTable[get_sr_index(sample_rate)];
+
+#if 0 /* replaced by table lookup */
+ if (sample_rate >= 64000) {
+ stopMin = (uint8_t)((10000.*128.) / (float)sample_rate + 0.5);
+ } else if (sample_rate < 32000) {
+ stopMin = (uint8_t)((6000.*128.) / (float)sample_rate + 0.5);
+ } else {
+ stopMin = (uint8_t)((8000.*128.) / (float)sample_rate + 0.5);
+ }
+#endif
+
+#if 0 /* replaced by table lookup */
+ /* diverging power series */
+ for (i = 0; i <= 13; i++) {
+ stopDk_t[i] = (int32_t)(stopMin * pow(64.0 / stopMin, i / 13.0) + 0.5);
+ }
+ for (i = 0; i < 13; i++) {
+ stopDk[i] = stopDk_t[i + 1] - stopDk_t[i];
+ }
+
+ /* needed? */
+ qsort(stopDk, 13, sizeof(stopDk[0]), longcmp);
+
+ k2 = stopMin;
+ for (i = 0; i < bs_stop_freq; i++) {
+ k2 += stopDk[i];
+ }
+ return min(64, k2);
+#endif
+ /* bs_stop_freq <= 13 */
+ return min(64, stopMin + offset[get_sr_index(sample_rate)][min(bs_stop_freq, 13)]);
+ }
+
+ return 0;
+}
+
+/* calculate the master frequency table from k0, k2, bs_freq_scale
+ and bs_alter_scale
+
+ version for bs_freq_scale = 0
+*/
+uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
+ uint8_t bs_alter_scale)
+{
+ int8_t incr;
+ uint8_t k;
+ uint8_t dk;
+ uint32_t nrBands, k2Achieved;
+ int32_t k2Diff, vDk[64] = {0};
+
+ /* mft only defined for k2 > k0 */
+ if (k2 <= k0) {
+ sbr->N_master = 0;
+ return 1;
+ }
+
+ dk = bs_alter_scale ? 2 : 1;
+
+#if 0 /* replaced by float-less design */
+ nrBands = 2 * (int32_t)((float)(k2 - k0) / (dk * 2) + (-1 + dk) / 2.0f);
+#else
+ if (bs_alter_scale) {
+ nrBands = (((k2 - k0 + 2) >> 2) << 1);
+ } else {
+ nrBands = (((k2 - k0) >> 1) << 1);
+ }
+#endif
+ nrBands = min(nrBands, 63);
+ if (nrBands <= 0) {
+ return 1;
+ }
+
+ k2Achieved = k0 + nrBands * dk;
+ k2Diff = k2 - k2Achieved;
+ for (k = 0; k < nrBands; k++) {
+ vDk[k] = dk;
+ }
+
+ if (k2Diff) {
+ incr = (k2Diff > 0) ? -1 : 1;
+ k = (uint8_t)((k2Diff > 0) ? (nrBands - 1) : 0);
+
+ while (k2Diff != 0) {
+ vDk[k] -= incr;
+ k += incr;
+ k2Diff += incr;
+ }
+ }
+
+ sbr->f_master[0] = k0;
+ for (k = 1; k <= nrBands; k++) {
+ sbr->f_master[k] = (uint8_t)(sbr->f_master[k - 1] + vDk[k - 1]);
+ }
+
+ sbr->N_master = (uint8_t)nrBands;
+ sbr->N_master = (min(sbr->N_master, 64));
+
+#if 0
+ printf("f_master[%d]: ", nrBands);
+ for (k = 0; k <= nrBands; k++) {
+ printf("%d ", sbr->f_master[k]);
+ }
+ printf("\n");
+#endif
+
+ return 0;
+}
+
+/*
+ This function finds the number of bands using this formula:
+ bands * log(a1/a0)/log(2.0) + 0.5
+*/
+static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1)
+{
+#ifdef FIXED_POINT
+ /* table with log2() values */
+ static const real_t log2Table[65] = {
+ COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(1.0000000000), COEF_CONST(1.5849625007),
+ COEF_CONST(2.0000000000), COEF_CONST(2.3219280949), COEF_CONST(2.5849625007), COEF_CONST(2.8073549221),
+ COEF_CONST(3.0000000000), COEF_CONST(3.1699250014), COEF_CONST(3.3219280949), COEF_CONST(3.4594316186),
+ COEF_CONST(3.5849625007), COEF_CONST(3.7004397181), COEF_CONST(3.8073549221), COEF_CONST(3.9068905956),
+ COEF_CONST(4.0000000000), COEF_CONST(4.0874628413), COEF_CONST(4.1699250014), COEF_CONST(4.2479275134),
+ COEF_CONST(4.3219280949), COEF_CONST(4.3923174228), COEF_CONST(4.4594316186), COEF_CONST(4.5235619561),
+ COEF_CONST(4.5849625007), COEF_CONST(4.6438561898), COEF_CONST(4.7004397181), COEF_CONST(4.7548875022),
+ COEF_CONST(4.8073549221), COEF_CONST(4.8579809951), COEF_CONST(4.9068905956), COEF_CONST(4.9541963104),
+ COEF_CONST(5.0000000000), COEF_CONST(5.0443941194), COEF_CONST(5.0874628413), COEF_CONST(5.1292830169),
+ COEF_CONST(5.1699250014), COEF_CONST(5.2094533656), COEF_CONST(5.2479275134), COEF_CONST(5.2854022189),
+ COEF_CONST(5.3219280949), COEF_CONST(5.3575520046), COEF_CONST(5.3923174228), COEF_CONST(5.4262647547),
+ COEF_CONST(5.4594316186), COEF_CONST(5.4918530963), COEF_CONST(5.5235619561), COEF_CONST(5.5545888517),
+ COEF_CONST(5.5849625007), COEF_CONST(5.6147098441), COEF_CONST(5.6438561898), COEF_CONST(5.6724253420),
+ COEF_CONST(5.7004397181), COEF_CONST(5.7279204546), COEF_CONST(5.7548875022), COEF_CONST(5.7813597135),
+ COEF_CONST(5.8073549221), COEF_CONST(5.8328900142), COEF_CONST(5.8579809951), COEF_CONST(5.8826430494),
+ COEF_CONST(5.9068905956), COEF_CONST(5.9307373376), COEF_CONST(5.9541963104), COEF_CONST(5.9772799235),
+ COEF_CONST(6.0)
+ };
+ real_t r0 = log2Table[a0]; /* coef */
+ real_t r1 = log2Table[a1]; /* coef */
+ real_t r2 = (r1 - r0); /* coef */
+
+ if (warp) {
+ r2 = MUL_C(r2, COEF_CONST(1.0 / 1.3));
+ }
+
+ /* convert r2 to real and then multiply and round */
+ r2 = (r2 >> (COEF_BITS - REAL_BITS)) * bands + (1 << (REAL_BITS - 1));
+
+ return (r2 >> REAL_BITS);
+#else
+ real_t div = (real_t)log(2.0);
+ if (warp) {
+ div *= (real_t)1.3;
+ }
+
+ return (int32_t)(bands * log((float)a1 / (float)a0) / div + 0.5);
+#endif
+}
+
+static real_t find_initial_power(uint8_t bands, uint8_t a0, uint8_t a1)
+{
+#ifdef FIXED_POINT
+ /* table with log() values */
+ static const real_t logTable[65] = {
+ COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(0.6931471806), COEF_CONST(1.0986122887),
+ COEF_CONST(1.3862943611), COEF_CONST(1.6094379124), COEF_CONST(1.7917594692), COEF_CONST(1.9459101491),
+ COEF_CONST(2.0794415417), COEF_CONST(2.1972245773), COEF_CONST(2.3025850930), COEF_CONST(2.3978952728),
+ COEF_CONST(2.4849066498), COEF_CONST(2.5649493575), COEF_CONST(2.6390573296), COEF_CONST(2.7080502011),
+ COEF_CONST(2.7725887222), COEF_CONST(2.8332133441), COEF_CONST(2.8903717579), COEF_CONST(2.9444389792),
+ COEF_CONST(2.9957322736), COEF_CONST(3.0445224377), COEF_CONST(3.0910424534), COEF_CONST(3.1354942159),
+ COEF_CONST(3.1780538303), COEF_CONST(3.2188758249), COEF_CONST(3.2580965380), COEF_CONST(3.2958368660),
+ COEF_CONST(3.3322045102), COEF_CONST(3.3672958300), COEF_CONST(3.4011973817), COEF_CONST(3.4339872045),
+ COEF_CONST(3.4657359028), COEF_CONST(3.4965075615), COEF_CONST(3.5263605246), COEF_CONST(3.5553480615),
+ COEF_CONST(3.5835189385), COEF_CONST(3.6109179126), COEF_CONST(3.6375861597), COEF_CONST(3.6635616461),
+ COEF_CONST(3.6888794541), COEF_CONST(3.7135720667), COEF_CONST(3.7376696183), COEF_CONST(3.7612001157),
+ COEF_CONST(3.7841896339), COEF_CONST(3.8066624898), COEF_CONST(3.8286413965), COEF_CONST(3.8501476017),
+ COEF_CONST(3.8712010109), COEF_CONST(3.8918202981), COEF_CONST(3.9120230054), COEF_CONST(3.9318256327),
+ COEF_CONST(3.9512437186), COEF_CONST(3.9702919136), COEF_CONST(3.9889840466), COEF_CONST(4.0073331852),
+ COEF_CONST(4.0253516907), COEF_CONST(4.0430512678), COEF_CONST(4.0604430105), COEF_CONST(4.0775374439),
+ COEF_CONST(4.0943445622), COEF_CONST(4.1108738642), COEF_CONST(4.1271343850), COEF_CONST(4.1431347264),
+ COEF_CONST(4.158883083)
+ };
+ /* standard Taylor polynomial coefficients for exp(x) around 0 */
+ /* a polynomial around x=1 is more precise, as most values are around 1.07,
+ but this is just fine already */
+ static const real_t c1 = COEF_CONST(1.0);
+ static const real_t c2 = COEF_CONST(1.0 / 2.0);
+ static const real_t c3 = COEF_CONST(1.0 / 6.0);
+ static const real_t c4 = COEF_CONST(1.0 / 24.0);
+
+ real_t r0 = logTable[a0]; /* coef */
+ real_t r1 = logTable[a1]; /* coef */
+ real_t r2 = (r1 - r0) / bands; /* coef */
+ real_t rexp = c1 + MUL_C((c1 + MUL_C((c2 + MUL_C((c3 + MUL_C(c4, r2)), r2)), r2)), r2);
+
+ return (rexp >> (COEF_BITS - REAL_BITS)); /* real */
+#else
+ return (real_t)pow((real_t)a1 / (real_t)a0, 1.0 / (real_t)bands);
+#endif
+}
+
+/*
+ version for bs_freq_scale > 0
+*/
+uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
+ uint8_t bs_freq_scale, uint8_t bs_alter_scale)
+{
+ uint8_t k, bands, twoRegions;
+ uint8_t k1;
+ uint8_t nrBand0, nrBand1;
+ int32_t vDk0[64] = {0}, vDk1[64] = {0};
+ int32_t vk0[64] = {0}, vk1[64] = {0};
+ uint8_t temp1[] = { 6, 5, 4 };
+ real_t q, qk;
+ int32_t A_1;
+#ifdef FIXED_POINT
+ real_t rk2, rk0;
+#endif
+
+ /* mft only defined for k2 > k0 */
+ if (k2 <= k0) {
+ sbr->N_master = 0;
+ return 1;
+ }
+
+ bands = temp1[bs_freq_scale - 1];
+
+#ifdef FIXED_POINT
+ rk0 = (real_t)k0 << REAL_BITS;
+ rk2 = (real_t)k2 << REAL_BITS;
+ if (rk2 > MUL_C(rk0, COEF_CONST(2.2449)))
+#else
+ if ((float)k2 / (float)k0 > 2.2449)
+#endif
+ {
+ twoRegions = 1;
+ k1 = k0 << 1;
+ } else {
+ twoRegions = 0;
+ k1 = k2;
+ }
+
+ nrBand0 = (uint8_t)(2 * find_bands(0, bands, k0, k1));
+ nrBand0 = min(nrBand0, 63);
+ if (nrBand0 <= 0) {
+ return 1;
+ }
+
+ q = find_initial_power(nrBand0, k0, k1);
+#ifdef FIXED_POINT
+ qk = (real_t)k0 << REAL_BITS;
+ //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+ A_1 = k0;
+#else
+ qk = REAL_CONST(k0);
+ A_1 = (int32_t)(qk + .5);
+#endif
+ for (k = 0; k <= nrBand0; k++) {
+ int32_t A_0 = A_1;
+#ifdef FIXED_POINT
+ qk = MUL_R(qk, q);
+ A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+#else
+ qk *= q;
+ A_1 = (int32_t)(qk + 0.5);
+#endif
+ vDk0[k] = A_1 - A_0;
+ }
+
+ /* needed? */
+ qsort(vDk0, nrBand0, sizeof(vDk0[0]), longcmp);
+
+ vk0[0] = k0;
+ for (k = 1; k <= nrBand0; k++) {
+ vk0[k] = vk0[k - 1] + vDk0[k - 1];
+ if (vDk0[k - 1] == 0) {
+ return 1;
+ }
+ }
+
+ if (!twoRegions) {
+ for (k = 0; k <= nrBand0; k++) {
+ sbr->f_master[k] = (uint8_t) vk0[k];
+ }
+
+ sbr->N_master = nrBand0;
+ sbr->N_master = min(sbr->N_master, 64);
+ return 0;
+ }
+
+ nrBand1 = (uint8_t)(2 * find_bands(1 /* warped */, bands, k1, k2));
+ nrBand1 = min(nrBand1, 63);
+
+ q = find_initial_power(nrBand1, k1, k2);
+#ifdef FIXED_POINT
+ qk = (real_t)k1 << REAL_BITS;
+ //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+ A_1 = k1;
+#else
+ qk = REAL_CONST(k1);
+ A_1 = (int32_t)(qk + .5);
+#endif
+ for (k = 0; k <= nrBand1 - 1; k++) {
+ int32_t A_0 = A_1;
+#ifdef FIXED_POINT
+ qk = MUL_R(qk, q);
+ A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+#else
+ qk *= q;
+ A_1 = (int32_t)(qk + 0.5);
+#endif
+ vDk1[k] = A_1 - A_0;
+ }
+
+ if (vDk1[0] < vDk0[nrBand0 - 1]) {
+ int32_t change;
+
+ /* needed? */
+ qsort(vDk1, nrBand1 + 1, sizeof(vDk1[0]), longcmp);
+ change = vDk0[nrBand0 - 1] - vDk1[0];
+ vDk1[0] = vDk0[nrBand0 - 1];
+ vDk1[nrBand1 - 1] = vDk1[nrBand1 - 1] - change;
+ }
+
+ /* needed? */
+ qsort(vDk1, nrBand1, sizeof(vDk1[0]), longcmp);
+ vk1[0] = k1;
+ for (k = 1; k <= nrBand1; k++) {
+ vk1[k] = vk1[k - 1] + vDk1[k - 1];
+ if (vDk1[k - 1] == 0) {
+ return 1;
+ }
+ }
+
+ sbr->N_master = nrBand0 + nrBand1;
+ sbr->N_master = min(sbr->N_master, 64);
+ for (k = 0; k <= nrBand0; k++) {
+ sbr->f_master[k] = (uint8_t) vk0[k];
+ }
+ for (k = nrBand0 + 1; k <= sbr->N_master; k++) {
+ sbr->f_master[k] = (uint8_t) vk1[k - nrBand0];
+ }
+
+#if 0
+ printf("f_master[%d]: ", sbr->N_master);
+ for (k = 0; k <= sbr->N_master; k++) {
+ printf("%d ", sbr->f_master[k]);
+ }
+ printf("\n");
+#endif
+
+ return 0;
+}
+
+/* calculate the derived frequency border tables from f_master */
+uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
+ uint8_t k2)
+{
+ uint8_t k, i;
+ uint32_t minus;
+
+ /* The following relation shall be satisfied: bs_xover_band < N_Master */
+ if (sbr->N_master <= bs_xover_band) {
+ return 1;
+ }
+
+ sbr->N_high = sbr->N_master - bs_xover_band;
+ sbr->N_low = (sbr->N_high >> 1) + (sbr->N_high - ((sbr->N_high >> 1) << 1));
+
+ sbr->n[0] = sbr->N_low;
+ sbr->n[1] = sbr->N_high;
+
+ for (k = 0; k <= sbr->N_high; k++) {
+ sbr->f_table_res[HI_RES][k] = sbr->f_master[k + bs_xover_band];
+ }
+
+ sbr->M = sbr->f_table_res[HI_RES][sbr->N_high] - sbr->f_table_res[HI_RES][0];
+ sbr->kx = sbr->f_table_res[HI_RES][0];
+ if (sbr->kx > 32) {
+ return 1;
+ }
+ if (sbr->kx + sbr->M > 64) {
+ return 1;
+ }
+
+ minus = (sbr->N_high & 1) ? 1 : 0;
+
+ for (k = 0; k <= sbr->N_low; k++) {
+ if (k == 0) {
+ i = 0;
+ } else {
+ i = (uint8_t)(2 * k - minus);
+ }
+ sbr->f_table_res[LO_RES][k] = sbr->f_table_res[HI_RES][i];
+ }
+
+#if 0
+ printf("bs_freq_scale: %d\n", sbr->bs_freq_scale);
+ printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands);
+ printf("f_table_res[HI_RES][%d]: ", sbr->N_high);
+ for (k = 0; k <= sbr->N_high; k++) {
+ printf("%d ", sbr->f_table_res[HI_RES][k]);
+ }
+ printf("\n");
+#endif
+#if 0
+ printf("f_table_res[LO_RES][%d]: ", sbr->N_low);
+ for (k = 0; k <= sbr->N_low; k++) {
+ printf("%d ", sbr->f_table_res[LO_RES][k]);
+ }
+ printf("\n");
+#endif
+
+ sbr->N_Q = 0;
+ if (sbr->bs_noise_bands == 0) {
+ sbr->N_Q = 1;
+ } else {
+#if 0
+ sbr->N_Q = max(1, (int32_t)(sbr->bs_noise_bands * (log(k2 / (float)sbr->kx) / log(2.0)) + 0.5));
+#else
+ sbr->N_Q = (uint8_t)(max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2)));
+#endif
+ sbr->N_Q = min(5, sbr->N_Q);
+ }
+
+ for (k = 0; k <= sbr->N_Q; k++) {
+ if (k == 0) {
+ i = 0;
+ } else {
+ /* i = i + (int32_t)((sbr->N_low - i)/(sbr->N_Q + 1 - k)); */
+ i = i + (sbr->N_low - i) / (sbr->N_Q + 1 - k);
+ }
+ sbr->f_table_noise[k] = sbr->f_table_res[LO_RES][i];
+ }
+
+ /* build table for mapping k to g in hf patching */
+ for (k = 0; k < 64; k++) {
+ uint8_t g;
+ for (g = 0; g < sbr->N_Q; g++) {
+ if ((sbr->f_table_noise[g] <= k) &&
+ (k < sbr->f_table_noise[g + 1])) {
+ sbr->table_map_k_to_g[k] = g;
+ break;
+ }
+ }
+ }
+
+#if 0
+ printf("f_table_noise[%d]: ", sbr->N_Q);
+ for (k = 0; k <= sbr->N_Q; k++) {
+ printf("%d ", sbr->f_table_noise[k] - sbr->kx);
+ }
+ printf("\n");
+#endif
+
+ return 0;
+}
+
+/* TODO: blegh, ugly */
+/* Modified to calculate for all possible bs_limiter_bands always
+ * This reduces the number calls to this functions needed (now only on
+ * header reset)
+ */
+void limiter_frequency_table(sbr_info *sbr)
+{
+#if 0
+ static const real_t limiterBandsPerOctave[] = { REAL_CONST(1.2),
+ REAL_CONST(2), REAL_CONST(3)
+ };
+#else
+ static const real_t limiterBandsCompare[] = { REAL_CONST(1.327152),
+ REAL_CONST(1.185093), REAL_CONST(1.119872)
+ };
+#endif
+ uint8_t k, s;
+ int8_t nrLim;
+#if 0
+ real_t limBands;
+#endif
+
+ sbr->f_table_lim[0][0] = sbr->f_table_res[LO_RES][0] - sbr->kx;
+ sbr->f_table_lim[0][1] = sbr->f_table_res[LO_RES][sbr->N_low] - sbr->kx;
+ sbr->N_L[0] = 1;
+
+#if 0
+ printf("f_table_lim[%d][%d]: ", 0, sbr->N_L[0]);
+ for (k = 0; k <= sbr->N_L[0]; k++) {
+ printf("%d ", sbr->f_table_lim[0][k]);
+ }
+ printf("\n");
+#endif
+
+ for (s = 1; s < 4; s++) {
+ int32_t limTable[100 /*TODO*/] = {0};
+ uint8_t patchBorders[64/*??*/] = {0};
+
+#if 0
+ limBands = limiterBandsPerOctave[s - 1];
+#endif
+
+ patchBorders[0] = sbr->kx;
+ for (k = 1; k <= sbr->noPatches; k++) {
+ patchBorders[k] = patchBorders[k - 1] + sbr->patchNoSubbands[k - 1];
+ }
+
+ for (k = 0; k <= sbr->N_low; k++) {
+ limTable[k] = sbr->f_table_res[LO_RES][k];
+ }
+ for (k = 1; k < sbr->noPatches; k++) {
+ limTable[k + sbr->N_low] = patchBorders[k];
+ }
+
+ /* needed */
+ qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp);
+ k = 1;
+ nrLim = sbr->noPatches + sbr->N_low - 1;
+
+ if (nrLim < 0) { // TODO: BIG FAT PROBLEM
+ return;
+ }
+
+restart:
+ if (k <= nrLim) {
+ real_t nOctaves;
+
+ if (limTable[k - 1] != 0)
+#if 0
+ nOctaves = REAL_CONST(log((float)limTable[k] / (float)limTable[k - 1]) / log(2.0));
+#else
+#ifdef FIXED_POINT
+ nOctaves = DIV_R((limTable[k] << REAL_BITS), REAL_CONST(limTable[k - 1]));
+#else
+ nOctaves = (real_t)limTable[k] / (real_t)limTable[k - 1];
+#endif
+#endif
+ else {
+ nOctaves = 0;
+ }
+
+#if 0
+ if ((MUL_R(nOctaves, limBands)) < REAL_CONST(0.49))
+#else
+ if (nOctaves < limiterBandsCompare[s - 1])
+#endif
+ {
+ uint8_t i;
+ if (limTable[k] != limTable[k - 1]) {
+ uint8_t found = 0, found2 = 0;
+ for (i = 0; i <= sbr->noPatches; i++) {
+ if (limTable[k] == patchBorders[i]) {
+ found = 1;
+ }
+ }
+ if (found) {
+ found2 = 0;
+ for (i = 0; i <= sbr->noPatches; i++) {
+ if (limTable[k - 1] == patchBorders[i]) {
+ found2 = 1;
+ }
+ }
+ if (found2) {
+ k++;
+ goto restart;
+ } else {
+ /* remove (k-1)th element */
+ limTable[k - 1] = sbr->f_table_res[LO_RES][sbr->N_low];
+ qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp);
+ nrLim--;
+ goto restart;
+ }
+ }
+ }
+ /* remove kth element */
+ limTable[k] = sbr->f_table_res[LO_RES][sbr->N_low];
+ qsort(limTable, nrLim, sizeof(limTable[0]), longcmp);
+ nrLim--;
+ goto restart;
+ } else {
+ k++;
+ goto restart;
+ }
+ }
+
+ sbr->N_L[s] = nrLim;
+ for (k = 0; k <= nrLim; k++) {
+ sbr->f_table_lim[s][k] = limTable[k] - sbr->kx;
+ }
+
+#if 0
+ printf("f_table_lim[%d][%d]: ", s, sbr->N_L[s]);
+ for (k = 0; k <= sbr->N_L[s]; k++) {
+ printf("%d ", sbr->f_table_lim[s][k]);
+ }
+ printf("\n");
+#endif
+ }
+}
+
+#endif