From: Alexandra Hájková <[email protected]>

---
 libavcodec/dxva2_h264.c  |  3 ++-
 libavcodec/dxva2_mpeg2.c | 14 ++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index e2e987d..281134c 100644
--- a/libavcodec/dxva2_h264.c
+++ b/libavcodec/dxva2_h264.c
@@ -20,6 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "bitstream.h"
 #include "h264.h"
 #include "h264data.h"
 #include "mpegutils.h"
@@ -230,7 +231,7 @@ static void fill_slice_long(AVCodecContext *avctx, 
DXVA_Slice_H264_Long *slice,
 
     slice->first_mb_in_slice     = (sl->mb_y >> FIELD_OR_MBAFF_PICTURE(h)) * 
h->mb_width + sl->mb_x;
     slice->NumMbsForSlice        = 0; /* XXX it is set once we have all slices 
*/
-    slice->BitOffsetToSliceData  = get_bits_count(&sl->gb);
+    slice->BitOffsetToSliceData  = bitstream_tell(&sl->bc);
     slice->slice_type            = ff_h264_get_slice_type(sl);
     if (sl->slice_type_fixed)
         slice->slice_type += 5;
diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
index 2d88f9b..4e32742 100644
--- a/libavcodec/dxva2_mpeg2.c
+++ b/libavcodec/dxva2_mpeg2.c
@@ -21,6 +21,8 @@
  */
 
 #include "libavutil/log.h"
+
+#include "bitstream.h"
 #include "mpegutils.h"
 #include "mpegvideo.h"
 
@@ -130,7 +132,7 @@ static void fill_slice(AVCodecContext *avctx,
                        const uint8_t *buffer, unsigned size)
 {
     int is_field = s->picture_structure != PICT_FRAME;
-    GetBitContext gb;
+    BitstreamContext bc;
 
     memset(slice, 0, sizeof(*slice));
     slice->wHorizontalPosition = s->mb_x;
@@ -143,13 +145,13 @@ static void fill_slice(AVCodecContext *avctx,
     slice->wNumberMBsInSlice   = (s->mb_y >> is_field) * s->mb_width + s->mb_x;
     slice->wBadSliceChopping   = 0;
 
-    init_get_bits(&gb, &buffer[4], 8 * (size - 4));
+    bitstream_init(&bc, &buffer[4], 8 * (size - 4));
 
-    slice->wQuantizerScaleCode = get_bits(&gb, 5);
-    while (get_bits1(&gb))
-        skip_bits(&gb, 8);
+    slice->wQuantizerScaleCode = bitstream_read(&bc, 5);
+    while (bitstream_read_bit(&bc))
+        bitstream_skip(&bc, 8);
 
-    slice->wMBbitOffset        = 4 * 8 + get_bits_count(&gb);
+    slice->wMBbitOffset        = 4 * 8 + bitstream_tell(&bc);
 }
 static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
                                              DECODER_BUFFER_DESC *bs,
-- 
2.7.3

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to