/* Process function for the Q7 Linear Interpolation Function.  */
q7_t arm_linear_interp_q7(const q7_t *pYData, q31_t x, uint32_t nValues)
/* Process function for the Q7 Linear Interpolation Function.  */
q7_t arm_linear_interp_q7(const q7_t *pYData, q31_t x, uint32_t nValues)
{
    q31_t y;
    q7_t y0, y1;
    q31_t fract;
    uint32_t index;
    if (x < 0)
    {
      return (pYData[0]);
    }
    index = (x >> 20) & 0xfff;
    if (index >= (nValues - 1))
    {
      return (pYData[nValues - 1]);
    }
    else
    {
      fract = (x & 0x000FFFFF);
      y0 = pYData[index];
      y1 = pYData[index + 1];
      y = ((y0 * (0xFFFFF - fract)));
      y += (y1 * fract);
      return (q7_t) (y >> 20);
     }
  }