aboutsummaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorAngie Chiang <angiebird@google.com>2019-08-21 16:04:40 -0700
committerAngie Chiang <angiebird@google.com>2019-08-27 15:57:25 -0700
commitefd02817da3d38140278cc92668547ada662c2e6 (patch)
treed14c4e872fdc15e0af9ad27e6c850ec867eddd73 /vp9
parent2981cfac00342163b976f7dbcf72573448f3793b (diff)
downloadlibvpx-efd02817da3d38140278cc92668547ada662c2e6.tar.gz
Add MACRO MAX_INTER_REF_FRAMES
Use MAX_INTER_REF_FRAMES wheneve it's suitable Change-Id: I0fad94371a6600099313685cbe38faebb44178c4
Diffstat (limited to 'vp9')
-rw-r--r--vp9/common/vp9_blockd.h1
-rw-r--r--vp9/encoder/vp9_encoder.c24
-rw-r--r--vp9/encoder/vp9_non_greedy_mv.c4
-rw-r--r--vp9/encoder/vp9_non_greedy_mv.h2
4 files changed, 16 insertions, 15 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index 2ddc0f121..6ef8127a5 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -60,6 +60,7 @@ typedef struct {
#define GOLDEN_FRAME 2
#define ALTREF_FRAME 3
#define MAX_REF_FRAMES 4
+#define MAX_INTER_REF_FRAMES 3
typedef int8_t MV_REFERENCE_FRAME;
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 39d47106f..d66e30024 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -6283,7 +6283,7 @@ static void mode_estimation(VP9_COMP *cpi, MACROBLOCK *x, MACROBLOCKD *xd,
set_mv_limits(cm, x, mi_row, mi_col);
- for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
+ for (rf_idx = 0; rf_idx < MAX_INTER_REF_FRAMES; ++rf_idx) {
int_mv mv;
if (ref_frame[rf_idx] == NULL) continue;
@@ -6836,9 +6836,9 @@ static void add_nb_blocks_to_heap(VP9_COMP *cpi, const TplDepFrame *tpl_frame,
#endif // USE_PQSORT
#endif // CHANGE_MV_SEARCH_ORDER
-static void build_motion_field(VP9_COMP *cpi, MACROBLOCKD *xd, int frame_idx,
- YV12_BUFFER_CONFIG *ref_frame[3],
- BLOCK_SIZE bsize) {
+static void build_motion_field(
+ VP9_COMP *cpi, MACROBLOCKD *xd, int frame_idx,
+ YV12_BUFFER_CONFIG *ref_frame[MAX_INTER_REF_FRAMES], BLOCK_SIZE bsize) {
VP9_COMMON *cm = &cpi->common;
ThreadData *td = &cpi->td;
TplDepFrame *tpl_frame = &cpi->tpl_stats[frame_idx];
@@ -6879,7 +6879,7 @@ static void build_motion_field(VP9_COMP *cpi, MACROBLOCKD *xd, int frame_idx,
qsort(cpi->feature_score_loc_sort, fs_loc_sort_size,
sizeof(*cpi->feature_score_loc_sort), compare_feature_score);
- for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
+ for (rf_idx = 0; rf_idx < MAX_INTER_REF_FRAMES; ++rf_idx) {
for (mi_row = 0; mi_row < cm->mi_rows; mi_row += mi_height) {
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += mi_width) {
TplDepStats *tpl_stats =
@@ -6890,7 +6890,7 @@ static void build_motion_field(VP9_COMP *cpi, MACROBLOCKD *xd, int frame_idx,
}
// TODO(angiebird): Clean up this part.
- for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
+ for (rf_idx = 0; rf_idx < MAX_INTER_REF_FRAMES; ++rf_idx) {
int i;
if (ref_frame[rf_idx] == NULL) {
continue;
@@ -6938,7 +6938,7 @@ static void mc_flow_dispenser(VP9_COMP *cpi, GF_PICTURE *gf_picture,
int frame_idx, BLOCK_SIZE bsize) {
TplDepFrame *tpl_frame = &cpi->tpl_stats[frame_idx];
YV12_BUFFER_CONFIG *this_frame = gf_picture[frame_idx].frame;
- YV12_BUFFER_CONFIG *ref_frame[3] = { NULL, NULL, NULL };
+ YV12_BUFFER_CONFIG *ref_frame[MAX_INTER_REF_FRAMES] = { NULL, NULL, NULL };
VP9_COMMON *cm = &cpi->common;
struct scale_factors sf;
@@ -6988,7 +6988,7 @@ static void mc_flow_dispenser(VP9_COMP *cpi, GF_PICTURE *gf_picture,
// Prepare reference frame pointers. If any reference frame slot is
// unavailable, the pointer will be set to Null.
- for (idx = 0; idx < 3; ++idx) {
+ for (idx = 0; idx < MAX_INTER_REF_FRAMES; ++idx) {
int rf_idx = gf_picture[frame_idx].ref_frame[idx];
if (rf_idx != -1) ref_frame[idx] = gf_picture[rf_idx].frame;
}
@@ -7013,7 +7013,7 @@ static void mc_flow_dispenser(VP9_COMP *cpi, GF_PICTURE *gf_picture,
BLOCK_SIZE square_bsize = square_block_idx_to_bsize(square_block_idx);
build_motion_field(cpi, xd, frame_idx, ref_frame, square_bsize);
}
- for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
+ for (rf_idx = 0; rf_idx < MAX_INTER_REF_FRAMES; ++rf_idx) {
int ref_frame_idx = gf_picture[frame_idx].ref_frame[rf_idx];
if (ref_frame_idx != -1) {
predict_mv_mode_arr(cpi, x, gf_picture, frame_idx, tpl_frame, rf_idx,
@@ -7067,7 +7067,7 @@ static void dump_tpl_stats(const VP9_COMP *cpi, int tpl_group_frames,
const VP9_COMMON *cm = &cpi->common;
int rf_idx;
for (frame_idx = 1; frame_idx < tpl_group_frames; ++frame_idx) {
- for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
+ for (rf_idx = 0; rf_idx < MAX_INTER_REF_FRAMES; ++rf_idx) {
const TplDepFrame *tpl_frame = &cpi->tpl_stats[frame_idx];
int mi_row, mi_col;
int ref_frame_idx;
@@ -7169,7 +7169,7 @@ static void init_tpl_buffer(VP9_COMP *cpi) {
continue;
#if CONFIG_NON_GREEDY_MV
- for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
+ for (rf_idx = 0; rf_idx < MAX_INTER_REF_FRAMES; ++rf_idx) {
for (sqr_bsize = 0; sqr_bsize < SQUARE_BLOCK_SIZES; ++sqr_bsize) {
vpx_free(cpi->tpl_stats[frame].pyramid_mv_arr[rf_idx][sqr_bsize]);
CHECK_MEM_ERROR(
@@ -7221,7 +7221,7 @@ static void free_tpl_buffer(VP9_COMP *cpi) {
for (frame = 0; frame < MAX_ARF_GOP_SIZE; ++frame) {
#if CONFIG_NON_GREEDY_MV
int rf_idx;
- for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
+ for (rf_idx = 0; rf_idx < MAX_INTER_REF_FRAMES; ++rf_idx) {
int sqr_bsize;
for (sqr_bsize = 0; sqr_bsize < SQUARE_BLOCK_SIZES; ++sqr_bsize) {
vpx_free(cpi->tpl_stats[frame].pyramid_mv_arr[rf_idx][sqr_bsize]);
diff --git a/vp9/encoder/vp9_non_greedy_mv.c b/vp9/encoder/vp9_non_greedy_mv.c
index 02a954eec..4ea06316d 100644
--- a/vp9/encoder/vp9_non_greedy_mv.c
+++ b/vp9/encoder/vp9_non_greedy_mv.c
@@ -179,7 +179,7 @@ Status vp9_alloc_motion_field_info(MotionFieldInfo *motion_field_info,
motion_field_info->motion_field_array =
vpx_calloc(frame_num, sizeof(*motion_field_info->motion_field_array));
for (frame_idx = 0; frame_idx < frame_num; ++frame_idx) {
- for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
+ for (rf_idx = 0; rf_idx < MAX_INTER_REF_FRAMES; ++rf_idx) {
for (square_block_idx = 0; square_block_idx < SQUARE_BLOCK_SIZES;
++square_block_idx) {
BLOCK_SIZE bsize = square_block_idx_to_bsize(square_block_idx);
@@ -235,7 +235,7 @@ void vp9_free_motion_field_info(MotionFieldInfo *motion_field_info) {
if (motion_field_info->allocated) {
int frame_idx, rf_idx, square_block_idx;
for (frame_idx = 0; frame_idx < motion_field_info->frame_num; ++frame_idx) {
- for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
+ for (rf_idx = 0; rf_idx < MAX_INTER_REF_FRAMES; ++rf_idx) {
for (square_block_idx = 0; square_block_idx < SQUARE_BLOCK_SIZES;
++square_block_idx) {
MotionField *motion_field =
diff --git a/vp9/encoder/vp9_non_greedy_mv.h b/vp9/encoder/vp9_non_greedy_mv.h
index a3f111894..f095ddf41 100644
--- a/vp9/encoder/vp9_non_greedy_mv.h
+++ b/vp9/encoder/vp9_non_greedy_mv.h
@@ -39,7 +39,7 @@ typedef struct MotionField {
typedef struct MotionFieldInfo {
int frame_num;
int allocated;
- MotionField (*motion_field_array)[3][SQUARE_BLOCK_SIZES];
+ MotionField (*motion_field_array)[MAX_INTER_REF_FRAMES][SQUARE_BLOCK_SIZES];
} MotionFieldInfo;
typedef struct {