package {
    default_team: "trendy_team_media_codec_framework",
    default_applicable_licenses: [
        "frameworks_av_media_codecs_amrnb_dec_license",
    ],
}

// Added automatically by a large-scale-change that took the approach of
// 'apply every license found to every target'. While this makes sure we respect
// every license restriction, it may not be entirely correct.
//
// e.g. GPL in an MIT project might only apply to the contrib/ directory.
//
// Please consider splitting the single license below into multiple licenses,
// taking care not to lose any license_kind information, and overriding the
// default license using the 'licenses: [...]' property on targets as needed.
//
// For unused files, consider creating a 'fileGroup' with "//visibility:private"
// to attach the license to, and including a comment whether the files may be
// used in the current project.
// See: http://go/android-license-faq
license {
    name: "frameworks_av_media_codecs_amrnb_dec_license",
    visibility: [":__subpackages__"],
    license_kinds: [
        "SPDX-license-identifier-Apache-2.0",
        "SPDX-license-identifier-BSD",
    ],
    license_text: [
        "NOTICE",
    ],
}

cc_library_static {
    name: "libstagefright_amrnbdec",
    vendor_available: true,
    host_supported: true,
    min_sdk_version: "29",
    apex_available: [
        "//apex_available:platform",
        "com.android.media.swcodec",
    ],

    srcs: [
        "src/a_refl.cpp",
        "src/agc.cpp",
        "src/amrdecode.cpp",
        "src/b_cn_cod.cpp",
        "src/bgnscd.cpp",
        "src/c_g_aver.cpp",
        "src/d2_9pf.cpp",
        "src/d2_11pf.cpp",
        "src/d3_14pf.cpp",
        "src/d4_17pf.cpp",
        "src/d8_31pf.cpp",
        "src/d1035pf.cpp",
        "src/d_gain_c.cpp",
        "src/d_gain_p.cpp",
        "src/d_plsf.cpp",
        "src/d_plsf_3.cpp",
        "src/d_plsf_5.cpp",
        "src/dec_amr.cpp",
        "src/dec_gain.cpp",
        "src/dec_input_format_tab.cpp",
        "src/dec_lag3.cpp",
        "src/dec_lag6.cpp",
        "src/dtx_dec.cpp",
        "src/ec_gains.cpp",
        "src/ex_ctrl.cpp",
        "src/if2_to_ets.cpp",
        "src/int_lsf.cpp",
        "src/lsp_avg.cpp",
        "src/ph_disp.cpp",
        "src/post_pro.cpp",
        "src/preemph.cpp",
        "src/pstfilt.cpp",
        "src/qgain475_tab.cpp",
        "src/sp_dec.cpp",
        "src/wmf_to_ets.cpp",
    ],

    export_include_dirs: ["src"],

    cflags: [
        "-DOSCL_IMPORT_REF=",
        "-DOSCL_UNUSED_ARG(x)=(void)(x)",

        "-Werror",
    ],

    //sanitize: {
    //    misc_undefined: [
    //        "signed-integer-overflow",
    //    ],
    //},

    shared_libs: [
        "liblog",
        "libstagefright_amrnb_common",
    ],

    target: {
        darwin: {
            enabled: false,
        },
    },
}

//###############################################################################
cc_test {
    name: "libstagefright_amrnbdec_test",
    gtest: false,
    host_supported: true,

    srcs: ["test/amrnbdec_test.cpp"],

    cflags: [
        "-Wall",
        "-Werror",
    ],

    local_include_dirs: ["src"],

    static_libs: [
        "libsndfile",
        "libstagefright_amrnbdec",
    ],

    shared_libs: [
        "libaudioutils",
        "liblog",
        "libstagefright_amrnb_common",
    ],

    target: {
        darwin: {
            enabled: false,
        },
    },

    //sanitize: {
    //    misc_undefined: [
    //        "signed-integer-overflow",
    //    ],
    //},
}
