Modify is_cur_buf_hbd() and get_buf_by_bd() functions
This CL introduces CONFIG_AV1_HIGHBITDEPTH macro in
is_cur_buf_hbd() and get_buf_by_bd() functions and also
cleans-up the code appropriately.
Change-Id: I7d2403fbd2875064b31e7fe0ac936789b5ce25c4
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index b90d348..f3f8f08 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -928,13 +928,23 @@
/*!\cond */
static INLINE int is_cur_buf_hbd(const MACROBLOCKD *xd) {
+#if CONFIG_AV1_HIGHBITDEPTH
return xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH ? 1 : 0;
+#else
+ (void)xd;
+ return 0;
+#endif
}
static INLINE uint8_t *get_buf_by_bd(const MACROBLOCKD *xd, uint8_t *buf16) {
+#if CONFIG_AV1_HIGHBITDEPTH
return (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
? CONVERT_TO_BYTEPTR(buf16)
: buf16;
+#else
+ (void)xd;
+ return buf16;
+#endif
}
typedef struct BitDepthInfo {
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c
index 66c3e28ae..f4f8e82 100644
--- a/av1/common/reconinter.c
+++ b/av1/common/reconinter.c
@@ -1189,7 +1189,6 @@
void av1_setup_obmc_dst_bufs(MACROBLOCKD *xd, uint8_t **dst_buf1,
uint8_t **dst_buf2) {
-#if CONFIG_AV1_HIGHBITDEPTH
if (is_cur_buf_hbd(xd)) {
int len = sizeof(uint16_t);
dst_buf1[0] = CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[0]);
@@ -1203,16 +1202,13 @@
dst_buf2[2] =
CONVERT_TO_BYTEPTR(xd->tmp_obmc_bufs[1] + MAX_SB_SQUARE * 2 * len);
} else {
-#endif // CONFIG_AV1_HIGHBITDEPTH
dst_buf1[0] = xd->tmp_obmc_bufs[0];
dst_buf1[1] = xd->tmp_obmc_bufs[0] + MAX_SB_SQUARE;
dst_buf1[2] = xd->tmp_obmc_bufs[0] + MAX_SB_SQUARE * 2;
dst_buf2[0] = xd->tmp_obmc_bufs[1];
dst_buf2[1] = xd->tmp_obmc_bufs[1] + MAX_SB_SQUARE;
dst_buf2[2] = xd->tmp_obmc_bufs[1] + MAX_SB_SQUARE * 2;
-#if CONFIG_AV1_HIGHBITDEPTH
}
-#endif // CONFIG_AV1_HIGHBITDEPTH
}
void av1_setup_build_prediction_by_above_pred(
diff --git a/av1/encoder/tpl_model.c b/av1/encoder/tpl_model.c
index 3658c34..a8e0ec1 100644
--- a/av1/encoder/tpl_model.c
+++ b/av1/encoder/tpl_model.c
@@ -479,7 +479,6 @@
// Pre-load the bottom left line.
if (xd->left_available &&
mi_row + tx_size_high_unit[tx_size] < xd->tile.mi_row_end) {
-#if CONFIG_AV1_HIGHBITDEPTH
if (is_cur_buf_hbd(xd)) {
uint16_t *dst = CONVERT_TO_SHORTPTR(dst_buffer);
for (int i = 0; i < bw; ++i)
@@ -490,11 +489,6 @@
dst_buffer[(bw + i) * dst_buffer_stride - 1] =
dst_buffer[(bw - 1) * dst_buffer_stride - 1];
}
-#else
- for (int i = 0; i < bw; ++i)
- dst_buffer[(bw + i) * dst_buffer_stride - 1] =
- dst_buffer[(bw - 1) * dst_buffer_stride - 1];
-#endif
}
// if cpi->sf.tpl_sf.prune_intra_modes is on, then search only DC_PRED,