Commit 9b78ed82 authored by John Koleszar's avatar John Koleszar Committed by Gerrit Code Review
Browse files

Merge "Using network byte order (big-endian) to encode tile size." into experimental

parents 51a7c763 85381e34
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
int dec_debug = 0; int dec_debug = 0;
#endif #endif
static int read_le32(const uint8_t *p) { static int read_be32(const uint8_t *p) {
return (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
} }
// len == 0 is not allowed // len == 0 is not allowed
...@@ -907,13 +907,13 @@ static void decode_tiles(VP9D_COMP *pbi, ...@@ -907,13 +907,13 @@ static void decode_tiles(VP9D_COMP *pbi,
data_ptr2[0][0] = data_ptr; data_ptr2[0][0] = data_ptr;
for (tile_row = 0; tile_row < pc->tile_rows; tile_row++) { for (tile_row = 0; tile_row < pc->tile_rows; tile_row++) {
if (tile_row) { if (tile_row) {
const int size = read_le32(data_ptr2[tile_row - 1][n_cols - 1]); const int size = read_be32(data_ptr2[tile_row - 1][n_cols - 1]);
data_ptr2[tile_row - 1][n_cols - 1] += 4; data_ptr2[tile_row - 1][n_cols - 1] += 4;
data_ptr2[tile_row][0] = data_ptr2[tile_row - 1][n_cols - 1] + size; data_ptr2[tile_row][0] = data_ptr2[tile_row - 1][n_cols - 1] + size;
} }
for (tile_col = 1; tile_col < n_cols; tile_col++) { for (tile_col = 1; tile_col < n_cols; tile_col++) {
const int size = read_le32(data_ptr2[tile_row][tile_col - 1]); const int size = read_be32(data_ptr2[tile_row][tile_col - 1]);
data_ptr2[tile_row][tile_col - 1] += 4; data_ptr2[tile_row][tile_col - 1] += 4;
data_ptr2[tile_row][tile_col] = data_ptr2[tile_row][tile_col] =
data_ptr2[tile_row][tile_col - 1] + size; data_ptr2[tile_row][tile_col - 1] + size;
...@@ -946,7 +946,7 @@ static void decode_tiles(VP9D_COMP *pbi, ...@@ -946,7 +946,7 @@ static void decode_tiles(VP9D_COMP *pbi,
decode_tile(pbi, residual_bc); decode_tile(pbi, residual_bc);
if (has_more) { if (has_more) {
const int size = read_le32(data_ptr); const int size = read_be32(data_ptr);
data_ptr += 4 + size; data_ptr += 4 + size;
} }
} }
......
...@@ -157,11 +157,11 @@ void write_switchable_interp_stats() { ...@@ -157,11 +157,11 @@ void write_switchable_interp_stats() {
static int update_bits[255]; static int update_bits[255];
static INLINE void write_le32(uint8_t *p, int value) { static INLINE void write_be32(uint8_t *p, int value) {
p[0] = value; p[0] = value >> 24;
p[1] = value >> 8; p[1] = value >> 16;
p[2] = value >> 16; p[2] = value >> 8;
p[3] = value >> 24; p[3] = value;
} }
...@@ -1747,7 +1747,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) { ...@@ -1747,7 +1747,7 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) {
vp9_stop_encode(&residual_bc); vp9_stop_encode(&residual_bc);
if (tile_col < pc->tile_columns - 1 || tile_row < pc->tile_rows - 1) { if (tile_col < pc->tile_columns - 1 || tile_row < pc->tile_rows - 1) {
// size of this tile // size of this tile
write_le32(data_ptr + total_size, residual_bc.pos); write_be32(data_ptr + total_size, residual_bc.pos);
total_size += 4; total_size += 4;
} }
......
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