diff options
author | Alexandra Hájková <alexandra@khirnov.net> | 2016-06-08 11:31:33 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2016-12-19 12:35:05 +0100 |
commit | fa64aea12ee69a32b916fefdef1c819f97e2cb9e (patch) | |
tree | 46394e76e3169a978b166f4218e9f80297df8fa4 | |
parent | 45286a625c6ced1f5c4c842244cbb4509429abba (diff) | |
download | ffmpeg-fa64aea12ee69a32b916fefdef1c819f97e2cb9e.tar.gz |
unary: Convert to the new bitstream reader
-rw-r--r-- | libavcodec/aic.c | 2 | ||||
-rw-r--r-- | libavcodec/alac.c | 2 | ||||
-rw-r--r-- | libavcodec/alsdec.c | 3 | ||||
-rw-r--r-- | libavcodec/apedec.c | 2 | ||||
-rw-r--r-- | libavcodec/dca_xll.c | 2 | ||||
-rw-r--r-- | libavcodec/dxtory.c | 2 | ||||
-rw-r--r-- | libavcodec/ituh263dec.c | 2 | ||||
-rw-r--r-- | libavcodec/mss4.c | 2 | ||||
-rw-r--r-- | libavcodec/ralf.c | 2 | ||||
-rw-r--r-- | libavcodec/takdec.c | 2 | ||||
-rw-r--r-- | libavcodec/tta.c | 2 | ||||
-rw-r--r-- | libavcodec/unary.h | 19 | ||||
-rw-r--r-- | libavcodec/unary_legacy.h | 56 | ||||
-rw-r--r-- | libavcodec/vc1.c | 2 | ||||
-rw-r--r-- | libavcodec/vc1_block.c | 2 | ||||
-rw-r--r-- | libavcodec/wavpack.c | 2 | ||||
-rw-r--r-- | libavformat/mpc8.c | 3 |
17 files changed, 83 insertions, 24 deletions
diff --git a/libavcodec/aic.c b/libavcodec/aic.c index 7c6ddddb0a..2c9b6f8098 100644 --- a/libavcodec/aic.c +++ b/libavcodec/aic.c @@ -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) diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 83d777c760..aef68e76a3 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -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 diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index af514870ef..9fd2827dcd 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -29,12 +29,13 @@ #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" diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index 2f6448867a..69ded9a670 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -31,7 +31,7 @@ #include "bytestream.h" #include "internal.h" #include "get_bits.h" -#include "unary.h" +#include "unary_legacy.h" /** * @file diff --git a/libavcodec/dca_xll.c b/libavcodec/dca_xll.c index 5a558b8c48..5d76793fbb 100644 --- a/libavcodec/dca_xll.c +++ b/libavcodec/dca_xll.c @@ -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) diff --git a/libavcodec/dxtory.c b/libavcodec/dxtory.c index e2b875b5e3..b0fae2f5ef 100644 --- a/libavcodec/dxtory.c +++ b/libavcodec/dxtory.c @@ -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, diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index 9199f5c28d..ca0dd2c0d9 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -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" diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c index 073e0e2da0..0acdb99b7a 100644 --- a/libavcodec/mss4.c +++ b/libavcodec/mss4.c @@ -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 diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c index bed5adfe00..9812837570 100644 --- a/libavcodec/ralf.c +++ b/libavcodec/ralf.c @@ -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 diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c index 394567bbba..e7320c66d4 100644 --- a/libavcodec/takdec.c +++ b/libavcodec/takdec.c @@ -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 diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 5532580e02..0f67a0575d 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -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 diff --git a/libavcodec/unary.h b/libavcodec/unary.h index d14929f797..2992017817 100644 --- a/libavcodec/unary.h +++ b/libavcodec/unary.h @@ -21,36 +21,37 @@ #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 index 0000000000..d14929f797 --- /dev/null +++ b/libavcodec/unary_legacy.h @@ -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 */ diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 7a93e971bc..8eba65c1d0 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -30,10 +30,10 @@ #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" /***********************************************************************/ diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c index 0e1018ce9b..d8f45f91dc 100644 --- a/libavcodec/vc1_block.c +++ b/libavcodec/vc1_block.c @@ -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" diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 7f55f515a3..b8adb3d484 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -26,7 +26,7 @@ #include "bytestream.h" #include "get_bits.h" #include "internal.h" -#include "unary.h" +#include "unary_legacy.h" /** * @file diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index d4005fa499..132e3cd907 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -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" |