[FFmpeg-cvslog] g723.1: deobfuscate "(x << 4) - x" to "15 * x"

Mans Rullgard git at videolan.org
Mon Aug 13 14:49:43 CEST 2012


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sat Aug 11 01:54:15 2012 +0100| [8b0de73464fcb110dce2f5601e4e27b2cbd33d20] | committer: Mans Rullgard

g723.1: deobfuscate "(x << 4) - x" to "15 * x"

The compiler performs this optimisation.

Signed-off-by: Mans Rullgard <mans at mansr.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b0de73464fcb110dce2f5601e4e27b2cbd33d20
---

 libavcodec/g723_1.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index 7d8a48e..d4158ff 100644
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -914,7 +914,7 @@ static void gain_scale(G723_1_Context *p, int16_t * buf, int energy)
     }
 
     for (i = 0; i < SUBFRAME_LEN; i++) {
-        p->pf_gain = ((p->pf_gain << 4) - p->pf_gain + gain + (1 << 3)) >> 4;
+        p->pf_gain = (15 * p->pf_gain + gain + (1 << 3)) >> 4;
         buf[i]     = av_clip_int16((buf[i] * (p->pf_gain + (p->pf_gain >> 4)) +
                                    (1 << 10)) >> 11);
     }



More information about the ffmpeg-cvslog mailing list