]> git.sesse.net Git - ffmpeg/commitdiff
unary: Convert to the new bitstream reader
authorAlexandra Hájková <alexandra@khirnov.net>
Wed, 8 Jun 2016 09:31:33 +0000 (11:31 +0200)
committerDiego Biurrun <diego@biurrun.de>
Mon, 19 Dec 2016 11:35:05 +0000 (12:35 +0100)
17 files changed:
libavcodec/aic.c
libavcodec/alac.c
libavcodec/alsdec.c
libavcodec/apedec.c
libavcodec/dca_xll.c
libavcodec/dxtory.c
libavcodec/ituh263dec.c
libavcodec/mss4.c
libavcodec/ralf.c
libavcodec/takdec.c
libavcodec/tta.c
libavcodec/unary.h
libavcodec/unary_legacy.h [new file with mode: 0644]
libavcodec/vc1.c
libavcodec/vc1_block.c
libavcodec/wavpack.c
libavformat/mpc8.c

index 7c6ddddb0a23396ba755ea94df9c80beb204b0e9..2c9b6f80985ab183665091925d3db36096d7ef70 100644 (file)
@@ -29,7 +29,7 @@
 #include "golomb.h"
 #include "idctdsp.h"
 #include "thread.h"
-#include "unary.h"
+#include "unary_legacy.h"
 
 #define AIC_HDR_SIZE    24
 #define AIC_BAND_COEFFS (64 + 32 + 192 + 96)
index 83d777c760a8d6742e8b5698ae819df1e3e00ceb..aef68e76a3bcc0b0c51da38b626e11e62f60ff57 100644 (file)
@@ -52,8 +52,8 @@
 #include "get_bits.h"
 #include "bytestream.h"
 #include "internal.h"
-#include "unary.h"
 #include "mathops.h"
+#include "unary_legacy.h"
 #include "alac_data.h"
 
 #define ALAC_EXTRADATA_SIZE 36
index af514870ef8ffbf7d9d36a2d079c50f26eaa1046..9fd2827dcdb37fa908b16080ca07b39e71f2f6d8 100644 (file)
 
 #include "avcodec.h"
 #include "get_bits.h"
-#include "unary.h"
 #include "mpeg4audio.h"
 #include "bytestream.h"
 #include "bgmc.h"
 #include "bswapdsp.h"
 #include "internal.h"
+#include "unary_legacy.h"
+
 #include "libavutil/samplefmt.h"
 #include "libavutil/crc.h"
 
index 2f6448867a1aaf2cf721fe560d5fcd0b7ceec358..69ded9a670176ec40693a6436018601da9d810db 100644 (file)
@@ -31,7 +31,7 @@
 #include "bytestream.h"
 #include "internal.h"
 #include "get_bits.h"
-#include "unary.h"
+#include "unary_legacy.h"
 
 /**
  * @file
index 5a558b8c48870620446c23374597d4be5d7b57e8..5d76793fbbd141a947f9e50a76b71971b1859849 100644 (file)
@@ -29,7 +29,7 @@
 #include "dca.h"
 #include "dcadata.h"
 #include "get_bits.h"
-#include "unary.h"
+#include "unary_legacy.h"
 
 /* Sign as bit 0 */
 static inline int get_bits_sm(GetBitContext *s, unsigned n)
index e2b875b5e34918644893ee9b71e4d92940663566..b0fae2f5ef91e7bd0755668abcee6141bc806189 100644 (file)
@@ -30,7 +30,7 @@
 #include "bytestream.h"
 #include "get_bits.h"
 #include "internal.h"
