/* * Copyright (c) 2016, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent. */ #include "av1/common/common.h" #include "av1/common/pred_common.h" #include "av1/common/reconinter.h" #include "av1/common/reconintra.h" #include "av1/common/seg_common.h" // Returns a context number for the given MB prediction signal static InterpFilter get_ref_filter_type(const MB_MODE_INFO *ref_mbmi, const MACROBLOCKD *xd, int dir, MV_REFERENCE_FRAME ref_frame) { … } int av1_get_pred_context_switchable_interp(const MACROBLOCKD *xd, int dir) { … } static void palette_add_to_cache(uint16_t *cache, int *n, uint16_t val) { … } int av1_get_palette_cache(const MACROBLOCKD *const xd, int plane, uint16_t *cache) { … } // The mode info data structure has a one element border above and to the // left of the entries corresponding to real macroblocks. // The prediction flags in these dummy entries are initialized to 0. // 0 - inter/inter, inter/--, --/inter, --/-- // 1 - intra/inter, inter/intra // 2 - intra/--, --/intra // 3 - intra/intra int av1_get_intra_inter_context(const MACROBLOCKD *xd) { … } #define CHECK_BACKWARD_REFS(ref_frame) … #define IS_BACKWARD_REF_FRAME(ref_frame) … int av1_get_reference_mode_context(const MACROBLOCKD *xd) { … } int av1_get_comp_reference_type_context(const MACROBLOCKD *xd) { … } // Returns a context number for the given MB prediction signal // // Signal the uni-directional compound reference frame pair as either // (BWDREF, ALTREF), or (LAST, LAST2) / (LAST, LAST3) / (LAST, GOLDEN), // conditioning on the pair is known as uni-directional. // // 3 contexts: Voting is used to compare the count of forward references with // that of backward references from the spatial neighbors. int av1_get_pred_context_uni_comp_ref_p(const MACROBLOCKD *xd) { … } // Returns a context number for the given MB prediction signal // // Signal the uni-directional compound reference frame pair as // either (LAST, LAST2), or (LAST, LAST3) / (LAST, GOLDEN), // conditioning on the pair is known as one of the above three. // // 3 contexts: Voting is used to compare the count of LAST2_FRAME with the // total count of LAST3/GOLDEN from the spatial neighbors. int av1_get_pred_context_uni_comp_ref_p1(const MACROBLOCKD *xd) { … } // Returns a context number for the given MB prediction signal // // Signal the uni-directional compound reference frame pair as // either (LAST, LAST3) or (LAST, GOLDEN), // conditioning on the pair is known as one of the above two. // // 3 contexts: Voting is used to compare the count of LAST3_FRAME with the // total count of GOLDEN_FRAME from the spatial neighbors. int av1_get_pred_context_uni_comp_ref_p2(const MACROBLOCKD *xd) { … } // == Common context functions for both comp and single ref == // // Obtain contexts to signal a reference frame to be either LAST/LAST2 or // LAST3/GOLDEN. static int get_pred_context_ll2_or_l3gld(const MACROBLOCKD *xd) { … } // Obtain contexts to signal a reference frame to be either LAST or LAST2. static int get_pred_context_last_or_last2(const MACROBLOCKD *xd) { … } // Obtain contexts to signal a reference frame to be either LAST3 or GOLDEN. static int get_pred_context_last3_or_gld(const MACROBLOCKD *xd) { … } // Obtain contexts to signal a reference frame be either BWDREF/ALTREF2, or // ALTREF. static int get_pred_context_brfarf2_or_arf(const MACROBLOCKD *xd) { … } // Obtain contexts to signal a reference frame be either BWDREF or ALTREF2. static int get_pred_context_brf_or_arf2(const MACROBLOCKD *xd) { … } // == Context functions for comp ref == // // Returns a context number for the given MB prediction signal // Signal the first reference frame for a compound mode be either // GOLDEN/LAST3, or LAST/LAST2. int av1_get_pred_context_comp_ref_p(const MACROBLOCKD *xd) { … } // Returns a context number for the given MB prediction signal // Signal the first reference frame for a compound mode be LAST, // conditioning on that it is known either LAST/LAST2. int av1_get_pred_context_comp_ref_p1(const MACROBLOCKD *xd) { … } // Returns a context number for the given MB prediction signal // Signal the first reference frame for a compound mode be GOLDEN, // conditioning on that it is known either GOLDEN or LAST3. int av1_get_pred_context_comp_ref_p2(const MACROBLOCKD *xd) { … } // Signal the 2nd reference frame for a compound mode be either // ALTREF, or ALTREF2/BWDREF. int av1_get_pred_context_comp_bwdref_p(const MACROBLOCKD *xd) { … } // Signal the 2nd reference frame for a compound mode be either // ALTREF2 or BWDREF. int av1_get_pred_context_comp_bwdref_p1(const MACROBLOCKD *xd) { … } // == Context functions for single ref == // // For the bit to signal whether the single reference is a forward reference // frame or a backward reference frame. int av1_get_pred_context_single_ref_p1(const MACROBLOCKD *xd) { … } // For the bit to signal whether the single reference is ALTREF_FRAME or // non-ALTREF backward reference frame, knowing that it shall be either of // these 2 choices. int av1_get_pred_context_single_ref_p2(const MACROBLOCKD *xd) { … } // For the bit to signal whether the single reference is LAST3/GOLDEN or // LAST2/LAST, knowing that it shall be either of these 2 choices. int av1_get_pred_context_single_ref_p3(const MACROBLOCKD *xd) { … } // For the bit to signal whether the single reference is LAST2_FRAME or // LAST_FRAME, knowing that it shall be either of these 2 choices. int av1_get_pred_context_single_ref_p4(const MACROBLOCKD *xd) { … } // For the bit to signal whether the single reference is GOLDEN_FRAME or // LAST3_FRAME, knowing that it shall be either of these 2 choices. int av1_get_pred_context_single_ref_p5(const MACROBLOCKD *xd) { … } // For the bit to signal whether the single reference is ALTREF2_FRAME or // BWDREF_FRAME, knowing that it shall be either of these 2 choices. int av1_get_pred_context_single_ref_p6(const MACROBLOCKD *xd) { … }