Code cleanup: mainly rd_pick_partition and methods called from there.
- Const correctness
- Refactoring
- Make variables local when possible etc
- Remove -Wcast-qual to allow explicitly casting away const.
Cherry-picked from aomedia/master: c27fcccc
And then a number of more const correctness changes to make sure other
experiments build OK.
Change-Id: I77c18d99d21218fbdc9b186d7ed3792dc401a0a0
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index a99a5cb..8d67c67 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -710,7 +710,7 @@
return cpi->alt_fb_idx;
}
-static INLINE int get_ref_frame_buf_idx(const AV1_COMP *const cpi,
+static INLINE int get_ref_frame_buf_idx(const AV1_COMP *cpi,
MV_REFERENCE_FRAME ref_frame) {
const AV1_COMMON *const cm = &cpi->common;
const int map_idx = get_ref_frame_map_idx(cpi, ref_frame);
@@ -718,15 +718,15 @@
}
static INLINE YV12_BUFFER_CONFIG *get_ref_frame_buffer(
- AV1_COMP *cpi, MV_REFERENCE_FRAME ref_frame) {
- AV1_COMMON *const cm = &cpi->common;
+ const AV1_COMP *cpi, MV_REFERENCE_FRAME ref_frame) {
+ const AV1_COMMON *const cm = &cpi->common;
const int buf_idx = get_ref_frame_buf_idx(cpi, ref_frame);
return buf_idx != INVALID_IDX ? &cm->buffer_pool->frame_bufs[buf_idx].buf
: NULL;
}
static INLINE const YV12_BUFFER_CONFIG *get_upsampled_ref(
- AV1_COMP *cpi, const MV_REFERENCE_FRAME ref_frame) {
+ const AV1_COMP *cpi, const MV_REFERENCE_FRAME ref_frame) {
// Use up-sampled reference frames.
const int buf_idx =
cpi->upsampled_ref_idx[get_ref_frame_map_idx(cpi, ref_frame)];
@@ -797,7 +797,7 @@
}
#endif // CONFIG_EXT_REFS
-static INLINE void set_ref_ptrs(AV1_COMMON *cm, MACROBLOCKD *xd,
+static INLINE void set_ref_ptrs(const AV1_COMMON *cm, MACROBLOCKD *xd,
MV_REFERENCE_FRAME ref0,
MV_REFERENCE_FRAME ref1) {
xd->block_refs[0] =