Make cdef block offset scalable with mode_info size

Properly map the mode_info offset to pixel offset in cdef to
support cb4x4 mode.

Change-Id: I1f876387cb327cbf6c5689a4bc5ac41a1b1b0f34
This commit is contained in:
Jingning Han 2017-03-28 15:39:44 -07:00
Родитель c86e7aa0d4
Коммит b06af20759
2 изменённых файлов: 18 добавлений и 10 удалений

Просмотреть файл

@ -222,20 +222,23 @@ void copy_dering_16bit_to_16bit(uint16_t *dst, int dstride, uint16_t *src,
dering_list *dlist, int dering_count,
BLOCK_SIZE bsize) {
int bi, bx, by;
const int mi_size_l2 = (bsize == BLOCK_8X8) ? MI_SIZE_LOG2 : MI_SIZE_LOG2 - 1;
if (bsize == BLOCK_8X8) {
for (bi = 0; bi < dering_count; bi++) {
by = dlist[bi].by;
bx = dlist[bi].bx;
copy_8x8_16bit_to_16bit(&dst[(by << 3) * dstride + (bx << 3)], dstride,
&src[bi << (2 * 3)], 8);
copy_8x8_16bit_to_16bit(
&dst[(by << mi_size_l2) * dstride + (bx << mi_size_l2)], dstride,
&src[bi << (2 * 3)], 8);
}
} else {
for (bi = 0; bi < dering_count; bi++) {
by = dlist[bi].by;
bx = dlist[bi].bx;
copy_4x4_16bit_to_16bit(&dst[(by << 2) * dstride + (bx << 2)], dstride,
&src[bi << (2 * 2)], 4);
copy_4x4_16bit_to_16bit(
&dst[(by << mi_size_l2) * dstride + (bx << mi_size_l2)], dstride,
&src[bi << (2 * 2)], 4);
}
}
}
@ -303,6 +306,7 @@ void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec,
};
int threshold = (pli ? level_table_uv : level_table)[level] << coeff_shift;
const int mi_size_l2 = xdec ? MI_SIZE_LOG2 - 1 : MI_SIZE_LOG2;
od_filter_dering_direction_func filter_dering_direction[OD_DERINGSIZES] = {
od_filter_dering_direction_4x4, od_filter_dering_direction_8x8
};
@ -314,7 +318,7 @@ void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec,
by = dlist[bi].by;
bx = dlist[bi].bx;
dir[by][bx] =
od_dir_find8(&in[8 * by * OD_FILT_BSTRIDE + 8 * bx],
od_dir_find8(&in[MI_SIZE * by * OD_FILT_BSTRIDE + MI_SIZE * bx],
OD_FILT_BSTRIDE, &var[by][bx], coeff_shift);
}
if (dirinit) *dirinit = 1;
@ -332,7 +336,7 @@ void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec,
get removed by the directional filtering. */
(filter_dering_direction[bsize - OD_LOG_BSIZE0])(
&y[bi << 2 * bsize], 1 << bsize,
&in[(by * OD_FILT_BSTRIDE << bsize) + (bx << bsize)],
&in[(by * OD_FILT_BSTRIDE << mi_size_l2) + (bx << mi_size_l2)],
od_adjust_thresh(threshold, var[by][bx]), dir[by][bx]);
}
} else {
@ -341,8 +345,8 @@ void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec,
bx = dlist[bi].bx;
(filter_dering_direction[bsize - OD_LOG_BSIZE0])(
&y[bi << 2 * bsize], 1 << bsize,
&in[(by * OD_FILT_BSTRIDE << bsize) + (bx << bsize)], threshold,
dir[by][bx]);
&in[(by * OD_FILT_BSTRIDE << mi_size_l2) + (bx << mi_size_l2)],
threshold, dir[by][bx]);
}
}
}
@ -358,8 +362,8 @@ void od_dering(uint8_t *dst, int dstride, uint16_t *y, uint16_t *in, int xdec,
(!threshold || (dir[by][bx] < 4 && dir[by][bx]) ? aom_clpf_block_hbd
: aom_clpf_hblock_hbd)(
in, &y[((bi - by) << 2 * bsize) - (bx << bsize)], OD_FILT_BSTRIDE,
1 << bsize, bx << bsize, by << bsize, 1 << bsize, 1 << bsize,
clpf_strength << coeff_shift, clpf_damping + coeff_shift);
1 << bsize, bx << mi_size_l2, by << mi_size_l2, 1 << bsize,
1 << bsize, clpf_strength << coeff_shift, clpf_damping + coeff_shift);
}
}
if (dst) {

Просмотреть файл

@ -18,7 +18,11 @@
#define OD_DERING_SIZE_LOG2 (3)
#if CONFIG_CB4X4
#define OD_DERING_NBLOCKS (OD_BSIZE_MAX / 4)
#else
#define OD_DERING_NBLOCKS (OD_BSIZE_MAX / 8)
#endif
/* We need to buffer three vertical lines. */
#define OD_FILT_VBORDER (3)