On Fri, 30 Jan 2015, Peter Meerwald wrote:

Signed-off-by: Peter Meerwald <[email protected]>
---
libavcodec/g722.c | 49 +++++++++++++++++++++++++++++++------------------
1 file changed, 31 insertions(+), 18 deletions(-)

diff --git a/libavcodec/g722.c b/libavcodec/g722.c
index 74c0868..2f79adf 100644
--- a/libavcodec/g722.c
+++ b/libavcodec/g722.c
@@ -71,6 +71,35 @@ const int16_t ff_g722_low_inv_quant6[64] = {
     211,   170,   130,    91,    54,    17,   -54,   -17
};

+static inline void s_zero(int cur_diff, struct G722Band *band) {
+    int s_zero = 0, tmp;
+
+    #define ACCUM(k, x, d) { \
+        tmp = x; \
+        band->zero_mem[k] = ((band->zero_mem[k]*255) >> 8) + \
+           d*((band->diff_mem[k]^cur_diff) < 0 ? -128 : 128); \
+        band->diff_mem[k] = tmp; \
+        s_zero += (tmp * band->zero_mem[k]) >> 15; \
+    }

We prefer (or well, I do at least) writing this kind of macros within a do {} while (0) - that makes the macro much more well behaved if it is used as a statement e.g. in combination with if statements. With an even half-decent compiler it should end up as the same generated code.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to