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 |
11 #include <math.h> | 11 #include <math.h> |
12 #include <stdio.h> | 12 #include <stdio.h> |
13 #include <limits.h> | 13 #include <limits.h> |
14 | 14 |
15 #include "./vpx_config.h" | 15 #include "./vpx_config.h" |
| 16 #include "./vp9_rtcd.h" |
| 17 #include "./vpx_dsp_rtcd.h" |
16 #include "./vpx_scale_rtcd.h" | 18 #include "./vpx_scale_rtcd.h" |
17 #include "vpx/internal/vpx_psnr.h" | 19 #include "vpx/internal/vpx_psnr.h" |
18 #include "vpx_ports/vpx_timer.h" | 20 #include "vpx_ports/vpx_timer.h" |
19 | 21 |
20 #include "vp9/common/vp9_alloccommon.h" | 22 #include "vp9/common/vp9_alloccommon.h" |
21 #include "vp9/common/vp9_filter.h" | 23 #include "vp9/common/vp9_filter.h" |
22 #include "vp9/common/vp9_idct.h" | 24 #include "vp9/common/vp9_idct.h" |
23 #if CONFIG_VP9_POSTPROC | 25 #if CONFIG_VP9_POSTPROC |
24 #include "vp9/common/vp9_postproc.h" | 26 #include "vp9/common/vp9_postproc.h" |
25 #endif | 27 #endif |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 121 } |
120 | 122 |
121 void vp9_apply_active_map(VP9_COMP *cpi) { | 123 void vp9_apply_active_map(VP9_COMP *cpi) { |
122 struct segmentation *const seg = &cpi->common.seg; | 124 struct segmentation *const seg = &cpi->common.seg; |
123 unsigned char *const seg_map = cpi->segmentation_map; | 125 unsigned char *const seg_map = cpi->segmentation_map; |
124 const unsigned char *const active_map = cpi->active_map.map; | 126 const unsigned char *const active_map = cpi->active_map.map; |
125 int i; | 127 int i; |
126 | 128 |
127 assert(AM_SEGMENT_ID_ACTIVE == CR_SEGMENT_ID_BASE); | 129 assert(AM_SEGMENT_ID_ACTIVE == CR_SEGMENT_ID_BASE); |
128 | 130 |
| 131 if (frame_is_intra_only(&cpi->common)) { |
| 132 cpi->active_map.enabled = 0; |
| 133 cpi->active_map.update = 1; |
| 134 } |
| 135 |
129 if (cpi->active_map.update) { | 136 if (cpi->active_map.update) { |
130 if (cpi->active_map.enabled) { | 137 if (cpi->active_map.enabled) { |
131 for (i = 0; i < cpi->common.mi_rows * cpi->common.mi_cols; ++i) | 138 for (i = 0; i < cpi->common.mi_rows * cpi->common.mi_cols; ++i) |
132 if (seg_map[i] == AM_SEGMENT_ID_ACTIVE) seg_map[i] = active_map[i]; | 139 if (seg_map[i] == AM_SEGMENT_ID_ACTIVE) seg_map[i] = active_map[i]; |
133 vp9_enable_segmentation(seg); | 140 vp9_enable_segmentation(seg); |
134 vp9_enable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_SKIP); | 141 vp9_enable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_SKIP); |
| 142 vp9_enable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF); |
| 143 // Setting the data to -MAX_LOOP_FILTER will result in the computed loop |
| 144 // filter level being zero regardless of the value of seg->abs_delta. |
| 145 vp9_set_segdata(seg, AM_SEGMENT_ID_INACTIVE, |
| 146 SEG_LVL_ALT_LF, -MAX_LOOP_FILTER); |
135 } else { | 147 } else { |
136 vp9_disable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_SKIP); | 148 vp9_disable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_SKIP); |
| 149 vp9_disable_segfeature(seg, AM_SEGMENT_ID_INACTIVE, SEG_LVL_ALT_LF); |
137 if (seg->enabled) { | 150 if (seg->enabled) { |
138 seg->update_data = 1; | 151 seg->update_data = 1; |
139 seg->update_map = 1; | 152 seg->update_map = 1; |
140 } | 153 } |
141 } | 154 } |
142 cpi->active_map.update = 0; | 155 cpi->active_map.update = 0; |
143 } | 156 } |
144 } | 157 } |
145 | 158 |
146 int vp9_set_active_map(VP9_COMP* cpi, | 159 int vp9_set_active_map(VP9_COMP* cpi, |
(...skipping 18 matching lines...) Expand all Loading... |
165 cpi->active_map.enabled = 1; | 178 cpi->active_map.enabled = 1; |
166 } else { | 179 } else { |
167 cpi->active_map.enabled = 0; | 180 cpi->active_map.enabled = 0; |
168 } | 181 } |
169 return 0; | 182 return 0; |
170 } else { | 183 } else { |
171 return -1; | 184 return -1; |
172 } | 185 } |
173 } | 186 } |
174 | 187 |
| 188 int vp9_get_active_map(VP9_COMP* cpi, |
| 189 unsigned char* new_map_16x16, |
| 190 int rows, |
| 191 int cols) { |
| 192 if (rows == cpi->common.mb_rows && cols == cpi->common.mb_cols && |
| 193 new_map_16x16) { |
| 194 unsigned char* const seg_map_8x8 = cpi->segmentation_map; |
| 195 const int mi_rows = cpi->common.mi_rows; |
| 196 const int mi_cols = cpi->common.mi_cols; |
| 197 memset(new_map_16x16, !cpi->active_map.enabled, rows * cols); |
| 198 if (cpi->active_map.enabled) { |
| 199 int r, c; |
| 200 for (r = 0; r < mi_rows; ++r) { |
| 201 for (c = 0; c < mi_cols; ++c) { |
| 202 // Cyclic refresh segments are considered active despite not having |
| 203 // AM_SEGMENT_ID_ACTIVE |
| 204 new_map_16x16[(r >> 1) * cols + (c >> 1)] |= |
| 205 seg_map_8x8[r * mi_cols + c] != AM_SEGMENT_ID_INACTIVE; |
| 206 } |
| 207 } |
| 208 } |
| 209 return 0; |
| 210 } else { |
| 211 return -1; |
| 212 } |
| 213 } |
| 214 |
175 void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv) { | 215 void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv) { |
176 MACROBLOCK *const mb = &cpi->td.mb; | 216 MACROBLOCK *const mb = &cpi->td.mb; |
177 cpi->common.allow_high_precision_mv = allow_high_precision_mv; | 217 cpi->common.allow_high_precision_mv = allow_high_precision_mv; |
178 if (cpi->common.allow_high_precision_mv) { | 218 if (cpi->common.allow_high_precision_mv) { |
179 mb->mvcost = mb->nmvcost_hp; | 219 mb->mvcost = mb->nmvcost_hp; |
180 mb->mvsadcost = mb->nmvsadcost_hp; | 220 mb->mvsadcost = mb->nmvsadcost_hp; |
181 } else { | 221 } else { |
182 mb->mvcost = mb->nmvcost; | 222 mb->mvcost = mb->nmvcost; |
183 mb->mvsadcost = mb->nmvsadcost; | 223 mb->mvsadcost = mb->nmvsadcost; |
184 } | 224 } |
(...skipping 20 matching lines...) Expand all Loading... |
205 vp9_zero(cpi->interp_filter_selected); | 245 vp9_zero(cpi->interp_filter_selected); |
206 } else { | 246 } else { |
207 *cm->fc = cm->frame_contexts[cm->frame_context_idx]; | 247 *cm->fc = cm->frame_contexts[cm->frame_context_idx]; |
208 vp9_zero(cpi->interp_filter_selected[0]); | 248 vp9_zero(cpi->interp_filter_selected[0]); |
209 } | 249 } |
210 } | 250 } |
211 | 251 |
212 static void vp9_enc_setup_mi(VP9_COMMON *cm) { | 252 static void vp9_enc_setup_mi(VP9_COMMON *cm) { |
213 int i; | 253 int i; |
214 cm->mi = cm->mip + cm->mi_stride + 1; | 254 cm->mi = cm->mip + cm->mi_stride + 1; |
215 vpx_memset(cm->mip, 0, cm->mi_stride * (cm->mi_rows + 1) * sizeof(*cm->mip)); | 255 memset(cm->mip, 0, cm->mi_stride * (cm->mi_rows + 1) * sizeof(*cm->mip)); |
216 cm->prev_mi = cm->prev_mip + cm->mi_stride + 1; | 256 cm->prev_mi = cm->prev_mip + cm->mi_stride + 1; |
217 // Clear top border row | 257 // Clear top border row |
218 vpx_memset(cm->prev_mip, 0, sizeof(*cm->prev_mip) * cm->mi_stride); | 258 memset(cm->prev_mip, 0, sizeof(*cm->prev_mip) * cm->mi_stride); |
219 // Clear left border column | 259 // Clear left border column |
220 for (i = 1; i < cm->mi_rows + 1; ++i) | 260 for (i = 1; i < cm->mi_rows + 1; ++i) |
221 vpx_memset(&cm->prev_mip[i * cm->mi_stride], 0, sizeof(*cm->prev_mip)); | 261 memset(&cm->prev_mip[i * cm->mi_stride], 0, sizeof(*cm->prev_mip)); |
| 262 |
| 263 cm->mi_grid_visible = cm->mi_grid_base + cm->mi_stride + 1; |
| 264 cm->prev_mi_grid_visible = cm->prev_mi_grid_base + cm->mi_stride + 1; |
| 265 |
| 266 memset(cm->mi_grid_base, 0, |
| 267 cm->mi_stride * (cm->mi_rows + 1) * sizeof(*cm->mi_grid_base)); |
222 } | 268 } |
223 | 269 |
224 static int vp9_enc_alloc_mi(VP9_COMMON *cm, int mi_size) { | 270 static int vp9_enc_alloc_mi(VP9_COMMON *cm, int mi_size) { |
225 cm->mip = vpx_calloc(mi_size, sizeof(*cm->mip)); | 271 cm->mip = vpx_calloc(mi_size, sizeof(*cm->mip)); |
226 if (!cm->mip) | 272 if (!cm->mip) |
227 return 1; | 273 return 1; |
228 cm->prev_mip = vpx_calloc(mi_size, sizeof(*cm->prev_mip)); | 274 cm->prev_mip = vpx_calloc(mi_size, sizeof(*cm->prev_mip)); |
229 if (!cm->prev_mip) | 275 if (!cm->prev_mip) |
230 return 1; | 276 return 1; |
231 cm->mi_alloc_size = mi_size; | 277 cm->mi_alloc_size = mi_size; |
| 278 |
| 279 cm->mi_grid_base = (MODE_INFO **)vpx_calloc(mi_size, sizeof(MODE_INFO*)); |
| 280 if (!cm->mi_grid_base) |
| 281 return 1; |
| 282 cm->prev_mi_grid_base = (MODE_INFO **)vpx_calloc(mi_size, sizeof(MODE_INFO*)); |
| 283 if (!cm->prev_mi_grid_base) |
| 284 return 1; |
| 285 |
232 return 0; | 286 return 0; |
233 } | 287 } |
234 | 288 |
235 static void vp9_enc_free_mi(VP9_COMMON *cm) { | 289 static void vp9_enc_free_mi(VP9_COMMON *cm) { |
236 vpx_free(cm->mip); | 290 vpx_free(cm->mip); |
237 cm->mip = NULL; | 291 cm->mip = NULL; |
238 vpx_free(cm->prev_mip); | 292 vpx_free(cm->prev_mip); |
239 cm->prev_mip = NULL; | 293 cm->prev_mip = NULL; |
| 294 vpx_free(cm->mi_grid_base); |
| 295 cm->mi_grid_base = NULL; |
| 296 vpx_free(cm->prev_mi_grid_base); |
| 297 cm->prev_mi_grid_base = NULL; |
240 } | 298 } |
241 | 299 |
242 static void vp9_swap_mi_and_prev_mi(VP9_COMMON *cm) { | 300 static void vp9_swap_mi_and_prev_mi(VP9_COMMON *cm) { |
243 // Current mip will be the prev_mip for the next frame. | 301 // Current mip will be the prev_mip for the next frame. |
| 302 MODE_INFO **temp_base = cm->prev_mi_grid_base; |
244 MODE_INFO *temp = cm->prev_mip; | 303 MODE_INFO *temp = cm->prev_mip; |
245 cm->prev_mip = cm->mip; | 304 cm->prev_mip = cm->mip; |
246 cm->mip = temp; | 305 cm->mip = temp; |
247 | 306 |
248 // Update the upper left visible macroblock ptrs. | 307 // Update the upper left visible macroblock ptrs. |
249 cm->mi = cm->mip + cm->mi_stride + 1; | 308 cm->mi = cm->mip + cm->mi_stride + 1; |
250 cm->prev_mi = cm->prev_mip + cm->mi_stride + 1; | 309 cm->prev_mi = cm->prev_mip + cm->mi_stride + 1; |
| 310 |
| 311 cm->prev_mi_grid_base = cm->mi_grid_base; |
| 312 cm->mi_grid_base = temp_base; |
| 313 cm->mi_grid_visible = cm->mi_grid_base + cm->mi_stride + 1; |
| 314 cm->prev_mi_grid_visible = cm->prev_mi_grid_base + cm->mi_stride + 1; |
251 } | 315 } |
252 | 316 |
253 void vp9_initialize_enc(void) { | 317 void vp9_initialize_enc(void) { |
254 static volatile int init_done = 0; | 318 static volatile int init_done = 0; |
255 | 319 |
256 if (!init_done) { | 320 if (!init_done) { |
257 vp9_rtcd(); | 321 vp9_rtcd(); |
| 322 vpx_dsp_rtcd(); |
| 323 vpx_scale_rtcd(); |
258 vp9_init_intra_predictors(); | 324 vp9_init_intra_predictors(); |
259 vp9_init_me_luts(); | 325 vp9_init_me_luts(); |
260 vp9_rc_init_minq_luts(); | 326 vp9_rc_init_minq_luts(); |
261 vp9_entropy_mv_init(); | 327 vp9_entropy_mv_init(); |
262 vp9_temporal_filter_init(); | 328 vp9_temporal_filter_init(); |
263 init_done = 1; | 329 init_done = 1; |
264 } | 330 } |
265 } | 331 } |
266 | 332 |
267 static void dealloc_compressor_data(VP9_COMP *cpi) { | 333 static void dealloc_compressor_data(VP9_COMP *cpi) { |
(...skipping 28 matching lines...) Expand all Loading... |
296 vpx_free(cpi->nmvsadcosts_hp[1]); | 362 vpx_free(cpi->nmvsadcosts_hp[1]); |
297 cpi->nmvsadcosts_hp[0] = NULL; | 363 cpi->nmvsadcosts_hp[0] = NULL; |
298 cpi->nmvsadcosts_hp[1] = NULL; | 364 cpi->nmvsadcosts_hp[1] = NULL; |
299 | 365 |
300 vp9_cyclic_refresh_free(cpi->cyclic_refresh); | 366 vp9_cyclic_refresh_free(cpi->cyclic_refresh); |
301 cpi->cyclic_refresh = NULL; | 367 cpi->cyclic_refresh = NULL; |
302 | 368 |
303 vpx_free(cpi->active_map.map); | 369 vpx_free(cpi->active_map.map); |
304 cpi->active_map.map = NULL; | 370 cpi->active_map.map = NULL; |
305 | 371 |
306 vp9_free_ref_frame_buffers(cm); | 372 vp9_free_ref_frame_buffers(cm->buffer_pool); |
| 373 #if CONFIG_VP9_POSTPROC |
| 374 vp9_free_postproc_buffers(cm); |
| 375 #endif |
307 vp9_free_context_buffers(cm); | 376 vp9_free_context_buffers(cm); |
308 | 377 |
309 vp9_free_frame_buffer(&cpi->last_frame_uf); | 378 vp9_free_frame_buffer(&cpi->last_frame_uf); |
310 vp9_free_frame_buffer(&cpi->scaled_source); | 379 vp9_free_frame_buffer(&cpi->scaled_source); |
311 vp9_free_frame_buffer(&cpi->scaled_last_source); | 380 vp9_free_frame_buffer(&cpi->scaled_last_source); |
312 vp9_free_frame_buffer(&cpi->alt_ref_buffer); | 381 vp9_free_frame_buffer(&cpi->alt_ref_buffer); |
313 vp9_lookahead_destroy(cpi->lookahead); | 382 vp9_lookahead_destroy(cpi->lookahead); |
314 | 383 |
315 vpx_free(cpi->tile_tok[0][0]); | 384 vpx_free(cpi->tile_tok[0][0]); |
316 cpi->tile_tok[0][0] = 0; | 385 cpi->tile_tok[0][0] = 0; |
317 | 386 |
318 vp9_free_pc_tree(&cpi->td); | 387 vp9_free_pc_tree(&cpi->td); |
319 | 388 |
320 for (i = 0; i < cpi->svc.number_spatial_layers; ++i) { | 389 for (i = 0; i < cpi->svc.number_spatial_layers; ++i) { |
321 LAYER_CONTEXT *const lc = &cpi->svc.layer_context[i]; | 390 LAYER_CONTEXT *const lc = &cpi->svc.layer_context[i]; |
322 vpx_free(lc->rc_twopass_stats_in.buf); | 391 vpx_free(lc->rc_twopass_stats_in.buf); |
323 lc->rc_twopass_stats_in.buf = NULL; | 392 lc->rc_twopass_stats_in.buf = NULL; |
324 lc->rc_twopass_stats_in.sz = 0; | 393 lc->rc_twopass_stats_in.sz = 0; |
325 } | 394 } |
326 | 395 |
327 if (cpi->source_diff_var != NULL) { | 396 if (cpi->source_diff_var != NULL) { |
328 vpx_free(cpi->source_diff_var); | 397 vpx_free(cpi->source_diff_var); |
329 cpi->source_diff_var = NULL; | 398 cpi->source_diff_var = NULL; |
330 } | 399 } |
331 | 400 |
332 for (i = 0; i < MAX_LAG_BUFFERS; ++i) { | 401 for (i = 0; i < MAX_LAG_BUFFERS; ++i) { |
333 vp9_free_frame_buffer(&cpi->svc.scaled_frames[i]); | 402 vp9_free_frame_buffer(&cpi->svc.scaled_frames[i]); |
334 } | 403 } |
335 vpx_memset(&cpi->svc.scaled_frames[0], 0, | 404 memset(&cpi->svc.scaled_frames[0], 0, |
336 MAX_LAG_BUFFERS * sizeof(cpi->svc.scaled_frames[0])); | 405 MAX_LAG_BUFFERS * sizeof(cpi->svc.scaled_frames[0])); |
337 | 406 |
338 vp9_free_frame_buffer(&cpi->svc.empty_frame.img); | 407 vp9_free_frame_buffer(&cpi->svc.empty_frame.img); |
339 vpx_memset(&cpi->svc.empty_frame, 0, sizeof(cpi->svc.empty_frame)); | 408 memset(&cpi->svc.empty_frame, 0, sizeof(cpi->svc.empty_frame)); |
340 } | 409 } |
341 | 410 |
342 static void save_coding_context(VP9_COMP *cpi) { | 411 static void save_coding_context(VP9_COMP *cpi) { |
343 CODING_CONTEXT *const cc = &cpi->coding_context; | 412 CODING_CONTEXT *const cc = &cpi->coding_context; |
344 VP9_COMMON *cm = &cpi->common; | 413 VP9_COMMON *cm = &cpi->common; |
345 | 414 |
346 // Stores a snapshot of key state variables which can subsequently be | 415 // Stores a snapshot of key state variables which can subsequently be |
347 // restored with a call to vp9_restore_coding_context. These functions are | 416 // restored with a call to vp9_restore_coding_context. These functions are |
348 // intended for use in a re-code loop in vp9_compress_frame where the | 417 // intended for use in a re-code loop in vp9_compress_frame where the |
349 // quantizer value is adjusted between loop iterations. | 418 // quantizer value is adjusted between loop iterations. |
350 vp9_copy(cc->nmvjointcost, cpi->td.mb.nmvjointcost); | 419 vp9_copy(cc->nmvjointcost, cpi->td.mb.nmvjointcost); |
351 | 420 |
352 vpx_memcpy(cc->nmvcosts[0], cpi->nmvcosts[0], | 421 memcpy(cc->nmvcosts[0], cpi->nmvcosts[0], |
353 MV_VALS * sizeof(*cpi->nmvcosts[0])); | 422 MV_VALS * sizeof(*cpi->nmvcosts[0])); |
354 vpx_memcpy(cc->nmvcosts[1], cpi->nmvcosts[1], | 423 memcpy(cc->nmvcosts[1], cpi->nmvcosts[1], |
355 MV_VALS * sizeof(*cpi->nmvcosts[1])); | 424 MV_VALS * sizeof(*cpi->nmvcosts[1])); |
356 vpx_memcpy(cc->nmvcosts_hp[0], cpi->nmvcosts_hp[0], | 425 memcpy(cc->nmvcosts_hp[0], cpi->nmvcosts_hp[0], |
357 MV_VALS * sizeof(*cpi->nmvcosts_hp[0])); | 426 MV_VALS * sizeof(*cpi->nmvcosts_hp[0])); |
358 vpx_memcpy(cc->nmvcosts_hp[1], cpi->nmvcosts_hp[1], | 427 memcpy(cc->nmvcosts_hp[1], cpi->nmvcosts_hp[1], |
359 MV_VALS * sizeof(*cpi->nmvcosts_hp[1])); | 428 MV_VALS * sizeof(*cpi->nmvcosts_hp[1])); |
360 | 429 |
361 vp9_copy(cc->segment_pred_probs, cm->seg.pred_probs); | 430 vp9_copy(cc->segment_pred_probs, cm->seg.pred_probs); |
362 | 431 |
363 vpx_memcpy(cpi->coding_context.last_frame_seg_map_copy, | 432 memcpy(cpi->coding_context.last_frame_seg_map_copy, |
364 cm->last_frame_seg_map, (cm->mi_rows * cm->mi_cols)); | 433 cm->last_frame_seg_map, (cm->mi_rows * cm->mi_cols)); |
365 | 434 |
366 vp9_copy(cc->last_ref_lf_deltas, cm->lf.last_ref_deltas); | 435 vp9_copy(cc->last_ref_lf_deltas, cm->lf.last_ref_deltas); |
367 vp9_copy(cc->last_mode_lf_deltas, cm->lf.last_mode_deltas); | 436 vp9_copy(cc->last_mode_lf_deltas, cm->lf.last_mode_deltas); |
368 | 437 |
369 cc->fc = *cm->fc; | 438 cc->fc = *cm->fc; |
370 } | 439 } |
371 | 440 |
372 static void restore_coding_context(VP9_COMP *cpi) { | 441 static void restore_coding_context(VP9_COMP *cpi) { |
373 CODING_CONTEXT *const cc = &cpi->coding_context; | 442 CODING_CONTEXT *const cc = &cpi->coding_context; |
374 VP9_COMMON *cm = &cpi->common; | 443 VP9_COMMON *cm = &cpi->common; |
375 | 444 |
376 // Restore key state variables to the snapshot state stored in the | 445 // Restore key state variables to the snapshot state stored in the |
377 // previous call to vp9_save_coding_context. | 446 // previous call to vp9_save_coding_context. |
378 vp9_copy(cpi->td.mb.nmvjointcost, cc->nmvjointcost); | 447 vp9_copy(cpi->td.mb.nmvjointcost, cc->nmvjointcost); |
379 | 448 |
380 vpx_memcpy(cpi->nmvcosts[0], cc->nmvcosts[0], | 449 memcpy(cpi->nmvcosts[0], cc->nmvcosts[0], MV_VALS * sizeof(*cc->nmvcosts[0])); |
381 MV_VALS * sizeof(*cc->nmvcosts[0])); | 450 memcpy(cpi->nmvcosts[1], cc->nmvcosts[1], MV_VALS * sizeof(*cc->nmvcosts[1])); |
382 vpx_memcpy(cpi->nmvcosts[1], cc->nmvcosts[1], | 451 memcpy(cpi->nmvcosts_hp[0], cc->nmvcosts_hp[0], |
383 MV_VALS * sizeof(*cc->nmvcosts[1])); | 452 MV_VALS * sizeof(*cc->nmvcosts_hp[0])); |
384 vpx_memcpy(cpi->nmvcosts_hp[0], cc->nmvcosts_hp[0], | 453 memcpy(cpi->nmvcosts_hp[1], cc->nmvcosts_hp[1], |
385 MV_VALS * sizeof(*cc->nmvcosts_hp[0])); | 454 MV_VALS * sizeof(*cc->nmvcosts_hp[1])); |
386 vpx_memcpy(cpi->nmvcosts_hp[1], cc->nmvcosts_hp[1], | |
387 MV_VALS * sizeof(*cc->nmvcosts_hp[1])); | |
388 | 455 |
389 vp9_copy(cm->seg.pred_probs, cc->segment_pred_probs); | 456 vp9_copy(cm->seg.pred_probs, cc->segment_pred_probs); |
390 | 457 |
391 vpx_memcpy(cm->last_frame_seg_map, | 458 memcpy(cm->last_frame_seg_map, |
392 cpi->coding_context.last_frame_seg_map_copy, | 459 cpi->coding_context.last_frame_seg_map_copy, |
393 (cm->mi_rows * cm->mi_cols)); | 460 (cm->mi_rows * cm->mi_cols)); |
394 | 461 |
395 vp9_copy(cm->lf.last_ref_deltas, cc->last_ref_lf_deltas); | 462 vp9_copy(cm->lf.last_ref_deltas, cc->last_ref_lf_deltas); |
396 vp9_copy(cm->lf.last_mode_deltas, cc->last_mode_lf_deltas); | 463 vp9_copy(cm->lf.last_mode_deltas, cc->last_mode_lf_deltas); |
397 | 464 |
398 *cm->fc = cc->fc; | 465 *cm->fc = cc->fc; |
399 } | 466 } |
400 | 467 |
401 static void configure_static_seg_features(VP9_COMP *cpi) { | 468 static void configure_static_seg_features(VP9_COMP *cpi) { |
402 VP9_COMMON *const cm = &cpi->common; | 469 VP9_COMMON *const cm = &cpi->common; |
403 const RATE_CONTROL *const rc = &cpi->rc; | 470 const RATE_CONTROL *const rc = &cpi->rc; |
404 struct segmentation *const seg = &cm->seg; | 471 struct segmentation *const seg = &cm->seg; |
405 | 472 |
406 int high_q = (int)(rc->avg_q > 48.0); | 473 int high_q = (int)(rc->avg_q > 48.0); |
407 int qi_delta; | 474 int qi_delta; |
408 | 475 |
409 // Disable and clear down for KF | 476 // Disable and clear down for KF |
410 if (cm->frame_type == KEY_FRAME) { | 477 if (cm->frame_type == KEY_FRAME) { |
411 // Clear down the global segmentation map | 478 // Clear down the global segmentation map |
412 vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols); | 479 memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols); |
413 seg->update_map = 0; | 480 seg->update_map = 0; |
414 seg->update_data = 0; | 481 seg->update_data = 0; |
415 cpi->static_mb_pct = 0; | 482 cpi->static_mb_pct = 0; |
416 | 483 |
417 // Disable segmentation | 484 // Disable segmentation |
418 vp9_disable_segmentation(seg); | 485 vp9_disable_segmentation(seg); |
419 | 486 |
420 // Clear down the segment features. | 487 // Clear down the segment features. |
421 vp9_clearall_segfeatures(seg); | 488 vp9_clearall_segfeatures(seg); |
422 } else if (cpi->refresh_alt_ref_frame) { | 489 } else if (cpi->refresh_alt_ref_frame) { |
423 // If this is an alt ref frame | 490 // If this is an alt ref frame |
424 // Clear down the global segmentation map | 491 // Clear down the global segmentation map |
425 vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols); | 492 memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols); |
426 seg->update_map = 0; | 493 seg->update_map = 0; |
427 seg->update_data = 0; | 494 seg->update_data = 0; |
428 cpi->static_mb_pct = 0; | 495 cpi->static_mb_pct = 0; |
429 | 496 |
430 // Disable segmentation and individual segment features by default | 497 // Disable segmentation and individual segment features by default |
431 vp9_disable_segmentation(seg); | 498 vp9_disable_segmentation(seg); |
432 vp9_clearall_segfeatures(seg); | 499 vp9_clearall_segfeatures(seg); |
433 | 500 |
434 // Scan frames from current to arf frame. | 501 // Scan frames from current to arf frame. |
435 // This function re-enables segmentation if appropriate. | 502 // This function re-enables segmentation if appropriate. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 vp9_set_segdata(seg, 1, SEG_LVL_REF_FRAME, ALTREF_FRAME); | 543 vp9_set_segdata(seg, 1, SEG_LVL_REF_FRAME, ALTREF_FRAME); |
477 vp9_enable_segfeature(seg, 1, SEG_LVL_REF_FRAME); | 544 vp9_enable_segfeature(seg, 1, SEG_LVL_REF_FRAME); |
478 vp9_enable_segfeature(seg, 1, SEG_LVL_SKIP); | 545 vp9_enable_segfeature(seg, 1, SEG_LVL_SKIP); |
479 } | 546 } |
480 } else { | 547 } else { |
481 // Disable segmentation and clear down features if alt ref | 548 // Disable segmentation and clear down features if alt ref |
482 // is not active for this group | 549 // is not active for this group |
483 | 550 |
484 vp9_disable_segmentation(seg); | 551 vp9_disable_segmentation(seg); |
485 | 552 |
486 vpx_memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols); | 553 memset(cpi->segmentation_map, 0, cm->mi_rows * cm->mi_cols); |
487 | 554 |
488 seg->update_map = 0; | 555 seg->update_map = 0; |
489 seg->update_data = 0; | 556 seg->update_data = 0; |
490 | 557 |
491 vp9_clearall_segfeatures(seg); | 558 vp9_clearall_segfeatures(seg); |
492 } | 559 } |
493 } else if (rc->is_src_frame_alt_ref) { | 560 } else if (rc->is_src_frame_alt_ref) { |
494 // Special case where we are coding over the top of a previous | 561 // Special case where we are coding over the top of a previous |
495 // alt ref frame. | 562 // alt ref frame. |
496 // Segment coding disabled for compred testing | 563 // Segment coding disabled for compred testing |
(...skipping 20 matching lines...) Expand all Loading... |
517 | 584 |
518 // No updates.. leave things as they are. | 585 // No updates.. leave things as they are. |
519 seg->update_map = 0; | 586 seg->update_map = 0; |
520 seg->update_data = 0; | 587 seg->update_data = 0; |
521 } | 588 } |
522 } | 589 } |
523 } | 590 } |
524 | 591 |
525 static void update_reference_segmentation_map(VP9_COMP *cpi) { | 592 static void update_reference_segmentation_map(VP9_COMP *cpi) { |
526 VP9_COMMON *const cm = &cpi->common; | 593 VP9_COMMON *const cm = &cpi->common; |
527 MODE_INFO *mi_8x8_ptr = cm->mi; | 594 MODE_INFO **mi_8x8_ptr = cm->mi_grid_visible; |
528 uint8_t *cache_ptr = cm->last_frame_seg_map; | 595 uint8_t *cache_ptr = cm->last_frame_seg_map; |
529 int row, col; | 596 int row, col; |
530 | 597 |
531 for (row = 0; row < cm->mi_rows; row++) { | 598 for (row = 0; row < cm->mi_rows; row++) { |
532 MODE_INFO *mi_8x8 = mi_8x8_ptr; | 599 MODE_INFO **mi_8x8 = mi_8x8_ptr; |
533 uint8_t *cache = cache_ptr; | 600 uint8_t *cache = cache_ptr; |
534 for (col = 0; col < cm->mi_cols; col++, mi_8x8++, cache++) | 601 for (col = 0; col < cm->mi_cols; col++, mi_8x8++, cache++) |
535 cache[0] = mi_8x8[0].src_mi->mbmi.segment_id; | 602 cache[0] = mi_8x8[0]->mbmi.segment_id; |
536 mi_8x8_ptr += cm->mi_stride; | 603 mi_8x8_ptr += cm->mi_stride; |
537 cache_ptr += cm->mi_cols; | 604 cache_ptr += cm->mi_cols; |
538 } | 605 } |
539 } | 606 } |
540 | 607 |
541 static void alloc_raw_frame_buffers(VP9_COMP *cpi) { | 608 static void alloc_raw_frame_buffers(VP9_COMP *cpi) { |
542 VP9_COMMON *cm = &cpi->common; | 609 VP9_COMMON *cm = &cpi->common; |
543 const VP9EncoderConfig *oxcf = &cpi->oxcf; | 610 const VP9EncoderConfig *oxcf = &cpi->oxcf; |
544 | 611 |
545 if (!cpi->lookahead) | 612 if (!cpi->lookahead) |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 cpi->framerate = framerate < 0.1 ? 30 : framerate; | 711 cpi->framerate = framerate < 0.1 ? 30 : framerate; |
645 vp9_rc_update_framerate(cpi); | 712 vp9_rc_update_framerate(cpi); |
646 } | 713 } |
647 | 714 |
648 static void set_tile_limits(VP9_COMP *cpi) { | 715 static void set_tile_limits(VP9_COMP *cpi) { |
649 VP9_COMMON *const cm = &cpi->common; | 716 VP9_COMMON *const cm = &cpi->common; |
650 | 717 |
651 int min_log2_tile_cols, max_log2_tile_cols; | 718 int min_log2_tile_cols, max_log2_tile_cols; |
652 vp9_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols); | 719 vp9_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols); |
653 | 720 |
654 cm->log2_tile_cols = clamp(cpi->oxcf.tile_columns, | 721 if (is_two_pass_svc(cpi) && cpi->svc.encode_empty_frame_state == ENCODING) { |
655 min_log2_tile_cols, max_log2_tile_cols); | 722 cm->log2_tile_cols = 0; |
656 cm->log2_tile_rows = cpi->oxcf.tile_rows; | 723 cm->log2_tile_rows = 0; |
| 724 } else { |
| 725 cm->log2_tile_cols = clamp(cpi->oxcf.tile_columns, |
| 726 min_log2_tile_cols, max_log2_tile_cols); |
| 727 cm->log2_tile_rows = cpi->oxcf.tile_rows; |
| 728 } |
657 } | 729 } |
658 | 730 |
659 static void init_buffer_indices(VP9_COMP *cpi) { | 731 static void init_buffer_indices(VP9_COMP *cpi) { |
660 cpi->lst_fb_idx = 0; | 732 cpi->lst_fb_idx = 0; |
661 cpi->gld_fb_idx = 1; | 733 cpi->gld_fb_idx = 1; |
662 cpi->alt_fb_idx = 2; | 734 cpi->alt_fb_idx = 2; |
663 } | 735 } |
664 | 736 |
665 static void init_config(struct VP9_COMP *cpi, VP9EncoderConfig *oxcf) { | 737 static void init_config(struct VP9_COMP *cpi, VP9EncoderConfig *oxcf) { |
666 VP9_COMMON *const cm = &cpi->common; | 738 VP9_COMMON *const cm = &cpi->common; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 int source_stride, \ | 924 int source_stride, \ |
853 const uint8_t* const ref_ptr[], \ | 925 const uint8_t* const ref_ptr[], \ |
854 int ref_stride, \ | 926 int ref_stride, \ |
855 unsigned int *sad_array) { \ | 927 unsigned int *sad_array) { \ |
856 int i; \ | 928 int i; \ |
857 fnname(src_ptr, source_stride, ref_ptr, ref_stride, sad_array); \ | 929 fnname(src_ptr, source_stride, ref_ptr, ref_stride, sad_array); \ |
858 for (i = 0; i < 4; i++) \ | 930 for (i = 0; i < 4; i++) \ |
859 sad_array[i] >>= 4; \ | 931 sad_array[i] >>= 4; \ |
860 } | 932 } |
861 | 933 |
862 MAKE_BFP_SAD_WRAPPER(vp9_highbd_sad32x16) | 934 MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad32x16) |
863 MAKE_BFP_SADAVG_WRAPPER(vp9_highbd_sad32x16_avg) | 935 MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad32x16_avg) |
864 MAKE_BFP_SAD4D_WRAPPER(vp9_highbd_sad32x16x4d) | 936 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad32x16x4d) |
865 MAKE_BFP_SAD_WRAPPER(vp9_highbd_sad16x32) | 937 MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad16x32) |
866 MAKE_BFP_SADAVG_WRAPPER(vp9_highbd_sad16x32_avg) | 938 MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad16x32_avg) |
867 MAKE_BFP_SAD4D_WRAPPER(vp9_highbd_sad16x32x4d) | 939 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad16x32x4d) |
868 MAKE_BFP_SAD_WRAPPER(vp9_highbd_sad64x32) | 940 MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad64x32) |
869 MAKE_BFP_SADAVG_WRAPPER(vp9_highbd_sad64x32_avg) | 941 MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad64x32_avg) |
870 MAKE_BFP_SAD4D_WRAPPER(vp9_highbd_sad64x32x4d) | 942 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad64x32x4d) |
871 MAKE_BFP_SAD_WRAPPER(vp9_highbd_sad32x64) | 943 MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad32x64) |
872 MAKE_BFP_SADAVG_WRAPPER(vp9_highbd_sad32x64_avg) | 944 MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad32x64_avg) |
873 MAKE_BFP_SAD4D_WRAPPER(vp9_highbd_sad32x64x4d) | 945 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad32x64x4d) |
874 MAKE_BFP_SAD_WRAPPER(vp9_highbd_sad32x32) | 946 MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad32x32) |
875 MAKE_BFP_SADAVG_WRAPPER(vp9_highbd_sad32x32_avg) | 947 MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad32x32_avg) |
876 MAKE_BFP_SAD3_WRAPPER(vp9_highbd_sad32x32x3) | 948 MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad32x32x3) |
877 MAKE_BFP_SAD8_WRAPPER(vp9_highbd_sad32x32x8) | 949 MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad32x32x8) |
878 MAKE_BFP_SAD4D_WRAPPER(vp9_highbd_sad32x32x4d) | 950 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad32x32x4d) |
879 MAKE_BFP_SAD_WRAPPER(vp9_highbd_sad64x64) | 951 MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad64x64) |
880 MAKE_BFP_SADAVG_WRAPPER(vp9_highbd_sad64x64_avg) | 952 MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad64x64_avg) |
881 MAKE_BFP_SAD3_WRAPPER(vp9_highbd_sad64x64x3) | 953 MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad64x64x3) |
882 MAKE_BFP_SAD8_WRAPPER(vp9_highbd_sad64x64x8) | 954 MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad64x64x8) |
883 MAKE_BFP_SAD4D_WRAPPER(vp9_highbd_sad64x64x4d) | 955 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad64x64x4d) |
884 MAKE_BFP_SAD_WRAPPER(vp9_highbd_sad16x16) | 956 MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad16x16) |
885 MAKE_BFP_SADAVG_WRAPPER(vp9_highbd_sad16x16_avg) | 957 MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad16x16_avg) |
886 MAKE_BFP_SAD3_WRAPPER(vp9_highbd_sad16x16x3) | 958 MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad16x16x3) |
887 MAKE_BFP_SAD8_WRAPPER(vp9_highbd_sad16x16x8) | 959 MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad16x16x8) |
888 MAKE_BFP_SAD4D_WRAPPER(vp9_highbd_sad16x16x4d) | 960 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad16x16x4d) |
889 MAKE_BFP_SAD_WRAPPER(vp9_highbd_sad16x8) | 961 MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad16x8) |
890 MAKE_BFP_SADAVG_WRAPPER(vp9_highbd_sad16x8_avg) | 962 MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad16x8_avg) |
891 MAKE_BFP_SAD3_WRAPPER(vp9_highbd_sad16x8x3) | 963 MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad16x8x3) |
892 MAKE_BFP_SAD8_WRAPPER(vp9_highbd_sad16x8x8) | 964 MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad16x8x8) |
893 MAKE_BFP_SAD4D_WRAPPER(vp9_highbd_sad16x8x4d) | 965 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad16x8x4d) |
894 MAKE_BFP_SAD_WRAPPER(vp9_highbd_sad8x16) | 966 MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad8x16) |
895 MAKE_BFP_SADAVG_WRAPPER(vp9_highbd_sad8x16_avg) | 967 MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad8x16_avg) |
896 MAKE_BFP_SAD3_WRAPPER(vp9_highbd_sad8x16x3) | 968 MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad8x16x3) |
897 MAKE_BFP_SAD8_WRAPPER(vp9_highbd_sad8x16x8) | 969 MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad8x16x8) |
898 MAKE_BFP_SAD4D_WRAPPER(vp9_highbd_sad8x16x4d) | 970 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad8x16x4d) |
899 MAKE_BFP_SAD_WRAPPER(vp9_highbd_sad8x8) | 971 MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad8x8) |
900 MAKE_BFP_SADAVG_WRAPPER(vp9_highbd_sad8x8_avg) | 972 MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad8x8_avg) |
901 MAKE_BFP_SAD3_WRAPPER(vp9_highbd_sad8x8x3) | 973 MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad8x8x3) |
902 MAKE_BFP_SAD8_WRAPPER(vp9_highbd_sad8x8x8) | 974 MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad8x8x8) |
903 MAKE_BFP_SAD4D_WRAPPER(vp9_highbd_sad8x8x4d) | 975 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad8x8x4d) |
904 MAKE_BFP_SAD_WRAPPER(vp9_highbd_sad8x4) | 976 MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad8x4) |
905 MAKE_BFP_SADAVG_WRAPPER(vp9_highbd_sad8x4_avg) | 977 MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad8x4_avg) |
906 MAKE_BFP_SAD8_WRAPPER(vp9_highbd_sad8x4x8) | 978 MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad8x4x8) |
907 MAKE_BFP_SAD4D_WRAPPER(vp9_highbd_sad8x4x4d) | 979 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad8x4x4d) |
908 MAKE_BFP_SAD_WRAPPER(vp9_highbd_sad4x8) | 980 MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad4x8) |
909 MAKE_BFP_SADAVG_WRAPPER(vp9_highbd_sad4x8_avg) | 981 MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad4x8_avg) |
910 MAKE_BFP_SAD8_WRAPPER(vp9_highbd_sad4x8x8) | 982 MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad4x8x8) |
911 MAKE_BFP_SAD4D_WRAPPER(vp9_highbd_sad4x8x4d) | 983 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad4x8x4d) |
912 MAKE_BFP_SAD_WRAPPER(vp9_highbd_sad4x4) | 984 MAKE_BFP_SAD_WRAPPER(vpx_highbd_sad4x4) |
913 MAKE_BFP_SADAVG_WRAPPER(vp9_highbd_sad4x4_avg) | 985 MAKE_BFP_SADAVG_WRAPPER(vpx_highbd_sad4x4_avg) |
914 MAKE_BFP_SAD3_WRAPPER(vp9_highbd_sad4x4x3) | 986 MAKE_BFP_SAD3_WRAPPER(vpx_highbd_sad4x4x3) |
915 MAKE_BFP_SAD8_WRAPPER(vp9_highbd_sad4x4x8) | 987 MAKE_BFP_SAD8_WRAPPER(vpx_highbd_sad4x4x8) |
916 MAKE_BFP_SAD4D_WRAPPER(vp9_highbd_sad4x4x4d) | 988 MAKE_BFP_SAD4D_WRAPPER(vpx_highbd_sad4x4x4d) |
917 | 989 |
918 static void highbd_set_var_fns(VP9_COMP *const cpi) { | 990 static void highbd_set_var_fns(VP9_COMP *const cpi) { |
919 VP9_COMMON *const cm = &cpi->common; | 991 VP9_COMMON *const cm = &cpi->common; |
920 if (cm->use_highbitdepth) { | 992 if (cm->use_highbitdepth) { |
921 switch (cm->bit_depth) { | 993 switch (cm->bit_depth) { |
922 case VPX_BITS_8: | 994 case VPX_BITS_8: |
923 HIGHBD_BFP(BLOCK_32X16, | 995 HIGHBD_BFP(BLOCK_32X16, |
924 vp9_highbd_sad32x16_bits8, | 996 vpx_highbd_sad32x16_bits8, |
925 vp9_highbd_sad32x16_avg_bits8, | 997 vpx_highbd_sad32x16_avg_bits8, |
926 vp9_highbd_variance32x16, | 998 vp9_highbd_variance32x16, |
927 vp9_highbd_sub_pixel_variance32x16, | 999 vp9_highbd_sub_pixel_variance32x16, |
928 vp9_highbd_sub_pixel_avg_variance32x16, | 1000 vp9_highbd_sub_pixel_avg_variance32x16, |
929 NULL, | 1001 NULL, |
930 NULL, | 1002 NULL, |
931 vp9_highbd_sad32x16x4d_bits8) | 1003 vpx_highbd_sad32x16x4d_bits8) |
932 | 1004 |
933 HIGHBD_BFP(BLOCK_16X32, | 1005 HIGHBD_BFP(BLOCK_16X32, |
934 vp9_highbd_sad16x32_bits8, | 1006 vpx_highbd_sad16x32_bits8, |
935 vp9_highbd_sad16x32_avg_bits8, | 1007 vpx_highbd_sad16x32_avg_bits8, |
936 vp9_highbd_variance16x32, | 1008 vp9_highbd_variance16x32, |
937 vp9_highbd_sub_pixel_variance16x32, | 1009 vp9_highbd_sub_pixel_variance16x32, |
938 vp9_highbd_sub_pixel_avg_variance16x32, | 1010 vp9_highbd_sub_pixel_avg_variance16x32, |
939 NULL, | 1011 NULL, |
940 NULL, | 1012 NULL, |
941 vp9_highbd_sad16x32x4d_bits8) | 1013 vpx_highbd_sad16x32x4d_bits8) |
942 | 1014 |
943 HIGHBD_BFP(BLOCK_64X32, | 1015 HIGHBD_BFP(BLOCK_64X32, |
944 vp9_highbd_sad64x32_bits8, | 1016 vpx_highbd_sad64x32_bits8, |
945 vp9_highbd_sad64x32_avg_bits8, | 1017 vpx_highbd_sad64x32_avg_bits8, |
946 vp9_highbd_variance64x32, | 1018 vp9_highbd_variance64x32, |
947 vp9_highbd_sub_pixel_variance64x32, | 1019 vp9_highbd_sub_pixel_variance64x32, |
948 vp9_highbd_sub_pixel_avg_variance64x32, | 1020 vp9_highbd_sub_pixel_avg_variance64x32, |
949 NULL, | 1021 NULL, |
950 NULL, | 1022 NULL, |
951 vp9_highbd_sad64x32x4d_bits8) | 1023 vpx_highbd_sad64x32x4d_bits8) |
952 | 1024 |
953 HIGHBD_BFP(BLOCK_32X64, | 1025 HIGHBD_BFP(BLOCK_32X64, |
954 vp9_highbd_sad32x64_bits8, | 1026 vpx_highbd_sad32x64_bits8, |
955 vp9_highbd_sad32x64_avg_bits8, | 1027 vpx_highbd_sad32x64_avg_bits8, |
956 vp9_highbd_variance32x64, | 1028 vp9_highbd_variance32x64, |
957 vp9_highbd_sub_pixel_variance32x64, | 1029 vp9_highbd_sub_pixel_variance32x64, |
958 vp9_highbd_sub_pixel_avg_variance32x64, | 1030 vp9_highbd_sub_pixel_avg_variance32x64, |
959 NULL, | 1031 NULL, |
960 NULL, | 1032 NULL, |
961 vp9_highbd_sad32x64x4d_bits8) | 1033 vpx_highbd_sad32x64x4d_bits8) |
962 | 1034 |
963 HIGHBD_BFP(BLOCK_32X32, | 1035 HIGHBD_BFP(BLOCK_32X32, |
964 vp9_highbd_sad32x32_bits8, | 1036 vpx_highbd_sad32x32_bits8, |
965 vp9_highbd_sad32x32_avg_bits8, | 1037 vpx_highbd_sad32x32_avg_bits8, |
966 vp9_highbd_variance32x32, | 1038 vp9_highbd_variance32x32, |
967 vp9_highbd_sub_pixel_variance32x32, | 1039 vp9_highbd_sub_pixel_variance32x32, |
968 vp9_highbd_sub_pixel_avg_variance32x32, | 1040 vp9_highbd_sub_pixel_avg_variance32x32, |
969 vp9_highbd_sad32x32x3_bits8, | 1041 vpx_highbd_sad32x32x3_bits8, |
970 vp9_highbd_sad32x32x8_bits8, | 1042 vpx_highbd_sad32x32x8_bits8, |
971 vp9_highbd_sad32x32x4d_bits8) | 1043 vpx_highbd_sad32x32x4d_bits8) |
972 | 1044 |
973 HIGHBD_BFP(BLOCK_64X64, | 1045 HIGHBD_BFP(BLOCK_64X64, |
974 vp9_highbd_sad64x64_bits8, | 1046 vpx_highbd_sad64x64_bits8, |
975 vp9_highbd_sad64x64_avg_bits8, | 1047 vpx_highbd_sad64x64_avg_bits8, |
976 vp9_highbd_variance64x64, | 1048 vp9_highbd_variance64x64, |
977 vp9_highbd_sub_pixel_variance64x64, | 1049 vp9_highbd_sub_pixel_variance64x64, |
978 vp9_highbd_sub_pixel_avg_variance64x64, | 1050 vp9_highbd_sub_pixel_avg_variance64x64, |
979 vp9_highbd_sad64x64x3_bits8, | 1051 vpx_highbd_sad64x64x3_bits8, |
980 vp9_highbd_sad64x64x8_bits8, | 1052 vpx_highbd_sad64x64x8_bits8, |
981 vp9_highbd_sad64x64x4d_bits8) | 1053 vpx_highbd_sad64x64x4d_bits8) |
982 | 1054 |
983 HIGHBD_BFP(BLOCK_16X16, | 1055 HIGHBD_BFP(BLOCK_16X16, |
984 vp9_highbd_sad16x16_bits8, | 1056 vpx_highbd_sad16x16_bits8, |
985 vp9_highbd_sad16x16_avg_bits8, | 1057 vpx_highbd_sad16x16_avg_bits8, |
986 vp9_highbd_variance16x16, | 1058 vp9_highbd_variance16x16, |
987 vp9_highbd_sub_pixel_variance16x16, | 1059 vp9_highbd_sub_pixel_variance16x16, |
988 vp9_highbd_sub_pixel_avg_variance16x16, | 1060 vp9_highbd_sub_pixel_avg_variance16x16, |
989 vp9_highbd_sad16x16x3_bits8, | 1061 vpx_highbd_sad16x16x3_bits8, |
990 vp9_highbd_sad16x16x8_bits8, | 1062 vpx_highbd_sad16x16x8_bits8, |
991 vp9_highbd_sad16x16x4d_bits8) | 1063 vpx_highbd_sad16x16x4d_bits8) |
992 | 1064 |
993 HIGHBD_BFP(BLOCK_16X8, | 1065 HIGHBD_BFP(BLOCK_16X8, |
994 vp9_highbd_sad16x8_bits8, | 1066 vpx_highbd_sad16x8_bits8, |
995 vp9_highbd_sad16x8_avg_bits8, | 1067 vpx_highbd_sad16x8_avg_bits8, |
996 vp9_highbd_variance16x8, | 1068 vp9_highbd_variance16x8, |
997 vp9_highbd_sub_pixel_variance16x8, | 1069 vp9_highbd_sub_pixel_variance16x8, |
998 vp9_highbd_sub_pixel_avg_variance16x8, | 1070 vp9_highbd_sub_pixel_avg_variance16x8, |
999 vp9_highbd_sad16x8x3_bits8, | 1071 vpx_highbd_sad16x8x3_bits8, |
1000 vp9_highbd_sad16x8x8_bits8, | 1072 vpx_highbd_sad16x8x8_bits8, |
1001 vp9_highbd_sad16x8x4d_bits8) | 1073 vpx_highbd_sad16x8x4d_bits8) |
1002 | 1074 |
1003 HIGHBD_BFP(BLOCK_8X16, | 1075 HIGHBD_BFP(BLOCK_8X16, |
1004 vp9_highbd_sad8x16_bits8, | 1076 vpx_highbd_sad8x16_bits8, |
1005 vp9_highbd_sad8x16_avg_bits8, | 1077 vpx_highbd_sad8x16_avg_bits8, |
1006 vp9_highbd_variance8x16, | 1078 vp9_highbd_variance8x16, |
1007 vp9_highbd_sub_pixel_variance8x16, | 1079 vp9_highbd_sub_pixel_variance8x16, |
1008 vp9_highbd_sub_pixel_avg_variance8x16, | 1080 vp9_highbd_sub_pixel_avg_variance8x16, |
1009 vp9_highbd_sad8x16x3_bits8, | 1081 vpx_highbd_sad8x16x3_bits8, |
1010 vp9_highbd_sad8x16x8_bits8, | 1082 vpx_highbd_sad8x16x8_bits8, |
1011 vp9_highbd_sad8x16x4d_bits8) | 1083 vpx_highbd_sad8x16x4d_bits8) |
1012 | 1084 |
1013 HIGHBD_BFP(BLOCK_8X8, | 1085 HIGHBD_BFP(BLOCK_8X8, |
1014 vp9_highbd_sad8x8_bits8, | 1086 vpx_highbd_sad8x8_bits8, |
1015 vp9_highbd_sad8x8_avg_bits8, | 1087 vpx_highbd_sad8x8_avg_bits8, |
1016 vp9_highbd_variance8x8, | 1088 vp9_highbd_variance8x8, |
1017 vp9_highbd_sub_pixel_variance8x8, | 1089 vp9_highbd_sub_pixel_variance8x8, |
1018 vp9_highbd_sub_pixel_avg_variance8x8, | 1090 vp9_highbd_sub_pixel_avg_variance8x8, |
1019 vp9_highbd_sad8x8x3_bits8, | 1091 vpx_highbd_sad8x8x3_bits8, |
1020 vp9_highbd_sad8x8x8_bits8, | 1092 vpx_highbd_sad8x8x8_bits8, |
1021 vp9_highbd_sad8x8x4d_bits8) | 1093 vpx_highbd_sad8x8x4d_bits8) |
1022 | 1094 |
1023 HIGHBD_BFP(BLOCK_8X4, | 1095 HIGHBD_BFP(BLOCK_8X4, |
1024 vp9_highbd_sad8x4_bits8, | 1096 vpx_highbd_sad8x4_bits8, |
1025 vp9_highbd_sad8x4_avg_bits8, | 1097 vpx_highbd_sad8x4_avg_bits8, |
1026 vp9_highbd_variance8x4, | 1098 vp9_highbd_variance8x4, |
1027 vp9_highbd_sub_pixel_variance8x4, | 1099 vp9_highbd_sub_pixel_variance8x4, |
1028 vp9_highbd_sub_pixel_avg_variance8x4, | 1100 vp9_highbd_sub_pixel_avg_variance8x4, |
1029 NULL, | 1101 NULL, |
1030 vp9_highbd_sad8x4x8_bits8, | 1102 vpx_highbd_sad8x4x8_bits8, |
1031 vp9_highbd_sad8x4x4d_bits8) | 1103 vpx_highbd_sad8x4x4d_bits8) |
1032 | 1104 |
1033 HIGHBD_BFP(BLOCK_4X8, | 1105 HIGHBD_BFP(BLOCK_4X8, |
1034 vp9_highbd_sad4x8_bits8, | 1106 vpx_highbd_sad4x8_bits8, |
1035 vp9_highbd_sad4x8_avg_bits8, | 1107 vpx_highbd_sad4x8_avg_bits8, |
1036 vp9_highbd_variance4x8, | 1108 vp9_highbd_variance4x8, |
1037 vp9_highbd_sub_pixel_variance4x8, | 1109 vp9_highbd_sub_pixel_variance4x8, |
1038 vp9_highbd_sub_pixel_avg_variance4x8, | 1110 vp9_highbd_sub_pixel_avg_variance4x8, |
1039 NULL, | 1111 NULL, |
1040 vp9_highbd_sad4x8x8_bits8, | 1112 vpx_highbd_sad4x8x8_bits8, |
1041 vp9_highbd_sad4x8x4d_bits8) | 1113 vpx_highbd_sad4x8x4d_bits8) |
1042 | 1114 |
1043 HIGHBD_BFP(BLOCK_4X4, | 1115 HIGHBD_BFP(BLOCK_4X4, |
1044 vp9_highbd_sad4x4_bits8, | 1116 vpx_highbd_sad4x4_bits8, |
1045 vp9_highbd_sad4x4_avg_bits8, | 1117 vpx_highbd_sad4x4_avg_bits8, |
1046 vp9_highbd_variance4x4, | 1118 vp9_highbd_variance4x4, |
1047 vp9_highbd_sub_pixel_variance4x4, | 1119 vp9_highbd_sub_pixel_variance4x4, |
1048 vp9_highbd_sub_pixel_avg_variance4x4, | 1120 vp9_highbd_sub_pixel_avg_variance4x4, |
1049 vp9_highbd_sad4x4x3_bits8, | 1121 vpx_highbd_sad4x4x3_bits8, |
1050 vp9_highbd_sad4x4x8_bits8, | 1122 vpx_highbd_sad4x4x8_bits8, |
1051 vp9_highbd_sad4x4x4d_bits8) | 1123 vpx_highbd_sad4x4x4d_bits8) |
1052 break; | 1124 break; |
1053 | 1125 |
1054 case VPX_BITS_10: | 1126 case VPX_BITS_10: |
1055 HIGHBD_BFP(BLOCK_32X16, | 1127 HIGHBD_BFP(BLOCK_32X16, |
1056 vp9_highbd_sad32x16_bits10, | 1128 vpx_highbd_sad32x16_bits10, |
1057 vp9_highbd_sad32x16_avg_bits10, | 1129 vpx_highbd_sad32x16_avg_bits10, |
1058 vp9_highbd_10_variance32x16, | 1130 vp9_highbd_10_variance32x16, |
1059 vp9_highbd_10_sub_pixel_variance32x16, | 1131 vp9_highbd_10_sub_pixel_variance32x16, |
1060 vp9_highbd_10_sub_pixel_avg_variance32x16, | 1132 vp9_highbd_10_sub_pixel_avg_variance32x16, |
1061 NULL, | 1133 NULL, |
1062 NULL, | 1134 NULL, |
1063 vp9_highbd_sad32x16x4d_bits10) | 1135 vpx_highbd_sad32x16x4d_bits10) |
1064 | 1136 |
1065 HIGHBD_BFP(BLOCK_16X32, | 1137 HIGHBD_BFP(BLOCK_16X32, |
1066 vp9_highbd_sad16x32_bits10, | 1138 vpx_highbd_sad16x32_bits10, |
1067 vp9_highbd_sad16x32_avg_bits10, | 1139 vpx_highbd_sad16x32_avg_bits10, |
1068 vp9_highbd_10_variance16x32, | 1140 vp9_highbd_10_variance16x32, |
1069 vp9_highbd_10_sub_pixel_variance16x32, | 1141 vp9_highbd_10_sub_pixel_variance16x32, |
1070 vp9_highbd_10_sub_pixel_avg_variance16x32, | 1142 vp9_highbd_10_sub_pixel_avg_variance16x32, |
1071 NULL, | 1143 NULL, |
1072 NULL, | 1144 NULL, |
1073 vp9_highbd_sad16x32x4d_bits10) | 1145 vpx_highbd_sad16x32x4d_bits10) |
1074 | 1146 |
1075 HIGHBD_BFP(BLOCK_64X32, | 1147 HIGHBD_BFP(BLOCK_64X32, |
1076 vp9_highbd_sad64x32_bits10, | 1148 vpx_highbd_sad64x32_bits10, |
1077 vp9_highbd_sad64x32_avg_bits10, | 1149 vpx_highbd_sad64x32_avg_bits10, |
1078 vp9_highbd_10_variance64x32, | 1150 vp9_highbd_10_variance64x32, |
1079 vp9_highbd_10_sub_pixel_variance64x32, | 1151 vp9_highbd_10_sub_pixel_variance64x32, |
1080 vp9_highbd_10_sub_pixel_avg_variance64x32, | 1152 vp9_highbd_10_sub_pixel_avg_variance64x32, |
1081 NULL, | 1153 NULL, |
1082 NULL, | 1154 NULL, |
1083 vp9_highbd_sad64x32x4d_bits10) | 1155 vpx_highbd_sad64x32x4d_bits10) |
1084 | 1156 |
1085 HIGHBD_BFP(BLOCK_32X64, | 1157 HIGHBD_BFP(BLOCK_32X64, |
1086 vp9_highbd_sad32x64_bits10, | 1158 vpx_highbd_sad32x64_bits10, |
1087 vp9_highbd_sad32x64_avg_bits10, | 1159 vpx_highbd_sad32x64_avg_bits10, |
1088 vp9_highbd_10_variance32x64, | 1160 vp9_highbd_10_variance32x64, |
1089 vp9_highbd_10_sub_pixel_variance32x64, | 1161 vp9_highbd_10_sub_pixel_variance32x64, |
1090 vp9_highbd_10_sub_pixel_avg_variance32x64, | 1162 vp9_highbd_10_sub_pixel_avg_variance32x64, |
1091 NULL, | 1163 NULL, |
1092 NULL, | 1164 NULL, |
1093 vp9_highbd_sad32x64x4d_bits10) | 1165 vpx_highbd_sad32x64x4d_bits10) |
1094 | 1166 |
1095 HIGHBD_BFP(BLOCK_32X32, | 1167 HIGHBD_BFP(BLOCK_32X32, |
1096 vp9_highbd_sad32x32_bits10, | 1168 vpx_highbd_sad32x32_bits10, |
1097 vp9_highbd_sad32x32_avg_bits10, | 1169 vpx_highbd_sad32x32_avg_bits10, |
1098 vp9_highbd_10_variance32x32, | 1170 vp9_highbd_10_variance32x32, |
1099 vp9_highbd_10_sub_pixel_variance32x32, | 1171 vp9_highbd_10_sub_pixel_variance32x32, |
1100 vp9_highbd_10_sub_pixel_avg_variance32x32, | 1172 vp9_highbd_10_sub_pixel_avg_variance32x32, |
1101 vp9_highbd_sad32x32x3_bits10, | 1173 vpx_highbd_sad32x32x3_bits10, |
1102 vp9_highbd_sad32x32x8_bits10, | 1174 vpx_highbd_sad32x32x8_bits10, |
1103 vp9_highbd_sad32x32x4d_bits10) | 1175 vpx_highbd_sad32x32x4d_bits10) |
1104 | 1176 |
1105 HIGHBD_BFP(BLOCK_64X64, | 1177 HIGHBD_BFP(BLOCK_64X64, |
1106 vp9_highbd_sad64x64_bits10, | 1178 vpx_highbd_sad64x64_bits10, |
1107 vp9_highbd_sad64x64_avg_bits10, | 1179 vpx_highbd_sad64x64_avg_bits10, |
1108 vp9_highbd_10_variance64x64, | 1180 vp9_highbd_10_variance64x64, |
1109 vp9_highbd_10_sub_pixel_variance64x64, | 1181 vp9_highbd_10_sub_pixel_variance64x64, |
1110 vp9_highbd_10_sub_pixel_avg_variance64x64, | 1182 vp9_highbd_10_sub_pixel_avg_variance64x64, |
1111 vp9_highbd_sad64x64x3_bits10, | 1183 vpx_highbd_sad64x64x3_bits10, |
1112 vp9_highbd_sad64x64x8_bits10, | 1184 vpx_highbd_sad64x64x8_bits10, |
1113 vp9_highbd_sad64x64x4d_bits10) | 1185 vpx_highbd_sad64x64x4d_bits10) |
1114 | 1186 |
1115 HIGHBD_BFP(BLOCK_16X16, | 1187 HIGHBD_BFP(BLOCK_16X16, |
1116 vp9_highbd_sad16x16_bits10, | 1188 vpx_highbd_sad16x16_bits10, |
1117 vp9_highbd_sad16x16_avg_bits10, | 1189 vpx_highbd_sad16x16_avg_bits10, |
1118 vp9_highbd_10_variance16x16, | 1190 vp9_highbd_10_variance16x16, |
1119 vp9_highbd_10_sub_pixel_variance16x16, | 1191 vp9_highbd_10_sub_pixel_variance16x16, |
1120 vp9_highbd_10_sub_pixel_avg_variance16x16, | 1192 vp9_highbd_10_sub_pixel_avg_variance16x16, |
1121 vp9_highbd_sad16x16x3_bits10, | 1193 vpx_highbd_sad16x16x3_bits10, |
1122 vp9_highbd_sad16x16x8_bits10, | 1194 vpx_highbd_sad16x16x8_bits10, |
1123 vp9_highbd_sad16x16x4d_bits10) | 1195 vpx_highbd_sad16x16x4d_bits10) |
1124 | 1196 |
1125 HIGHBD_BFP(BLOCK_16X8, | 1197 HIGHBD_BFP(BLOCK_16X8, |
1126 vp9_highbd_sad16x8_bits10, | 1198 vpx_highbd_sad16x8_bits10, |
1127 vp9_highbd_sad16x8_avg_bits10, | 1199 vpx_highbd_sad16x8_avg_bits10, |
1128 vp9_highbd_10_variance16x8, | 1200 vp9_highbd_10_variance16x8, |
1129 vp9_highbd_10_sub_pixel_variance16x8, | 1201 vp9_highbd_10_sub_pixel_variance16x8, |
1130 vp9_highbd_10_sub_pixel_avg_variance16x8, | 1202 vp9_highbd_10_sub_pixel_avg_variance16x8, |
1131 vp9_highbd_sad16x8x3_bits10, | 1203 vpx_highbd_sad16x8x3_bits10, |
1132 vp9_highbd_sad16x8x8_bits10, | 1204 vpx_highbd_sad16x8x8_bits10, |
1133 vp9_highbd_sad16x8x4d_bits10) | 1205 vpx_highbd_sad16x8x4d_bits10) |
1134 | 1206 |
1135 HIGHBD_BFP(BLOCK_8X16, | 1207 HIGHBD_BFP(BLOCK_8X16, |
1136 vp9_highbd_sad8x16_bits10, | 1208 vpx_highbd_sad8x16_bits10, |
1137 vp9_highbd_sad8x16_avg_bits10, | 1209 vpx_highbd_sad8x16_avg_bits10, |
1138 vp9_highbd_10_variance8x16, | 1210 vp9_highbd_10_variance8x16, |
1139 vp9_highbd_10_sub_pixel_variance8x16, | 1211 vp9_highbd_10_sub_pixel_variance8x16, |
1140 vp9_highbd_10_sub_pixel_avg_variance8x16, | 1212 vp9_highbd_10_sub_pixel_avg_variance8x16, |
1141 vp9_highbd_sad8x16x3_bits10, | 1213 vpx_highbd_sad8x16x3_bits10, |
1142 vp9_highbd_sad8x16x8_bits10, | 1214 vpx_highbd_sad8x16x8_bits10, |
1143 vp9_highbd_sad8x16x4d_bits10) | 1215 vpx_highbd_sad8x16x4d_bits10) |
1144 | 1216 |
1145 HIGHBD_BFP(BLOCK_8X8, | 1217 HIGHBD_BFP(BLOCK_8X8, |
1146 vp9_highbd_sad8x8_bits10, | 1218 vpx_highbd_sad8x8_bits10, |
1147 vp9_highbd_sad8x8_avg_bits10, | 1219 vpx_highbd_sad8x8_avg_bits10, |
1148 vp9_highbd_10_variance8x8, | 1220 vp9_highbd_10_variance8x8, |
1149 vp9_highbd_10_sub_pixel_variance8x8, | 1221 vp9_highbd_10_sub_pixel_variance8x8, |
1150 vp9_highbd_10_sub_pixel_avg_variance8x8, | 1222 vp9_highbd_10_sub_pixel_avg_variance8x8, |
1151 vp9_highbd_sad8x8x3_bits10, | 1223 vpx_highbd_sad8x8x3_bits10, |
1152 vp9_highbd_sad8x8x8_bits10, | 1224 vpx_highbd_sad8x8x8_bits10, |
1153 vp9_highbd_sad8x8x4d_bits10) | 1225 vpx_highbd_sad8x8x4d_bits10) |
1154 | 1226 |
1155 HIGHBD_BFP(BLOCK_8X4, | 1227 HIGHBD_BFP(BLOCK_8X4, |
1156 vp9_highbd_sad8x4_bits10, | 1228 vpx_highbd_sad8x4_bits10, |
1157 vp9_highbd_sad8x4_avg_bits10, | 1229 vpx_highbd_sad8x4_avg_bits10, |
1158 vp9_highbd_10_variance8x4, | 1230 vp9_highbd_10_variance8x4, |
1159 vp9_highbd_10_sub_pixel_variance8x4, | 1231 vp9_highbd_10_sub_pixel_variance8x4, |
1160 vp9_highbd_10_sub_pixel_avg_variance8x4, | 1232 vp9_highbd_10_sub_pixel_avg_variance8x4, |
1161 NULL, | 1233 NULL, |
1162 vp9_highbd_sad8x4x8_bits10, | 1234 vpx_highbd_sad8x4x8_bits10, |
1163 vp9_highbd_sad8x4x4d_bits10) | 1235 vpx_highbd_sad8x4x4d_bits10) |
1164 | 1236 |
1165 HIGHBD_BFP(BLOCK_4X8, | 1237 HIGHBD_BFP(BLOCK_4X8, |
1166 vp9_highbd_sad4x8_bits10, | 1238 vpx_highbd_sad4x8_bits10, |
1167 vp9_highbd_sad4x8_avg_bits10, | 1239 vpx_highbd_sad4x8_avg_bits10, |
1168 vp9_highbd_10_variance4x8, | 1240 vp9_highbd_10_variance4x8, |
1169 vp9_highbd_10_sub_pixel_variance4x8, | 1241 vp9_highbd_10_sub_pixel_variance4x8, |
1170 vp9_highbd_10_sub_pixel_avg_variance4x8, | 1242 vp9_highbd_10_sub_pixel_avg_variance4x8, |
1171 NULL, | 1243 NULL, |
1172 vp9_highbd_sad4x8x8_bits10, | 1244 vpx_highbd_sad4x8x8_bits10, |
1173 vp9_highbd_sad4x8x4d_bits10) | 1245 vpx_highbd_sad4x8x4d_bits10) |
1174 | 1246 |
1175 HIGHBD_BFP(BLOCK_4X4, | 1247 HIGHBD_BFP(BLOCK_4X4, |
1176 vp9_highbd_sad4x4_bits10, | 1248 vpx_highbd_sad4x4_bits10, |
1177 vp9_highbd_sad4x4_avg_bits10, | 1249 vpx_highbd_sad4x4_avg_bits10, |
1178 vp9_highbd_10_variance4x4, | 1250 vp9_highbd_10_variance4x4, |
1179 vp9_highbd_10_sub_pixel_variance4x4, | 1251 vp9_highbd_10_sub_pixel_variance4x4, |
1180 vp9_highbd_10_sub_pixel_avg_variance4x4, | 1252 vp9_highbd_10_sub_pixel_avg_variance4x4, |
1181 vp9_highbd_sad4x4x3_bits10, | 1253 vpx_highbd_sad4x4x3_bits10, |
1182 vp9_highbd_sad4x4x8_bits10, | 1254 vpx_highbd_sad4x4x8_bits10, |
1183 vp9_highbd_sad4x4x4d_bits10) | 1255 vpx_highbd_sad4x4x4d_bits10) |
1184 break; | 1256 break; |
1185 | 1257 |
1186 case VPX_BITS_12: | 1258 case VPX_BITS_12: |
1187 HIGHBD_BFP(BLOCK_32X16, | 1259 HIGHBD_BFP(BLOCK_32X16, |
1188 vp9_highbd_sad32x16_bits12, | 1260 vpx_highbd_sad32x16_bits12, |
1189 vp9_highbd_sad32x16_avg_bits12, | 1261 vpx_highbd_sad32x16_avg_bits12, |
1190 vp9_highbd_12_variance32x16, | 1262 vp9_highbd_12_variance32x16, |
1191 vp9_highbd_12_sub_pixel_variance32x16, | 1263 vp9_highbd_12_sub_pixel_variance32x16, |
1192 vp9_highbd_12_sub_pixel_avg_variance32x16, | 1264 vp9_highbd_12_sub_pixel_avg_variance32x16, |
1193 NULL, | 1265 NULL, |
1194 NULL, | 1266 NULL, |
1195 vp9_highbd_sad32x16x4d_bits12) | 1267 vpx_highbd_sad32x16x4d_bits12) |
1196 | 1268 |
1197 HIGHBD_BFP(BLOCK_16X32, | 1269 HIGHBD_BFP(BLOCK_16X32, |
1198 vp9_highbd_sad16x32_bits12, | 1270 vpx_highbd_sad16x32_bits12, |
1199 vp9_highbd_sad16x32_avg_bits12, | 1271 vpx_highbd_sad16x32_avg_bits12, |
1200 vp9_highbd_12_variance16x32, | 1272 vp9_highbd_12_variance16x32, |
1201 vp9_highbd_12_sub_pixel_variance16x32, | 1273 vp9_highbd_12_sub_pixel_variance16x32, |
1202 vp9_highbd_12_sub_pixel_avg_variance16x32, | 1274 vp9_highbd_12_sub_pixel_avg_variance16x32, |
1203 NULL, | 1275 NULL, |
1204 NULL, | 1276 NULL, |
1205 vp9_highbd_sad16x32x4d_bits12) | 1277 vpx_highbd_sad16x32x4d_bits12) |
1206 | 1278 |
1207 HIGHBD_BFP(BLOCK_64X32, | 1279 HIGHBD_BFP(BLOCK_64X32, |
1208 vp9_highbd_sad64x32_bits12, | 1280 vpx_highbd_sad64x32_bits12, |
1209 vp9_highbd_sad64x32_avg_bits12, | 1281 vpx_highbd_sad64x32_avg_bits12, |
1210 vp9_highbd_12_variance64x32, | 1282 vp9_highbd_12_variance64x32, |
1211 vp9_highbd_12_sub_pixel_variance64x32, | 1283 vp9_highbd_12_sub_pixel_variance64x32, |
1212 vp9_highbd_12_sub_pixel_avg_variance64x32, | 1284 vp9_highbd_12_sub_pixel_avg_variance64x32, |
1213 NULL, | 1285 NULL, |
1214 NULL, | 1286 NULL, |
1215 vp9_highbd_sad64x32x4d_bits12) | 1287 vpx_highbd_sad64x32x4d_bits12) |
1216 | 1288 |
1217 HIGHBD_BFP(BLOCK_32X64, | 1289 HIGHBD_BFP(BLOCK_32X64, |
1218 vp9_highbd_sad32x64_bits12, | 1290 vpx_highbd_sad32x64_bits12, |
1219 vp9_highbd_sad32x64_avg_bits12, | 1291 vpx_highbd_sad32x64_avg_bits12, |
1220 vp9_highbd_12_variance32x64, | 1292 vp9_highbd_12_variance32x64, |
1221 vp9_highbd_12_sub_pixel_variance32x64, | 1293 vp9_highbd_12_sub_pixel_variance32x64, |
1222 vp9_highbd_12_sub_pixel_avg_variance32x64, | 1294 vp9_highbd_12_sub_pixel_avg_variance32x64, |
1223 NULL, | 1295 NULL, |
1224 NULL, | 1296 NULL, |
1225 vp9_highbd_sad32x64x4d_bits12) | 1297 vpx_highbd_sad32x64x4d_bits12) |
1226 | 1298 |
1227 HIGHBD_BFP(BLOCK_32X32, | 1299 HIGHBD_BFP(BLOCK_32X32, |
1228 vp9_highbd_sad32x32_bits12, | 1300 vpx_highbd_sad32x32_bits12, |
1229 vp9_highbd_sad32x32_avg_bits12, | 1301 vpx_highbd_sad32x32_avg_bits12, |
1230 vp9_highbd_12_variance32x32, | 1302 vp9_highbd_12_variance32x32, |
1231 vp9_highbd_12_sub_pixel_variance32x32, | 1303 vp9_highbd_12_sub_pixel_variance32x32, |
1232 vp9_highbd_12_sub_pixel_avg_variance32x32, | 1304 vp9_highbd_12_sub_pixel_avg_variance32x32, |
1233 vp9_highbd_sad32x32x3_bits12, | 1305 vpx_highbd_sad32x32x3_bits12, |
1234 vp9_highbd_sad32x32x8_bits12, | 1306 vpx_highbd_sad32x32x8_bits12, |
1235 vp9_highbd_sad32x32x4d_bits12) | 1307 vpx_highbd_sad32x32x4d_bits12) |
1236 | 1308 |
1237 HIGHBD_BFP(BLOCK_64X64, | 1309 HIGHBD_BFP(BLOCK_64X64, |
1238 vp9_highbd_sad64x64_bits12, | 1310 vpx_highbd_sad64x64_bits12, |
1239 vp9_highbd_sad64x64_avg_bits12, | 1311 vpx_highbd_sad64x64_avg_bits12, |
1240 vp9_highbd_12_variance64x64, | 1312 vp9_highbd_12_variance64x64, |
1241 vp9_highbd_12_sub_pixel_variance64x64, | 1313 vp9_highbd_12_sub_pixel_variance64x64, |
1242 vp9_highbd_12_sub_pixel_avg_variance64x64, | 1314 vp9_highbd_12_sub_pixel_avg_variance64x64, |
1243 vp9_highbd_sad64x64x3_bits12, | 1315 vpx_highbd_sad64x64x3_bits12, |
1244 vp9_highbd_sad64x64x8_bits12, | 1316 vpx_highbd_sad64x64x8_bits12, |
1245 vp9_highbd_sad64x64x4d_bits12) | 1317 vpx_highbd_sad64x64x4d_bits12) |
1246 | 1318 |
1247 HIGHBD_BFP(BLOCK_16X16, | 1319 HIGHBD_BFP(BLOCK_16X16, |
1248 vp9_highbd_sad16x16_bits12, | 1320 vpx_highbd_sad16x16_bits12, |
1249 vp9_highbd_sad16x16_avg_bits12, | 1321 vpx_highbd_sad16x16_avg_bits12, |
1250 vp9_highbd_12_variance16x16, | 1322 vp9_highbd_12_variance16x16, |
1251 vp9_highbd_12_sub_pixel_variance16x16, | 1323 vp9_highbd_12_sub_pixel_variance16x16, |
1252 vp9_highbd_12_sub_pixel_avg_variance16x16, | 1324 vp9_highbd_12_sub_pixel_avg_variance16x16, |
1253 vp9_highbd_sad16x16x3_bits12, | 1325 vpx_highbd_sad16x16x3_bits12, |
1254 vp9_highbd_sad16x16x8_bits12, | 1326 vpx_highbd_sad16x16x8_bits12, |
1255 vp9_highbd_sad16x16x4d_bits12) | 1327 vpx_highbd_sad16x16x4d_bits12) |
1256 | 1328 |
1257 HIGHBD_BFP(BLOCK_16X8, | 1329 HIGHBD_BFP(BLOCK_16X8, |
1258 vp9_highbd_sad16x8_bits12, | 1330 vpx_highbd_sad16x8_bits12, |
1259 vp9_highbd_sad16x8_avg_bits12, | 1331 vpx_highbd_sad16x8_avg_bits12, |
1260 vp9_highbd_12_variance16x8, | 1332 vp9_highbd_12_variance16x8, |
1261 vp9_highbd_12_sub_pixel_variance16x8, | 1333 vp9_highbd_12_sub_pixel_variance16x8, |
1262 vp9_highbd_12_sub_pixel_avg_variance16x8, | 1334 vp9_highbd_12_sub_pixel_avg_variance16x8, |
1263 vp9_highbd_sad16x8x3_bits12, | 1335 vpx_highbd_sad16x8x3_bits12, |
1264 vp9_highbd_sad16x8x8_bits12, | 1336 vpx_highbd_sad16x8x8_bits12, |
1265 vp9_highbd_sad16x8x4d_bits12) | 1337 vpx_highbd_sad16x8x4d_bits12) |
1266 | 1338 |
1267 HIGHBD_BFP(BLOCK_8X16, | 1339 HIGHBD_BFP(BLOCK_8X16, |
1268 vp9_highbd_sad8x16_bits12, | 1340 vpx_highbd_sad8x16_bits12, |
1269 vp9_highbd_sad8x16_avg_bits12, | 1341 vpx_highbd_sad8x16_avg_bits12, |
1270 vp9_highbd_12_variance8x16, | 1342 vp9_highbd_12_variance8x16, |
1271 vp9_highbd_12_sub_pixel_variance8x16, | 1343 vp9_highbd_12_sub_pixel_variance8x16, |
1272 vp9_highbd_12_sub_pixel_avg_variance8x16, | 1344 vp9_highbd_12_sub_pixel_avg_variance8x16, |
1273 vp9_highbd_sad8x16x3_bits12, | 1345 vpx_highbd_sad8x16x3_bits12, |
1274 vp9_highbd_sad8x16x8_bits12, | 1346 vpx_highbd_sad8x16x8_bits12, |
1275 vp9_highbd_sad8x16x4d_bits12) | 1347 vpx_highbd_sad8x16x4d_bits12) |
1276 | 1348 |
1277 HIGHBD_BFP(BLOCK_8X8, | 1349 HIGHBD_BFP(BLOCK_8X8, |
1278 vp9_highbd_sad8x8_bits12, | 1350 vpx_highbd_sad8x8_bits12, |
1279 vp9_highbd_sad8x8_avg_bits12, | 1351 vpx_highbd_sad8x8_avg_bits12, |
1280 vp9_highbd_12_variance8x8, | 1352 vp9_highbd_12_variance8x8, |
1281 vp9_highbd_12_sub_pixel_variance8x8, | 1353 vp9_highbd_12_sub_pixel_variance8x8, |
1282 vp9_highbd_12_sub_pixel_avg_variance8x8, | 1354 vp9_highbd_12_sub_pixel_avg_variance8x8, |
1283 vp9_highbd_sad8x8x3_bits12, | 1355 vpx_highbd_sad8x8x3_bits12, |
1284 vp9_highbd_sad8x8x8_bits12, | 1356 vpx_highbd_sad8x8x8_bits12, |
1285 vp9_highbd_sad8x8x4d_bits12) | 1357 vpx_highbd_sad8x8x4d_bits12) |
1286 | 1358 |
1287 HIGHBD_BFP(BLOCK_8X4, | 1359 HIGHBD_BFP(BLOCK_8X4, |
1288 vp9_highbd_sad8x4_bits12, | 1360 vpx_highbd_sad8x4_bits12, |
1289 vp9_highbd_sad8x4_avg_bits12, | 1361 vpx_highbd_sad8x4_avg_bits12, |
1290 vp9_highbd_12_variance8x4, | 1362 vp9_highbd_12_variance8x4, |
1291 vp9_highbd_12_sub_pixel_variance8x4, | 1363 vp9_highbd_12_sub_pixel_variance8x4, |
1292 vp9_highbd_12_sub_pixel_avg_variance8x4, | 1364 vp9_highbd_12_sub_pixel_avg_variance8x4, |
1293 NULL, | 1365 NULL, |
1294 vp9_highbd_sad8x4x8_bits12, | 1366 vpx_highbd_sad8x4x8_bits12, |
1295 vp9_highbd_sad8x4x4d_bits12) | 1367 vpx_highbd_sad8x4x4d_bits12) |
1296 | 1368 |
1297 HIGHBD_BFP(BLOCK_4X8, | 1369 HIGHBD_BFP(BLOCK_4X8, |
1298 vp9_highbd_sad4x8_bits12, | 1370 vpx_highbd_sad4x8_bits12, |
1299 vp9_highbd_sad4x8_avg_bits12, | 1371 vpx_highbd_sad4x8_avg_bits12, |
1300 vp9_highbd_12_variance4x8, | 1372 vp9_highbd_12_variance4x8, |
1301 vp9_highbd_12_sub_pixel_variance4x8, | 1373 vp9_highbd_12_sub_pixel_variance4x8, |
1302 vp9_highbd_12_sub_pixel_avg_variance4x8, | 1374 vp9_highbd_12_sub_pixel_avg_variance4x8, |
1303 NULL, | 1375 NULL, |
1304 vp9_highbd_sad4x8x8_bits12, | 1376 vpx_highbd_sad4x8x8_bits12, |
1305 vp9_highbd_sad4x8x4d_bits12) | 1377 vpx_highbd_sad4x8x4d_bits12) |
1306 | 1378 |
1307 HIGHBD_BFP(BLOCK_4X4, | 1379 HIGHBD_BFP(BLOCK_4X4, |
1308 vp9_highbd_sad4x4_bits12, | 1380 vpx_highbd_sad4x4_bits12, |
1309 vp9_highbd_sad4x4_avg_bits12, | 1381 vpx_highbd_sad4x4_avg_bits12, |
1310 vp9_highbd_12_variance4x4, | 1382 vp9_highbd_12_variance4x4, |
1311 vp9_highbd_12_sub_pixel_variance4x4, | 1383 vp9_highbd_12_sub_pixel_variance4x4, |
1312 vp9_highbd_12_sub_pixel_avg_variance4x4, | 1384 vp9_highbd_12_sub_pixel_avg_variance4x4, |
1313 vp9_highbd_sad4x4x3_bits12, | 1385 vpx_highbd_sad4x4x3_bits12, |
1314 vp9_highbd_sad4x4x8_bits12, | 1386 vpx_highbd_sad4x4x8_bits12, |
1315 vp9_highbd_sad4x4x4d_bits12) | 1387 vpx_highbd_sad4x4x4d_bits12) |
1316 break; | 1388 break; |
1317 | 1389 |
1318 default: | 1390 default: |
1319 assert(0 && "cm->bit_depth should be VPX_BITS_8, " | 1391 assert(0 && "cm->bit_depth should be VPX_BITS_8, " |
1320 "VPX_BITS_10 or VPX_BITS_12"); | 1392 "VPX_BITS_10 or VPX_BITS_12"); |
1321 } | 1393 } |
1322 } | 1394 } |
1323 } | 1395 } |
1324 #endif // CONFIG_VP9_HIGHBITDEPTH | 1396 #endif // CONFIG_VP9_HIGHBITDEPTH |
1325 | 1397 |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 cpi->twopass.frame_mb_stats_buf = NULL; | 1634 cpi->twopass.frame_mb_stats_buf = NULL; |
1563 } | 1635 } |
1564 #endif | 1636 #endif |
1565 | 1637 |
1566 cpi->refresh_alt_ref_frame = 0; | 1638 cpi->refresh_alt_ref_frame = 0; |
1567 cpi->multi_arf_last_grp_enabled = 0; | 1639 cpi->multi_arf_last_grp_enabled = 0; |
1568 | 1640 |
1569 cpi->b_calculate_psnr = CONFIG_INTERNAL_STATS; | 1641 cpi->b_calculate_psnr = CONFIG_INTERNAL_STATS; |
1570 #if CONFIG_INTERNAL_STATS | 1642 #if CONFIG_INTERNAL_STATS |
1571 cpi->b_calculate_ssimg = 0; | 1643 cpi->b_calculate_ssimg = 0; |
| 1644 cpi->b_calculate_blockiness = 1; |
| 1645 cpi->b_calculate_consistency = 1; |
| 1646 cpi->total_inconsistency = 0; |
| 1647 cpi->psnr.worst = 100.0; |
| 1648 cpi->worst_ssim = 100.0; |
1572 | 1649 |
1573 cpi->count = 0; | 1650 cpi->count = 0; |
1574 cpi->bytes = 0; | 1651 cpi->bytes = 0; |
1575 | 1652 |
1576 if (cpi->b_calculate_psnr) { | 1653 if (cpi->b_calculate_psnr) { |
1577 cpi->total_y = 0.0; | |
1578 cpi->total_u = 0.0; | |
1579 cpi->total_v = 0.0; | |
1580 cpi->total = 0.0; | |
1581 cpi->total_sq_error = 0; | 1654 cpi->total_sq_error = 0; |
1582 cpi->total_samples = 0; | 1655 cpi->total_samples = 0; |
1583 | 1656 |
1584 cpi->totalp_y = 0.0; | |
1585 cpi->totalp_u = 0.0; | |
1586 cpi->totalp_v = 0.0; | |
1587 cpi->totalp = 0.0; | |
1588 cpi->totalp_sq_error = 0; | 1657 cpi->totalp_sq_error = 0; |
1589 cpi->totalp_samples = 0; | 1658 cpi->totalp_samples = 0; |
1590 | 1659 |
1591 cpi->tot_recode_hits = 0; | 1660 cpi->tot_recode_hits = 0; |
1592 cpi->summed_quality = 0; | 1661 cpi->summed_quality = 0; |
1593 cpi->summed_weights = 0; | 1662 cpi->summed_weights = 0; |
1594 cpi->summedp_quality = 0; | 1663 cpi->summedp_quality = 0; |
1595 cpi->summedp_weights = 0; | 1664 cpi->summedp_weights = 0; |
1596 } | 1665 } |
1597 | 1666 |
1598 if (cpi->b_calculate_ssimg) { | 1667 if (cpi->b_calculate_ssimg) { |
1599 cpi->total_ssimg_y = 0; | 1668 cpi->ssimg.worst= 100.0; |
1600 cpi->total_ssimg_u = 0; | 1669 } |
1601 cpi->total_ssimg_v = 0; | 1670 cpi->fastssim.worst = 100.0; |
1602 cpi->total_ssimg_all = 0; | 1671 |
| 1672 cpi->psnrhvs.worst = 100.0; |
| 1673 |
| 1674 if (cpi->b_calculate_blockiness) { |
| 1675 cpi->total_blockiness = 0; |
| 1676 cpi->worst_blockiness = 0.0; |
| 1677 } |
| 1678 |
| 1679 if (cpi->b_calculate_consistency) { |
| 1680 cpi->ssim_vars = vpx_malloc(sizeof(*cpi->ssim_vars)*720*480); |
| 1681 cpi->worst_consistency = 100.0; |
1603 } | 1682 } |
1604 | 1683 |
1605 #endif | 1684 #endif |
1606 | 1685 |
1607 cpi->first_time_stamp_ever = INT64_MAX; | 1686 cpi->first_time_stamp_ever = INT64_MAX; |
1608 | 1687 |
1609 cal_nmvjointsadcost(cpi->td.mb.nmvjointsadcost); | 1688 cal_nmvjointsadcost(cpi->td.mb.nmvjointsadcost); |
1610 cpi->td.mb.nmvcost[0] = &cpi->nmvcosts[0][MV_MAX]; | 1689 cpi->td.mb.nmvcost[0] = &cpi->nmvcosts[0][MV_MAX]; |
1611 cpi->td.mb.nmvcost[1] = &cpi->nmvcosts[1][MV_MAX]; | 1690 cpi->td.mb.nmvcost[1] = &cpi->nmvcosts[1][MV_MAX]; |
1612 cpi->td.mb.nmvsadcost[0] = &cpi->nmvsadcosts[0][MV_MAX]; | 1691 cpi->td.mb.nmvsadcost[0] = &cpi->nmvsadcosts[0][MV_MAX]; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1715 #define BFP(BT, SDF, SDAF, VF, SVF, SVAF, SDX3F, SDX8F, SDX4DF)\ | 1794 #define BFP(BT, SDF, SDAF, VF, SVF, SVAF, SDX3F, SDX8F, SDX4DF)\ |
1716 cpi->fn_ptr[BT].sdf = SDF; \ | 1795 cpi->fn_ptr[BT].sdf = SDF; \ |
1717 cpi->fn_ptr[BT].sdaf = SDAF; \ | 1796 cpi->fn_ptr[BT].sdaf = SDAF; \ |
1718 cpi->fn_ptr[BT].vf = VF; \ | 1797 cpi->fn_ptr[BT].vf = VF; \ |
1719 cpi->fn_ptr[BT].svf = SVF; \ | 1798 cpi->fn_ptr[BT].svf = SVF; \ |
1720 cpi->fn_ptr[BT].svaf = SVAF; \ | 1799 cpi->fn_ptr[BT].svaf = SVAF; \ |
1721 cpi->fn_ptr[BT].sdx3f = SDX3F; \ | 1800 cpi->fn_ptr[BT].sdx3f = SDX3F; \ |
1722 cpi->fn_ptr[BT].sdx8f = SDX8F; \ | 1801 cpi->fn_ptr[BT].sdx8f = SDX8F; \ |
1723 cpi->fn_ptr[BT].sdx4df = SDX4DF; | 1802 cpi->fn_ptr[BT].sdx4df = SDX4DF; |
1724 | 1803 |
1725 BFP(BLOCK_32X16, vp9_sad32x16, vp9_sad32x16_avg, | 1804 BFP(BLOCK_32X16, vpx_sad32x16, vpx_sad32x16_avg, |
1726 vp9_variance32x16, vp9_sub_pixel_variance32x16, | 1805 vp9_variance32x16, vp9_sub_pixel_variance32x16, |
1727 vp9_sub_pixel_avg_variance32x16, NULL, NULL, vp9_sad32x16x4d) | 1806 vp9_sub_pixel_avg_variance32x16, NULL, NULL, vpx_sad32x16x4d) |
1728 | 1807 |
1729 BFP(BLOCK_16X32, vp9_sad16x32, vp9_sad16x32_avg, | 1808 BFP(BLOCK_16X32, vpx_sad16x32, vpx_sad16x32_avg, |
1730 vp9_variance16x32, vp9_sub_pixel_variance16x32, | 1809 vp9_variance16x32, vp9_sub_pixel_variance16x32, |
1731 vp9_sub_pixel_avg_variance16x32, NULL, NULL, vp9_sad16x32x4d) | 1810 vp9_sub_pixel_avg_variance16x32, NULL, NULL, vpx_sad16x32x4d) |
1732 | 1811 |
1733 BFP(BLOCK_64X32, vp9_sad64x32, vp9_sad64x32_avg, | 1812 BFP(BLOCK_64X32, vpx_sad64x32, vpx_sad64x32_avg, |
1734 vp9_variance64x32, vp9_sub_pixel_variance64x32, | 1813 vp9_variance64x32, vp9_sub_pixel_variance64x32, |
1735 vp9_sub_pixel_avg_variance64x32, NULL, NULL, vp9_sad64x32x4d) | 1814 vp9_sub_pixel_avg_variance64x32, NULL, NULL, vpx_sad64x32x4d) |
1736 | 1815 |
1737 BFP(BLOCK_32X64, vp9_sad32x64, vp9_sad32x64_avg, | 1816 BFP(BLOCK_32X64, vpx_sad32x64, vpx_sad32x64_avg, |
1738 vp9_variance32x64, vp9_sub_pixel_variance32x64, | 1817 vp9_variance32x64, vp9_sub_pixel_variance32x64, |
1739 vp9_sub_pixel_avg_variance32x64, NULL, NULL, vp9_sad32x64x4d) | 1818 vp9_sub_pixel_avg_variance32x64, NULL, NULL, vpx_sad32x64x4d) |
1740 | 1819 |
1741 BFP(BLOCK_32X32, vp9_sad32x32, vp9_sad32x32_avg, | 1820 BFP(BLOCK_32X32, vpx_sad32x32, vpx_sad32x32_avg, |
1742 vp9_variance32x32, vp9_sub_pixel_variance32x32, | 1821 vp9_variance32x32, vp9_sub_pixel_variance32x32, |
1743 vp9_sub_pixel_avg_variance32x32, vp9_sad32x32x3, vp9_sad32x32x8, | 1822 vp9_sub_pixel_avg_variance32x32, vpx_sad32x32x3, vpx_sad32x32x8, |
1744 vp9_sad32x32x4d) | 1823 vpx_sad32x32x4d) |
1745 | 1824 |
1746 BFP(BLOCK_64X64, vp9_sad64x64, vp9_sad64x64_avg, | 1825 BFP(BLOCK_64X64, vpx_sad64x64, vpx_sad64x64_avg, |
1747 vp9_variance64x64, vp9_sub_pixel_variance64x64, | 1826 vp9_variance64x64, vp9_sub_pixel_variance64x64, |
1748 vp9_sub_pixel_avg_variance64x64, vp9_sad64x64x3, vp9_sad64x64x8, | 1827 vp9_sub_pixel_avg_variance64x64, vpx_sad64x64x3, vpx_sad64x64x8, |
1749 vp9_sad64x64x4d) | 1828 vpx_sad64x64x4d) |
1750 | 1829 |
1751 BFP(BLOCK_16X16, vp9_sad16x16, vp9_sad16x16_avg, | 1830 BFP(BLOCK_16X16, vpx_sad16x16, vpx_sad16x16_avg, |
1752 vp9_variance16x16, vp9_sub_pixel_variance16x16, | 1831 vp9_variance16x16, vp9_sub_pixel_variance16x16, |
1753 vp9_sub_pixel_avg_variance16x16, vp9_sad16x16x3, vp9_sad16x16x8, | 1832 vp9_sub_pixel_avg_variance16x16, vpx_sad16x16x3, vpx_sad16x16x8, |
1754 vp9_sad16x16x4d) | 1833 vpx_sad16x16x4d) |
1755 | 1834 |
1756 BFP(BLOCK_16X8, vp9_sad16x8, vp9_sad16x8_avg, | 1835 BFP(BLOCK_16X8, vpx_sad16x8, vpx_sad16x8_avg, |
1757 vp9_variance16x8, vp9_sub_pixel_variance16x8, | 1836 vp9_variance16x8, vp9_sub_pixel_variance16x8, |
1758 vp9_sub_pixel_avg_variance16x8, | 1837 vp9_sub_pixel_avg_variance16x8, |
1759 vp9_sad16x8x3, vp9_sad16x8x8, vp9_sad16x8x4d) | 1838 vpx_sad16x8x3, vpx_sad16x8x8, vpx_sad16x8x4d) |
1760 | 1839 |
1761 BFP(BLOCK_8X16, vp9_sad8x16, vp9_sad8x16_avg, | 1840 BFP(BLOCK_8X16, vpx_sad8x16, vpx_sad8x16_avg, |
1762 vp9_variance8x16, vp9_sub_pixel_variance8x16, | 1841 vp9_variance8x16, vp9_sub_pixel_variance8x16, |
1763 vp9_sub_pixel_avg_variance8x16, | 1842 vp9_sub_pixel_avg_variance8x16, |
1764 vp9_sad8x16x3, vp9_sad8x16x8, vp9_sad8x16x4d) | 1843 vpx_sad8x16x3, vpx_sad8x16x8, vpx_sad8x16x4d) |
1765 | 1844 |
1766 BFP(BLOCK_8X8, vp9_sad8x8, vp9_sad8x8_avg, | 1845 BFP(BLOCK_8X8, vpx_sad8x8, vpx_sad8x8_avg, |
1767 vp9_variance8x8, vp9_sub_pixel_variance8x8, | 1846 vp9_variance8x8, vp9_sub_pixel_variance8x8, |
1768 vp9_sub_pixel_avg_variance8x8, | 1847 vp9_sub_pixel_avg_variance8x8, |
1769 vp9_sad8x8x3, vp9_sad8x8x8, vp9_sad8x8x4d) | 1848 vpx_sad8x8x3, vpx_sad8x8x8, vpx_sad8x8x4d) |
1770 | 1849 |
1771 BFP(BLOCK_8X4, vp9_sad8x4, vp9_sad8x4_avg, | 1850 BFP(BLOCK_8X4, vpx_sad8x4, vpx_sad8x4_avg, |
1772 vp9_variance8x4, vp9_sub_pixel_variance8x4, | 1851 vp9_variance8x4, vp9_sub_pixel_variance8x4, |
1773 vp9_sub_pixel_avg_variance8x4, NULL, vp9_sad8x4x8, vp9_sad8x4x4d) | 1852 vp9_sub_pixel_avg_variance8x4, NULL, vpx_sad8x4x8, vpx_sad8x4x4d) |
1774 | 1853 |
1775 BFP(BLOCK_4X8, vp9_sad4x8, vp9_sad4x8_avg, | 1854 BFP(BLOCK_4X8, vpx_sad4x8, vpx_sad4x8_avg, |
1776 vp9_variance4x8, vp9_sub_pixel_variance4x8, | 1855 vp9_variance4x8, vp9_sub_pixel_variance4x8, |
1777 vp9_sub_pixel_avg_variance4x8, NULL, vp9_sad4x8x8, vp9_sad4x8x4d) | 1856 vp9_sub_pixel_avg_variance4x8, NULL, vpx_sad4x8x8, vpx_sad4x8x4d) |
1778 | 1857 |
1779 BFP(BLOCK_4X4, vp9_sad4x4, vp9_sad4x4_avg, | 1858 BFP(BLOCK_4X4, vpx_sad4x4, vpx_sad4x4_avg, |
1780 vp9_variance4x4, vp9_sub_pixel_variance4x4, | 1859 vp9_variance4x4, vp9_sub_pixel_variance4x4, |
1781 vp9_sub_pixel_avg_variance4x4, | 1860 vp9_sub_pixel_avg_variance4x4, |
1782 vp9_sad4x4x3, vp9_sad4x4x8, vp9_sad4x4x4d) | 1861 vpx_sad4x4x3, vpx_sad4x4x8, vpx_sad4x4x4d) |
1783 | 1862 |
1784 #if CONFIG_VP9_HIGHBITDEPTH | 1863 #if CONFIG_VP9_HIGHBITDEPTH |
1785 highbd_set_var_fns(cpi); | 1864 highbd_set_var_fns(cpi); |
1786 #endif | 1865 #endif |
1787 | 1866 |
1788 /* vp9_init_quantizer() is first called here. Add check in | 1867 /* vp9_init_quantizer() is first called here. Add check in |
1789 * vp9_frame_init_quantizer() so that vp9_init_quantizer is only | 1868 * vp9_frame_init_quantizer() so that vp9_init_quantizer is only |
1790 * called later when needed. This will avoid unnecessary calls of | 1869 * called later when needed. This will avoid unnecessary calls of |
1791 * vp9_init_quantizer() for every frame. | 1870 * vp9_init_quantizer() for every frame. |
1792 */ | 1871 */ |
1793 vp9_init_quantizer(cpi); | 1872 vp9_init_quantizer(cpi); |
1794 | 1873 |
1795 vp9_loop_filter_init(cm); | 1874 vp9_loop_filter_init(cm); |
1796 | 1875 |
1797 cm->error.setjmp = 0; | 1876 cm->error.setjmp = 0; |
1798 | 1877 |
1799 return cpi; | 1878 return cpi; |
1800 } | 1879 } |
| 1880 #define SNPRINT(H, T) \ |
| 1881 snprintf((H) + strlen(H), sizeof(H) - strlen(H), (T)) |
| 1882 |
| 1883 #define SNPRINT2(H, T, V) \ |
| 1884 snprintf((H) + strlen(H), sizeof(H) - strlen(H), (T), (V)) |
1801 | 1885 |
1802 void vp9_remove_compressor(VP9_COMP *cpi) { | 1886 void vp9_remove_compressor(VP9_COMP *cpi) { |
1803 VP9_COMMON *const cm = &cpi->common; | 1887 VP9_COMMON *const cm = &cpi->common; |
1804 unsigned int i; | 1888 unsigned int i; |
1805 int t; | 1889 int t; |
1806 | 1890 |
1807 if (!cpi) | 1891 if (!cpi) |
1808 return; | 1892 return; |
1809 | 1893 |
1810 if (cpi && (cm->current_video_frame > 0)) { | 1894 if (cpi && (cm->current_video_frame > 0)) { |
1811 #if CONFIG_INTERNAL_STATS | 1895 #if CONFIG_INTERNAL_STATS |
1812 | |
1813 vp9_clear_system_state(); | 1896 vp9_clear_system_state(); |
1814 | 1897 |
1815 // printf("\n8x8-4x4:%d-%d\n", cpi->t8x8_count, cpi->t4x4_count); | |
1816 if (cpi->oxcf.pass != 1) { | 1898 if (cpi->oxcf.pass != 1) { |
| 1899 char headings[512] = {0}; |
| 1900 char results[512] = {0}; |
1817 FILE *f = fopen("opsnr.stt", "a"); | 1901 FILE *f = fopen("opsnr.stt", "a"); |
1818 double time_encoded = (cpi->last_end_time_stamp_seen | 1902 double time_encoded = (cpi->last_end_time_stamp_seen |
1819 - cpi->first_time_stamp_ever) / 10000000.000; | 1903 - cpi->first_time_stamp_ever) / 10000000.000; |
1820 double total_encode_time = (cpi->time_receive_data + | 1904 double total_encode_time = (cpi->time_receive_data + |
1821 cpi->time_compress_data) / 1000.000; | 1905 cpi->time_compress_data) / 1000.000; |
1822 const double dr = | 1906 const double dr = |
1823 (double)cpi->bytes * (double) 8 / (double)1000 / time_encoded; | 1907 (double)cpi->bytes * (double) 8 / (double)1000 / time_encoded; |
1824 const double peak = (double)((1 << cpi->oxcf.input_bit_depth) - 1); | 1908 const double peak = (double)((1 << cpi->oxcf.input_bit_depth) - 1); |
1825 | 1909 |
1826 if (cpi->b_calculate_psnr) { | 1910 if (cpi->b_calculate_psnr) { |
1827 const double total_psnr = | 1911 const double total_psnr = |
1828 vpx_sse_to_psnr((double)cpi->total_samples, peak, | 1912 vpx_sse_to_psnr((double)cpi->total_samples, peak, |
1829 (double)cpi->total_sq_error); | 1913 (double)cpi->total_sq_error); |
1830 const double totalp_psnr = | 1914 const double totalp_psnr = |
1831 vpx_sse_to_psnr((double)cpi->totalp_samples, peak, | 1915 vpx_sse_to_psnr((double)cpi->totalp_samples, peak, |
1832 (double)cpi->totalp_sq_error); | 1916 (double)cpi->totalp_sq_error); |
1833 const double total_ssim = 100 * pow(cpi->summed_quality / | 1917 const double total_ssim = 100 * pow(cpi->summed_quality / |
1834 cpi->summed_weights, 8.0); | 1918 cpi->summed_weights, 8.0); |
1835 const double totalp_ssim = 100 * pow(cpi->summedp_quality / | 1919 const double totalp_ssim = 100 * pow(cpi->summedp_quality / |
1836 cpi->summedp_weights, 8.0); | 1920 cpi->summedp_weights, 8.0); |
1837 | 1921 |
1838 fprintf(f, "Bitrate\tAVGPsnr\tGLBPsnr\tAVPsnrP\tGLPsnrP\t" | 1922 snprintf(headings, sizeof(headings), |
1839 "VPXSSIM\tVPSSIMP\t Time(ms)\n"); | 1923 "Bitrate\tAVGPsnr\tGLBPsnr\tAVPsnrP\tGLPsnrP\t" |
1840 fprintf(f, "%7.2f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t%8.0f\n", | 1924 "VPXSSIM\tVPSSIMP\tFASTSIM\tPSNRHVS\t" |
1841 dr, cpi->total / cpi->count, total_psnr, | 1925 "WstPsnr\tWstSsim\tWstFast\tWstHVS"); |
1842 cpi->totalp / cpi->count, totalp_psnr, total_ssim, totalp_ssim, | 1926 snprintf(results, sizeof(results), |
1843 total_encode_time); | 1927 "%7.2f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t" |
1844 } | 1928 "%7.3f\t%7.3f\t%7.3f\t%7.3f" |
| 1929 "%7.3f\t%7.3f\t%7.3f\t%7.3f", |
| 1930 dr, cpi->psnr.stat[ALL] / cpi->count, total_psnr, |
| 1931 cpi->psnrp.stat[ALL] / cpi->count, totalp_psnr, |
| 1932 total_ssim, totalp_ssim, |
| 1933 cpi->fastssim.stat[ALL] / cpi->count, |
| 1934 cpi->psnrhvs.stat[ALL] / cpi->count, |
| 1935 cpi->psnr.worst, cpi->worst_ssim, cpi->fastssim.worst, |
| 1936 cpi->psnrhvs.worst); |
1845 | 1937 |
1846 if (cpi->b_calculate_ssimg) { | 1938 if (cpi->b_calculate_blockiness) { |
1847 fprintf(f, "BitRate\tSSIM_Y\tSSIM_U\tSSIM_V\tSSIM_A\t Time(ms)\n"); | 1939 SNPRINT(headings, "\t Block\tWstBlck"); |
1848 fprintf(f, "%7.2f\t%6.4f\t%6.4f\t%6.4f\t%6.4f\t%8.0f\n", dr, | 1940 SNPRINT2(results, "\t%7.3f", cpi->total_blockiness / cpi->count); |
1849 cpi->total_ssimg_y / cpi->count, | 1941 SNPRINT2(results, "\t%7.3f", cpi->worst_blockiness); |
1850 cpi->total_ssimg_u / cpi->count, | 1942 } |
1851 cpi->total_ssimg_v / cpi->count, | 1943 |
1852 cpi->total_ssimg_all / cpi->count, total_encode_time); | 1944 if (cpi->b_calculate_consistency) { |
| 1945 double consistency = |
| 1946 vpx_sse_to_psnr((double)cpi->totalp_samples, peak, |
| 1947 (double)cpi->total_inconsistency); |
| 1948 |
| 1949 SNPRINT(headings, "\tConsist\tWstCons"); |
| 1950 SNPRINT2(results, "\t%7.3f", consistency); |
| 1951 SNPRINT2(results, "\t%7.3f", cpi->worst_consistency); |
| 1952 } |
| 1953 |
| 1954 if (cpi->b_calculate_ssimg) { |
| 1955 SNPRINT(headings, "\t SSIMG\tWtSSIMG"); |
| 1956 SNPRINT2(results, "\t%7.3f", cpi->ssimg.stat[ALL] / cpi->count); |
| 1957 SNPRINT2(results, "\t%7.3f", cpi->ssimg.worst); |
| 1958 } |
| 1959 |
| 1960 fprintf(f, "%s\t Time\n", headings); |
| 1961 fprintf(f, "%s\t%8.0f\n", results, total_encode_time); |
1853 } | 1962 } |
1854 | 1963 |
1855 fclose(f); | 1964 fclose(f); |
1856 } | 1965 } |
1857 | 1966 |
1858 #endif | 1967 #endif |
1859 | 1968 |
1860 #if 0 | 1969 #if 0 |
1861 { | 1970 { |
1862 printf("\n_pick_loop_filter_level:%d\n", cpi->time_pick_lpf / 1000); | 1971 printf("\n_pick_loop_filter_level:%d\n", cpi->time_pick_lpf / 1000); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 } | 2010 } |
1902 | 2011 |
1903 #if CONFIG_FP_MB_STATS | 2012 #if CONFIG_FP_MB_STATS |
1904 if (cpi->use_fp_mb_stats) { | 2013 if (cpi->use_fp_mb_stats) { |
1905 vpx_free(cpi->twopass.frame_mb_stats_buf); | 2014 vpx_free(cpi->twopass.frame_mb_stats_buf); |
1906 cpi->twopass.frame_mb_stats_buf = NULL; | 2015 cpi->twopass.frame_mb_stats_buf = NULL; |
1907 } | 2016 } |
1908 #endif | 2017 #endif |
1909 | 2018 |
1910 vp9_remove_common(cm); | 2019 vp9_remove_common(cm); |
| 2020 vp9_free_ref_frame_buffers(cm->buffer_pool); |
| 2021 #if CONFIG_VP9_POSTPROC |
| 2022 vp9_free_postproc_buffers(cm); |
| 2023 #endif |
1911 vpx_free(cpi); | 2024 vpx_free(cpi); |
1912 | 2025 |
1913 #if CONFIG_VP9_TEMPORAL_DENOISING | 2026 #if CONFIG_VP9_TEMPORAL_DENOISING |
1914 #ifdef OUTPUT_YUV_DENOISED | 2027 #ifdef OUTPUT_YUV_DENOISED |
1915 fclose(yuv_denoised_file); | 2028 fclose(yuv_denoised_file); |
1916 #endif | 2029 #endif |
1917 #endif | 2030 #endif |
1918 #ifdef OUTPUT_YUV_SKINMAP | 2031 #ifdef OUTPUT_YUV_SKINMAP |
1919 fclose(yuv_skinmap_file); | 2032 fclose(yuv_skinmap_file); |
1920 #endif | 2033 #endif |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2486 } else { /* For non key/golden frames */ | 2599 } else { /* For non key/golden frames */ |
2487 if (cpi->refresh_alt_ref_frame) { | 2600 if (cpi->refresh_alt_ref_frame) { |
2488 int arf_idx = cpi->alt_fb_idx; | 2601 int arf_idx = cpi->alt_fb_idx; |
2489 if ((cpi->oxcf.pass == 2) && cpi->multi_arf_allowed) { | 2602 if ((cpi->oxcf.pass == 2) && cpi->multi_arf_allowed) { |
2490 const GF_GROUP *const gf_group = &cpi->twopass.gf_group; | 2603 const GF_GROUP *const gf_group = &cpi->twopass.gf_group; |
2491 arf_idx = gf_group->arf_update_idx[gf_group->index]; | 2604 arf_idx = gf_group->arf_update_idx[gf_group->index]; |
2492 } | 2605 } |
2493 | 2606 |
2494 ref_cnt_fb(pool->frame_bufs, | 2607 ref_cnt_fb(pool->frame_bufs, |
2495 &cm->ref_frame_map[arf_idx], cm->new_fb_idx); | 2608 &cm->ref_frame_map[arf_idx], cm->new_fb_idx); |
2496 vpx_memcpy(cpi->interp_filter_selected[ALTREF_FRAME], | 2609 memcpy(cpi->interp_filter_selected[ALTREF_FRAME], |
2497 cpi->interp_filter_selected[0], | 2610 cpi->interp_filter_selected[0], |
2498 sizeof(cpi->interp_filter_selected[0])); | 2611 sizeof(cpi->interp_filter_selected[0])); |
2499 } | 2612 } |
2500 | 2613 |
2501 if (cpi->refresh_golden_frame) { | 2614 if (cpi->refresh_golden_frame) { |
2502 ref_cnt_fb(pool->frame_bufs, | 2615 ref_cnt_fb(pool->frame_bufs, |
2503 &cm->ref_frame_map[cpi->gld_fb_idx], cm->new_fb_idx); | 2616 &cm->ref_frame_map[cpi->gld_fb_idx], cm->new_fb_idx); |
2504 if (!cpi->rc.is_src_frame_alt_ref) | 2617 if (!cpi->rc.is_src_frame_alt_ref) |
2505 vpx_memcpy(cpi->interp_filter_selected[GOLDEN_FRAME], | 2618 memcpy(cpi->interp_filter_selected[GOLDEN_FRAME], |
2506 cpi->interp_filter_selected[0], | 2619 cpi->interp_filter_selected[0], |
2507 sizeof(cpi->interp_filter_selected[0])); | 2620 sizeof(cpi->interp_filter_selected[0])); |
2508 else | 2621 else |
2509 vpx_memcpy(cpi->interp_filter_selected[GOLDEN_FRAME], | 2622 memcpy(cpi->interp_filter_selected[GOLDEN_FRAME], |
2510 cpi->interp_filter_selected[ALTREF_FRAME], | 2623 cpi->interp_filter_selected[ALTREF_FRAME], |
2511 sizeof(cpi->interp_filter_selected[ALTREF_FRAME])); | 2624 sizeof(cpi->interp_filter_selected[ALTREF_FRAME])); |
2512 } | 2625 } |
2513 } | 2626 } |
2514 | 2627 |
2515 if (cpi->refresh_last_frame) { | 2628 if (cpi->refresh_last_frame) { |
2516 ref_cnt_fb(pool->frame_bufs, | 2629 ref_cnt_fb(pool->frame_bufs, |
2517 &cm->ref_frame_map[cpi->lst_fb_idx], cm->new_fb_idx); | 2630 &cm->ref_frame_map[cpi->lst_fb_idx], cm->new_fb_idx); |
2518 if (!cpi->rc.is_src_frame_alt_ref) | 2631 if (!cpi->rc.is_src_frame_alt_ref) |
2519 vpx_memcpy(cpi->interp_filter_selected[LAST_FRAME], | 2632 memcpy(cpi->interp_filter_selected[LAST_FRAME], |
2520 cpi->interp_filter_selected[0], | 2633 cpi->interp_filter_selected[0], |
2521 sizeof(cpi->interp_filter_selected[0])); | 2634 sizeof(cpi->interp_filter_selected[0])); |
2522 } | 2635 } |
2523 #if CONFIG_VP9_TEMPORAL_DENOISING | 2636 #if CONFIG_VP9_TEMPORAL_DENOISING |
2524 if (cpi->oxcf.noise_sensitivity > 0) { | 2637 if (cpi->oxcf.noise_sensitivity > 0) { |
2525 vp9_denoiser_update_frame_info(&cpi->denoiser, | 2638 vp9_denoiser_update_frame_info(&cpi->denoiser, |
2526 *cpi->Source, | 2639 *cpi->Source, |
2527 cpi->common.frame_type, | 2640 cpi->common.frame_type, |
2528 cpi->refresh_alt_ref_frame, | 2641 cpi->refresh_alt_ref_frame, |
2529 cpi->refresh_golden_frame, | 2642 cpi->refresh_golden_frame, |
2530 cpi->refresh_last_frame); | 2643 cpi->refresh_last_frame); |
2531 } | 2644 } |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3397 if (vp9_rc_drop_frame(cpi)) { | 3510 if (vp9_rc_drop_frame(cpi)) { |
3398 vp9_rc_postencode_update_drop_frame(cpi); | 3511 vp9_rc_postencode_update_drop_frame(cpi); |
3399 ++cm->current_video_frame; | 3512 ++cm->current_video_frame; |
3400 return; | 3513 return; |
3401 } | 3514 } |
3402 } | 3515 } |
3403 | 3516 |
3404 vp9_clear_system_state(); | 3517 vp9_clear_system_state(); |
3405 | 3518 |
3406 #if CONFIG_INTERNAL_STATS | 3519 #if CONFIG_INTERNAL_STATS |
3407 vpx_memset(cpi->mode_chosen_counts, 0, | 3520 memset(cpi->mode_chosen_counts, 0, |
3408 MAX_MODES * sizeof(*cpi->mode_chosen_counts)); | 3521 MAX_MODES * sizeof(*cpi->mode_chosen_counts)); |
3409 #endif | 3522 #endif |
3410 | 3523 |
3411 if (cpi->sf.recode_loop == DISALLOW_RECODE) { | 3524 if (cpi->sf.recode_loop == DISALLOW_RECODE) { |
3412 encode_without_recode_loop(cpi); | 3525 encode_without_recode_loop(cpi); |
3413 } else { | 3526 } else { |
3414 encode_with_recode_loop(cpi, size, dest); | 3527 encode_with_recode_loop(cpi, size, dest); |
3415 } | 3528 } |
3416 | 3529 |
3417 #if CONFIG_VP9_TEMPORAL_DENOISING | 3530 #if CONFIG_VP9_TEMPORAL_DENOISING |
3418 #ifdef OUTPUT_YUV_DENOISED | 3531 #ifdef OUTPUT_YUV_DENOISED |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3748 if (rc->is_src_frame_alt_ref) { | 3861 if (rc->is_src_frame_alt_ref) { |
3749 // Current frame is an ARF overlay frame. | 3862 // Current frame is an ARF overlay frame. |
3750 cpi->alt_ref_source = NULL; | 3863 cpi->alt_ref_source = NULL; |
3751 | 3864 |
3752 // Don't refresh the last buffer for an ARF overlay frame. It will | 3865 // Don't refresh the last buffer for an ARF overlay frame. It will |
3753 // become the GF so preserve last as an alternative prediction option. | 3866 // become the GF so preserve last as an alternative prediction option. |
3754 cpi->refresh_last_frame = 0; | 3867 cpi->refresh_last_frame = 0; |
3755 } | 3868 } |
3756 } | 3869 } |
3757 | 3870 |
| 3871 #if CONFIG_INTERNAL_STATS |
| 3872 extern double vp9_get_blockiness(const unsigned char *img1, int img1_pitch, |
| 3873 const unsigned char *img2, int img2_pitch, |
| 3874 int width, int height); |
| 3875 #endif |
| 3876 |
| 3877 void adjust_image_stat(double y, double u, double v, double all, ImageStat *s) { |
| 3878 s->stat[Y] += y; |
| 3879 s->stat[U] += u; |
| 3880 s->stat[V] += v; |
| 3881 s->stat[ALL] += all; |
| 3882 s->worst = MIN(s->worst, all); |
| 3883 } |
| 3884 |
3758 int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, | 3885 int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, |
3759 size_t *size, uint8_t *dest, | 3886 size_t *size, uint8_t *dest, |
3760 int64_t *time_stamp, int64_t *time_end, int flush) { | 3887 int64_t *time_stamp, int64_t *time_end, int flush) { |
3761 const VP9EncoderConfig *const oxcf = &cpi->oxcf; | 3888 const VP9EncoderConfig *const oxcf = &cpi->oxcf; |
3762 VP9_COMMON *const cm = &cpi->common; | 3889 VP9_COMMON *const cm = &cpi->common; |
3763 BufferPool *const pool = cm->buffer_pool; | 3890 BufferPool *const pool = cm->buffer_pool; |
3764 RATE_CONTROL *const rc = &cpi->rc; | 3891 RATE_CONTROL *const rc = &cpi->rc; |
3765 struct vpx_usec_timer cmptimer; | 3892 struct vpx_usec_timer cmptimer; |
3766 YV12_BUFFER_CONFIG *force_src_buffer = NULL; | 3893 YV12_BUFFER_CONFIG *force_src_buffer = NULL; |
3767 struct lookahead_entry *last_source = NULL; | 3894 struct lookahead_entry *last_source = NULL; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4000 | 4127 |
4001 vpx_usec_timer_mark(&cmptimer); | 4128 vpx_usec_timer_mark(&cmptimer); |
4002 cpi->time_compress_data += vpx_usec_timer_elapsed(&cmptimer); | 4129 cpi->time_compress_data += vpx_usec_timer_elapsed(&cmptimer); |
4003 | 4130 |
4004 if (cpi->b_calculate_psnr && oxcf->pass != 1 && cm->show_frame) | 4131 if (cpi->b_calculate_psnr && oxcf->pass != 1 && cm->show_frame) |
4005 generate_psnr_packet(cpi); | 4132 generate_psnr_packet(cpi); |
4006 | 4133 |
4007 #if CONFIG_INTERNAL_STATS | 4134 #if CONFIG_INTERNAL_STATS |
4008 | 4135 |
4009 if (oxcf->pass != 1) { | 4136 if (oxcf->pass != 1) { |
| 4137 double samples; |
4010 cpi->bytes += (int)(*size); | 4138 cpi->bytes += (int)(*size); |
4011 | 4139 |
4012 if (cm->show_frame) { | 4140 if (cm->show_frame) { |
4013 cpi->count++; | 4141 cpi->count++; |
4014 | 4142 |
4015 if (cpi->b_calculate_psnr) { | 4143 if (cpi->b_calculate_psnr) { |
4016 YV12_BUFFER_CONFIG *orig = cpi->Source; | 4144 YV12_BUFFER_CONFIG *orig = cpi->Source; |
4017 YV12_BUFFER_CONFIG *recon = cpi->common.frame_to_show; | 4145 YV12_BUFFER_CONFIG *recon = cpi->common.frame_to_show; |
4018 YV12_BUFFER_CONFIG *pp = &cm->post_proc_buffer; | 4146 YV12_BUFFER_CONFIG *pp = &cm->post_proc_buffer; |
4019 PSNR_STATS psnr; | 4147 PSNR_STATS psnr; |
4020 #if CONFIG_VP9_HIGHBITDEPTH | 4148 #if CONFIG_VP9_HIGHBITDEPTH |
4021 calc_highbd_psnr(orig, recon, &psnr, cpi->td.mb.e_mbd.bd, | 4149 calc_highbd_psnr(orig, recon, &psnr, cpi->td.mb.e_mbd.bd, |
4022 cpi->oxcf.input_bit_depth); | 4150 cpi->oxcf.input_bit_depth); |
4023 #else | 4151 #else |
4024 calc_psnr(orig, recon, &psnr); | 4152 calc_psnr(orig, recon, &psnr); |
4025 #endif // CONFIG_VP9_HIGHBITDEPTH | 4153 #endif // CONFIG_VP9_HIGHBITDEPTH |
4026 | 4154 |
4027 cpi->total += psnr.psnr[0]; | 4155 adjust_image_stat(psnr.psnr[1], psnr.psnr[2], psnr.psnr[3], |
4028 cpi->total_y += psnr.psnr[1]; | 4156 psnr.psnr[0], &cpi->psnr); |
4029 cpi->total_u += psnr.psnr[2]; | |
4030 cpi->total_v += psnr.psnr[3]; | |
4031 cpi->total_sq_error += psnr.sse[0]; | 4157 cpi->total_sq_error += psnr.sse[0]; |
4032 cpi->total_samples += psnr.samples[0]; | 4158 cpi->total_samples += psnr.samples[0]; |
| 4159 samples = psnr.samples[0]; |
4033 | 4160 |
4034 { | 4161 { |
4035 PSNR_STATS psnr2; | 4162 PSNR_STATS psnr2; |
4036 double frame_ssim2 = 0, weight = 0; | 4163 double frame_ssim2 = 0, weight = 0; |
4037 #if CONFIG_VP9_POSTPROC | 4164 #if CONFIG_VP9_POSTPROC |
4038 if (vp9_alloc_frame_buffer(&cm->post_proc_buffer, | 4165 if (vp9_alloc_frame_buffer(&cm->post_proc_buffer, |
4039 recon->y_crop_width, recon->y_crop_height, | 4166 recon->y_crop_width, recon->y_crop_height, |
4040 cm->subsampling_x, cm->subsampling_y, | 4167 cm->subsampling_x, cm->subsampling_y, |
4041 #if CONFIG_VP9_HIGHBITDEPTH | 4168 #if CONFIG_VP9_HIGHBITDEPTH |
4042 cm->use_highbitdepth, | 4169 cm->use_highbitdepth, |
4043 #endif | 4170 #endif |
4044 VP9_ENC_BORDER_IN_PIXELS, | 4171 VP9_ENC_BORDER_IN_PIXELS, |
4045 cm->byte_alignment) < 0) { | 4172 cm->byte_alignment) < 0) { |
4046 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, | 4173 vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR, |
4047 "Failed to allocate post processing buffer"); | 4174 "Failed to allocate post processing buffer"); |
4048 } | 4175 } |
4049 | 4176 |
4050 vp9_deblock(cm->frame_to_show, &cm->post_proc_buffer, | 4177 vp9_deblock(cm->frame_to_show, &cm->post_proc_buffer, |
4051 cm->lf.filter_level * 10 / 6); | 4178 cm->lf.filter_level * 10 / 6); |
4052 #endif | 4179 #endif |
4053 vp9_clear_system_state(); | 4180 vp9_clear_system_state(); |
4054 | 4181 |
4055 #if CONFIG_VP9_HIGHBITDEPTH | 4182 #if CONFIG_VP9_HIGHBITDEPTH |
4056 calc_highbd_psnr(orig, pp, &psnr, cpi->td.mb.e_mbd.bd, | 4183 calc_highbd_psnr(orig, pp, &psnr, cpi->td.mb.e_mbd.bd, |
4057 cpi->oxcf.input_bit_depth); | 4184 cpi->oxcf.input_bit_depth); |
4058 #else | 4185 #else |
4059 calc_psnr(orig, pp, &psnr2); | 4186 calc_psnr(orig, pp, &psnr2); |
4060 #endif // CONFIG_VP9_HIGHBITDEPTH | 4187 #endif // CONFIG_VP9_HIGHBITDEPTH |
4061 | 4188 |
4062 cpi->totalp += psnr2.psnr[0]; | |
4063 cpi->totalp_y += psnr2.psnr[1]; | |
4064 cpi->totalp_u += psnr2.psnr[2]; | |
4065 cpi->totalp_v += psnr2.psnr[3]; | |
4066 cpi->totalp_sq_error += psnr2.sse[0]; | 4189 cpi->totalp_sq_error += psnr2.sse[0]; |
4067 cpi->totalp_samples += psnr2.samples[0]; | 4190 cpi->totalp_samples += psnr2.samples[0]; |
| 4191 adjust_image_stat(psnr2.psnr[1], psnr2.psnr[2], psnr2.psnr[3], |
| 4192 psnr2.psnr[0], &cpi->psnrp); |
4068 | 4193 |
4069 #if CONFIG_VP9_HIGHBITDEPTH | 4194 #if CONFIG_VP9_HIGHBITDEPTH |
4070 if (cm->use_highbitdepth) { | 4195 if (cm->use_highbitdepth) { |
4071 frame_ssim2 = vp9_highbd_calc_ssim(orig, recon, &weight, | 4196 frame_ssim2 = vp9_highbd_calc_ssim(orig, recon, &weight, |
4072 (int)cm->bit_depth); | 4197 (int)cm->bit_depth); |
4073 } else { | 4198 } else { |
4074 frame_ssim2 = vp9_calc_ssim(orig, recon, &weight); | 4199 frame_ssim2 = vp9_calc_ssim(orig, recon, &weight); |
4075 } | 4200 } |
4076 #else | 4201 #else |
4077 frame_ssim2 = vp9_calc_ssim(orig, recon, &weight); | 4202 frame_ssim2 = vp9_calc_ssim(orig, recon, &weight); |
4078 #endif // CONFIG_VP9_HIGHBITDEPTH | 4203 #endif // CONFIG_VP9_HIGHBITDEPTH |
4079 | 4204 |
| 4205 cpi->worst_ssim= MIN(cpi->worst_ssim, frame_ssim2); |
4080 cpi->summed_quality += frame_ssim2 * weight; | 4206 cpi->summed_quality += frame_ssim2 * weight; |
4081 cpi->summed_weights += weight; | 4207 cpi->summed_weights += weight; |
4082 | 4208 |
4083 #if CONFIG_VP9_HIGHBITDEPTH | 4209 #if CONFIG_VP9_HIGHBITDEPTH |
4084 if (cm->use_highbitdepth) { | 4210 if (cm->use_highbitdepth) { |
4085 frame_ssim2 = vp9_highbd_calc_ssim( | 4211 frame_ssim2 = vp9_highbd_calc_ssim( |
4086 orig, &cm->post_proc_buffer, &weight, (int)cm->bit_depth); | 4212 orig, &cm->post_proc_buffer, &weight, (int)cm->bit_depth); |
4087 } else { | 4213 } else { |
4088 frame_ssim2 = vp9_calc_ssim(orig, &cm->post_proc_buffer, &weight); | 4214 frame_ssim2 = vp9_calc_ssim(orig, &cm->post_proc_buffer, &weight); |
4089 } | 4215 } |
4090 #else | 4216 #else |
4091 frame_ssim2 = vp9_calc_ssim(orig, &cm->post_proc_buffer, &weight); | 4217 frame_ssim2 = vp9_calc_ssim(orig, &cm->post_proc_buffer, &weight); |
4092 #endif // CONFIG_VP9_HIGHBITDEPTH | 4218 #endif // CONFIG_VP9_HIGHBITDEPTH |
4093 | 4219 |
4094 cpi->summedp_quality += frame_ssim2 * weight; | 4220 cpi->summedp_quality += frame_ssim2 * weight; |
4095 cpi->summedp_weights += weight; | 4221 cpi->summedp_weights += weight; |
4096 #if 0 | 4222 #if 0 |
4097 { | 4223 { |
4098 FILE *f = fopen("q_used.stt", "a"); | 4224 FILE *f = fopen("q_used.stt", "a"); |
4099 fprintf(f, "%5d : Y%f7.3:U%f7.3:V%f7.3:F%f7.3:S%7.3f\n", | 4225 fprintf(f, "%5d : Y%f7.3:U%f7.3:V%f7.3:F%f7.3:S%7.3f\n", |
4100 cpi->common.current_video_frame, y2, u2, v2, | 4226 cpi->common.current_video_frame, y2, u2, v2, |
4101 frame_psnr2, frame_ssim2); | 4227 frame_psnr2, frame_ssim2); |
4102 fclose(f); | 4228 fclose(f); |
4103 } | 4229 } |
4104 #endif | 4230 #endif |
4105 } | 4231 } |
4106 } | 4232 } |
| 4233 if (cpi->b_calculate_blockiness) { |
| 4234 double frame_blockiness = vp9_get_blockiness( |
| 4235 cpi->Source->y_buffer, cpi->Source->y_stride, |
| 4236 cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride, |
| 4237 cpi->Source->y_width, cpi->Source->y_height); |
| 4238 cpi->worst_blockiness = MAX(cpi->worst_blockiness, frame_blockiness); |
| 4239 cpi->total_blockiness += frame_blockiness; |
| 4240 } |
4107 | 4241 |
| 4242 if (cpi->b_calculate_consistency) { |
| 4243 double this_inconsistency = vp9_get_ssim_metrics( |
| 4244 cpi->Source->y_buffer, cpi->Source->y_stride, |
| 4245 cm->frame_to_show->y_buffer, cm->frame_to_show->y_stride, |
| 4246 cpi->Source->y_width, cpi->Source->y_height, cpi->ssim_vars, |
| 4247 &cpi->metrics, 1); |
| 4248 |
| 4249 const double peak = (double)((1 << cpi->oxcf.input_bit_depth) - 1); |
| 4250 |
| 4251 |
| 4252 double consistency = vpx_sse_to_psnr(samples, peak, |
| 4253 (double)cpi->total_inconsistency); |
| 4254 |
| 4255 if (consistency > 0.0) |
| 4256 cpi->worst_consistency = MIN(cpi->worst_consistency, |
| 4257 consistency); |
| 4258 cpi->total_inconsistency += this_inconsistency; |
| 4259 } |
4108 | 4260 |
4109 if (cpi->b_calculate_ssimg) { | 4261 if (cpi->b_calculate_ssimg) { |
4110 double y, u, v, frame_all; | 4262 double y, u, v, frame_all; |
4111 #if CONFIG_VP9_HIGHBITDEPTH | 4263 #if CONFIG_VP9_HIGHBITDEPTH |
4112 if (cm->use_highbitdepth) { | 4264 if (cm->use_highbitdepth) { |
4113 frame_all = vp9_highbd_calc_ssimg(cpi->Source, cm->frame_to_show, &y, | 4265 frame_all = vp9_highbd_calc_ssimg(cpi->Source, cm->frame_to_show, &y, |
4114 &u, &v, (int)cm->bit_depth); | 4266 &u, &v, (int)cm->bit_depth); |
4115 } else { | 4267 } else { |
4116 frame_all = vp9_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, | 4268 frame_all = vp9_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, |
4117 &v); | 4269 &v); |
4118 } | 4270 } |
4119 #else | 4271 #else |
4120 frame_all = vp9_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v); | 4272 frame_all = vp9_calc_ssimg(cpi->Source, cm->frame_to_show, &y, &u, &v); |
4121 #endif // CONFIG_VP9_HIGHBITDEPTH | 4273 #endif // CONFIG_VP9_HIGHBITDEPTH |
4122 cpi->total_ssimg_y += y; | 4274 adjust_image_stat(y, u, v, frame_all, &cpi->ssimg); |
4123 cpi->total_ssimg_u += u; | 4275 } |
4124 cpi->total_ssimg_v += v; | 4276 { |
4125 cpi->total_ssimg_all += frame_all; | 4277 double y, u, v, frame_all; |
| 4278 frame_all = vp9_calc_fastssim(cpi->Source, cm->frame_to_show, &y, &u, |
| 4279 &v); |
| 4280 adjust_image_stat(y, u, v, frame_all, &cpi->fastssim); |
| 4281 /* TODO(JBB): add 10/12 bit support */ |
| 4282 } |
| 4283 { |
| 4284 double y, u, v, frame_all; |
| 4285 frame_all = vp9_psnrhvs(cpi->Source, cm->frame_to_show, &y, &u, &v); |
| 4286 adjust_image_stat(y, u, v, frame_all, &cpi->psnrhvs); |
4126 } | 4287 } |
4127 } | 4288 } |
4128 } | 4289 } |
4129 | 4290 |
4130 #endif | 4291 #endif |
4131 | 4292 |
4132 if (is_two_pass_svc(cpi)) { | 4293 if (is_two_pass_svc(cpi)) { |
4133 if (cpi->svc.encode_empty_frame_state == ENCODING) | 4294 if (cpi->svc.encode_empty_frame_state == ENCODING) |
4134 cpi->svc.encode_empty_frame_state = ENCODED; | 4295 cpi->svc.encode_empty_frame_state = ENCODED; |
4135 | 4296 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4295 if (flags & VP8_EFLAG_NO_UPD_ARF) | 4456 if (flags & VP8_EFLAG_NO_UPD_ARF) |
4296 upd ^= VP9_ALT_FLAG; | 4457 upd ^= VP9_ALT_FLAG; |
4297 | 4458 |
4298 vp9_update_reference(cpi, upd); | 4459 vp9_update_reference(cpi, upd); |
4299 } | 4460 } |
4300 | 4461 |
4301 if (flags & VP8_EFLAG_NO_UPD_ENTROPY) { | 4462 if (flags & VP8_EFLAG_NO_UPD_ENTROPY) { |
4302 vp9_update_entropy(cpi, 0); | 4463 vp9_update_entropy(cpi, 0); |
4303 } | 4464 } |
4304 } | 4465 } |
OLD | NEW |