[FFmpeg-cvslog] g723.1: do not bounce intermediate values via memory

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


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sat Aug 11 21:00:21 2012 +0100| [138914dcd83132f6edc6f1799c5a17e0b6b559bb] | committer: Mans Rullgard

g723.1: do not bounce intermediate values via memory

Although a reasonable compiler will probably optimise out the
actual store and load, this operation still implies a truncation
to 16 bits which the compiler will probably not realise is not
necessary here.

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

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

 libavcodec/g723_1.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index 657c144..4c1c4da 100644
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -1064,9 +1064,8 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
                                    p->cur_rate);
                 /* Get the total excitation */
                 for (j = 0; j < SUBFRAME_LEN; j++) {
-                    vector_ptr[j] = av_clip_int16(vector_ptr[j] << 1);
-                    vector_ptr[j] = av_clip_int16(vector_ptr[j] +
-                                                  acb_vector[j]);
+                    int v = av_clip_int16(vector_ptr[j] << 1);
+                    vector_ptr[j] = av_clip_int16(v + acb_vector[j]);
                 }
                 vector_ptr += SUBFRAME_LEN;
             }



More information about the ffmpeg-cvslog mailing list