]> git.sesse.net Git - ffmpeg/commit
avcodec: Remove cumbersome way of checking for amount of bytes left
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 25 Mar 2021 09:27:31 +0000 (10:27 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Tue, 30 Mar 2021 10:36:32 +0000 (12:36 +0200)
commit67f6e7ed6ddac43139984b6956f45bb5c1861546
treea931d71df1442c32203715d2e6fa82a3fab6a4af
parent11ff9cb5e976e87ec345e6f4856f62b86d6cb0b3
avcodec: Remove cumbersome way of checking for amount of bytes left

Several encoders used code like the following to check for the amount of
bytes left in a PutBitContext:
pb->buf_end - pb->buf - (put_bits_count(pb) >> 3)
Besides the fact that using the pointers directly might pose
a maintainence burden in the future this also leads to suboptimal code:
The above code reads all three pointers (buf, buf_ptr and buf_end), but
touching buf is unnecessary and switching to put_bytes_left()
automatically fixes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/asvenc.c
libavcodec/ffv1enc_template.c
libavcodec/huffyuvenc.c
libavcodec/ljpegenc.c
libavcodec/mpegvideo_enc.c
libavcodec/svq1enc.c
libavcodec/xsubenc.c