summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/i965_encoder_utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/i965_encoder_utils.c b/src/i965_encoder_utils.c
index ac58cd1..8db1b87 100644
--- a/src/i965_encoder_utils.c
+++ b/src/i965_encoder_utils.c
@@ -134,7 +134,11 @@ avc_bitstream_put_ui(avc_bitstream *bs, unsigned int val, int size_in_bits)
bs->buffer[pos] = (bs->buffer[pos] << size_in_bits | val);
} else {
size_in_bits -= bit_left;
- bs->buffer[pos] = (bs->buffer[pos] << bit_left) | (val >> size_in_bits);
+ if (bit_left == 32) {
+ bs->buffer[pos] = val;
+ } else {
+ bs->buffer[pos] = (bs->buffer[pos] << bit_left) | (val >> size_in_bits);
+ }
bs->buffer[pos] = swap32(bs->buffer[pos]);
if (pos + 1 == bs->max_size_in_dword) {