Commit 522c989b authored by Yaowu Xu's avatar Yaowu Xu

Properly compute token buffer size

This accounts for border extension necessary when image size is not
a multiple of SB size in either horizontal or vertical direction.

BUG=aomedia:647

Change-Id: I18ae9edf148a83f8b32a06ca31410e30ebaa5a47
parent 0aa2eb2c
...@@ -705,10 +705,10 @@ static INLINE int enc_is_ref_frame_buf(AV1_COMP *cpi, RefCntBuffer *frame_buf) { ...@@ -705,10 +705,10 @@ static INLINE int enc_is_ref_frame_buf(AV1_COMP *cpi, RefCntBuffer *frame_buf) {
static INLINE unsigned int get_token_alloc(int mb_rows, int mb_cols) { static INLINE unsigned int get_token_alloc(int mb_rows, int mb_cols) {
// We assume 3 planes all at full resolution. We assume up to 1 token per // We assume 3 planes all at full resolution. We assume up to 1 token per
// pixel, and then allow a head room of 1 EOSB token per 4x4 block per plane, // pixel, and then allow a head room of 1 EOSB token per 4x4 block per plane,
// plus EOSB_TOKEN per plane, plus a 8 token margin. // plus EOSB_TOKEN per plane.
// TODO(sebastien): Figure out the exact max size needed. // ALIGN_POWER_OF_TWO is used to round image size up to multipel of SBs
// See: https://crbug.com/aomedia/647 return ALIGN_POWER_OF_TWO(mb_rows, MAX_SB_SIZE_LOG2 - 4) *
return mb_rows * mb_cols * (16 * 16 + 17 + 8) * 3; ALIGN_POWER_OF_TWO(mb_cols, MAX_SB_SIZE_LOG2 - 4) * (16 * 16 + 17) * 3;
} }
// Get the allocated token size for a tile. It does the same calculation as in // Get the allocated token size for a tile. It does the same calculation as in
......
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