Skip to content
  • David Barker's avatar
    Fix an edge case in tile group decoding · 1a191125
    David Barker authored
    As of patch https://aomedia-review.googlesource.com/c/20220 ,
    it is no longer always the case that tile_rows == (1 << log2_tile_rows)
    and tile_cols == (1 << log2_tile_cols). This exposed an inconsistency
    in the tile-group decoding:
    
    When reading the first tile group in a frame, we read
    (log2_tile_rows + log2_tile_cols) bits each for the tile group
    start and length, but when reading later tile groups we read
    get_msb(tile_rows * tile_cols) bits. But now there are edge cases
    where those values differ! Since the encoder always uses
    (log2_tile_rows + log2_tile_cols) bits, this leads to mis-parsing
    the bitstream.
    
    Fix this by moving the decode logic to one function, which always
    reads (log2_tile_rows + log2_tile_cols) bits. As a bonus, this gives
    us one place to check other invariants, eg. that tile groups can't
    run off the end of the frame.
    
    Change-Id: I83b24314526b6055300b70b0f1cdce038e6b23dc
    1a191125