diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index ba1034a72e..398d286a92 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -674,10 +674,7 @@ int CBS_FUNC(write_unsigned)(CodedBitstreamContext *ctx, PutBitContext *pbc, if (put_bits_left(pbc) < width) return AVERROR(ENOSPC); - if (width < 32) - put_bits(pbc, width, value); - else - put_bits32(pbc, value); + put_bits63(pbc, width, value); CBS_TRACE_WRITE_END(); @@ -746,10 +743,7 @@ int CBS_FUNC(write_signed)(CodedBitstreamContext *ctx, PutBitContext *pbc, if (put_bits_left(pbc) < width) return AVERROR(ENOSPC); - if (width < 32) - put_sbits(pbc, width, value); - else - put_bits32(pbc, value); + put_bits63(pbc, width, zero_extend(value, width)); CBS_TRACE_WRITE_END();