///|
/// Inverse horizontal squeeze. The left half (rounded up) of each row holds
/// the averages and the right half the residuals.
fn inverse_h(merged : @grid.SubGrid[Int32]) -> Unit {
  let height = merged.height
  let width = merged.width
  if width == 0 {
    return
  }
  let buf = merged.buf
  let scratch = FixedArray::make(width, 0)
  let avg_width = div_ceil(width, 2)
  let pairs = width / 2
  for y in 0.. Unit {
  let width = merged.width
  let height = merged.height
  if height == 0 {
    return
  }
  let buf = merged.buf
  let stride = merged.stride
  let avg_height = div_ceil(height, 2)
  let residu_height = height / 2
  // Process whole rows at a time (same result as upstream's column loop).
  let scratch = FixedArray::make(height * width, 0)
  for y in 0.. Int32 {
  if a >= b && b >= c {
    let mut x = (4 * a - 3 * c - b + 6) / 12
    if x - (x & 1) > 2 * (a - b) {
      x = 2 * (a - b) + 1
    }
    if x + (x & 1) > 2 * (b - c) {
      x = 2 * (b - c)
    }
    x
  } else if a <= b && b <= c {
    let mut x = (4 * a - 3 * c - b - 6) / 12
    if x + (x & 1) < 2 * (a - b) {
      x = 2 * (a - b) - 1
    }
    if x - (x & 1) < 2 * (b - c) {
      x = 2 * (b - c)
    }
    x
  } else {
    0
  }
}