Fix bilateral filter asan error for highbitdepth
BUG=webm:1334
Change-Id: I5886eec0a22a8cc056e1bdb493d2faf183816656
diff --git a/av1/common/restoration.c b/av1/common/restoration.c
index 8f0a212..f1c4239 100644
--- a/av1/common/restoration.c
+++ b/av1/common/restoration.c
@@ -369,6 +369,7 @@
const int tile_height = rst->tile_height >> rst->subsampling_y;
int i, j, subtile_idx;
int h_start, h_end, v_start, v_end;
+ const int shift = bit_depth - 8;
for (subtile_idx = 0; subtile_idx < BILATERAL_SUBTILES; ++subtile_idx) {
uint16_t *data_p, *tmpdata_p;
@@ -398,7 +399,7 @@
for (y = -RESTORATION_HALFWIN; y <= RESTORATION_HALFWIN; ++y) {
for (x = -RESTORATION_HALFWIN; x <= RESTORATION_HALFWIN; ++x) {
wt = (int)wx_lut[y + RESTORATION_HALFWIN][x + RESTORATION_HALFWIN] *
- (int)wr_lut_[data_p2[x] - data_p[j]];
+ (int)wr_lut_[(data_p2[x] >> shift) - (data_p[j] >> shift)];
wtsum += (int64_t)wt;
flsum += (int64_t)wt * data_p2[x];
}