Skip to content
  • David Barker's avatar
    Fix encode/decode mismatch when enabling frame resizing · d706ed25
    David Barker authored
    There was a bug caused by the following sequence of events:
    * A frame was coded full-size, filling out the
      cm->above_context array as normal.
    * The next frame was coded at a reduced size
    * Due to changes between VP9 and AV1, we now clear the
      context arrays per-tile on the decoder side. The amount
      cleared is the span of the tile, rounded up to the next
      mi unit. Since this frame is at a reduced size, this
      leaves some entries "off the edge of the frame" set to 1.
    * get_entropy_context() reads a full transform block's worth
      of data from cm->above_context. This could read the off-frame
      1s, even when all the in-frame values were 0 (eg, because
      we're working on the topmost block of the frame).
    * This leads to the decoder getting the wrong context, causing
      an encode/decode mismatch.
    We fix this by rounding up to the next superblock, rather than
    the next mi unit, when clearing the context arrays per-tile.
    This is safe because all tiles other than the rightmost column
    must be an integer number of superblocks wide.
    Change-Id: I8283c69957900572d44eb8d7f633cb59e352da3c