Skip to content
  • David Barker's avatar
    Adjust chroma position in warp filter · a60dc9d6
    David Barker authored
    When using chroma subsampling, the warp filter currently behaves
    strangely when projecting chroma pixels, especially when the
    subsamplings are not equal along the x and y axes.
    
    For example, when subsampling_x = 1 and subsampling_y = 0, we
    calculate the destination coordinates (dx, dy) from the source
    coordinates (sx, sy) as:
    dx = project(2*sx+0.5, 2*sy+0.5)/2 - 0.5
    dy = project(sx, sy)
    where project() applies the affine warp model.
    
    This patch changes to a simpler and more consistent model,
    where we:
    * Project the chroma sample into luma coordinates, taking
      the chroma sample to be co-located with the top-left luma
      sample in its (2x2, or 2x1, or 1x2) subsampling block
      (this is done for simplicity; we don't expect the exact
       position to make much difference to the output quality)
    * Apply the transformation in luma coordinates
    * Project the resulting luma sample back into chroma coordinates
    
    Change to software speed is in the noise, but this approach
    should be simpler in hardware, and should slightly improve
    quality for 4:2:2 and 4:4:0 videos.
    
    Change-Id: Idd455fdd3897594ca7d4edff5b85b78961d1638d
    a60dc9d6