| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 | 11 |
| 12 #include <limits.h> | 12 #include <limits.h> |
| 13 #include "vpx_mem/vpx_mem.h" | 13 #include "vpx_mem/vpx_mem.h" |
| 14 #include "vp9/encoder/vp9_segmentation.h" | 14 #include "vp9/encoder/vp9_segmentation.h" |
| 15 #include "vp9/common/vp9_pred_common.h" | 15 #include "vp9/common/vp9_pred_common.h" |
| 16 #include "vp9/common/vp9_tile_common.h" | 16 #include "vp9/common/vp9_tile_common.h" |
| 17 | 17 |
| 18 void vp9_enable_segmentation(VP9_PTR ptr) { | 18 void vp9_enable_segmentation(VP9_PTR ptr) { |
| 19 VP9_COMP *cpi = (VP9_COMP *)ptr; | 19 VP9_COMP *cpi = (VP9_COMP *)ptr; |
| 20 struct segmentation *const seg = &cpi->common.seg; |
| 20 | 21 |
| 21 cpi->mb.e_mbd.seg.enabled = 1; | 22 seg->enabled = 1; |
| 22 cpi->mb.e_mbd.seg.update_map = 1; | 23 seg->update_map = 1; |
| 23 cpi->mb.e_mbd.seg.update_data = 1; | 24 seg->update_data = 1; |
| 24 } | 25 } |
| 25 | 26 |
| 26 void vp9_disable_segmentation(VP9_PTR ptr) { | 27 void vp9_disable_segmentation(VP9_PTR ptr) { |
| 27 VP9_COMP *cpi = (VP9_COMP *)ptr; | 28 VP9_COMP *cpi = (VP9_COMP *)ptr; |
| 28 cpi->mb.e_mbd.seg.enabled = 0; | 29 struct segmentation *const seg = &cpi->common.seg; |
| 30 seg->enabled = 0; |
| 29 } | 31 } |
| 30 | 32 |
| 31 void vp9_set_segmentation_map(VP9_PTR ptr, | 33 void vp9_set_segmentation_map(VP9_PTR ptr, |
| 32 unsigned char *segmentation_map) { | 34 unsigned char *segmentation_map) { |
| 33 VP9_COMP *cpi = (VP9_COMP *)(ptr); | 35 VP9_COMP *cpi = (VP9_COMP *)ptr; |
| 36 struct segmentation *const seg = &cpi->common.seg; |
| 34 | 37 |
| 35 // Copy in the new segmentation map | 38 // Copy in the new segmentation map |
| 36 vpx_memcpy(cpi->segmentation_map, segmentation_map, | 39 vpx_memcpy(cpi->segmentation_map, segmentation_map, |
| 37 (cpi->common.mi_rows * cpi->common.mi_cols)); | 40 (cpi->common.mi_rows * cpi->common.mi_cols)); |
| 38 | 41 |
| 39 // Signal that the map should be updated. | 42 // Signal that the map should be updated. |
| 40 cpi->mb.e_mbd.seg.update_map = 1; | 43 seg->update_map = 1; |
| 41 cpi->mb.e_mbd.seg.update_data = 1; | 44 seg->update_data = 1; |
| 42 } | 45 } |
| 43 | 46 |
| 44 void vp9_set_segment_data(VP9_PTR ptr, | 47 void vp9_set_segment_data(VP9_PTR ptr, |
| 45 signed char *feature_data, | 48 signed char *feature_data, |
| 46 unsigned char abs_delta) { | 49 unsigned char abs_delta) { |
| 47 VP9_COMP *cpi = (VP9_COMP *)(ptr); | 50 VP9_COMP *cpi = (VP9_COMP *)ptr; |
| 51 struct segmentation *const seg = &cpi->common.seg; |
| 48 | 52 |
| 49 cpi->mb.e_mbd.seg.abs_delta = abs_delta; | 53 seg->abs_delta = abs_delta; |
| 50 | 54 |
| 51 vpx_memcpy(cpi->mb.e_mbd.seg.feature_data, feature_data, | 55 vpx_memcpy(seg->feature_data, feature_data, sizeof(seg->feature_data)); |
| 52 sizeof(cpi->mb.e_mbd.seg.feature_data)); | |
| 53 | 56 |
| 54 // TBD ?? Set the feature mask | 57 // TBD ?? Set the feature mask |
| 55 // vpx_memcpy(cpi->mb.e_mbd.segment_feature_mask, 0, | 58 // vpx_memcpy(cpi->mb.e_mbd.segment_feature_mask, 0, |
| 56 // sizeof(cpi->mb.e_mbd.segment_feature_mask)); | 59 // sizeof(cpi->mb.e_mbd.segment_feature_mask)); |
| 57 } | 60 } |
| 58 | 61 |
| 59 // Based on set of segment counts calculate a probability tree | 62 // Based on set of segment counts calculate a probability tree |
| 60 static void calc_segtree_probs(MACROBLOCKD *xd, int *segcounts, | 63 static void calc_segtree_probs(int *segcounts, vp9_prob *segment_tree_probs) { |
| 61 vp9_prob *segment_tree_probs) { | |
| 62 // Work out probabilities of each segment | 64 // Work out probabilities of each segment |
| 63 const int c01 = segcounts[0] + segcounts[1]; | 65 const int c01 = segcounts[0] + segcounts[1]; |
| 64 const int c23 = segcounts[2] + segcounts[3]; | 66 const int c23 = segcounts[2] + segcounts[3]; |
| 65 const int c45 = segcounts[4] + segcounts[5]; | 67 const int c45 = segcounts[4] + segcounts[5]; |
| 66 const int c67 = segcounts[6] + segcounts[7]; | 68 const int c67 = segcounts[6] + segcounts[7]; |
| 67 | 69 |
| 68 segment_tree_probs[0] = get_binary_prob(c01 + c23, c45 + c67); | 70 segment_tree_probs[0] = get_binary_prob(c01 + c23, c45 + c67); |
| 69 segment_tree_probs[1] = get_binary_prob(c01, c23); | 71 segment_tree_probs[1] = get_binary_prob(c01, c23); |
| 70 segment_tree_probs[2] = get_binary_prob(c45, c67); | 72 segment_tree_probs[2] = get_binary_prob(c45, c67); |
| 71 segment_tree_probs[3] = get_binary_prob(segcounts[0], segcounts[1]); | 73 segment_tree_probs[3] = get_binary_prob(segcounts[0], segcounts[1]); |
| 72 segment_tree_probs[4] = get_binary_prob(segcounts[2], segcounts[3]); | 74 segment_tree_probs[4] = get_binary_prob(segcounts[2], segcounts[3]); |
| 73 segment_tree_probs[5] = get_binary_prob(segcounts[4], segcounts[5]); | 75 segment_tree_probs[5] = get_binary_prob(segcounts[4], segcounts[5]); |
| 74 segment_tree_probs[6] = get_binary_prob(segcounts[6], segcounts[7]); | 76 segment_tree_probs[6] = get_binary_prob(segcounts[6], segcounts[7]); |
| 75 } | 77 } |
| 76 | 78 |
| 77 // Based on set of segment counts and probabilities calculate a cost estimate | 79 // Based on set of segment counts and probabilities calculate a cost estimate |
| 78 static int cost_segmap(MACROBLOCKD *xd, int *segcounts, vp9_prob *probs) { | 80 static int cost_segmap(int *segcounts, vp9_prob *probs) { |
| 79 const int c01 = segcounts[0] + segcounts[1]; | 81 const int c01 = segcounts[0] + segcounts[1]; |
| 80 const int c23 = segcounts[2] + segcounts[3]; | 82 const int c23 = segcounts[2] + segcounts[3]; |
| 81 const int c45 = segcounts[4] + segcounts[5]; | 83 const int c45 = segcounts[4] + segcounts[5]; |
| 82 const int c67 = segcounts[6] + segcounts[7]; | 84 const int c67 = segcounts[6] + segcounts[7]; |
| 83 const int c0123 = c01 + c23; | 85 const int c0123 = c01 + c23; |
| 84 const int c4567 = c45 + c67; | 86 const int c4567 = c45 + c67; |
| 85 | 87 |
| 86 // Cost the top node of the tree | 88 // Cost the top node of the tree |
| 87 int cost = c0123 * vp9_cost_zero(probs[0]) + | 89 int cost = c0123 * vp9_cost_zero(probs[0]) + |
| 88 c4567 * vp9_cost_one(probs[0]); | 90 c4567 * vp9_cost_one(probs[0]); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 131 |
| 130 segment_id = mi->mbmi.segment_id; | 132 segment_id = mi->mbmi.segment_id; |
| 131 xd->mode_info_context = mi; | 133 xd->mode_info_context = mi; |
| 132 set_mi_row_col(cm, xd, mi_row, bh, mi_col, bw); | 134 set_mi_row_col(cm, xd, mi_row, bh, mi_col, bw); |
| 133 | 135 |
| 134 // Count the number of hits on each segment with no prediction | 136 // Count the number of hits on each segment with no prediction |
| 135 no_pred_segcounts[segment_id]++; | 137 no_pred_segcounts[segment_id]++; |
| 136 | 138 |
| 137 // Temporal prediction not allowed on key frames | 139 // Temporal prediction not allowed on key frames |
| 138 if (cm->frame_type != KEY_FRAME) { | 140 if (cm->frame_type != KEY_FRAME) { |
| 139 const BLOCK_SIZE_TYPE bsize = mi->mbmi.sb_type; | 141 const BLOCK_SIZE bsize = mi->mbmi.sb_type; |
| 140 // Test to see if the segment id matches the predicted value. | 142 // Test to see if the segment id matches the predicted value. |
| 141 const int pred_segment_id = vp9_get_segment_id(cm, cm->last_frame_seg_map, | 143 const int pred_segment_id = vp9_get_segment_id(cm, cm->last_frame_seg_map, |
| 142 bsize, mi_row, mi_col); | 144 bsize, mi_row, mi_col); |
| 143 const int pred_flag = pred_segment_id == segment_id; | 145 const int pred_flag = pred_segment_id == segment_id; |
| 144 const int pred_context = vp9_get_pred_context_seg_id(xd); | 146 const int pred_context = vp9_get_pred_context_seg_id(xd); |
| 145 | 147 |
| 146 // Store the prediction status for this mb and update counts | 148 // Store the prediction status for this mb and update counts |
| 147 // as appropriate | 149 // as appropriate |
| 148 vp9_set_pred_flag_seg_id(cm, bsize, mi_row, mi_col, pred_flag); | 150 vp9_set_pred_flag_seg_id(cm, bsize, mi_row, mi_col, pred_flag); |
| 149 temporal_predictor_count[pred_context][pred_flag]++; | 151 temporal_predictor_count[pred_context][pred_flag]++; |
| 150 | 152 |
| 151 if (!pred_flag) | 153 if (!pred_flag) |
| 152 // Update the "unpredicted" segment count | 154 // Update the "unpredicted" segment count |
| 153 t_unpred_seg_counts[segment_id]++; | 155 t_unpred_seg_counts[segment_id]++; |
| 154 } | 156 } |
| 155 } | 157 } |
| 156 | 158 |
| 157 static void count_segs_sb(VP9_COMP *cpi, MODE_INFO *mi, | 159 static void count_segs_sb(VP9_COMP *cpi, MODE_INFO *mi, |
| 158 int *no_pred_segcounts, | 160 int *no_pred_segcounts, |
| 159 int (*temporal_predictor_count)[2], | 161 int (*temporal_predictor_count)[2], |
| 160 int *t_unpred_seg_counts, | 162 int *t_unpred_seg_counts, |
| 161 int mi_row, int mi_col, | 163 int mi_row, int mi_col, |
| 162 BLOCK_SIZE_TYPE bsize) { | 164 BLOCK_SIZE bsize) { |
| 163 VP9_COMMON *const cm = &cpi->common; | 165 const VP9_COMMON *const cm = &cpi->common; |
| 164 const int mis = cm->mode_info_stride; | 166 const int mis = cm->mode_info_stride; |
| 165 int bwl, bhl; | 167 int bw, bh; |
| 166 const int bsl = mi_width_log2(bsize), bs = 1 << (bsl - 1); | 168 const int bs = num_8x8_blocks_wide_lookup[bsize], hbs = bs / 2; |
| 167 | 169 |
| 168 if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) | 170 if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) |
| 169 return; | 171 return; |
| 170 | 172 |
| 171 bwl = mi_width_log2(mi->mbmi.sb_type); | 173 bw = num_8x8_blocks_wide_lookup[mi->mbmi.sb_type]; |
| 172 bhl = mi_height_log2(mi->mbmi.sb_type); | 174 bh = num_8x8_blocks_high_lookup[mi->mbmi.sb_type]; |
| 173 | 175 |
| 174 if (bwl == bsl && bhl == bsl) { | 176 if (bw == bs && bh == bs) { |
| 175 count_segs(cpi, mi, no_pred_segcounts, temporal_predictor_count, | 177 count_segs(cpi, mi, no_pred_segcounts, temporal_predictor_count, |
| 176 t_unpred_seg_counts, 1 << bsl, 1 << bsl, mi_row, mi_col); | 178 t_unpred_seg_counts, bs, bs, mi_row, mi_col); |
| 177 } else if (bwl == bsl && bhl < bsl) { | 179 } else if (bw == bs && bh < bs) { |
| 178 count_segs(cpi, mi, no_pred_segcounts, temporal_predictor_count, | 180 count_segs(cpi, mi, no_pred_segcounts, temporal_predictor_count, |
| 179 t_unpred_seg_counts, 1 << bsl, bs, mi_row, mi_col); | 181 t_unpred_seg_counts, bs, hbs, mi_row, mi_col); |
| 180 count_segs(cpi, mi + bs * mis, no_pred_segcounts, temporal_predictor_count, | 182 count_segs(cpi, mi + hbs * mis, no_pred_segcounts, temporal_predictor_count, |
| 181 t_unpred_seg_counts, 1 << bsl, bs, mi_row + bs, mi_col); | 183 t_unpred_seg_counts, bs, hbs, mi_row + hbs, mi_col); |
| 182 } else if (bwl < bsl && bhl == bsl) { | 184 } else if (bw < bs && bh == bs) { |
| 183 count_segs(cpi, mi, no_pred_segcounts, temporal_predictor_count, | 185 count_segs(cpi, mi, no_pred_segcounts, temporal_predictor_count, |
| 184 t_unpred_seg_counts, bs, 1 << bsl, mi_row, mi_col); | 186 t_unpred_seg_counts, hbs, bs, mi_row, mi_col); |
| 185 count_segs(cpi, mi + bs, no_pred_segcounts, temporal_predictor_count, | 187 count_segs(cpi, mi + hbs, no_pred_segcounts, temporal_predictor_count, |
| 186 t_unpred_seg_counts, bs, 1 << bsl, mi_row, mi_col + bs); | 188 t_unpred_seg_counts, hbs, bs, mi_row, mi_col + hbs); |
| 187 } else { | 189 } else { |
| 188 BLOCK_SIZE_TYPE subsize; | 190 const BLOCK_SIZE subsize = subsize_lookup[PARTITION_SPLIT][bsize]; |
| 189 int n; | 191 int n; |
| 190 | 192 |
| 191 assert(bwl < bsl && bhl < bsl); | 193 assert(bw < bs && bh < bs); |
| 192 if (bsize == BLOCK_SIZE_SB64X64) { | |
| 193 subsize = BLOCK_SIZE_SB32X32; | |
| 194 } else if (bsize == BLOCK_SIZE_SB32X32) { | |
| 195 subsize = BLOCK_SIZE_MB16X16; | |
| 196 } else { | |
| 197 assert(bsize == BLOCK_SIZE_MB16X16); | |
| 198 subsize = BLOCK_SIZE_SB8X8; | |
| 199 } | |
| 200 | 194 |
| 201 for (n = 0; n < 4; n++) { | 195 for (n = 0; n < 4; n++) { |
| 202 const int y_idx = n >> 1, x_idx = n & 0x01; | 196 const int mi_dc = hbs * (n & 1); |
| 197 const int mi_dr = hbs * (n >> 1); |
| 203 | 198 |
| 204 count_segs_sb(cpi, mi + y_idx * bs * mis + x_idx * bs, | 199 count_segs_sb(cpi, &mi[mi_dr * mis + mi_dc], |
| 205 no_pred_segcounts, temporal_predictor_count, | 200 no_pred_segcounts, temporal_predictor_count, |
| 206 t_unpred_seg_counts, | 201 t_unpred_seg_counts, |
| 207 mi_row + y_idx * bs, mi_col + x_idx * bs, subsize); | 202 mi_row + mi_dr, mi_col + mi_dc, subsize); |
| 208 } | 203 } |
| 209 } | 204 } |
| 210 } | 205 } |
| 211 | 206 |
| 212 void vp9_choose_segmap_coding_method(VP9_COMP *cpi) { | 207 void vp9_choose_segmap_coding_method(VP9_COMP *cpi) { |
| 213 VP9_COMMON *const cm = &cpi->common; | 208 VP9_COMMON *const cm = &cpi->common; |
| 214 MACROBLOCKD *const xd = &cpi->mb.e_mbd; | 209 struct segmentation *seg = &cm->seg; |
| 215 | 210 |
| 216 int no_pred_cost; | 211 int no_pred_cost; |
| 217 int t_pred_cost = INT_MAX; | 212 int t_pred_cost = INT_MAX; |
| 218 | 213 |
| 219 int i, tile_col, mi_row, mi_col; | 214 int i, tile_col, mi_row, mi_col; |
| 220 | 215 |
| 221 int temporal_predictor_count[PREDICTION_PROBS][2]; | 216 int temporal_predictor_count[PREDICTION_PROBS][2] = { { 0 } }; |
| 222 int no_pred_segcounts[MAX_SEGMENTS]; | 217 int no_pred_segcounts[MAX_SEGMENTS] = { 0 }; |
| 223 int t_unpred_seg_counts[MAX_SEGMENTS]; | 218 int t_unpred_seg_counts[MAX_SEGMENTS] = { 0 }; |
| 224 | 219 |
| 225 vp9_prob no_pred_tree[SEG_TREE_PROBS]; | 220 vp9_prob no_pred_tree[SEG_TREE_PROBS]; |
| 226 vp9_prob t_pred_tree[SEG_TREE_PROBS]; | 221 vp9_prob t_pred_tree[SEG_TREE_PROBS]; |
| 227 vp9_prob t_nopred_prob[PREDICTION_PROBS]; | 222 vp9_prob t_nopred_prob[PREDICTION_PROBS]; |
| 228 | 223 |
| 229 const int mis = cm->mode_info_stride; | 224 const int mis = cm->mode_info_stride; |
| 230 MODE_INFO *mi_ptr, *mi; | 225 MODE_INFO *mi_ptr, *mi; |
| 231 | 226 |
| 232 // Set default state for the segment tree probabilities and the | 227 // Set default state for the segment tree probabilities and the |
| 233 // temporal coding probabilities | 228 // temporal coding probabilities |
| 234 vpx_memset(xd->seg.tree_probs, 255, sizeof(xd->seg.tree_probs)); | 229 vpx_memset(seg->tree_probs, 255, sizeof(seg->tree_probs)); |
| 235 vpx_memset(xd->seg.pred_probs, 255, sizeof(xd->seg.pred_probs)); | 230 vpx_memset(seg->pred_probs, 255, sizeof(seg->pred_probs)); |
| 236 | |
| 237 vpx_memset(no_pred_segcounts, 0, sizeof(no_pred_segcounts)); | |
| 238 vpx_memset(t_unpred_seg_counts, 0, sizeof(t_unpred_seg_counts)); | |
| 239 vpx_memset(temporal_predictor_count, 0, sizeof(temporal_predictor_count)); | |
| 240 | 231 |
| 241 // First of all generate stats regarding how well the last segment map | 232 // First of all generate stats regarding how well the last segment map |
| 242 // predicts this one | 233 // predicts this one |
| 243 for (tile_col = 0; tile_col < 1 << cm->log2_tile_cols; tile_col++) { | 234 for (tile_col = 0; tile_col < 1 << cm->log2_tile_cols; tile_col++) { |
| 244 vp9_get_tile_col_offsets(cm, tile_col); | 235 vp9_get_tile_col_offsets(cm, tile_col); |
| 245 mi_ptr = cm->mi + cm->cur_tile_mi_col_start; | 236 mi_ptr = cm->mi + cm->cur_tile_mi_col_start; |
| 246 for (mi_row = 0; mi_row < cm->mi_rows; | 237 for (mi_row = 0; mi_row < cm->mi_rows; |
| 247 mi_row += 8, mi_ptr += 8 * mis) { | 238 mi_row += 8, mi_ptr += 8 * mis) { |
| 248 mi = mi_ptr; | 239 mi = mi_ptr; |
| 249 for (mi_col = cm->cur_tile_mi_col_start; mi_col < cm->cur_tile_mi_col_end; | 240 for (mi_col = cm->cur_tile_mi_col_start; mi_col < cm->cur_tile_mi_col_end; |
| 250 mi_col += 8, mi += 8) | 241 mi_col += 8, mi += 8) |
| 251 count_segs_sb(cpi, mi, no_pred_segcounts, temporal_predictor_count, | 242 count_segs_sb(cpi, mi, no_pred_segcounts, temporal_predictor_count, |
| 252 t_unpred_seg_counts, mi_row, mi_col, BLOCK_SIZE_SB64X64); | 243 t_unpred_seg_counts, mi_row, mi_col, BLOCK_64X64); |
| 253 } | 244 } |
| 254 } | 245 } |
| 255 | 246 |
| 256 // Work out probability tree for coding segments without prediction | 247 // Work out probability tree for coding segments without prediction |
| 257 // and the cost. | 248 // and the cost. |
| 258 calc_segtree_probs(xd, no_pred_segcounts, no_pred_tree); | 249 calc_segtree_probs(no_pred_segcounts, no_pred_tree); |
| 259 no_pred_cost = cost_segmap(xd, no_pred_segcounts, no_pred_tree); | 250 no_pred_cost = cost_segmap(no_pred_segcounts, no_pred_tree); |
| 260 | 251 |
| 261 // Key frames cannot use temporal prediction | 252 // Key frames cannot use temporal prediction |
| 262 if (cm->frame_type != KEY_FRAME) { | 253 if (cm->frame_type != KEY_FRAME) { |
| 263 // Work out probability tree for coding those segments not | 254 // Work out probability tree for coding those segments not |
| 264 // predicted using the temporal method and the cost. | 255 // predicted using the temporal method and the cost. |
| 265 calc_segtree_probs(xd, t_unpred_seg_counts, t_pred_tree); | 256 calc_segtree_probs(t_unpred_seg_counts, t_pred_tree); |
| 266 t_pred_cost = cost_segmap(xd, t_unpred_seg_counts, t_pred_tree); | 257 t_pred_cost = cost_segmap(t_unpred_seg_counts, t_pred_tree); |
| 267 | 258 |
| 268 // Add in the cost of the signalling for each prediction context | 259 // Add in the cost of the signalling for each prediction context |
| 269 for (i = 0; i < PREDICTION_PROBS; i++) { | 260 for (i = 0; i < PREDICTION_PROBS; i++) { |
| 270 const int count0 = temporal_predictor_count[i][0]; | 261 const int count0 = temporal_predictor_count[i][0]; |
| 271 const int count1 = temporal_predictor_count[i][1]; | 262 const int count1 = temporal_predictor_count[i][1]; |
| 272 | 263 |
| 273 t_nopred_prob[i] = get_binary_prob(count0, count1); | 264 t_nopred_prob[i] = get_binary_prob(count0, count1); |
| 274 | 265 |
| 275 // Add in the predictor signaling cost | 266 // Add in the predictor signaling cost |
| 276 t_pred_cost += count0 * vp9_cost_zero(t_nopred_prob[i]) + | 267 t_pred_cost += count0 * vp9_cost_zero(t_nopred_prob[i]) + |
| 277 count1 * vp9_cost_one(t_nopred_prob[i]); | 268 count1 * vp9_cost_one(t_nopred_prob[i]); |
| 278 } | 269 } |
| 279 } | 270 } |
| 280 | 271 |
| 281 // Now choose which coding method to use. | 272 // Now choose which coding method to use. |
| 282 if (t_pred_cost < no_pred_cost) { | 273 if (t_pred_cost < no_pred_cost) { |
| 283 xd->seg.temporal_update = 1; | 274 seg->temporal_update = 1; |
| 284 vpx_memcpy(xd->seg.tree_probs, t_pred_tree, sizeof(t_pred_tree)); | 275 vpx_memcpy(seg->tree_probs, t_pred_tree, sizeof(t_pred_tree)); |
| 285 vpx_memcpy(xd->seg.pred_probs, t_nopred_prob, sizeof(t_nopred_prob)); | 276 vpx_memcpy(seg->pred_probs, t_nopred_prob, sizeof(t_nopred_prob)); |
| 286 } else { | 277 } else { |
| 287 xd->seg.temporal_update = 0; | 278 seg->temporal_update = 0; |
| 288 vpx_memcpy(xd->seg.tree_probs, no_pred_tree, sizeof(no_pred_tree)); | 279 vpx_memcpy(seg->tree_probs, no_pred_tree, sizeof(no_pred_tree)); |
| 289 } | 280 } |
| 290 } | 281 } |
| OLD | NEW |