Skip to content
  • Urvang Joshi's avatar
    Palette: Handle case of too few unique centroids. · 5fb95f7d
    Urvang Joshi authored
    Even though number of unique colors in a block may be at least
    PALETTE_MIN_SIZE, sometimes the K-means can generate fewer than
    PALETTE_MIN_SIZE unique centroids due to integer rounding.
    
    This was resulting in "k - PALETTE_MIN_SIZE" being negative and using
    that as an index into palette_y_size_cost array was causing a UBSan
    error.
    
    BUG=aomedia:515
    
    Change-Id: Ia00b4bb2efebbe43d1fec7b619ebb837b1ae961c
    5fb95f7d