aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/acelp_vectors.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-03-25 09:05:49 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-03-30 12:36:32 +0200
commit11ff9cb5e976e87ec345e6f4856f62b86d6cb0b3 (patch)
treedc21b6c01a9a3a9270664cbb5b6a9a078fdbc306 /libavcodec/acelp_vectors.c
parente48f18e2d5e492ef41139d55a3698044fc245eca (diff)
downloadffmpeg-11ff9cb5e976e87ec345e6f4856f62b86d6cb0b3.tar.gz
avcodec/put_bits: Add functions for amount of bytes written/left
Often a caller doesn't want the amount of bits written via a PutBitContext, but the amount of bytes. This in particular happens after one has flushed the PutBitContext (e.g. at the end of encoding, when one wants to know the actual packet size). The current way of doing this is with put_bits_count(pb)/8 (or (put_bits_count(pb) + 7)/8). Yet this has some issues: It contains implicit multiplications and divisions by 8 with a cast in between; it obscurs the intent; and it restricts the size of the buffer to (currently) INT_MAX/8 (or to 1/8 of the maximum of whatever put_bits_count() returns), although said restriction is not really necessary for users that don't need a bitcount. Corresponding functions for the amount of bytes left have also been addded. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/acelp_vectors.c')
0 files changed, 0 insertions, 0 deletions