Commit d7e0ff79 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch '54-fix-incorrect-downmix-matrix-for-5_1_4-to-5_1_2' into 'main'

Resolve "fix incorrect downmix matrix for 5_1_4 to 5_1_2"

See merge request !48
parents 385e84d2 c6da3100
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -157,6 +157,8 @@

#define FIX_34                                          /* Nokia: Fix bug in MASA format EXT output spherical indexing */

#define FIX_I54_LS_CONVERSION                           /* FhG: fix incorrect downmix matrix for 5_1_4 to 5_1_2 and upmix matrix for 7_1 to 7_1_4 */

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
#endif
+55 −0
Original line number Diff line number Diff line
@@ -580,6 +580,23 @@ const LS_CONVERSION_MATRIX ls_conversion_cicp14_cicp6[] =
    {43, 0.849999964f}
};

#ifdef FIX_I54_LS_CONVERSION
const LS_CONVERSION_MATRIX ls_conversion_cicp14_cicp12[] =
{
    /* First row indicates the number of non-zero elements */
    {8, 0.0f},
    /* Index of non-zero element, value of non-zero element*/
    {0,  1.000000000f},
    {9,  1.000000000f},
    {18, 1.000000000f},
    {27, 1.000000000f},
    {36, 1.000000000f},
    {45, 1.000000000f},
    {48, 0.849999964f},
    {57, 0.849999964f}
};
#endif

const LS_CONVERSION_MATRIX ls_conversion_cicp16_cicp6[] =
{
    /* First row indicates the number of non-zero elements */
@@ -620,6 +637,18 @@ const LS_CONVERSION_MATRIX ls_conversion_cicp16_cicp14[] =
    /* First row indicates the number of non-zero elements */
    {10, 0.0f},
    /* Index of non-zero element, value of non-zero element*/
#ifdef FIX_I54_LS_CONVERSION
    {0,  1.000000000f},
    {9,  1.000000000f},
    {18, 1.000000000f},
    {27, 1.000000000f},
    {36, 1.000000000f},
    {45, 1.000000000f},
    {54, 1.000000000f},
    {63, 1.000000000f},
    {68, 0.849999964f},
    {77, 0.849999964f},
#else
    {0,  1.000000000f},
    {11, 1.000000000f},
    {22, 1.000000000f},
@@ -630,6 +659,7 @@ const LS_CONVERSION_MATRIX ls_conversion_cicp16_cicp14[] =
    {59, 0.849999964f},
    {66, 1.000000000f},
    {77, 1.000000000f},
#endif
};

const LS_CONVERSION_MATRIX ls_conversion_cicp19_cicp6[] =
@@ -747,6 +777,23 @@ const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp16[] =
    {75, 1.0f}
};

#ifdef FIX_I54_LS_CONVERSION
const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp19[] =
{
    /* First row indicates the number of non-zero elements */
    {8,  0.0f},
    /* Index of non-zero element, value of non-zero element*/
    {0,  1.0f},
    {13, 1.0f},
    {26, 1.0f},
    {39, 1.0f},
    {54, 1.0f},
    {67, 1.0f},
    {76, 1.0f},
    {89, 1.0f}
};
#endif

