Merge "Remove redundant prefixes from enums in audio common types and effects HAL"

This commit is contained in:
Mikhail Naganov 2016-10-12 15:33:34 +00:00 committed by Android (Google) Code Review
commit d2586811e8
2 changed files with 456 additions and 535 deletions

File diff suppressed because it is too large Load diff

View file

@ -108,109 +108,90 @@ enum Result {
* | | | have to implement a process function.
* +----------------+--------+--------------------------------------------------
*/
// TODO(mnaganov): Consider if "EFFECT_FLAG_" prefix can be dropped.
@export(name="", value_prefix="EFFECT_FLAG_")
enum EffectFlags {
// Insert mode
EFFECT_FLAG_TYPE_SHIFT = 0,
EFFECT_FLAG_TYPE_SIZE = 3,
EFFECT_FLAG_TYPE_MASK =
((1 << EFFECT_FLAG_TYPE_SIZE) -1) << EFFECT_FLAG_TYPE_SHIFT,
EFFECT_FLAG_TYPE_INSERT = 0 << EFFECT_FLAG_TYPE_SHIFT,
EFFECT_FLAG_TYPE_AUXILIARY = 1 << EFFECT_FLAG_TYPE_SHIFT,
EFFECT_FLAG_TYPE_REPLACE = 2 << EFFECT_FLAG_TYPE_SHIFT,
EFFECT_FLAG_TYPE_PRE_PROC = 3 << EFFECT_FLAG_TYPE_SHIFT,
EFFECT_FLAG_TYPE_POST_PROC = 4 << EFFECT_FLAG_TYPE_SHIFT,
TYPE_SHIFT = 0,
TYPE_SIZE = 3,
TYPE_MASK = ((1 << TYPE_SIZE) -1) << TYPE_SHIFT,
TYPE_INSERT = 0 << TYPE_SHIFT,
TYPE_AUXILIARY = 1 << TYPE_SHIFT,
TYPE_REPLACE = 2 << TYPE_SHIFT,
TYPE_PRE_PROC = 3 << TYPE_SHIFT,
TYPE_POST_PROC = 4 << TYPE_SHIFT,
// Insert preference
EFFECT_FLAG_INSERT_SHIFT = EFFECT_FLAG_TYPE_SHIFT + EFFECT_FLAG_TYPE_SIZE,
EFFECT_FLAG_INSERT_SIZE = 3,
EFFECT_FLAG_INSERT_MASK =
((1 << EFFECT_FLAG_INSERT_SIZE) -1) << EFFECT_FLAG_INSERT_SHIFT,
EFFECT_FLAG_INSERT_ANY = 0 << EFFECT_FLAG_INSERT_SHIFT,
EFFECT_FLAG_INSERT_FIRST = 1 << EFFECT_FLAG_INSERT_SHIFT,
EFFECT_FLAG_INSERT_LAST = 2 << EFFECT_FLAG_INSERT_SHIFT,
EFFECT_FLAG_INSERT_EXCLUSIVE = 3 << EFFECT_FLAG_INSERT_SHIFT,
INSERT_SHIFT = TYPE_SHIFT + TYPE_SIZE,
INSERT_SIZE = 3,
INSERT_MASK = ((1 << INSERT_SIZE) -1) << INSERT_SHIFT,
INSERT_ANY = 0 << INSERT_SHIFT,
INSERT_FIRST = 1 << INSERT_SHIFT,
INSERT_LAST = 2 << INSERT_SHIFT,
INSERT_EXCLUSIVE = 3 << INSERT_SHIFT,
// Volume control
EFFECT_FLAG_VOLUME_SHIFT =
EFFECT_FLAG_INSERT_SHIFT + EFFECT_FLAG_INSERT_SIZE,
EFFECT_FLAG_VOLUME_SIZE = 3,
EFFECT_FLAG_VOLUME_MASK =
((1 << EFFECT_FLAG_VOLUME_SIZE) -1) << EFFECT_FLAG_VOLUME_SHIFT,
EFFECT_FLAG_VOLUME_CTRL = 1 << EFFECT_FLAG_VOLUME_SHIFT,
EFFECT_FLAG_VOLUME_IND = 2 << EFFECT_FLAG_VOLUME_SHIFT,
EFFECT_FLAG_VOLUME_NONE = 0 << EFFECT_FLAG_VOLUME_SHIFT,
VOLUME_SHIFT = INSERT_SHIFT + INSERT_SIZE,
VOLUME_SIZE = 3,
VOLUME_MASK = ((1 << VOLUME_SIZE) -1) << VOLUME_SHIFT,
VOLUME_CTRL = 1 << VOLUME_SHIFT,
VOLUME_IND = 2 << VOLUME_SHIFT,
VOLUME_NONE = 0 << VOLUME_SHIFT,
// Device indication
EFFECT_FLAG_DEVICE_SHIFT =
EFFECT_FLAG_VOLUME_SHIFT + EFFECT_FLAG_VOLUME_SIZE,
EFFECT_FLAG_DEVICE_SIZE = 3,
EFFECT_FLAG_DEVICE_MASK =
((1 << EFFECT_FLAG_DEVICE_SIZE) -1) << EFFECT_FLAG_DEVICE_SHIFT,
EFFECT_FLAG_DEVICE_IND = 1 << EFFECT_FLAG_DEVICE_SHIFT,
EFFECT_FLAG_DEVICE_NONE = 0 << EFFECT_FLAG_DEVICE_SHIFT,
DEVICE_SHIFT = VOLUME_SHIFT + VOLUME_SIZE,
DEVICE_SIZE = 3,
DEVICE_MASK = ((1 << DEVICE_SIZE) -1) << DEVICE_SHIFT,
DEVICE_IND = 1 << DEVICE_SHIFT,
DEVICE_NONE = 0 << DEVICE_SHIFT,
// Sample input modes
EFFECT_FLAG_INPUT_SHIFT =
EFFECT_FLAG_DEVICE_SHIFT + EFFECT_FLAG_DEVICE_SIZE,
EFFECT_FLAG_INPUT_SIZE = 2,
EFFECT_FLAG_INPUT_MASK =
((1 << EFFECT_FLAG_INPUT_SIZE) -1) << EFFECT_FLAG_INPUT_SHIFT,
EFFECT_FLAG_INPUT_DIRECT = 1 << EFFECT_FLAG_INPUT_SHIFT,
EFFECT_FLAG_INPUT_PROVIDER = 2 << EFFECT_FLAG_INPUT_SHIFT,
EFFECT_FLAG_INPUT_BOTH = 3 << EFFECT_FLAG_INPUT_SHIFT,
INPUT_SHIFT = DEVICE_SHIFT + DEVICE_SIZE,
INPUT_SIZE = 2,
INPUT_MASK = ((1 << INPUT_SIZE) -1) << INPUT_SHIFT,
INPUT_DIRECT = 1 << INPUT_SHIFT,
INPUT_PROVIDER = 2 << INPUT_SHIFT,
INPUT_BOTH = 3 << INPUT_SHIFT,
// Sample output modes
EFFECT_FLAG_OUTPUT_SHIFT = EFFECT_FLAG_INPUT_SHIFT + EFFECT_FLAG_INPUT_SIZE,
EFFECT_FLAG_OUTPUT_SIZE = 2,
EFFECT_FLAG_OUTPUT_MASK =
((1 << EFFECT_FLAG_OUTPUT_SIZE) -1) << EFFECT_FLAG_OUTPUT_SHIFT,
EFFECT_FLAG_OUTPUT_DIRECT = 1 << EFFECT_FLAG_OUTPUT_SHIFT,
EFFECT_FLAG_OUTPUT_PROVIDER = 2 << EFFECT_FLAG_OUTPUT_SHIFT,
EFFECT_FLAG_OUTPUT_BOTH = 3 << EFFECT_FLAG_OUTPUT_SHIFT,
OUTPUT_SHIFT = INPUT_SHIFT + INPUT_SIZE,
OUTPUT_SIZE = 2,
OUTPUT_MASK = ((1 << OUTPUT_SIZE) -1) << OUTPUT_SHIFT,
OUTPUT_DIRECT = 1 << OUTPUT_SHIFT,
OUTPUT_PROVIDER = 2 << OUTPUT_SHIFT,
OUTPUT_BOTH = 3 << OUTPUT_SHIFT,
// Hardware acceleration mode
EFFECT_FLAG_HW_ACC_SHIFT =
EFFECT_FLAG_OUTPUT_SHIFT + EFFECT_FLAG_OUTPUT_SIZE,
EFFECT_FLAG_HW_ACC_SIZE = 2,
EFFECT_FLAG_HW_ACC_MASK =
((1 << EFFECT_FLAG_HW_ACC_SIZE) -1) << EFFECT_FLAG_HW_ACC_SHIFT,
EFFECT_FLAG_HW_ACC_SIMPLE = 1 << EFFECT_FLAG_HW_ACC_SHIFT,
EFFECT_FLAG_HW_ACC_TUNNEL = 2 << EFFECT_FLAG_HW_ACC_SHIFT,
HW_ACC_SHIFT = OUTPUT_SHIFT + OUTPUT_SIZE,
HW_ACC_SIZE = 2,
HW_ACC_MASK = ((1 << HW_ACC_SIZE) -1) << HW_ACC_SHIFT,
HW_ACC_SIMPLE = 1 << HW_ACC_SHIFT,
HW_ACC_TUNNEL = 2 << HW_ACC_SHIFT,
// Audio mode indication
EFFECT_FLAG_AUDIO_MODE_SHIFT =
EFFECT_FLAG_HW_ACC_SHIFT + EFFECT_FLAG_HW_ACC_SIZE,
EFFECT_FLAG_AUDIO_MODE_SIZE = 2,
EFFECT_FLAG_AUDIO_MODE_MASK =
((1 << EFFECT_FLAG_AUDIO_MODE_SIZE) -1) << EFFECT_FLAG_AUDIO_MODE_SHIFT,
EFFECT_FLAG_AUDIO_MODE_IND = 1 << EFFECT_FLAG_AUDIO_MODE_SHIFT,
EFFECT_FLAG_AUDIO_MODE_NONE = 0 << EFFECT_FLAG_AUDIO_MODE_SHIFT,
AUDIO_MODE_SHIFT = HW_ACC_SHIFT + HW_ACC_SIZE,
AUDIO_MODE_SIZE = 2,
AUDIO_MODE_MASK = ((1 << AUDIO_MODE_SIZE) -1) << AUDIO_MODE_SHIFT,
AUDIO_MODE_IND = 1 << AUDIO_MODE_SHIFT,
AUDIO_MODE_NONE = 0 << AUDIO_MODE_SHIFT,
// Audio source indication
EFFECT_FLAG_AUDIO_SOURCE_SHIFT =
EFFECT_FLAG_AUDIO_MODE_SHIFT + EFFECT_FLAG_AUDIO_MODE_SIZE,
EFFECT_FLAG_AUDIO_SOURCE_SIZE = 2,
EFFECT_FLAG_AUDIO_SOURCE_MASK = ((1 << EFFECT_FLAG_AUDIO_SOURCE_SIZE) -1)
<< EFFECT_FLAG_AUDIO_SOURCE_SHIFT,
EFFECT_FLAG_AUDIO_SOURCE_IND = 1 << EFFECT_FLAG_AUDIO_SOURCE_SHIFT,
EFFECT_FLAG_AUDIO_SOURCE_NONE = 0 << EFFECT_FLAG_AUDIO_SOURCE_SHIFT,
AUDIO_SOURCE_SHIFT = AUDIO_MODE_SHIFT + AUDIO_MODE_SIZE,
AUDIO_SOURCE_SIZE = 2,
AUDIO_SOURCE_MASK = ((1 << AUDIO_SOURCE_SIZE) -1) << AUDIO_SOURCE_SHIFT,
AUDIO_SOURCE_IND = 1 << AUDIO_SOURCE_SHIFT,
AUDIO_SOURCE_NONE = 0 << AUDIO_SOURCE_SHIFT,
// Effect offload indication
EFFECT_FLAG_OFFLOAD_SHIFT =
EFFECT_FLAG_AUDIO_SOURCE_SHIFT + EFFECT_FLAG_AUDIO_SOURCE_SIZE,
EFFECT_FLAG_OFFLOAD_SIZE = 1,
EFFECT_FLAG_OFFLOAD_MASK =
((1 << EFFECT_FLAG_OFFLOAD_SIZE) -1) << EFFECT_FLAG_OFFLOAD_SHIFT,
EFFECT_FLAG_OFFLOAD_SUPPORTED = 1 << EFFECT_FLAG_OFFLOAD_SHIFT,
OFFLOAD_SHIFT = AUDIO_SOURCE_SHIFT + AUDIO_SOURCE_SIZE,
OFFLOAD_SIZE = 1,
OFFLOAD_MASK = ((1 << OFFLOAD_SIZE) -1) << OFFLOAD_SHIFT,
OFFLOAD_SUPPORTED = 1 << OFFLOAD_SHIFT,
// Effect has no process indication
EFFECT_FLAG_NO_PROCESS_SHIFT =
EFFECT_FLAG_OFFLOAD_SHIFT + EFFECT_FLAG_OFFLOAD_SIZE,
EFFECT_FLAG_NO_PROCESS_SIZE = 1,
EFFECT_FLAG_NO_PROCESS_MASK =
((1 << EFFECT_FLAG_NO_PROCESS_SIZE) -1) << EFFECT_FLAG_NO_PROCESS_SHIFT,
EFFECT_FLAG_NO_PROCESS = 1 << EFFECT_FLAG_NO_PROCESS_SHIFT
NO_PROCESS_SHIFT = OFFLOAD_SHIFT + OFFLOAD_SIZE,
NO_PROCESS_SIZE = 1,
NO_PROCESS_MASK = ((1 << NO_PROCESS_SIZE) -1) << NO_PROCESS_SHIFT,
NO_PROCESS = 1 << NO_PROCESS_SHIFT
};
/*
@ -246,24 +227,24 @@ struct AudioBuffer {
vec<uint8_t> data;
};
@export(name="effect_buffer_access_e", value_prefix="EFFECT_BUFFER_")
enum EffectBufferAccess {
EFFECT_BUFFER_ACCESS_WRITE,
EFFECT_BUFFER_ACCESS_READ,
EFFECT_BUFFER_ACCESS_ACCUMULATE
ACCESS_WRITE,
ACCESS_READ,
ACCESS_ACCUMULATE
};
/*
* Determines what fields of EffectBufferConfig need to be considered.
*/
@export(name="", value_prefix="EFFECT_CONFIG_")
enum EffectConfigParameters {
EFFECT_CONFIG_BUFFER = 0x0001, // buffer field
EFFECT_CONFIG_SMP_RATE = 0x0002, // samplingRate
EFFECT_CONFIG_CHANNELS = 0x0004, // channels
EFFECT_CONFIG_FORMAT = 0x0008, // format
EFFECT_CONFIG_ACC_MODE = 0x0010, // accessMode
EFFECT_CONFIG_ALL = EFFECT_CONFIG_BUFFER | EFFECT_CONFIG_SMP_RATE |
EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT |
EFFECT_CONFIG_ACC_MODE
BUFFER = 0x0001, // buffer field
SMP_RATE = 0x0002, // samplingRate
CHANNELS = 0x0004, // channels
FORMAT = 0x0008, // format
ACC_MODE = 0x0010, // accessMode
ALL = BUFFER | SMP_RATE | CHANNELS | FORMAT | ACC_MODE
};
/*
@ -284,10 +265,11 @@ struct EffectConfig {
EffectBufferConfig outputCfg;
};
@export(name="effect_feature_e", value_prefix="EFFECT_FEATURE_")
enum EffectFeature {
EFFECT_FEATURE_AUX_CHANNELS, // supports auxiliary channels
// (e.g. dual mic noise suppressor)
EFFECT_FEATURE_CNT
AUX_CHANNELS, // supports auxiliary channels
// (e.g. dual mic noise suppressor)
CNT
};
struct EffectFeatureConfig {