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/libraac/raac_decode.c b/audio_codec/libraac/raac_decode.c
new file mode 100644
index 0000000..99528f1
--- a/dev/null
+++ b/audio_codec/libraac/raac_decode.c
@@ -0,0 +1,854 @@
+#include <stdio.h>
+#include <limits.h>
+//#include <asm/cache.h>
+
+#ifndef __MW__
+#include <inttypes.h>
+#else
+#include <core/types.h>
+#endif
+#include "raac_decode.h"
+#include "aac_decode.h"
+#include "include/rm_parse.h"
+#include "include/ra_depack.h"
+#include "include/ra_decode.h"
+
+#include "include/rm_memory_default.h"
+#include "aacdec.h"
+
+#include "../../amadec/adec-armdec-mgt.h"
+
+#include <android/log.h>
+
+#define LOG_TAG "RaacDecoder"
+#define raac_print(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
+
+#define DefaultReadSize 32*1024
+#define DefaultOutBufSize 370*1024
+
+typedef struct {
+ rm_parser* pParser;
+ ra_depack* pDepack;
+ ra_decode* pDecode;
+ ra_format_info* pRaInfo;
+ rm_packet* pPacket;
+ ra_block* pBlock;
+ rm_stream_header* pHdr;
+ UINT32 usStreamNum;
+} rm_info_t;
+
+#define AUDIO_EXTRA_DATA_SIZE (2048*2)
+
+struct audio_info {
+ int valid;
+ int sample_rate;
+ int channels;
+ int bitrate;
+ int codec_id;
+ int block_align;
+ int extradata_size;
+ char extradata[AUDIO_EXTRA_DATA_SIZE];
+};
+
+struct frame_info {
+ int len;
+ unsigned long offset;/*steam start to here*/
+ unsigned long buffered_len;/*data buffer in dsp,pcm datalen*/
+ int reversed[1];/*for cache aligned 32 bytes*/
+};
+
+cook_IObuf cook_input;
+cook_IObuf cook_output;
+
+struct frame_info cur_frame;
+static unsigned aac_timestamplen = 0;
+static unsigned aac_timestamp = 0;
+static raac_decoder_info_t raac_dec_info ;
+static rm_info_t raac_info ;
+static char file_header[AUDIO_EXTRA_DATA_SIZE];
+#pragma align_to(64,file_header)
+static char *cur_read_ptr = file_header;
+
+void set_timestamp(unsigned val)
+{
+ aac_timestamp = val;
+}
+
+void set_timestamp_len(unsigned val)
+{
+ aac_timestamplen = val;
+}
+
+ra_decode*
+ra_decode_create2(void* pUserError,
+ rm_error_func_ptr fpError,
+ void* pUserMem,
+ rm_malloc_func_ptr fpMalloc,
+ rm_free_func_ptr fpFree)
+{
+ ra_decode* pRet = HXNULL;
+
+ if (fpMalloc && fpFree) {
+ pRet = (ra_decode*) fpMalloc(pUserMem, sizeof(ra_decode));
+
+ if (pRet) {
+ /* Zero out the struct */
+ memset((void*) pRet, 0, sizeof(ra_decode));
+ /* Assign the error function */
+ pRet->fpError = fpError;
+ pRet->pUserError = pUserError;
+ /* Assign the memory functions */
+ pRet->fpMalloc = fpMalloc;
+ pRet->fpFree = fpFree;
+ pRet->pUserMem = pUserMem;
+ }
+ }
+
+ return pRet;
+}
+
+ra_decode*
+ra_decode_create(void* pUserError,
+ rm_error_func_ptr fpError)
+{
+ return ra_decode_create2(pUserError,
+ fpError,
+ HXNULL,
+ rm_memory_default_malloc,
+ rm_memory_default_free);
+}
+
+/* ra_decode_destroy()
+ * Deletes the decoder backend and frontend instances. */
+void
+ra_decode_destroy(ra_decode* pFrontEnd)
+{
+ rm_free_func_ptr fpFree;
+ void* pUserMem;
+
+ if (pFrontEnd && pFrontEnd->fpFree) {
+ /* Save a pointer to fpFree and pUserMem */
+ fpFree = pFrontEnd->fpFree;
+ pUserMem = pFrontEnd->pUserMem;
+
+ if (pFrontEnd->pDecode && pFrontEnd->fpClose) {
+ /* Free the decoder instance and backend */
+ pFrontEnd->fpClose(pFrontEnd->pDecode,
+ pUserMem,
+ fpFree);
+ }
+
+ /* Free the ra_decode struct memory */
+ fpFree(pUserMem, pFrontEnd);
+ }
+}
+
+/* ra_decode_init()
+ * Selects decoder backend with fourCC code.
+ * Calls decoder backend init function with init params.
+ * Returns zero on success, negative result indicates failure. */
+HX_RESULT
+ra_decode_init(ra_decode* pFrontEnd,
+ UINT32 ulFourCC,
+ void* pInitParams,
+ UINT32 ulInitParamsSize,
+ ra_format_info* pStreamInfo)
+{
+ HX_RESULT retVal = HXR_OK;
+
+ /* Assign the backend function pointers */
+ if (ulFourCC == 0x72616163 || /* 'raac' */
+ ulFourCC == 0x72616370) { /* 'racp' */
+ pFrontEnd->fpInit = aac_decode_init;
+ pFrontEnd->fpReset = aac_decode_reset;
+ pFrontEnd->fpConceal = aac_decode_conceal;
+ pFrontEnd->fpDecode = aac_decode_decode;
+ pFrontEnd->fpGetMaxSize = aac_decode_getmaxsize;
+ pFrontEnd->fpGetChannels = aac_decode_getchannels;
+ pFrontEnd->fpGetChannelMask = aac_decode_getchannelmask;
+ pFrontEnd->fpGetSampleRate = aac_decode_getrate;
+ pFrontEnd->fpMaxSamp = aac_decode_getdelay;
+ pFrontEnd->fpClose = aac_decode_close;
+ } else {
+ /* error - codec not supported */
+ raac_print(" cook decode: not supported fourcc\n");
+ retVal = HXR_DEC_NOT_FOUND;
+ }
+
+ if (retVal == HXR_OK && pFrontEnd && pFrontEnd->fpInit && pStreamInfo) {
+ retVal = pFrontEnd->fpInit(pInitParams, ulInitParamsSize, pStreamInfo,
+ &pFrontEnd->pDecode, pFrontEnd->pUserMem,
+ pFrontEnd->fpMalloc, pFrontEnd->fpFree);
+ }
+
+ return retVal;
+}
+
+/* ra_decode_reset()
+ * Calls decoder backend reset function.
+ * Depending on which codec is in use, *pNumSamplesOut samples may
+ * be flushed. After reset, the decoder returns to its initial state.
+ * Returns zero on success, negative result indicates failure. */
+HX_RESULT
+ra_decode_reset(ra_decode* pFrontEnd,
+ UINT16* pSamplesOut,
+ UINT32 ulNumSamplesAvail,
+ UINT32* pNumSamplesOut)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pFrontEnd && pFrontEnd->fpReset) {
+ retVal = pFrontEnd->fpReset(pFrontEnd->pDecode, pSamplesOut,
+ ulNumSamplesAvail, pNumSamplesOut);
+ }
+
+ return retVal;
+}
+
+/* ra_decode_conceal()
+ * Calls decoder backend conceal function.
+ * On successive calls to ra_decode_decode(), the decoder will attempt
+ * to conceal ulNumSamples. No input data should be sent while concealed
+ * frames are being produced. Once the decoder has exhausted the concealed
+ * samples, it can proceed normally with decoding valid input data.
+ * Returns zero on success, negative result indicates failure. */
+HX_RESULT
+ra_decode_conceal(ra_decode* pFrontEnd,
+ UINT32 ulNumSamples)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pFrontEnd && pFrontEnd->fpConceal) {
+ retVal = pFrontEnd->fpConceal(pFrontEnd->pDecode, ulNumSamples);
+ }
+
+ return retVal;
+}
+
+/* ra_decode_decode()
+ * Calls decoder backend decode function.
+ * pData : input data (compressed frame).
+ * ulNumBytes : input data size in bytes.
+ * pNumBytesConsumed : amount of input data consumed by decoder.
+ * pSamplesOut : output data (uncompressed frame).
+ * ulNumSamplesAvail : size of output buffer.
+ * pNumSamplesOut : amount of ouput data produced by decoder.
+ * ulFlags : control flags for decoder.
+ * Returns zero on success, negative result indicates failure. */
+HX_RESULT
+ra_decode_decode(ra_decode* pFrontEnd,
+ UINT8* pData,
+ UINT32 ulNumBytes,
+ UINT32* pNumBytesConsumed,
+ UINT16* pSamplesOut,
+ UINT32 ulNumSamplesAvail,
+ UINT32* pNumSamplesOut,
+ UINT32 ulFlags,
+ UINT32 ulTimeStamp)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pFrontEnd && pFrontEnd->fpDecode) {
+ retVal = pFrontEnd->fpDecode(pFrontEnd->pDecode, pData, ulNumBytes,
+ pNumBytesConsumed, pSamplesOut,
+ ulNumSamplesAvail, pNumSamplesOut, ulFlags, ulTimeStamp);
+ }
+
+ return retVal;
+}
+
+
+/**************** Accessor Functions *******************/
+/* ra_decode_getmaxsize()
+ * pNumSamples receives the maximum number of samples produced
+ * by the decoder in response to a call to ra_decode_decode().
+ * Returns zero on success, negative result indicates failure. */
+HX_RESULT
+ra_decode_getmaxsize(ra_decode* pFrontEnd,
+ UINT32* pNumSamples)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pFrontEnd && pFrontEnd->fpGetMaxSize) {
+ retVal = pFrontEnd->fpGetMaxSize(pFrontEnd->pDecode, pNumSamples);
+ }
+
+ return retVal;
+}
+
+/* ra_decode_getchannels()
+ * pNumChannels receives the number of audio channels in the bitstream.
+ * Returns zero on success, negative result indicates failure. */
+HX_RESULT
+ra_decode_getchannels(ra_decode* pFrontEnd,
+ UINT32* pNumChannels)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pFrontEnd && pFrontEnd->fpGetChannels) {
+ retVal = pFrontEnd->fpGetChannels(pFrontEnd->pDecode, pNumChannels);
+ }
+
+ return retVal;
+}
+
+/* ra_decode_getchannelmask()
+ * pChannelMask receives the 32-bit mapping of the audio output channels.
+ * Returns zero on success, negative result indicates failure. */
+HX_RESULT
+ra_decode_getchannelmask(ra_decode* pFrontEnd,
+ UINT32* pChannelMask)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pFrontEnd && pFrontEnd->fpGetChannelMask) {
+ retVal = pFrontEnd->fpGetChannelMask(pFrontEnd->pDecode, pChannelMask);
+ }
+
+ return retVal;
+}
+
+/* ra_decode_getrate()
+ * pSampleRate receives the sampling rate of the output samples.
+ * Returns zero on success, negative result indicates failure. */
+HX_RESULT
+ra_decode_getrate(ra_decode* pFrontEnd,
+ UINT32* pSampleRate)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pFrontEnd && pFrontEnd->fpGetSampleRate) {
+ retVal = pFrontEnd->fpGetSampleRate(pFrontEnd->pDecode, pSampleRate);
+ }
+
+ return retVal;
+}
+
+/* ra_decode_getdelay()
+ * pNumSamples receives the number of invalid output samples
+ * produced by the decoder at startup.
+ * If non-zero, it is up to the user to discard these samples.
+ * Returns zero on success, negative result indicates failure. */
+HX_RESULT
+ra_decode_getdelay(ra_decode* pFrontEnd,
+ UINT32* pNumSamples)
+{
+ HX_RESULT retVal = HXR_FAIL;
+
+ if (pFrontEnd && pFrontEnd->fpMaxSamp) {
+ retVal = pFrontEnd->fpMaxSamp(pFrontEnd->pDecode, pNumSamples);
+ }
+
+ return retVal;
+}
+
+
+void rm_error(void* pError, HX_RESULT result, const char* pszMsg)
+{
+ //dsp_mailbox_send(1,M1B_IRQ7_DECODE_FATAL_ERR, 1, NULL, 0);
+ //trans_err_code(DECODE_FATAL_ERR);
+ raac_print("rm_error pError=0x%08x result=0x%08x msg=%s\n", pError, result, pszMsg);
+ //while(1);
+}
+//static int raac_decode_frame(unsigned char *buf, int maxlen, struct frame_fmt *fmt)
+int audio_dec_decode(audio_decoder_operations_t *adec_ops, char *outbuf, int *outlen, char *inbuf, int inlen)
+{
+ HX_RESULT retVal = HXR_OK;
+ UINT32 ulBytesConsumed = 0;
+ UINT32 ulTotalConsumed = 0;
+ UINT32 ulBytesLeft = 0;
+ UINT32 ulNumSamplesOut = 0;
+ UINT32 ulMaxSamples = 0;
+ UINT32 out_data_len = 0;
+
+ if (inlen > 0) {
+ int len = inlen - cook_input.buf_len;
+ int read_len;
+ read_len = (inlen > cook_input.buf_max) ? cook_input.buf_max : inlen;
+ if (len > 0) {
+ memcpy(cook_input.buf + cook_input.buf_len,
+ inbuf + cook_input.buf_len, read_len - cook_input.buf_len);
+ cook_input.buf_len += read_len - cook_input.buf_len;
+ }
+ }
+ //libcook_print("audio_dec_decoder cook_input.buf_len = %d\n", cook_input.buf_len);
+ while (cook_output.buf_len <= 0) {
+ retVal = rm_parser_get_packet(raac_info.pParser, &raac_info.pPacket);
+ if (retVal == HXR_OK) {
+ //if (ra_info.pPacket->usStream == ra_info.usStreamNum)
+ {
+ retVal = ra_depack_add_packet(raac_info.pDepack, raac_info.pPacket);
+
+ }
+ rm_parser_destroy_packet(raac_info.pParser, &raac_info.pPacket);
+ }
+ if (retVal != HXR_OK) {
+ raac_print("cook_decode_frame£º add packet failed\n");
+ break;
+ }
+ }
+
+ *outlen = 0;
+ if (cook_output.buf_len > 0) {
+ memcpy(outbuf, cook_output.buf, cook_output.buf_len);
+ (*outlen) = cook_output.buf_len;
+ cook_output.buf_len = 0;
+ }
+
+ int ret = 0;
+ //ret = ra_dec_info.decoded_size + cook_input.cousume;
+ ret = cook_input.cousume;
+ //libcook_print("ret decoder = %d\n", ret);
+ cook_input.cousume = 0;
+ adec_ops->pts = cur_frame.offset;
+ cur_frame.offset = 0;
+ return ret;
+ //return raac_dec_info.decoded_size;
+}
+
+
+UINT32 rm_io_read(void* pUserRead, BYTE* pBuf, UINT32 ulBytesToRead)
+{
+ memcpy(pBuf, cur_read_ptr, ulBytesToRead);
+ cur_read_ptr = cur_read_ptr + ulBytesToRead;
+ if ((unsigned)(cur_read_ptr - file_header) > AUDIO_EXTRA_DATA_SIZE) {
+ //trans_err_code(DECODE_INIT_ERR);
+ raac_print("warning :: raac.read byte exceed the the buffer then sent,%d \n", (unsigned)(cur_read_ptr - file_header));
+ while (1) {
+ ;
+ }
+ }
+ return ulBytesToRead;
+}
+void rm_io_seek(void* pUserRead, UINT32 ulOffset, UINT32 ulOrigin)
+{
+ if (ulOrigin == HX_SEEK_ORIGIN_CUR) {
+ cur_read_ptr += ulOffset;
+ } else if (ulOrigin == HX_SEEK_ORIGIN_SET) {
+ cur_read_ptr = (char *)pUserRead + ulOffset;
+ } else if (ulOrigin == HX_SEEK_ORIGIN_END) {
+ cur_read_ptr = sizeof(file_header) + (char *)pUserRead - ulOffset;
+ }
+ if ((unsigned)(cur_read_ptr - file_header) > AUDIO_EXTRA_DATA_SIZE) {
+ //trans_err_code(DECODE_INIT_ERR);
+ raac_print("warning :: raac.seek buffer pos exceed the the buffer then sent,%d \n", (unsigned)(cur_read_ptr - file_header));
+ while (1) {
+ ;
+ }
+ }
+
+}
+unsigned rm_ab_read(void* pUserRead, BYTE* pBuf, UINT32 ulBytesToRead)
+{
+ int ret = 0;
+#if 0
+ if (pBuf && ulBytesToRead) {
+ ret = read_buffer(pBuf, ulBytesToRead);
+ }
+ return ret;
+#endif
+ if (pBuf && ulBytesToRead) {
+ ret = (ulBytesToRead > cook_input.buf_len) ? cook_input.buf_len : ulBytesToRead;
+ memcpy(pBuf, cook_input.buf, ret);
+ if (ret < cook_input.buf_len) {
+ memcpy(cook_input.buf, (cook_input.buf + ret), cook_input.buf_len - ret);
+ }
+ cook_input.buf_len -= ret;
+ }
+ cook_input.cousume += ret;
+ cook_input.all_consume += ret;
+ return ret;
+}
+void rm_ab_seek(void* pUserRead, UINT32 ulOffset, UINT32 ulOrigin)
+{
+ int i;
+#if 0
+ if (ulOrigin == HX_SEEK_ORIGIN_CUR) {
+ for (i = 0; i < ulOffset; i++) {
+ read_byte();
+ }
+ }
+#endif
+ if (ulOrigin == HX_SEEK_ORIGIN_CUR) {
+ if (ulOffset <= cook_input.buf_len) {
+ //memcpy(cook_input.buf, cook_input.buf + ulOffset, cook_input.buf_len - ulOffset);
+ cook_input.buf_len -= ulOffset;
+ cook_input.cousume += ulOffset;
+ //cook_input.all_consume += ulOffset;
+ memcpy(cook_input.buf, cook_input.buf + ulOffset, cook_input.buf_len);
+ } else {
+ raac_print("rm_ab_seek failed\n");
+ }
+ }
+
+}
+HX_RESULT _raac_block_available(void* pAvail, UINT32 ulSubStream, ra_block* pBlock)
+{
+ int len = 0, wlen;
+ int offset = 0;
+ HX_RESULT retVal = HXR_OK;
+ UINT32 ulBytesConsumed = 0;
+ UINT32 ulTotalConsumed = 0;
+ UINT32 ulBytesLeft = 0;
+ UINT32 ulNumSamplesOut = 0;
+ UINT32 ulMaxSamples = 0;
+ UINT32 out_data_len = 0;
+ UINT32 delay_pts = 0;
+ //BYTE* buf = raac_dec_info.input_buf;//passed from the audio dec thread
+ rm_info_t* pInfo = (rm_info_t*) pAvail;
+ if (pAvail && pBlock && pBlock->pData && pBlock->ulDataLen) {
+ ulBytesLeft = pBlock->ulDataLen;
+ while (retVal == HXR_OK && ulBytesLeft) {
+ retVal = ra_decode_decode(raac_dec_info.pDecode,
+ pBlock->pData + pBlock->ulDataLen - ulBytesLeft,
+ ulBytesLeft,
+ &ulBytesConsumed,
+ (UINT16*)raac_dec_info.pOutBuf,
+ raac_dec_info.ulOutBufSize / 2,
+ &ulNumSamplesOut,
+ pBlock->ulDataFlags,
+ pBlock->ulTimestamp * 90);
+
+ if (retVal == HXR_OK) {
+ if (ulBytesConsumed) {
+ ulBytesLeft -= ulBytesConsumed;
+ }
+ if (ulNumSamplesOut) {
+ len = ulNumSamplesOut * 2;
+ }
+ } else if (retVal == HXR_NO_DATA) {
+ raac_print("raac decode not enough data.\n");
+ return 0;
+ } else {
+ raac_print("raac decode error.\n");
+ return 0;
+ }
+ //#if 0
+ //raac_print("ulTimestamp=%ld\n", pBlock->ulTimestamp);
+ cur_frame.offset = pBlock->ulTimestamp * 90 + 1;
+ cur_frame.buffered_len = 0;
+ cur_frame.len = 0;
+ delay_pts += ulNumSamplesOut;//(ulNumSamplesOut/raac_info.pRaInfo->usNumChannels)*90 /(raac_info.pRaInfo->ulSampleRate / 1000);
+ //refresh_swap_register1(cur_frame.offset+delay_pts, len);
+ //#endif
+ memcpy(cook_output.buf + cook_output.buf_len, raac_dec_info.pOutBuf, len);
+ cook_output.buf_len += len;
+ len = 0;
+ }
+ delay_pts = (delay_pts / raac_info.pRaInfo->usNumChannels) * 90 / (raac_info.pRaInfo->ulSampleRate / 1000);
+ cur_frame.offset += delay_pts;
+ raac_dec_info.decoded_size = out_data_len;
+ }
+ return retVal;
+}
+//static int raac_decode_init(struct frame_fmt * fmt)
+int audio_dec_init(audio_decoder_operations_t *adec_ops)
+{
+ //raac_print("\n\n[%s]BuildDate--%s BuildTime--%s", __FUNCTION__, __DATE__, __TIME__);
+ raac_print("enter into %s:%d\n", __FUNCTION__, __LINE__);
+ HX_RESULT retVal = HXR_OK;
+ unsigned ulNumStreams = 0;
+ rm_parser* pParser = HXNULL;
+ rm_stream_header *pHdr = HXNULL;
+ ra_depack *pRADpack = HXNULL;
+ ra_format_info *pRAInfo = HXNULL;
+ int i;
+#if 0
+ struct audio_info *real_data;
+ real_data = (struct audio_info *)fmt->private_data;
+ if (!real_data || !real_data->extradata) {
+ raac_print("[raac decode],got extra data failed\n");
+ return -1;
+ }
+#endif
+ struct audio_info real_data;
+
+ real_data.bitrate = adec_ops->bps;
+ real_data.channels = adec_ops->channels;
+ real_data.extradata_size = adec_ops->extradata_size;
+ real_data.sample_rate = adec_ops->samplerate;
+
+ adec_ops->nInBufSize = DefaultReadSize;
+ adec_ops->nOutBufSize = DefaultOutBufSize;
+ raac_print("%s:%d\n", __FUNCTION__, __LINE__);
+ memset(real_data.extradata, 0, AUDIO_EXTRA_DATA_SIZE);
+ raac_print("%d,%d\n", real_data.extradata_size, adec_ops->extradata_size);
+ for (i = 0; i < real_data.extradata_size; i++) {
+ real_data.extradata[i] = adec_ops->extradata[i];
+ }
+
+ raac_print("raac audioinfo four data [0x%x], [0x%x],[0x%x],[0x%x],[0x%x],[0x%x],[0x%x],[0x%x],\n", real_data.extradata[0], \
+ real_data.extradata[1], real_data.extradata[2], real_data.extradata[3], \
+ real_data.extradata[4], real_data.extradata[5], real_data.extradata[6], real_data.extradata[7]);
+
+ memcpy(file_header, real_data.extradata, AUDIO_EXTRA_DATA_SIZE);
+
+ if (cook_input.buf == NULL) {
+ cook_input.buf = (BYTE *)malloc(DefaultReadSize * sizeof(BYTE));
+ if (cook_input.buf != NULL) {
+ memset(cook_input.buf, 0, DefaultReadSize);
+ cook_input.buf_len = 0;
+ cook_input.buf_max = DefaultReadSize;
+ cook_input.cousume = 0;
+ cook_input.all_consume = 0;
+ } else {
+ raac_print("inbuf malloc failed\n");
+ return -1;
+ }
+ }
+ if (cook_output.buf == NULL) {
+ cook_output.buf = (BYTE *)malloc(DefaultOutBufSize * sizeof(BYTE));
+ if (cook_output.buf != NULL) {
+ memset(cook_output.buf, 0, DefaultOutBufSize);
+ cook_output.buf_len = 0;
+ cook_output.buf_max = DefaultOutBufSize;
+ cook_output.cousume = 0;
+ } else {
+ raac_print("outbuf malloc failed\n");
+ return -1;
+ }
+ }
+
+ if (cook_input.buf == NULL || cook_output.buf == NULL) {
+ raac_print("malloc buf failed\n");
+ return -1;
+
+ }
+ //dsp_cache_wback((unsigned)file_header,AUDIO_EXTRA_DATA_SIZE);
+ cur_frame.offset = 0;
+
+ unsigned ulCodec4CC = 0;
+ //int i;
+ /*clear up the decoder structure */
+ memset(&raac_dec_info, 0, sizeof(raac_decoder_info_t));
+ memset(&raac_info, 0, sizeof(rm_info_t));
+ cur_read_ptr = file_header;
+
+ /* Create the parser struct */
+ pParser = rm_parser_create(NULL, rm_error);
+ if (!pParser) {
+ raac_print("[raac decode],create parser failed\n");
+ return -1;
+ }
+ /* Set the stream into the parser */
+#if 0
+ for (i = 0; i < 1; i++) {
+ raac_print("%d header data [0x%x],[0x%x],[0x%x],[0x%x],[0x%x],[0x%x],[0x%x],[0x%x]\n\t", i, \
+ file_header[i * 8 + 0], file_header[i * 8 + 1], file_header[i * 8 + 2], file_header[i * 8 + 3], \
+ file_header[i * 8 + 4], file_header[i * 8 + 5], file_header[i * 8 + 6], file_header[i * 8 + 7]);
+ }
+#endif /* 0 */
+ retVal = rm_parser_init_io(pParser, file_header, rm_io_read, rm_io_seek);
+ if (retVal != HXR_OK) {
+ raac_print("[raac decode], parser init IO failed,errid %d\n", retVal);
+ rm_parser_destroy(&pParser);
+ return -1;
+ }
+ /* Read all the headers at the beginning of the .rm file */
+ retVal = rm_parser_read_headers(pParser);
+ if (retVal != HXR_OK) {
+ raac_print("[raac decode], parser read header failed,errid %d\n", retVal);
+ rm_parser_destroy(&pParser);
+ return -1;
+ }
+ raac_print("raac: rm_parser_read_headers finished \n");
+ /* Get the number of streams */
+ ulNumStreams = rm_parser_get_num_streams(pParser);
+ if (ulNumStreams == 0) {
+ raac_print("[raac decode], no stream found\n");
+ rm_parser_destroy(&pParser);
+ return -1;
+ }
+ for (i = 0; i < ulNumStreams && retVal == HXR_OK; i++) {
+ retVal = rm_parser_get_stream_header(pParser, i, &pHdr);
+ if (retVal == HXR_OK) {
+ if (rm_stream_is_realaudio(pHdr)) {
+ /* Create the RealAudio depacketizer */
+ pRADpack = ra_depack_create((void*)pParser, _raac_block_available, NULL, rm_error);
+ if (!pRADpack) {
+ raac_print("[raac decode], create depack failed\n");
+ rm_parser_destroy_stream_header(pParser, &pHdr);
+ rm_parser_destroy(&pParser);
+ return -1;
+ }
+ /* Initialize the RA depacketizer with the stream header */
+ retVal = ra_depack_init(pRADpack, pHdr);
+ if (retVal != HXR_OK) {
+ raac_print("[raac decode],init depack failed,errid %d\n", retVal);
+ ra_depack_destroy(&pRADpack);
+ rm_parser_destroy_stream_header(pParser, &pHdr);
+ rm_parser_destroy(&pParser);
+ return -1;
+ }
+ /*
+ * Get the codec 4CC of substream 0. We
+ * arbitrarily choose substream 0 here.
+ */
+ ulCodec4CC = ra_depack_get_codec_4cc(pRADpack, 0);
+ if (ulCodec4CC == 0x636F6F6B) { /* cook */
+ retVal = ra_depack_get_codec_init_info(pRADpack, 0, &pRAInfo);
+ raac_info.pRaInfo = pRAInfo;
+ } else if ((ulCodec4CC == 0x72616163) || (ulCodec4CC == 0x72616370))
+ /* raac racp */
+ {
+ retVal = ra_depack_get_codec_init_info(pRADpack, 0, &pRAInfo);
+ raac_info.pRaInfo = pRAInfo;
+ }
+ raac_info.pDepack = pRADpack;
+ }
+ rm_parser_destroy_stream_header(pParser, &pHdr);
+ }
+ raac_print("raac rm_parser_get_stream_header finished\n");
+ }
+ /* Set the stream into the parser */
+ retVal = rm_parser_init_io(pParser, 0, rm_ab_read, rm_ab_seek);
+ if (retVal != HXR_OK) {
+ if (pRADpack) {
+ ra_depack_destroy(&pRADpack);
+ raac_info.pDepack = NULL;
+ }
+ if (pParser) {
+ rm_parser_destroy(&pParser);
+ }
+ raac_print("[raac decode],rm_parser_init_io failed,errid %d\n", retVal);
+ return -1;
+ }
+ raac_info.pParser = pParser;
+ rm_parser_set_stream(&pParser, 0);
+ rm_parser_file_seek(pParser, 0);
+ raac_dec_info.pDecode = ra_decode_create(HXNULL, rm_error);
+ if (retVal != HXR_OK) {
+ if (pRADpack) {
+ ra_depack_destroy(&pRADpack);
+ raac_info.pDepack = NULL;
+ }
+ if (pParser) {
+ rm_parser_destroy(&pParser);
+ }
+ raac_print("[raac decode],ra_decode_create failed,errid %d\n", retVal);
+ return -1;
+ }
+ raac_dec_info.ulStatus = RADEC_PLAY;
+ raac_dec_info.ulTotalSample = 0;
+ raac_dec_info.ulTotalSamplePlayed = 0;
+ UINT32 ulBufSize = 2048/*max sample*/ * 2/*max channel*/ * sizeof(UINT16) * SBR_MUL;
+ raac_dec_info.ulOutBufSize = ulBufSize;
+ raac_dec_info.pOutBuf = (BYTE*) malloc(raac_dec_info.ulOutBufSize);
+ if (raac_dec_info.pOutBuf == NULL) {
+ if (pRADpack) {
+ ra_depack_destroy(&pRADpack);
+ raac_info.pDepack = NULL;
+ }
+ if (pParser) {
+ rm_parser_destroy(&pParser);
+ raac_info.pParser = NULL;
+ }
+ raac_print("[raac decode],dsp malloc failed,request %s bytes\n", raac_dec_info.ulOutBufSize);
+ return -1;
+ }
+ retVal = ra_decode_init(raac_dec_info.pDecode, ulCodec4CC, HXNULL, 0, raac_info.pRaInfo);
+ if (retVal != HXR_OK) {
+ if (pRADpack) {
+ ra_depack_destroy(&pRADpack);
+ raac_info.pDepack = NULL;
+ }
+ if (pParser) {
+ rm_parser_destroy(&pParser);
+ raac_info.pParser = NULL;
+ }
+ raac_print("[raac decode],ra_decode_init failed,errid %d\n", retVal);
+ return -1;
+ }
+ //fmt->valid=CHANNEL_VALID | SAMPLE_RATE_VALID | DATA_WIDTH_VALID;
+ //fmt->channel_num = raac_info.pRaInfo->usNumChannels;
+ //fmt->data_width = 16;
+#if 0//def AAC_ENABLE_SBR
+ //fmt->sample_rate = raac_info.pRaInfo->ulActualRate;
+#else
+ //fmt->sample_rate = raac_info.pRaInfo->ulSampleRate;
+ aac_decode *pdec = (aac_decode *)raac_dec_info.pDecode->pDecode;
+ if (pdec /*&& pdec->ulSampleRateCore*/) {
+ //fmt->sample_rate = pdec->ulSampleRateCore;
+ raac_print("actual sr %d, sr %d,sbr %d,core sr %d,dec aac sr %d \n", raac_info.pRaInfo->ulActualRate, \
+ raac_info.pRaInfo->ulSampleRate, pdec->bSBR, \
+ pdec->ulSampleRateCore, pdec->ulSampleRateOut);
+ }
+#endif
+
+ return 0;
+}
+
+void ra_depack_cleanup(void)
+{
+ /* Destroy the codec init info */
+ if (raac_info.pRaInfo) {
+ ra_depack_destroy_codec_init_info(raac_info.pDepack, &raac_info.pRaInfo);
+ }
+ /* Destroy the depacketizer */
+ if (raac_info.pDepack) {
+ ra_depack_destroy(&raac_info.pDepack);
+ }
+ /* If we have a packet, destroy it */
+ if (raac_info.pPacket) {
+ rm_parser_destroy_packet(raac_info.pParser, &raac_info.pPacket);
+ }
+ if (raac_info.pParser) {
+ rm_parser_destroy(&raac_info.pParser);
+ }
+ memset(&raac_info, 0, sizeof(raac_info));
+}
+
+
+//static int raac_decode_release(void)
+int audio_dec_release(audio_decoder_operations_t *adec_ops)
+{
+ if (cook_input.buf != NULL) {
+ free(cook_input.buf);
+ cook_input.buf = NULL;
+ }
+ if (cook_output.buf != NULL) {
+ free(cook_output.buf);
+ cook_output.buf = NULL;
+ }
+
+ ra_decode_destroy(raac_dec_info.pDecode);
+ raac_dec_info.pDecode = HXNULL;
+ if (raac_dec_info.pOutBuf) {
+ free(raac_dec_info.pOutBuf);
+ raac_dec_info.pOutBuf = HXNULL;
+ }
+ raac_dec_info.ulStatus = RADEC_IDLE;
+ ra_depack_cleanup();
+ raac_print(" raac decoder release\n");
+
+ return 0;
+}
+
+int audio_dec_getinfo(audio_decoder_operations_t *adec_ops, void *pAudioInfo)
+{
+ aac_decode *pdec = (aac_decode *)raac_dec_info.pDecode->pDecode;
+ if (pdec) {
+ ((AudioInfo *)pAudioInfo)->channels = pdec->ulNumChannels;
+ ((AudioInfo *)pAudioInfo)->samplerate = pdec->ulSampleRateOut;
+ }
+ return 0;
+}
+
+
+#if 0
+static struct codec_type raac_codec = {
+ .name = "raac",
+ .init = raac_decode_init,
+ .release = raac_decode_release,
+ .decode_frame = raac_decode_frame,
+};
+
+
+void __used raac_codec_init(void)
+{
+ raac_print("register raac lib \n");
+ register_codec(&raac_codec);
+}
+
+CODEC_INIT(raac_codec_init);
+#endif