Commit 21d8e859 authored by Dmitry Kovalev's avatar Dmitry Kovalev

Cleanup in mvref_common.{h, c}.

Making code more compact, adding consts, removing redundant arguments,
adding do/while(0) for macros.

Change-Id: Ic9ec0bc58cee0910a5450b7fb8cfbf35fa9d0d16
parent 1c159c47
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include <limits.h>
#include "vp9/common/vp9_findnearmv.h" #include "vp9/common/vp9_findnearmv.h"
#include "vp9/common/vp9_mvref_common.h" #include "vp9/common/vp9_mvref_common.h"
...@@ -45,17 +43,14 @@ void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd, ...@@ -45,17 +43,14 @@ void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col) { int mi_row, int mi_col) {
int_mv dst_list[MAX_MV_REF_CANDIDATES]; int_mv dst_list[MAX_MV_REF_CANDIDATES];
int_mv mv_list[MAX_MV_REF_CANDIDATES]; int_mv mv_list[MAX_MV_REF_CANDIDATES];
MODE_INFO *mi = xd->mode_info_context; MODE_INFO *const mi = xd->mode_info_context;
MB_MODE_INFO *const mbmi = &mi->mbmi;
assert(ref_idx == 0 || ref_idx == 1); assert(ref_idx == 0 || ref_idx == 1);
assert(MAX_MV_REF_CANDIDATES == 2); // makes code here slightly easier assert(MAX_MV_REF_CANDIDATES == 2); // makes code here slightly easier
vp9_find_mv_refs_idx(cm, xd, xd->mode_info_context, vp9_find_mv_refs_idx(cm, xd, mi, xd->prev_mode_info_context,
xd->prev_mode_info_context, mi->mbmi.ref_frame[ref_idx],
mbmi->ref_frame[ref_idx], mv_list, block_idx, mi_row, mi_col);
mv_list, cm->ref_frame_sign_bias, block_idx,
mi_row, mi_col);
dst_list[1].as_int = 0; dst_list[1].as_int = 0;
if (block_idx == 0) { if (block_idx == 0) {
......
This diff is collapsed.
...@@ -14,27 +14,20 @@ ...@@ -14,27 +14,20 @@
#ifndef VP9_COMMON_VP9_MVREF_COMMON_H_ #ifndef VP9_COMMON_VP9_MVREF_COMMON_H_
#define VP9_COMMON_VP9_MVREF_COMMON_H_ #define VP9_COMMON_VP9_MVREF_COMMON_H_
void vp9_find_mv_refs_idx(VP9_COMMON *cm, void vp9_find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
MACROBLOCKD *xd, MODE_INFO *mi, const MODE_INFO *prev_mi,
MODE_INFO *here, MV_REFERENCE_FRAME ref_frame,
const MODE_INFO *lf_here,
const MV_REFERENCE_FRAME ref_frame,
int_mv *mv_ref_list, int_mv *mv_ref_list,
const int *ref_sign_bias, int block_idx,
const int block_idx, int mi_row, int mi_col);
const int mi_row,
const int mi_col);
static INLINE void vp9_find_mv_refs(VP9_COMMON *cm, static INLINE void vp9_find_mv_refs(const VP9_COMMON *cm, const MACROBLOCKD *xd,
MACROBLOCKD *xd, MODE_INFO *mi, const MODE_INFO *prev_mi,
MODE_INFO *here,
MODE_INFO *lf_here,
MV_REFERENCE_FRAME ref_frame, MV_REFERENCE_FRAME ref_frame,
int_mv *mv_ref_list, int_mv *mv_ref_list,
int *ref_sign_bias,
int mi_row, int mi_col) { int mi_row, int mi_col) {
vp9_find_mv_refs_idx(cm, xd, here, lf_here, ref_frame, vp9_find_mv_refs_idx(cm, xd, mi, prev_mi, ref_frame,
mv_ref_list, ref_sign_bias, -1, mi_row, mi_col); mv_ref_list, -1, mi_row, mi_col);
} }
#endif // VP9_COMMON_VP9_MVREF_COMMON_H_ #endif // VP9_COMMON_VP9_MVREF_COMMON_H_
...@@ -454,8 +454,7 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi, ...@@ -454,8 +454,7 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
is_compound = ref1 > INTRA_FRAME; is_compound = ref1 > INTRA_FRAME;
vp9_find_mv_refs(cm, xd, mi, xd->prev_mode_info_context, vp9_find_mv_refs(cm, xd, mi, xd->prev_mode_info_context,
ref0, mbmi->ref_mvs[ref0], cm->ref_frame_sign_bias, ref0, mbmi->ref_mvs[ref0], mi_row, mi_col);
mi_row, mi_col);
inter_mode_ctx = mbmi->mode_context[ref0]; inter_mode_ctx = mbmi->mode_context[ref0];
...@@ -478,8 +477,7 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi, ...@@ -478,8 +477,7 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
if (is_compound) { if (is_compound) {
vp9_find_mv_refs(cm, xd, mi, xd->prev_mode_info_context, vp9_find_mv_refs(cm, xd, mi, xd->prev_mode_info_context,
ref1, mbmi->ref_mvs[ref1], cm->ref_frame_sign_bias, ref1, mbmi->ref_mvs[ref1], mi_row, mi_col);
mi_row, mi_col);
if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) { if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
vp9_find_best_ref_mvs(xd, mbmi->ref_mvs[ref1], vp9_find_best_ref_mvs(xd, mbmi->ref_mvs[ref1],
......
...@@ -2273,8 +2273,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x, ...@@ -2273,8 +2273,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
vp9_find_mv_refs(&cpi->common, xd, xd->mode_info_context, vp9_find_mv_refs(&cpi->common, xd, xd->mode_info_context,
xd->prev_mode_info_context, xd->prev_mode_info_context,
frame_type, frame_type,
mbmi->ref_mvs[frame_type], mbmi->ref_mvs[frame_type], mi_row, mi_col);
cpi->common.ref_frame_sign_bias, mi_row, mi_col);
// Candidate refinement carried out at encoder and decoder // Candidate refinement carried out at encoder and decoder
vp9_find_best_ref_mvs(xd, vp9_find_best_ref_mvs(xd,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment