[FFmpeg-cvslog] wavpackenc: use put_sbits()

James Almer git at videolan.org
Sat Apr 18 23:09:03 CEST 2015


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat Apr 18 18:06:27 2015 -0300| [5cd21693440663236fc56a0357a5272740bf2982] | committer: James Almer

wavpackenc: use put_sbits()

Reviewed-by: Michael Niedermayer <michaelni at gmx.at>
Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavcodec/wavpackenc.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
index c174950..87f1445 100644
--- a/libavcodec/wavpackenc.c
+++ b/libavcodec/wavpackenc.c
@@ -2143,7 +2143,6 @@ static void pack_int32(WavPackEncodeContext *s,
                        int nb_samples)
 {
     const int sent_bits = s->int32_sent_bits;
-    int32_t value, mask = (1 << sent_bits) - 1;
     PutBitContext *pb = &s->pb;
     int i, pre_shift;
 
@@ -2154,15 +2153,12 @@ static void pack_int32(WavPackEncodeContext *s,
 
     if (s->flags & WV_MONO_DATA) {
         for (i = 0; i < nb_samples; i++) {
-            value = (samples_l[i] >> pre_shift) & mask;
-            put_bits(pb, sent_bits, value);
+            put_sbits(pb, sent_bits, samples_l[i] >> pre_shift);
         }
     } else {
         for (i = 0; i < nb_samples; i++) {
-            value = (samples_l[i] >> pre_shift) & mask;
-            put_bits(pb, sent_bits, value);
-            value = (samples_r[i] >> pre_shift) & mask;
-            put_bits(pb, sent_bits, value);
+            put_sbits(pb, sent_bits, samples_l[i] >> pre_shift);
+            put_sbits(pb, sent_bits, samples_r[i] >> pre_shift);
         }
     }
 }



More information about the ffmpeg-cvslog mailing list