#include "vp9/common/vp9_pred_common.h"
#include "vp9/common/vp9_seg_common.h"
+int vp9_compound_reference_allowed(const VP9_COMMON *cm) {
+ int i;
+ for (i = 1; i < REFS_PER_FRAME; ++i)
+ if (cm->ref_frame_sign_bias[i + 1] != cm->ref_frame_sign_bias[1]) return 1;
+
+ return 0;
+}
+
void vp9_setup_compound_reference_mode(VP9_COMMON *cm) {
if (cm->ref_frame_sign_bias[LAST_FRAME] ==
cm->ref_frame_sign_bias[GOLDEN_FRAME]) {
return cm->fc->single_ref_prob[vp9_get_pred_context_single_ref_p2(xd)][1];
}
+int vp9_compound_reference_allowed(const VP9_COMMON *cm);
+
void vp9_setup_compound_reference_mode(VP9_COMMON *cm);
// Returns a context number for the given MB prediction signal
#define MAX_VP9_HEADER_SIZE 80
-static int is_compound_reference_allowed(const VP9_COMMON *cm) {
- int i;
- for (i = 1; i < REFS_PER_FRAME; ++i)
- if (cm->ref_frame_sign_bias[i + 1] != cm->ref_frame_sign_bias[1]) return 1;
-
- return 0;
-}
-
static int read_is_valid(const uint8_t *start, size_t len, const uint8_t *end) {
return len != 0 && len <= (size_t)(end - start);
}
static REFERENCE_MODE read_frame_reference_mode(const VP9_COMMON *cm,
vpx_reader *r) {
- if (is_compound_reference_allowed(cm)) {
+ if (vp9_compound_reference_allowed(cm)) {
return vpx_read_bit(r)
? (vpx_read_bit(r) ? REFERENCE_MODE_SELECT : COMPOUND_REFERENCE)
: SINGLE_REFERENCE;
// side behavior is where the ALT ref buffer has opposite sign bias to
// the other two.
if (!frame_is_intra_only(cm)) {
- if ((cm->ref_frame_sign_bias[ALTREF_FRAME] ==
- cm->ref_frame_sign_bias[GOLDEN_FRAME]) ||
- (cm->ref_frame_sign_bias[ALTREF_FRAME] ==
- cm->ref_frame_sign_bias[LAST_FRAME])) {
- cpi->allow_comp_inter_inter = 0;
- } else {
+ if (vp9_compound_reference_allowed(cm)) {
cpi->allow_comp_inter_inter = 1;
vp9_setup_compound_reference_mode(cm);
+ } else {
+ cpi->allow_comp_inter_inter = 0;
}
}