const LS_CONVERSION_MATRIX ls_conversion_cicp14_cicp19[] =
{
    /* First row indicates the number of non-zero elements */
@@ -802,7 +849,11 @@ const LS_CONVERSION_MAPPING ls_conversion_mapping[LS_SETUP_CONVERSION_NUM_MAPPIN
    {AUDIO_CONFIG_7_1,   AUDIO_CONFIG_5_1,   ls_conversion_cicp12_cicp6},

    {AUDIO_CONFIG_5_1_2, AUDIO_CONFIG_5_1,   ls_conversion_cicp14_cicp6},
#ifdef FIX_I54_LS_CONVERSION
    {AUDIO_CONFIG_5_1_2, AUDIO_CONFIG_7_1,   ls_conversion_cicp14_cicp12},
#else
    {AUDIO_CONFIG_5_1_2, AUDIO_CONFIG_7_1,   ls_conversion_cicp14_cicp6},
#endif

    {AUDIO_CONFIG_5_1_4, AUDIO_CONFIG_5_1,   ls_conversion_cicp16_cicp6},
    {AUDIO_CONFIG_5_1_4, AUDIO_CONFIG_7_1,   ls_conversion_cicp16_cicp12},
@@ -827,7 +878,11 @@ const LS_CONVERSION_MAPPING ls_conversion_mapping[LS_SETUP_CONVERSION_NUM_MAPPIN

    {AUDIO_CONFIG_7_1, AUDIO_CONFIG_5_1_2, ls_conversion_cicp12_cicp14},
    {AUDIO_CONFIG_7_1, AUDIO_CONFIG_5_1_4, ls_conversion_cicp12_cicp16},
#ifdef FIX_I54_LS_CONVERSION
    {AUDIO_CONFIG_7_1, AUDIO_CONFIG_7_1_4, ls_conversion_cicp12_cicp19},
#else
    {AUDIO_CONFIG_7_1, AUDIO_CONFIG_7_1_4, NULL},
#endif

    {AUDIO_CONFIG_5_1_2, AUDIO_CONFIG_5_1_4, NULL},
    {AUDIO_CONFIG_5_1_2, AUDIO_CONFIG_7_1_4, ls_conversion_cicp14_cicp19},
+6 −0
Original line number Diff line number Diff line
@@ -120,6 +120,9 @@ extern const float ls_conversion_cicpX_stereo[12][2];
extern const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp6[];
extern const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp6[];
extern const LS_CONVERSION_MATRIX ls_conversion_cicp14_cicp6[];
#ifdef FIX_I54_LS_CONVERSION
extern const LS_CONVERSION_MATRIX ls_conversion_cicp14_cicp12[];
#endif
extern const LS_CONVERSION_MATRIX ls_conversion_cicp16_cicp6[];
extern const LS_CONVERSION_MATRIX ls_conversion_cicp16_cicp14[];
extern const LS_CONVERSION_MATRIX ls_conversion_cicp19_cicp6[];
@@ -130,6 +133,9 @@ extern const LS_CONVERSION_MATRIX ls_conversion_cicp19_cicp16[];
/* Upmix matrices */
extern const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp14[];
extern const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp16[];
#ifdef FIX_I54_LS_CONVERSION
extern const LS_CONVERSION_MATRIX ls_conversion_cicp12_cicp19[];
#endif
extern const LS_CONVERSION_MATRIX ls_conversion_cicp14_cicp19[];
extern const LS_CONVERSION_MATRIX ls_conversion_cicp16_cicp19[];

+8 −4
Original line number Diff line number Diff line
@@ -78,17 +78,17 @@ IVAS_CICP14_TO_6 = IVAS_CICP14_TO_6.reshape(8, 6)

IVAS_CICP16_TO_6 = np.zeros(10 * 6)
IVAS_CICP16_TO_6[[0, 7, 14, 21, 28, 35]] = 1
IVAS_CICP16_TO_6[[36, 43, 52, 59]] = 0.89999964
IVAS_CICP16_TO_6[[36, 43, 52, 59]] = 0.849999964
IVAS_CICP16_TO_6 = IVAS_CICP16_TO_6.reshape(10, 6)

IVAS_CICP16_TO_12 = np.zeros(10 * 8)
IVAS_CICP16_TO_12[[0, 9, 18, 27, 36, 45]] = 1
IVAS_CICP16_TO_12[[48, 57, 68, 77]] = 0.89999964
IVAS_CICP16_TO_12[[48, 57, 68, 77]] = 0.849999964
IVAS_CICP16_TO_12 = IVAS_CICP16_TO_12.reshape(10, 8)

IVAS_CICP16_TO_14 = np.zeros(10 * 8)
IVAS_CICP16_TO_14[[0, 9, 18, 27, 36, 45, 54, 63]] = 1
IVAS_CICP16_TO_14[[68, 77]] = 0.899999964
IVAS_CICP16_TO_14[[68, 77]] = 0.849999964
IVAS_CICP16_TO_14 = IVAS_CICP16_TO_14.reshape(10, 8)

IVAS_CICP19_TO_6 = np.zeros(12 * 6)
@@ -134,6 +134,10 @@ IVAS_CICP12_TO_16 = np.zeros(8 * 10)
IVAS_CICP12_TO_16[[0, 11, 22, 33, 44, 55, 64, 75]] = 1
IVAS_CICP12_TO_16 = IVAS_CICP12_TO_16.reshape(8, 10)

IVAS_CICP12_TO_19 = np.zeros(8 * 12)
IVAS_CICP12_TO_19[[0, 13, 26, 39, 54, 67, 76, 89]] = 1
IVAS_CICP12_TO_19 = IVAS_CICP12_TO_19.reshape(8, 12)

IVAS_CICP14_TO_19 = np.zeros(8 * 12)
IVAS_CICP14_TO_19[[0, 13, 26, 39, 52, 65, 80, 93]] = 1
IVAS_CICP14_TO_19 = IVAS_CICP14_TO_19.reshape(8, 12)
@@ -178,7 +182,7 @@ IVAS_MC_CONVERSION = {
        # upmix
        "5_1_2": IVAS_CICP12_TO_14,
        "5_1_4": IVAS_CICP12_TO_16,
        "7_1_4": np.pad(np.eye(8), [[0, 0], [0, 4]]),
        "7_1_4": IVAS_CICP12_TO_19,
    },
    "5_1_2": {
        # downmix