It is unused. Furthermore, this automatically fixes the issue that init_get_bits() failure would lead to NULL + 0 (when setting buffer_end) which is UB before C23. This happened in the fic-avi and fic-avi-skip_cursor FATE-tests. This saved 7296B of .text here.
Unified · Split
| @@ -107,7 +107,7 @@ typedef BitstreamContext GetBitContext; · 106 unmodified lines | |||
| 107 | #else // CACHED_BITSTREAM_READER | 107 | #else // CACHED_BITSTREAM_READER |
| 108 | 108 | ||
| 109 | typedef struct GetBitContext { | 109 | typedef struct GetBitContext { |
| 110 | const uint8_t *buffer, *buffer_end; | 110 | const uint8_t *buffer; |
| 111 | int index; | 111 | int index; |
| 112 | int size_in_bits; | 112 | int size_in_bits; |
| 113 | int size_in_bits_plus8; | 113 | int size_in_bits_plus8; |
| @@ -512,7 +512,6 @@ static inline unsigned int show_bits_long(GetBitContext *s, int n) · 398 unmodified lines | |||
| 512 | static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, | 512 | static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, |
| 513 | int bit_size) | 513 | int bit_size) |
| 514 | { | 514 | { |
| 515 | int buffer_size; | ||
| 516 | int ret = 0; | 515 | int ret = 0; |
| 517 | 516 | ||
| 518 | if (bit_size >= INT_MAX - FFMAX(7, AV_INPUT_BUFFER_PADDING_SIZE*8) || bit_size < 0 || !buffer) { | 517 | if (bit_size >= INT_MAX - FFMAX(7, AV_INPUT_BUFFER_PADDING_SIZE*8) || bit_size < 0 || !buffer) { |
| @@ -521,12 +520,9 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, · 2 unmodified lines | |||
| 521 | ret = AVERROR_INVALIDDATA; | 520 | ret = AVERROR_INVALIDDATA; |
| 522 | } | 521 | } |
| 523 | 522 | ||
| 524 | buffer_size = (bit_size + 7) >> 3; | ||
| 525 | |||
| 526 | s->buffer = buffer; | 523 | s->buffer = buffer; |
| 527 | s->size_in_bits = bit_size; | 524 | s->size_in_bits = bit_size; |
| 528 | s->size_in_bits_plus8 = bit_size + 8; | 525 | s->size_in_bits_plus8 = bit_size + 8; |
| 529 | s->buffer_end = buffer + buffer_size; | ||
| 530 | s->index = 0; | 526 | s->index = 0; |
| 531 | 527 | ||
| 532 | return ret; | 528 | return ret; |