OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 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 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // quantizer value is adjusted between loop iterations. | 132 // quantizer value is adjusted between loop iterations. |
133 | 133 |
134 cc->nmvc = cm->fc.nmvc; | 134 cc->nmvc = cm->fc.nmvc; |
135 vp9_copy(cc->nmvjointcost, cpi->mb.nmvjointcost); | 135 vp9_copy(cc->nmvjointcost, cpi->mb.nmvjointcost); |
136 vp9_copy(cc->nmvcosts, cpi->mb.nmvcosts); | 136 vp9_copy(cc->nmvcosts, cpi->mb.nmvcosts); |
137 vp9_copy(cc->nmvcosts_hp, cpi->mb.nmvcosts_hp); | 137 vp9_copy(cc->nmvcosts_hp, cpi->mb.nmvcosts_hp); |
138 | 138 |
139 vp9_copy(cc->vp9_mode_contexts, cm->fc.vp9_mode_contexts); | 139 vp9_copy(cc->vp9_mode_contexts, cm->fc.vp9_mode_contexts); |
140 | 140 |
141 vp9_copy(cc->ymode_prob, cm->fc.ymode_prob); | 141 vp9_copy(cc->ymode_prob, cm->fc.ymode_prob); |
142 #if CONFIG_SUPERBLOCKS | |
143 vp9_copy(cc->sb_ymode_prob, cm->fc.sb_ymode_prob); | 142 vp9_copy(cc->sb_ymode_prob, cm->fc.sb_ymode_prob); |
144 #endif | |
145 vp9_copy(cc->bmode_prob, cm->fc.bmode_prob); | 143 vp9_copy(cc->bmode_prob, cm->fc.bmode_prob); |
146 vp9_copy(cc->uv_mode_prob, cm->fc.uv_mode_prob); | 144 vp9_copy(cc->uv_mode_prob, cm->fc.uv_mode_prob); |
147 vp9_copy(cc->i8x8_mode_prob, cm->fc.i8x8_mode_prob); | 145 vp9_copy(cc->i8x8_mode_prob, cm->fc.i8x8_mode_prob); |
148 vp9_copy(cc->sub_mv_ref_prob, cm->fc.sub_mv_ref_prob); | 146 vp9_copy(cc->sub_mv_ref_prob, cm->fc.sub_mv_ref_prob); |
149 vp9_copy(cc->mbsplit_prob, cm->fc.mbsplit_prob); | 147 vp9_copy(cc->mbsplit_prob, cm->fc.mbsplit_prob); |
150 | 148 |
151 // Stats | 149 // Stats |
152 #ifdef MODE_STATS | 150 #ifdef MODE_STATS |
153 vp9_copy(cc->y_modes, y_modes); | 151 vp9_copy(cc->y_modes, y_modes); |
154 vp9_copy(cc->uv_modes, uv_modes); | 152 vp9_copy(cc->uv_modes, uv_modes); |
155 vp9_copy(cc->b_modes, b_modes); | 153 vp9_copy(cc->b_modes, b_modes); |
156 vp9_copy(cc->inter_y_modes, inter_y_modes); | 154 vp9_copy(cc->inter_y_modes, inter_y_modes); |
157 vp9_copy(cc->inter_uv_modes, inter_uv_modes); | 155 vp9_copy(cc->inter_uv_modes, inter_uv_modes); |
158 vp9_copy(cc->inter_b_modes, inter_b_modes); | 156 vp9_copy(cc->inter_b_modes, inter_b_modes); |
159 #endif | 157 #endif |
160 | 158 |
161 vp9_copy(cc->segment_pred_probs, cm->segment_pred_probs); | 159 vp9_copy(cc->segment_pred_probs, cm->segment_pred_probs); |
162 vp9_copy(cc->ref_pred_probs_update, cpi->ref_pred_probs_update); | 160 vp9_copy(cc->ref_pred_probs_update, cpi->ref_pred_probs_update); |
163 vp9_copy(cc->ref_pred_probs, cm->ref_pred_probs); | 161 vp9_copy(cc->ref_pred_probs, cm->ref_pred_probs); |
164 vp9_copy(cc->prob_comppred, cm->prob_comppred); | 162 vp9_copy(cc->prob_comppred, cm->prob_comppred); |
165 | 163 |
166 vpx_memcpy(cpi->coding_context.last_frame_seg_map_copy, | 164 vpx_memcpy(cpi->coding_context.last_frame_seg_map_copy, |
167 cm->last_frame_seg_map, (cm->mb_rows * cm->mb_cols)); | 165 cm->last_frame_seg_map, (cm->mb_rows * cm->mb_cols)); |
168 | 166 |
169 vp9_copy(cc->last_ref_lf_deltas, xd->last_ref_lf_deltas); | 167 vp9_copy(cc->last_ref_lf_deltas, xd->last_ref_lf_deltas); |
170 vp9_copy(cc->last_mode_lf_deltas, xd->last_mode_lf_deltas); | 168 vp9_copy(cc->last_mode_lf_deltas, xd->last_mode_lf_deltas); |
171 | 169 |
172 vp9_copy(cc->coef_probs, cm->fc.coef_probs); | 170 vp9_copy(cc->coef_probs_4x4, cm->fc.coef_probs_4x4); |
173 vp9_copy(cc->hybrid_coef_probs, cm->fc.hybrid_coef_probs); | 171 vp9_copy(cc->hybrid_coef_probs_4x4, cm->fc.hybrid_coef_probs_4x4); |
174 vp9_copy(cc->coef_probs_8x8, cm->fc.coef_probs_8x8); | 172 vp9_copy(cc->coef_probs_8x8, cm->fc.coef_probs_8x8); |
175 vp9_copy(cc->hybrid_coef_probs_8x8, cm->fc.hybrid_coef_probs_8x8); | 173 vp9_copy(cc->hybrid_coef_probs_8x8, cm->fc.hybrid_coef_probs_8x8); |
176 vp9_copy(cc->coef_probs_16x16, cm->fc.coef_probs_16x16); | 174 vp9_copy(cc->coef_probs_16x16, cm->fc.coef_probs_16x16); |
177 vp9_copy(cc->hybrid_coef_probs_16x16, cm->fc.hybrid_coef_probs_16x16); | 175 vp9_copy(cc->hybrid_coef_probs_16x16, cm->fc.hybrid_coef_probs_16x16); |
| 176 vp9_copy(cc->coef_probs_32x32, cm->fc.coef_probs_32x32); |
178 vp9_copy(cc->switchable_interp_prob, cm->fc.switchable_interp_prob); | 177 vp9_copy(cc->switchable_interp_prob, cm->fc.switchable_interp_prob); |
179 #if CONFIG_COMP_INTERINTRA_PRED | 178 #if CONFIG_COMP_INTERINTRA_PRED |
180 cc->interintra_prob = cm->fc.interintra_prob; | 179 cc->interintra_prob = cm->fc.interintra_prob; |
181 #endif | 180 #endif |
182 } | 181 } |
183 | 182 |
184 void vp9_restore_coding_context(VP9_COMP *cpi) { | 183 void vp9_restore_coding_context(VP9_COMP *cpi) { |
185 CODING_CONTEXT *const cc = &cpi->coding_context; | 184 CODING_CONTEXT *const cc = &cpi->coding_context; |
186 VP9_COMMON *cm = &cpi->common; | 185 VP9_COMMON *cm = &cpi->common; |
187 MACROBLOCKD *xd = &cpi->mb.e_mbd; | 186 MACROBLOCKD *xd = &cpi->mb.e_mbd; |
188 | 187 |
189 // Restore key state variables to the snapshot state stored in the | 188 // Restore key state variables to the snapshot state stored in the |
190 // previous call to vp9_save_coding_context. | 189 // previous call to vp9_save_coding_context. |
191 | 190 |
192 cm->fc.nmvc = cc->nmvc; | 191 cm->fc.nmvc = cc->nmvc; |
193 vp9_copy(cpi->mb.nmvjointcost, cc->nmvjointcost); | 192 vp9_copy(cpi->mb.nmvjointcost, cc->nmvjointcost); |
194 vp9_copy(cpi->mb.nmvcosts, cc->nmvcosts); | 193 vp9_copy(cpi->mb.nmvcosts, cc->nmvcosts); |
195 vp9_copy(cpi->mb.nmvcosts_hp, cc->nmvcosts_hp); | 194 vp9_copy(cpi->mb.nmvcosts_hp, cc->nmvcosts_hp); |
196 | 195 |
197 vp9_copy(cm->fc.vp9_mode_contexts, cc->vp9_mode_contexts); | 196 vp9_copy(cm->fc.vp9_mode_contexts, cc->vp9_mode_contexts); |
198 | 197 |
199 vp9_copy(cm->fc.ymode_prob, cc->ymode_prob); | 198 vp9_copy(cm->fc.ymode_prob, cc->ymode_prob); |
200 #if CONFIG_SUPERBLOCKS | |
201 vp9_copy(cm->fc.sb_ymode_prob, cc->sb_ymode_prob); | 199 vp9_copy(cm->fc.sb_ymode_prob, cc->sb_ymode_prob); |
202 #endif | |
203 vp9_copy(cm->fc.bmode_prob, cc->bmode_prob); | 200 vp9_copy(cm->fc.bmode_prob, cc->bmode_prob); |
204 vp9_copy(cm->fc.i8x8_mode_prob, cc->i8x8_mode_prob); | 201 vp9_copy(cm->fc.i8x8_mode_prob, cc->i8x8_mode_prob); |
205 vp9_copy(cm->fc.uv_mode_prob, cc->uv_mode_prob); | 202 vp9_copy(cm->fc.uv_mode_prob, cc->uv_mode_prob); |
206 vp9_copy(cm->fc.sub_mv_ref_prob, cc->sub_mv_ref_prob); | 203 vp9_copy(cm->fc.sub_mv_ref_prob, cc->sub_mv_ref_prob); |
207 vp9_copy(cm->fc.mbsplit_prob, cc->mbsplit_prob); | 204 vp9_copy(cm->fc.mbsplit_prob, cc->mbsplit_prob); |
208 | 205 |
209 // Stats | 206 // Stats |
210 #ifdef MODE_STATS | 207 #ifdef MODE_STATS |
211 vp9_copy(y_modes, cc->y_modes); | 208 vp9_copy(y_modes, cc->y_modes); |
212 vp9_copy(uv_modes, cc->uv_modes); | 209 vp9_copy(uv_modes, cc->uv_modes); |
213 vp9_copy(b_modes, cc->b_modes); | 210 vp9_copy(b_modes, cc->b_modes); |
214 vp9_copy(inter_y_modes, cc->inter_y_modes); | 211 vp9_copy(inter_y_modes, cc->inter_y_modes); |
215 vp9_copy(inter_uv_modes, cc->inter_uv_modes); | 212 vp9_copy(inter_uv_modes, cc->inter_uv_modes); |
216 vp9_copy(inter_b_modes, cc->inter_b_modes); | 213 vp9_copy(inter_b_modes, cc->inter_b_modes); |
217 #endif | 214 #endif |
218 | 215 |
219 vp9_copy(cm->segment_pred_probs, cc->segment_pred_probs); | 216 vp9_copy(cm->segment_pred_probs, cc->segment_pred_probs); |
220 vp9_copy(cpi->ref_pred_probs_update, cc->ref_pred_probs_update); | 217 vp9_copy(cpi->ref_pred_probs_update, cc->ref_pred_probs_update); |
221 vp9_copy(cm->ref_pred_probs, cc->ref_pred_probs); | 218 vp9_copy(cm->ref_pred_probs, cc->ref_pred_probs); |
222 vp9_copy(cm->prob_comppred, cc->prob_comppred); | 219 vp9_copy(cm->prob_comppred, cc->prob_comppred); |
223 | 220 |
224 vpx_memcpy(cm->last_frame_seg_map, | 221 vpx_memcpy(cm->last_frame_seg_map, |
225 cpi->coding_context.last_frame_seg_map_copy, | 222 cpi->coding_context.last_frame_seg_map_copy, |
226 (cm->mb_rows * cm->mb_cols)); | 223 (cm->mb_rows * cm->mb_cols)); |
227 | 224 |
228 vp9_copy(xd->last_ref_lf_deltas, cc->last_ref_lf_deltas); | 225 vp9_copy(xd->last_ref_lf_deltas, cc->last_ref_lf_deltas); |
229 vp9_copy(xd->last_mode_lf_deltas, cc->last_mode_lf_deltas); | 226 vp9_copy(xd->last_mode_lf_deltas, cc->last_mode_lf_deltas); |
230 | 227 |
231 vp9_copy(cm->fc.coef_probs, cc->coef_probs); | 228 vp9_copy(cm->fc.coef_probs_4x4, cc->coef_probs_4x4); |
232 vp9_copy(cm->fc.hybrid_coef_probs, cc->hybrid_coef_probs); | 229 vp9_copy(cm->fc.hybrid_coef_probs_4x4, cc->hybrid_coef_probs_4x4); |
233 vp9_copy(cm->fc.coef_probs_8x8, cc->coef_probs_8x8); | 230 vp9_copy(cm->fc.coef_probs_8x8, cc->coef_probs_8x8); |
234 vp9_copy(cm->fc.hybrid_coef_probs_8x8, cc->hybrid_coef_probs_8x8); | 231 vp9_copy(cm->fc.hybrid_coef_probs_8x8, cc->hybrid_coef_probs_8x8); |
235 vp9_copy(cm->fc.coef_probs_16x16, cc->coef_probs_16x16); | 232 vp9_copy(cm->fc.coef_probs_16x16, cc->coef_probs_16x16); |
236 vp9_copy(cm->fc.hybrid_coef_probs_16x16, cc->hybrid_coef_probs_16x16); | 233 vp9_copy(cm->fc.hybrid_coef_probs_16x16, cc->hybrid_coef_probs_16x16); |
| 234 vp9_copy(cm->fc.coef_probs_32x32, cc->coef_probs_32x32); |
237 vp9_copy(cm->fc.switchable_interp_prob, cc->switchable_interp_prob); | 235 vp9_copy(cm->fc.switchable_interp_prob, cc->switchable_interp_prob); |
238 #if CONFIG_COMP_INTERINTRA_PRED | 236 #if CONFIG_COMP_INTERINTRA_PRED |
239 cm->fc.interintra_prob = cc->interintra_prob; | 237 cm->fc.interintra_prob = cc->interintra_prob; |
240 #endif | 238 #endif |
241 } | 239 } |
242 | 240 |
243 | 241 |
244 void vp9_setup_key_frame(VP9_COMP *cpi) { | 242 void vp9_setup_key_frame(VP9_COMP *cpi) { |
245 VP9_COMMON *cm = &cpi->common; | 243 VP9_COMMON *cm = &cpi->common; |
246 // Setup for Key frame: | 244 // Setup for Key frame: |
(...skipping 20 matching lines...) Expand all Loading... |
267 vpx_memcpy(&cpi->common.lfc, &cpi->common.fc, sizeof(cpi->common.fc)); | 265 vpx_memcpy(&cpi->common.lfc, &cpi->common.fc, sizeof(cpi->common.fc)); |
268 vpx_memcpy(&cpi->common.lfc_a, &cpi->common.fc, sizeof(cpi->common.fc)); | 266 vpx_memcpy(&cpi->common.lfc_a, &cpi->common.fc, sizeof(cpi->common.fc)); |
269 | 267 |
270 vpx_memset(cm->prev_mip, 0, | 268 vpx_memset(cm->prev_mip, 0, |
271 (cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO)); | 269 (cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO)); |
272 vpx_memset(cm->mip, 0, | 270 vpx_memset(cm->mip, 0, |
273 (cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO)); | 271 (cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO)); |
274 | 272 |
275 vp9_update_mode_info_border(cm, cm->mip); | 273 vp9_update_mode_info_border(cm, cm->mip); |
276 vp9_update_mode_info_in_image(cm, cm->mi); | 274 vp9_update_mode_info_in_image(cm, cm->mi); |
| 275 |
| 276 #if CONFIG_NEW_MVREF |
| 277 if (1) { |
| 278 MACROBLOCKD *xd = &cpi->mb.e_mbd; |
| 279 |
| 280 // Defaults probabilities for encoding the MV ref id signal |
| 281 vpx_memset(xd->mb_mv_ref_probs, VP9_DEFAULT_MV_REF_PROB, |
| 282 sizeof(xd->mb_mv_ref_probs)); |
| 283 } |
| 284 #endif |
277 } | 285 } |
278 | 286 |
279 void vp9_setup_inter_frame(VP9_COMP *cpi) { | 287 void vp9_setup_inter_frame(VP9_COMP *cpi) { |
280 if (cpi->common.refresh_alt_ref_frame) { | 288 if (cpi->common.refresh_alt_ref_frame) { |
281 vpx_memcpy(&cpi->common.fc, | 289 vpx_memcpy(&cpi->common.fc, |
282 &cpi->common.lfc_a, | 290 &cpi->common.lfc_a, |
283 sizeof(cpi->common.fc)); | 291 sizeof(cpi->common.fc)); |
284 } else { | 292 } else { |
285 vpx_memcpy(&cpi->common.fc, | 293 vpx_memcpy(&cpi->common.fc, |
286 &cpi->common.lfc, | 294 &cpi->common.lfc, |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 int vp9_pick_frame_size(VP9_COMP *cpi) { | 701 int vp9_pick_frame_size(VP9_COMP *cpi) { |
694 VP9_COMMON *cm = &cpi->common; | 702 VP9_COMMON *cm = &cpi->common; |
695 | 703 |
696 if (cm->frame_type == KEY_FRAME) | 704 if (cm->frame_type == KEY_FRAME) |
697 calc_iframe_target_size(cpi); | 705 calc_iframe_target_size(cpi); |
698 else | 706 else |
699 calc_pframe_target_size(cpi); | 707 calc_pframe_target_size(cpi); |
700 | 708 |
701 return 1; | 709 return 1; |
702 } | 710 } |
OLD | NEW |