+pub const DEF_WEIGHT_INFO: WeightInfo = WeightInfo {
+ luma_weighted: false,
+ luma_weight: 0,
+ luma_offset: 0,
+ luma_shift: 0,
+ chroma_weighted: false,
+ chroma_weight: [0; 2],
+ chroma_offset: [0; 2],
+ chroma_shift: 0,
+};
+
+impl SliceHeader {
+ pub fn get_weight(&self, list_id: u8, idx: usize) -> WeightInfo {
+ if list_id == 0 {
+ if idx < self.num_ref_idx_l0_active {
+ self.weights_l0[idx]
+ } else {
+ DEF_WEIGHT_INFO
+ }
+ } else {
+ if idx < self.num_ref_idx_l1_active {
+ self.weights_l1[idx]
+ } else {
+ DEF_WEIGHT_INFO
+ }
+ }
+ }
+}
+