Commit 71a37de8 authored by James Zern's avatar James Zern

bitstream.c: normalize some size types

size_t -> uint32_t, quiets -Wshorten-64-to-32 warnings

BUG=aomedia:445

Change-Id: Id714ece4ca672ac2a6beabca32a5fa30d83c8231
parent be0bdd8c
......@@ -16,8 +16,8 @@ size_t aom_rb_bytes_read(struct aom_read_bit_buffer *rb) {
}
int aom_rb_read_bit(struct aom_read_bit_buffer *rb) {
const size_t off = rb->bit_offset;
const size_t p = off >> 3;
const uint32_t off = rb->bit_offset;
const uint32_t p = off >> 3;
const int q = 7 - (int)(off & 0x7);
if (rb->bit_buffer + p < rb->bit_buffer_end) {
const int bit = (rb->bit_buffer[p] >> q) & 1;
......
......@@ -25,7 +25,7 @@ typedef void (*aom_rb_error_handler)(void *data);
struct aom_read_bit_buffer {
const uint8_t *bit_buffer;
const uint8_t *bit_buffer_end;
size_t bit_offset;
uint32_t bit_offset;
void *error_handler_data;
aom_rb_error_handler error_handler;
......
......@@ -15,7 +15,7 @@
#include "./aom_config.h"
#include "./bitwriter_buffer.h"
size_t aom_wb_bytes_written(const struct aom_write_bit_buffer *wb) {
uint32_t aom_wb_bytes_written(const struct aom_write_bit_buffer *wb) {
return wb->bit_offset / CHAR_BIT + (wb->bit_offset % CHAR_BIT > 0);
}
......
......@@ -20,10 +20,10 @@ extern "C" {
struct aom_write_bit_buffer {
uint8_t *bit_buffer;
size_t bit_offset;
uint32_t bit_offset;
};
size_t aom_wb_bytes_written(const struct aom_write_bit_buffer *wb);
uint32_t aom_wb_bytes_written(const struct aom_write_bit_buffer *wb);
void aom_wb_write_bit(struct aom_write_bit_buffer *wb, int bit);
......
......@@ -3998,14 +3998,14 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
int tile_row, tile_col;
TOKENEXTRA *(*const tok_buffers)[MAX_TILE_COLS] = cpi->tile_tok;
TileBufferEnc(*const tile_buffers)[MAX_TILE_COLS] = cpi->tile_buffers;
size_t total_size = 0;
uint32_t total_size = 0;
const int tile_cols = cm->tile_cols;
const int tile_rows = cm->tile_rows;
unsigned int tile_size = 0;
#if CONFIG_TILE_GROUPS
const int n_log2_tiles = cm->log2_tile_rows + cm->log2_tile_cols;
const int have_tiles = n_log2_tiles > 0;
size_t comp_hdr_size;
uint32_t comp_hdr_size;
// Fixed size tile groups for the moment
const int num_tg_hdrs = cm->num_tg;
const int tg_size = (tile_rows * tile_cols + num_tg_hdrs - 1) / num_tg_hdrs;
......@@ -4013,12 +4013,12 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
int tg_count = 1;
int tile_size_bytes = 4;
int tile_col_size_bytes;
int uncompressed_hdr_size = 0;
uint32_t uncompressed_hdr_size = 0;
uint8_t *dst = NULL;
struct aom_write_bit_buffer comp_hdr_len_wb;
struct aom_write_bit_buffer tg_params_wb;
struct aom_write_bit_buffer tile_size_bytes_wb;
int saved_offset;
uint32_t saved_offset;
int mtu_size = cpi->oxcf.mtu;
int curr_tg_data_size = 0;
int hdr_size;
......@@ -4188,7 +4188,7 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
should therefore be tile_count-1.
Move the last tile and insert headers before it
*/
int old_total_size = total_size - tile_size - 4;
uint32_t old_total_size = total_size - tile_size - 4;
memmove(dst + old_total_size + hdr_size, dst + old_total_size,
(tile_size + 4) * sizeof(uint8_t));
// Copy uncompressed header
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment