Commit 19ca46c6 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Update for using 64 bit operator

[x] Fix for using 64 bit operator in place of 40 bit operator
[x] Few cleanup changes
parent 428e2a05
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -128,7 +128,6 @@
    <ClCompile Include="..\lib_com\basop32.c" />
    <ClCompile Include="..\lib_com\basop_com_lpc.c" />
    <ClCompile Include="..\lib_com\basop_lsf_tools.c" />
    <ClCompile Include="..\lib_com\basop_mpy.c" />
    <ClCompile Include="..\lib_com\basop_tcx_utils.c" />
    <ClCompile Include="..\lib_com\basop_util.c" />
    <ClCompile Include="..\lib_com\bitalloc.c" />
@@ -149,6 +148,7 @@
    <ClCompile Include="..\lib_com\dlpc_bfi.c" />
    <ClCompile Include="..\lib_com\edct.c" />
    <ClCompile Include="..\lib_com\enh1632.c" />
    <ClCompile Include="..\lib_com\enh32.c" />
    <ClCompile Include="..\lib_com\enh40.c" />
    <ClCompile Include="..\lib_com\enh64.c" />
    <ClCompile Include="..\lib_com\enhancer.c" />
@@ -293,7 +293,6 @@
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_com\basop32.h" />
    <ClInclude Include="..\lib_com\basop_mpy.h" />
    <ClInclude Include="..\lib_com\basop_proto_func.h" />
    <ClInclude Include="..\lib_com\basop_settings.h" />
    <ClInclude Include="..\lib_com\basop_util.h" />
+3 −6
Original line number Diff line number Diff line
@@ -40,9 +40,6 @@
    <ClCompile Include="..\lib_com\basop_lsf_tools.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\basop_mpy.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\basop_tcx_utils.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
@@ -518,6 +515,9 @@
    <ClCompile Include="..\lib_com\rom_com_fx.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\enh32.c">
      <Filter>common_all_c</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_com\basop_proto_func.h">
@@ -526,9 +526,6 @@
    <ClInclude Include="..\lib_com\basop_settings.h">
      <Filter>common_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_com\basop_mpy.h">
      <Filter>common_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_com\basop_util.h">
      <Filter>common_h</Filter>
    </ClInclude>

lib_com/basop_mpy.c

deleted100644 → 0
+0 −177
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository. All Rights Reserved.

   This software is protected by copyright law and by international treaties.
   The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository retain full ownership rights in their respective contributions in
   the software. This notice grants no license of any kind, including but not limited to patent
   license, nor is any license granted by implication, estoppel or otherwise.

   Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
   contributions.

   This software is provided "AS IS", without any express or implied warranties. The software is in the
   development stage. It is intended exclusively for experts who have experience with such software and
   solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
   and fitness for a particular purpose are hereby disclaimed and excluded.

   Any dispute, controversy or claim arising under or in relation to providing this software shall be
   submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
   accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
   the United Nations Convention on Contracts on the International Sales of Goods.

*******************************************************************************************************/

/*====================================================================================
    EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
  ====================================================================================*/

#include "basop_mpy.h"
#include <stdint.h>
#include "options.h"

#define WMC_TOOL_SKIP

Word32 Mpy_32_16_1( Word32 x, Word16 y )
{
    Word32 mh;
    UWord16 ml;

    Mpy_32_16_ss( x, y, &mh, &ml );

    return ( mh );
}

Word32 Mpy_32_16_r( Word32 x, Word16 y )
{
    Word32 mh;
    UWord16 ml;

    Mpy_32_16_ss( x, y, &mh, &ml );

    if ( s_and( ml, -32768 /* 0x8000 */ ) )
    {
        mh = L_add( mh, 1 );
    }

    return ( mh );
}


Word32 Mpy_32_32( Word32 x, Word32 y )
{
    Word32 mh;
    UWord32 ml;

    Mpy_32_32_ss( x, y, &mh, &ml );

    return ( mh );
}


Word32 Mpy_32_32_r(Word32 L_var1, Word32 L_var2) {
  Word32 L_var_out;
  Word64 L64_var1;

  L64_var1 = ((Word64)L_var1 * L_var2);
  L64_var1 = W_shr(L64_var1, 15);
  L_var_out = W_round48_L(L64_var1);
  return L_var_out;
}


Word32 Madd_32_16(Word32 L_var3, Word32 L_var1, Word16 var2) {
  Word32 L_var_out;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
  Flag Overflow = 0;
#endif

  L_var_out = Mpy_32_16_1(L_var1, var2);
#ifdef BASOP_NOGLOB
  L_var_out = L_add_o(L_var3, L_var_out, &Overflow);
#else /* BASOP_NOGLOB */
  L_var_out = L_add(L_var3, L_var_out);
#endif /* BASOP_NOGLOB */

  return L_var_out;
}

Word32 Madd_32_16_r(Word32 L_var3, Word32 L_var1, Word16 var2) {
  Word32 L_var_out;

  L_var_out = Mpy_32_16_r(L_var1, var2);
  L_var_out = L_add(L_var3, L_var_out);

  return L_var_out;
}

