• Rupert Swarbrick's avatar
    Don't compute rtile width/height in av1_get_rest_ntiles · 64b8bbdf
    Rupert Swarbrick authored
    Restoration units are a fixed square size (in cm->rst_info[plane]) for
    almost the entire image. The only special case is for tiles at the
    right hand edge or the bottom row, which might expand or be cropped.
    
    The av1_get_rest_ntiles function was implementing the cropping
    behaviour when the image happened to be less than one restoration unit
    wide or high (but not the expansion behaviour), but the result was
    never useful: if you want to get the size of a restoration tile in
    order to divide by it to work out what tile you're on, the fixed
    square size is what you want. If you need to know how big this
    particular tile is, call av1_get_rest_tile_limits.
    
    As well as removing the output arguments from
    av1_get_rest_tile_limits, this patch also removes the tile_width and
    tile_height fields from the RestorationInternal structure. Note that
    the tile size which is what you actually need is accessible as
    rst->rsi->restoration_tilesize. (In practice, these were almost always
    the same anyway).
    
    This patch also has a couple of other small cleanups. Firstly, it
    moves the subsampling_y field out of
    CONFIG_STRIPED_LOOP_RESTORATION. It's not actually needed when you're
    not doing striped loop restoration, but this gets rid of lots of
    horrible #if/#endif lines at callsites for av1_get_rest_tile_limits.
    
    Secondly, it simplifies the code in init_rest_search_ctxt (and fixes
    some tautologous assertions). Now that YV12_BUFFER_CONFIG has a more
    uniform layout, there's a simpler way to set things up, so we use
    that.
    
    Change-Id: I3c32d8ea0abe119dc86b9efa7564b27dde2151dc
    64b8bbdf
restoration.c 75.1 KB