-#include "unary.h"
+#include "unary_legacy.h"
 
 static int dxtory_decode_v1_rgb(AVCodecContext *avctx, AVFrame *pic,
                                 const uint8_t *src, int src_size,
index 9199f5c28dbe0db71f927b8b5d1631526a9f102e..ca0dd2c0d957aff43fc65fa7d7736e3656f9b83d 100644 (file)
@@ -40,7 +40,7 @@
 #include "internal.h"
 #include "mathops.h"
 #include "mpegutils.h"
-#include "unary.h"
+#include "unary_legacy.h"
 #include "flv.h"
 #include "rv10.h"
 #include "mpeg4video.h"
index 073e0e2da012c0b956569c355a2eb5bd16695bc3..0acdb99b7adda6b35023eb007a7cb859d04c92cc 100644 (file)
@@ -30,7 +30,7 @@
 #include "get_bits.h"
 #include "internal.h"
 #include "mss34dsp.h"
-#include "unary.h"
+#include "unary_legacy.h"
 
 #define HEADER_SIZE 8
 
index bed5adfe0039bfb8dfbc36a007d9655c8dc002f6..9812837570ca5f95a36bc18d7b91409fd880a795 100644 (file)
@@ -32,7 +32,7 @@
 #include "get_bits.h"
 #include "golomb.h"
 #include "internal.h"
-#include "unary.h"
+#include "unary_legacy.h"
 #include "ralfdata.h"
 
 #define FILTER_NONE 0
index 394567bbba6f7d2b7f78fbcf6f76f72996cfa1d1..e7320c66d4eb2dbfea83060327d202114320ae9d 100644 (file)
@@ -32,7 +32,7 @@
 #include "audiodsp.h"
 #include "avcodec.h"
 #include "internal.h"
-#include "unary.h"
+#include "unary_legacy.h"
 #include "tak.h"
 
 #define MAX_SUBFRAMES     8                         // max number of subframes per channel
index 5532580e02239076d086a9078b5f75534db0c633..0f67a0575d3913a9e38568c1a29b424008bf8a84 100644 (file)
@@ -35,7 +35,7 @@
 #include "avcodec.h"
 #include "get_bits.h"
 #include "internal.h"
-#include "unary.h"
+#include "unary_legacy.h"
 
 #define FORMAT_SIMPLE    1
 #define FORMAT_ENCRYPTED 2
index d14929f797de9713331e4c6de10fe36c58d8841c..29920178173d93f1a21151cca14a704fc84aa4eb 100644 (file)
 #ifndef AVCODEC_UNARY_H
 #define AVCODEC_UNARY_H
 
-#include "get_bits.h"
+#include "bitstream.h"
 
 /**
  * Get unary code of limited length
- * @param gb GetBitContext
+ * @param bc BitstreamContext
  * @param[in] stop The bitstop value (unary code of 1's or 0's)
  * @param[in] len Maximum length
  * @return Unary length/index
  */
-static inline int get_unary(GetBitContext *gb, int stop, int len)
+static inline int get_unary(BitstreamContext *bc, int stop, int len)
 {
     int i;
 
-    for(i = 0; i < len && get_bits1(gb) != stop; i++);
+    for (i = 0; i < len && bitstream_read_bit(bc) != stop; i++)
+        ;
     return i;
 }
 
 /**
  * Get unary code terminated by a 0 with a maximum length of 33
- * @param gb GetBitContext
+ * @param bc BitstreamContext
  * @return Unary length/index
  */
-static inline int get_unary_0_33(GetBitContext *gb)
+static inline int get_unary_0_33(BitstreamContext *bc)
 {
-    return get_unary(gb, 0, 33);
+    return get_unary(bc, 0, 33);
 }
 
-static inline int get_unary_0_9(GetBitContext *gb)
+static inline int get_unary_0_9(BitstreamContext *bc)
 {
-    return get_unary(gb, 0, 9);
+    return get_unary(bc, 0, 9);
 }
 
 #endif /* AVCODEC_UNARY_H */
diff --git a/libavcodec/unary_legacy.h b/libavcodec/unary_legacy.h
new file mode 100644 (file)
index 0000000..d14929f
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_UNARY_H
+#define AVCODEC_UNARY_H
+
+#include "get_bits.h"
+
+/**
+ * Get unary code of limited length
+ * @param gb GetBitContext
+ * @param[in] stop The bitstop value (unary code of 1's or 0's)
+ * @param[in] len Maximum length
+ * @return Unary length/index
+ */
+static inline int get_unary(GetBitContext *gb, int stop, int len)
+{
+    int i;
+
+    for(i = 0; i < len && get_bits1(gb) != stop; i++);
+    return i;
+}
+
+/**
+ * Get unary code terminated by a 0 with a maximum length of 33
+ * @param gb GetBitContext
+ * @return Unary length/index
+ */
+static inline int get_unary_0_33(GetBitContext *gb)
+{
+    return get_unary(gb, 0, 33);
+}
+
+static inline int get_unary_0_9(GetBitContext *gb)
+{
+    return get_unary(gb, 0, 9);
+}
+
+#endif /* AVCODEC_UNARY_H */
index 7a93e971bce6627fa1e42daa04bb1e3b2cbec3f0..8eba65c1d04c3188a39523df663ed463ea557d68 100644 (file)
 #include "internal.h"
 #include "avcodec.h"
 #include "mpegvideo.h"
+#include "unary_legacy.h"
 #include "vc1.h"
 #include "vc1data.h"
 #include "wmv2data.h"
-#include "unary.h"
 #include "simple_idct.h"
 
 /***********************************************************************/
index 0e1018ce9b76f412a49617f58c4caa4fea081d66..d8f45f91dca88941248795f71fc5f1195c320e73 100644 (file)
@@ -30,7 +30,7 @@
 #include "mpegutils.h"
 #include "mpegvideo.h"
 #include "msmpeg4data.h"
-#include "unary.h"
+#include "unary_legacy.h"
 #include "vc1.h"
 #include "vc1_pred.h"
 #include "vc1acdata.h"
index 7f55f515a3adf26cd93ed0f0fabea02c452a67da..b8adb3d4841dba153ba81fe28cbf2fe3e2761b2e 100644 (file)
@@ -26,7 +26,7 @@
 #include "bytestream.h"
 #include "get_bits.h"
 #include "internal.h"
-#include "unary.h"
+#include "unary_legacy.h"
 
 /**
  * @file
index d4005fa499949090d5d462486016073b58ba8d69..132e3cd9073def3a7ed6b8090aeb1f4d648ac2fa 100644 (file)
@@ -20,7 +20,8 @@
  */
 
 #include "libavcodec/get_bits.h"
-#include "libavcodec/unary.h"
+#include "libavcodec/unary_legacy.h"
+
 #include "apetag.h"
 #include "avformat.h"
 #include "internal.h"