]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/bgmc.c
lavc: Drop deprecated way of setting codec dimensions
[ffmpeg] / libavcodec / bgmc.c
index ad8baaecacae70b17805f71efef496f9ba6092fd..1de67537af6462f4154a21bfe35f823a5087781d 100644 (file)
@@ -26,6 +26,8 @@
  */
 
 #include "libavutil/attributes.h"
+
+#include "bitstream.h"
 #include "bgmc.h"
 
 #define FREQ_BITS  14                      // bits used by frequency counters
@@ -485,24 +487,26 @@ av_cold void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status)
 
 
 /** Initialize decoding and reads the first value */
-void ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h,
+void ff_bgmc_decode_init(BitstreamContext *bc, unsigned int *h,
                          unsigned int *l, unsigned int *v)
 {
     *h = TOP_VALUE;
     *l = 0;
-    *v = get_bits_long(gb, VALUE_BITS);
+    *v = bitstream_read(bc, VALUE_BITS);
 }
 
 
 /** Finish decoding */
-void ff_bgmc_decode_end(GetBitContext *gb)
+void ff_bgmc_decode_end(BitstreamContext *bc)
 {
-    skip_bits_long(gb, -(VALUE_BITS - 2));
+    unsigned pos = bitstream_tell(bc) - VALUE_BITS + 2;
+
+    bitstream_seek(bc, pos);
 }
 
 
 /** Read and decode a block Gilbert-Moore coded symbol */
-void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
+void ff_bgmc_decode(BitstreamContext *bc, unsigned int num, int32_t *dst,
                     int delta, unsigned int sx,
                     unsigned int *h, unsigned int *l, unsigned int *v,
                     uint8_t *cf_lut, int *cf_lut_status)
@@ -547,7 +551,7 @@ void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
 
             low  *= 2;
             high  = 2 * high + 1;
-            value = 2 * value + get_bits1(gb);
+            value = 2 * value + bitstream_read_bit(bc);
         }
 
         *dst++ = symbol;