• Romain Vimont's avatar
    Refactor restoration units · e7521d26
    Romain Vimont authored
    A restoration unit may contain several super-blocks, and may be
    "stretched" on borders, even across tile boundaries:
    In the bitstream, it must be coded only for its first super-block, in
    plane order. To do so, a "coded" flag was set the first time, so that
    further super-blocks using the same restoration will not "code" it.
    But this assumed that all super-blocks associated to a restoration unit
    were encoded sequentially in plane order. With parallel tile encoding,
    even with proper synchronization (preventing data races), this
    introduces a race condition: a "stretched" restoration unit may not be
    coded in its first super-block, corrupting the bitstream.
    To avoid the problem, expose the restoration unit only for its first
    super-block, by returning a Option<&(mut) RestorationUnit>. This also
    avoids the need for any synchronization (a restoration unit will never
    be retrieved by more than 1 tile).
    At frame level, lrf_filter_frame() will still retrieve the correct
    restoration unit for each super-block, by calling
lrf.rs 40.2 KB