History

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().

Andreas Rheinhardt committed 2 years ago

Commit 4484e9b1 parent 988e3191 file · +10 −0Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/put_bits.h+10−0
@@ -74,6 +74,16 @@ static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, · 73 unmodified lines
7474 s->bit_buf = 0;
7575 }
7676
77+/**
78+ * Inform the compiler that a PutBitContext is flushed (i.e. if it has just
79+ * been initialized or flushed). Undefined behaviour occurs if this is used
80+ * with a PutBitContext for which this is not true.
81+ */
82+static inline void put_bits_assume_flushed(const PutBitContext *s)
83+{
84+ av_assume(s->bit_left == BUF_BITS);
85+}
86+
7787 /**
7888 * @return the total number of bits written to the bitstream.
7989 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t