Word32 Msub_32_16(Word32 L_var3, Word32 L_var1, Word16 var2) {
  Word32 L_var_out;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
  Flag Overflow = 0;
#endif

  L_var_out = Mpy_32_16_1(L_var1, var2);
#ifdef BASOP_NOGLOB
  L_var_out = L_sub_o(L_var3, L_var_out, &Overflow);
#else /* BASOP_NOGLOB */
  L_var_out = L_sub(L_var3, L_var_out);
#endif

  return L_var_out;
}

Word32 Msub_32_16_r(Word32 L_var3, Word32 L_var1, Word16 var2) {
  Word32 L_var_out;

  L_var_out = Mpy_32_16_r(L_var1, var2);
  L_var_out = L_sub(L_var3, L_var_out);

  return L_var_out;
}

Word32 Madd_32_32(Word32 L_var3, Word32 L_var1, Word32 L_var2) {
  Word32 L_var_out;

  L_var_out = Mpy_32_32(L_var1, L_var2);
  L_var_out = L_add(L_var3, L_var_out);

  return L_var_out;
}

Word32 Madd_32_32_r(Word32 L_var3, Word32 L_var1, Word32 L_var2) {
  Word32 L_var_out;

  L_var_out = Mpy_32_32_r(L_var1, L_var2);
  L_var_out = L_add(L_var3, L_var_out);

  return L_var_out;
}

Word32 Msub_32_32(Word32 L_var3, Word32 L_var1, Word32 L_var2) {
  Word32 L_var_out;

  L_var_out = Mpy_32_32(L_var1, L_var2);
  L_var_out = L_sub(L_var3, L_var_out);

  return L_var_out;
}


Word32 Msub_32_32_r(Word32 L_var3, Word32 L_var1, Word32 L_var2) {
  Word32 L_var_out;

  L_var_out = Mpy_32_32_r(L_var1, L_var2);
  L_var_out = L_sub(L_var3, L_var_out);

  return L_var_out;
}
#undef WMC_TOOL_SKIP

lib_com/basop_mpy.h

deleted100644 → 0
+0 −94
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository. All Rights Reserved.

   This software is protected by copyright law and by international treaties.
   The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
   contributors to this repository retain full ownership rights in their respective contributions in
   the software. This notice grants no license of any kind, including but not limited to patent
   license, nor is any license granted by implication, estoppel or otherwise.

   Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
   contributions.

   This software is provided "AS IS", without any express or implied warranties. The software is in the
   development stage. It is intended exclusively for experts who have experience with such software and
   solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
   and fitness for a particular purpose are hereby disclaimed and excluded.

   Any dispute, controversy or claim arising under or in relation to providing this software shall be
   submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
   accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
   the United Nations Convention on Contracts on the International Sales of Goods.

*******************************************************************************************************/

/*====================================================================================
    EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
  ====================================================================================*/

#ifndef __BASOP_MPY_H
#define __BASOP_MPY_H

#include "stl.h"
#include <stdint.h>
#include "options.h"

/**
 * \brief   32*16 Bit fractional Multiplication using 40 bit OPS
 *          Performs a multiplication of a 32-bit variable x by
 *          a 16-bit variable y, returning a 32-bit value.
 *
 * \param[i] x
 * \param[i] y
 *
 * \return x*y
 */
Word32 Mpy_32_16_1( Word32 x, Word16 y );


/**
 * \brief   32*16 Bit fractional Multiplication using 40 bit OPS
 *          Performs a multiplication of a 32-bit variable x by
 *          a 16-bit variable y including rounding, returning a 32-bit value.
 *
 * \param[i] x
 * \param[i] y
 *
 * \return x*y
 */
Word32 Mpy_32_16_r( Word32 x, Word16 y );


/**
 * \brief   32*32 Bit fractional Multiplication using 40 bit OPS
 *
 *          Performs a multiplication of a 32-bit variable x by
 *          a 32-bit variable y, returning a 32-bit value.
 *
 * \param[i] x
 * \param[i] y
 *
 * \return x*y
 */

Word32 Mpy_32_32( Word32 x, Word32 y );

Word32 Madd_32_16(Word32 L_var3, Word32 L_var1, Word16 var2);
Word32 Madd_32_16_r(Word32 L_var3, Word32 L_var1, Word16 var2);
Word32 Msub_32_16(Word32 L_var3, Word32 L_var1, Word16 var2);
Word32 Msub_32_16_r(Word32 L_var3, Word32 L_var1, Word16 var2);
Word32 Madd_32_32(Word32 L_var3, Word32 L_var1, Word32 L_var2);
Word32 Madd_32_32_r(Word32 L_var3, Word32 L_var1, Word32 L_var2);
Word32 Msub_32_32(Word32 L_var3, Word32 L_var1, Word32 L_var2);
Word32 Msub_32_32_r(Word32 L_var3, Word32 L_var1, Word32 L_var2);


#endif /* __BASOP_SETTINGS_H */
+0 −1
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@
#include <stdint.h>
#include "options.h"
#include "stl.h"
#include "basop_mpy.h"

#define WORD32_BITS      32
#define MAXVAL_WORD32    ( (int32_t) 0x7FFFFFFF )
Loading