ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | Fri May 24 16:33:47 2024 +0200| [4484e9b37307116647a2bd5b202cbff90c8e3cfc] | committer: Andreas Rheinhardt
avcodec/put_bits: Allow to mark places where PutBitContext is flushed This will allow the compiler to optimize the "is the cache full?" branches away from some put_bits(). Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4484e9b37307116647a2bd5b202cbff90c8e3cfc --- libavcodec/put_bits.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h index 56c3f4cc6d..c3eee622d4 100644 --- a/libavcodec/put_bits.h +++ b/libavcodec/put_bits.h @@ -74,6 +74,16 @@ static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, s->bit_buf = 0; } +/** + * Inform the compiler that a PutBitContext is flushed (i.e. if it has just + * been initialized or flushed). Undefined behaviour occurs if this is used + * with a PutBitContext for which this is not true. + */ +static inline void put_bits_assume_flushed(const PutBitContext *s) +{ + av_assume(s->bit_left == BUF_BITS); +} + /** * @return the total number of bits written to the bitstream. */ _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".