This will allow the compiler to optimize the "is the cache full?" branches away from some put_bits().
Unified · Split
| @@ -74,6 +74,16 @@ static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, · 73 unmodified lines | ||
| 74 | 74 | s->bit_buf = 0; |
| 75 | 75 | } |
| 76 | 76 | |
| 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 | + | |
| 77 | 87 | /** |
| 78 | 88 | * @return the total number of bits written to the bitstream. |
| 79 | 89 | */ |