1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

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.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2024-05-24 16:33:47 +02:00
parent 988e319b40
commit 4484e9b373

View File

@ -74,6 +74,16 @@ static inline void init_put_bits(PutBitContext *s, uint8_t *buffer,
s->bit_buf = 0; 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. * @return the total number of bits written to the bitstream.
*/ */