avcodec/cbs: Use put_bits63()
It is better when BUF_BITS == 64 (i.e. on x64), because the underlying put_bits can then handle 0..63 bits naturally. It does not worsen the code when BUF_BITS != 64, because the compiler can optimize this to the same code as now (due to the assert). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
a2acb46a6e
commit
6676038b23
1 changed files with 2 additions and 8 deletions
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue