• Rupert Swarbrick's avatar
    Simplify the search in pickrst.c · 1a96c3f5
    Rupert Swarbrick authored
    The end results should be essentially the same, except hopefully a
    little better because the previous code got the costing slightly
    wrong if there were multiple tiles.
    The code was doing something quite complicated to search for the best
    restoration types; this patch makes it much simpler. Basically,
    av1_pick_filter_restoration loops over the planes in the image. For
    each plane, it loops over the possible restoration types, calling
    search_rest_type for each one.
    search_rest_type iterates over the restoration units in the image,
    resetting the current context on tile boundaries and calling
    search_<rest_type> for each restoration unit.
    The search_norestore function just computes the SSE error with no
    restoration. The search_wiener and search_sgrproj functions compute
    the best set of coefficients and then the resulting SSE error with
    those coefficients (ignoring the bit cost, so the result can be
    re-used for switchable restoration).
    In all cases but search_norestore, the search function has to decide
    what restoration type is best for each restoration unit. For example,
    search_wiener could choose to enable or disable Wiener filtering on
    this unit.
    Eventually, search_rest_type calculates the RDCOST after summing bit
    rates and SSE errors over the restoration units. This cost gets
    returned to av1_pick_filter_restoration which can then choose the best
    frame-level restoration type.
    Change-Id: I9bc17eb47cc46413adae749a43a440825c41bba6
encoder.c 243 KB