OSDN Git Service

audio effect: add flag for effects without actual processing
authorEric Laurent <elaurent@google.com>
Thu, 15 Sep 2016 18:40:57 +0000 (11:40 -0700)
committerEric Laurent <elaurent@google.com>
Thu, 15 Sep 2016 18:52:22 +0000 (11:52 -0700)
Add a flag for effect descriptor indicating that the effect does not
implement a process function. This tells the framework that no
latency or performance penalty comes with enabling this effect.
When this flag is set, the process function does not have to be implemented
by the effect implementation.

Bug: 31491112
Change-Id: I69e6959eb17e04266f4de3f2943c226e34868b1f

include/hardware/audio_effect.h

index 41cd2e6..e49980d 100644 (file)
@@ -150,6 +150,13 @@ typedef struct effect_descriptor_s {
 //  | Effect offload supported  | 22        | 0 The effect cannot be offloaded to an audio DSP
 //  |                           |           | 1 The effect can be offloaded to an audio DSP
 //  +---------------------------+-----------+-----------------------------------
+//  | Process function not      | 23        | 0 The effect implements a process function.
+//  | implemented               |           | 1 The effect does not implement a process function:
+//  |                           |           |   enabling the effect has no impact on latency or
+//  |                           |           |   CPU load.
+//  |                           |           |   Effect implementations setting this flag do not have
+//  |                           |           |   to implement a process function.
+//  +---------------------------+-----------+-----------------------------------
 
 // Insert mode
 #define EFFECT_FLAG_TYPE_SHIFT          0
@@ -240,6 +247,14 @@ typedef struct effect_descriptor_s {
                                           << EFFECT_FLAG_OFFLOAD_SHIFT)
 #define EFFECT_FLAG_OFFLOAD_SUPPORTED   (1 << EFFECT_FLAG_OFFLOAD_SHIFT)
 
+// Effect has no process indication
+#define EFFECT_FLAG_NO_PROCESS_SHIFT       (EFFECT_FLAG_OFFLOAD_SHIFT + \
+                                                    EFFECT_FLAG_OFFLOAD_SIZE)
+#define EFFECT_FLAG_NO_PROCESS_SIZE        1
+#define EFFECT_FLAG_NO_PROCESS_MASK        (((1 << EFFECT_FLAG_NO_PROCESS_SIZE) -1) \
+                                          << EFFECT_FLAG_NO_PROCESS_SHIFT)
+#define EFFECT_FLAG_NO_PROCESS          (1 << EFFECT_FLAG_NO_PROCESS_SHIFT)
+
 #define EFFECT_MAKE_API_VERSION(M, m)  (((M)<<16) | ((m) & 0xFFFF))
 #define EFFECT_API_VERSION_MAJOR(v)    ((v)>>16)
 #define EFFECT_API_VERSION_MINOR(v)    ((m) & 0xFFFF)