wavpackenc: use put_sbits()
authorJames Almer <jamrial@gmail.com>
Sat, 18 Apr 2015 21:06:27 +0000 (18:06 -0300)
committerJames Almer <jamrial@gmail.com>
Sat, 18 Apr 2015 21:07:54 +0000 (18:07 -0300)
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/wavpackenc.c

index c174950..87f1445 100644 (file)
@@ -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);
         }
     }
 }