Guest User

Untitled

a guest
Jun 4th, 2018
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.98 KB | None | 0 0
  1. commit cfeb0b4881c40ab60c70cbb32c7138d51df9dc7b
  2. Author: Shashi Kumar <[email protected]>
  3. Date:   Sat Nov 27 21:01:24 2010 +0530
  4.  
  5.     libaudio: Add support to disable MBADRC parameter.
  6.    
  7.     -While playing audio bass effect (boost of low frequencies) is observed.
  8.     -By enabling MBADRC parameters bass effect is observed.
  9.     -Added MBADRC flag to enable/disable and changes in HAL to disable MBADRC parameters.
  10.    
  11.     Change-Id: I5ba78868c43310a4d8269d65a3584ac36094ac13
  12.     CRs-Fixed: 265600
  13.  
  14. diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp
  15. index dbe9fd0..1ac0725 100644
  16. --- a/libaudio/AudioHardware.cpp
  17. +++ b/libaudio/AudioHardware.cpp
  18. @@ -57,6 +57,7 @@ static struct adrc_filter adrc_cfg[3];
  19.  static struct mbadrc_filter mbadrc_cfg[3];
  20.  eqalizer eqalizer[3];
  21.  static uint16_t adrc_flag[3];
  22. +static uint16_t mbadrc_flag[3];
  23.  static uint16_t eq_flag[3];
  24.  static uint16_t rx_iir_flag[3];
  25.  static bool audpp_filter_inited = false;
  26. @@ -447,8 +448,7 @@ int check_and_set_audpp_parameters(char *buf, int size)
  27.              goto token_err;
  28.  
  29.          for (i = 0; i < 48; i++) {
  30. -            j = (i >= 40)? i : ((i % 2)? (i - 1) : (i + 1));
  31. -            iir_cfg[device_id].iir_params[j] = (uint16_t)strtol(p, &ps, 16);
  32. +            iir_cfg[device_id].iir_params[i] = (uint16_t)strtol(p, &ps, 16);
  33.              if (!(p = strtok(NULL, seps)))
  34.                  goto token_err;
  35.          }
  36. @@ -626,7 +626,12 @@ int check_and_set_audpp_parameters(char *buf, int size)
  37.              if (!(p = strtok(NULL, seps)))
  38.                  goto token_err;
  39.              mbadrc_cfg[device_id].ext_buf.buff[i] = (uint16_t)strtol(p, &ps, 16);
  40. -            }
  41. +        }
  42. +        if (!(p = strtok(NULL, seps)))
  43. +            goto token_err;
  44. +
  45. +        mbadrc_flag[device_id] = (uint16_t)strtol(p, &ps, 16);
  46. +        LOGV("MBADRC flag = %02x.", mbadrc_flag[device_id]);
  47.      }else if ((buf[0] == 'E') || (buf[0] == 'F') || (buf[0] == 'G')){
  48.       //Pre-Processing Features TX_IIR,NS,AGC
  49.          switch (buf[1]) {
  50. @@ -885,24 +890,30 @@ static int msm72xx_enable_postproc(bool state)
  51.  
  52.      if(mbadrc_filter_exists[device_id] && state)
  53.      {
  54. -       if(post_proc_feature_mask & MBADRC_ENABLE)
  55. -       {
  56. -            post_proc_feature_mask &= ~ADRC_ENABLE;
  57. +        LOGV("MBADRC Enabled");
  58. +        post_proc_feature_mask &= ADRC_DISABLE;
  59. +        if ((mbadrc_flag[device_id] == 0) && (post_proc_feature_mask & MBADRC_ENABLE))
  60. +        {
  61. +            LOGV("MBADRC Disable");
  62. +            post_proc_feature_mask &= MBADRC_DISABLE;
  63. +        }
  64. +        else if(post_proc_feature_mask & MBADRC_ENABLE)
  65. +        {
  66.              LOGV("MBADRC Enabled %d", post_proc_feature_mask);
  67.  
  68.              if (ioctl(fd, AUDIO_SET_MBADRC, &mbadrc_cfg[device_id]) < 0)
  69.              {
  70.                  LOGE("set mbadrc filter error");
  71.              }
  72. -       }
  73. +        }
  74.      }
  75.      else if (adrc_filter_exists[device_id] && state)
  76.      {
  77. -        post_proc_feature_mask &= ~MBADRC_ENABLE;
  78. +        post_proc_feature_mask &= MBADRC_DISABLE;
  79.          LOGV("ADRC Enabled %d", post_proc_feature_mask);
  80.  
  81.          if (adrc_flag[device_id] == 0 && (post_proc_feature_mask & ADRC_ENABLE))
  82. -            post_proc_feature_mask &= ~ADRC_ENABLE;
  83. +            post_proc_feature_mask &= ADRC_DISABLE;
  84.          else if(post_proc_feature_mask & ADRC_ENABLE)
  85.          {
  86.              LOGI("ADRC Filter ADRC FLAG = %02x.", adrc_flag[device_id]);
  87. @@ -920,9 +931,14 @@ static int msm72xx_enable_postproc(bool state)
  88.              }
  89.          }
  90.      }
  91. +    else
  92. +    {
  93. +        LOGV("MBADRC and ADRC Disabled");
  94. +        post_proc_feature_mask &= (MBADRC_DISABLE | ADRC_DISABLE);
  95. +    }
  96.  
  97.      if (eq_flag[device_id] == 0 && (post_proc_feature_mask & EQ_ENABLE))
  98. -        post_proc_feature_mask &= ~EQ_ENABLE;
  99. +        post_proc_feature_mask &= EQ_DISABLE;
  100.      else if ((post_proc_feature_mask & EQ_ENABLE) && state)
  101.      {
  102.          LOGI("Setting EQ Filter");
  103. @@ -932,7 +948,7 @@ static int msm72xx_enable_postproc(bool state)
  104.      }
  105.  
  106.      if (rx_iir_flag[device_id] == 0 && (post_proc_feature_mask & RX_IIR_ENABLE))
  107. -        post_proc_feature_mask &= ~RX_IIR_ENABLE;
  108. +        post_proc_feature_mask &= RX_IIR_DISABLE;
  109.      else if ((post_proc_feature_mask & RX_IIR_ENABLE)&& state)
  110.      {
  111.          LOGI("IIR Filter FLAG = %02x.", rx_iir_flag[device_id]);
  112. diff --git a/libaudio/AudioHardware.h b/libaudio/AudioHardware.h
  113. index b7ee9a0..354e08d 100644
  114. --- a/libaudio/AudioHardware.h
  115. +++ b/libaudio/AudioHardware.h
  116. @@ -49,13 +49,13 @@ namespace android {
  117.  #define EQ_MAX_BAND_NUM 12
  118.  
  119.  #define ADRC_ENABLE  0x0001
  120. -#define ADRC_DISABLE 0x0000
  121. +#define ADRC_DISABLE 0xFFFE
  122.  #define EQ_ENABLE    0x0002
  123. -#define EQ_DISABLE   0x0000
  124. +#define EQ_DISABLE   0xFFFD
  125.  #define RX_IIR_ENABLE  0x0004
  126. -#define RX_IIR_DISABLE 0x0000
  127. +#define RX_IIR_DISABLE 0xFFFB
  128.  #define MBADRC_ENABLE  0x0010
  129. -#define MBADRC_DISABLE 0x0000
  130. +#define MBADRC_DISABLE 0xFFEF
  131.  
  132.  #define AGC_ENABLE     0x0001
  133.  #define NS_ENABLE      0x0002
Add Comment
Please, Sign In to add comment