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 #ifndef VP9_ENCODER_VP9_ENCODER_H_ | 11 #ifndef VP9_ENCODER_VP9_ENCODER_H_ |
12 #define VP9_ENCODER_VP9_ENCODER_H_ | 12 #define VP9_ENCODER_VP9_ENCODER_H_ |
13 | 13 |
14 #include <stdio.h> | 14 #include <stdio.h> |
15 | 15 |
16 #include "./vpx_config.h" | 16 #include "./vpx_config.h" |
17 #include "vpx/internal/vpx_codec_internal.h" | 17 #include "vpx/internal/vpx_codec_internal.h" |
18 #include "vpx/vp8cx.h" | 18 #include "vpx/vp8cx.h" |
19 | 19 |
20 #include "vp9/common/vp9_ppflags.h" | 20 #include "vp9/common/vp9_ppflags.h" |
21 #include "vp9/common/vp9_entropymode.h" | 21 #include "vp9/common/vp9_entropymode.h" |
22 #include "vp9/common/vp9_onyxc_int.h" | 22 #include "vp9/common/vp9_onyxc_int.h" |
| 23 #include "vp9/common/vp9_thread.h" |
23 | 24 |
24 #include "vp9/encoder/vp9_aq_cyclicrefresh.h" | 25 #include "vp9/encoder/vp9_aq_cyclicrefresh.h" |
25 #include "vp9/encoder/vp9_context_tree.h" | 26 #include "vp9/encoder/vp9_context_tree.h" |
26 #include "vp9/encoder/vp9_encodemb.h" | 27 #include "vp9/encoder/vp9_encodemb.h" |
27 #include "vp9/encoder/vp9_firstpass.h" | 28 #include "vp9/encoder/vp9_firstpass.h" |
28 #include "vp9/encoder/vp9_lookahead.h" | 29 #include "vp9/encoder/vp9_lookahead.h" |
29 #include "vp9/encoder/vp9_mbgraph.h" | 30 #include "vp9/encoder/vp9_mbgraph.h" |
30 #include "vp9/encoder/vp9_mcomp.h" | 31 #include "vp9/encoder/vp9_mcomp.h" |
31 #include "vp9/encoder/vp9_quantize.h" | 32 #include "vp9/encoder/vp9_quantize.h" |
32 #include "vp9/encoder/vp9_ratectrl.h" | 33 #include "vp9/encoder/vp9_ratectrl.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 * just by decoding the frame headers. | 210 * just by decoding the frame headers. |
210 */ | 211 */ |
211 unsigned int frame_parallel_decoding_mode; | 212 unsigned int frame_parallel_decoding_mode; |
212 | 213 |
213 int arnr_max_frames; | 214 int arnr_max_frames; |
214 int arnr_strength; | 215 int arnr_strength; |
215 | 216 |
216 int tile_columns; | 217 int tile_columns; |
217 int tile_rows; | 218 int tile_rows; |
218 | 219 |
| 220 int max_threads; |
| 221 |
219 vpx_fixed_buf_t two_pass_stats_in; | 222 vpx_fixed_buf_t two_pass_stats_in; |
220 struct vpx_codec_pkt_list *output_pkt_list; | 223 struct vpx_codec_pkt_list *output_pkt_list; |
221 | 224 |
222 #if CONFIG_FP_MB_STATS | 225 #if CONFIG_FP_MB_STATS |
223 vpx_fixed_buf_t firstpass_mb_stats_in; | 226 vpx_fixed_buf_t firstpass_mb_stats_in; |
224 #endif | 227 #endif |
225 | 228 |
226 vp8e_tuning tuning; | 229 vp8e_tuning tuning; |
227 vp9e_tune_content content; | 230 vp9e_tune_content content; |
228 #if CONFIG_VP9_HIGHBITDEPTH | 231 #if CONFIG_VP9_HIGHBITDEPTH |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 297 |
295 int ext_refresh_frame_context_pending; | 298 int ext_refresh_frame_context_pending; |
296 int ext_refresh_frame_context; | 299 int ext_refresh_frame_context; |
297 | 300 |
298 YV12_BUFFER_CONFIG last_frame_uf; | 301 YV12_BUFFER_CONFIG last_frame_uf; |
299 | 302 |
300 TOKENEXTRA *tile_tok[4][1 << 6]; | 303 TOKENEXTRA *tile_tok[4][1 << 6]; |
301 unsigned int tok_count[4][1 << 6]; | 304 unsigned int tok_count[4][1 << 6]; |
302 | 305 |
303 // Ambient reconstruction err target for force key frames | 306 // Ambient reconstruction err target for force key frames |
304 int ambient_err; | 307 int64_t ambient_err; |
305 | 308 |
306 RD_OPT rd; | 309 RD_OPT rd; |
307 | 310 |
308 CODING_CONTEXT coding_context; | 311 CODING_CONTEXT coding_context; |
309 | 312 |
310 int *nmvcosts[2]; | 313 int *nmvcosts[2]; |
311 int *nmvcosts_hp[2]; | 314 int *nmvcosts_hp[2]; |
312 int *nmvsadcosts[2]; | 315 int *nmvsadcosts[2]; |
313 int *nmvsadcosts_hp[2]; | 316 int *nmvsadcosts_hp[2]; |
314 | 317 |
315 int zbin_mode_boost; | |
316 int zbin_mode_boost_enabled; | |
317 | |
318 int64_t last_time_stamp_seen; | 318 int64_t last_time_stamp_seen; |
319 int64_t last_end_time_stamp_seen; | 319 int64_t last_end_time_stamp_seen; |
320 int64_t first_time_stamp_ever; | 320 int64_t first_time_stamp_ever; |
321 | 321 |
322 RATE_CONTROL rc; | 322 RATE_CONTROL rc; |
323 double framerate; | 323 double framerate; |
324 | 324 |
325 int interp_filter_selected[MAX_REF_FRAMES][SWITCHABLE]; | 325 int interp_filter_selected[MAX_REF_FRAMES][SWITCHABLE]; |
326 | 326 |
327 struct vpx_codec_pkt_list *output_pkt_list; | 327 struct vpx_codec_pkt_list *output_pkt_list; |
328 | 328 |
329 MBGRAPH_FRAME_STATS mbgraph_stats[MAX_LAG_BUFFERS]; | 329 MBGRAPH_FRAME_STATS mbgraph_stats[MAX_LAG_BUFFERS]; |
330 int mbgraph_n_frames; // number of frames filled in the above | 330 int mbgraph_n_frames; // number of frames filled in the above |
331 int static_mb_pct; // % forced skip mbs by segmentation | 331 int static_mb_pct; // % forced skip mbs by segmentation |
332 int ref_frame_flags; | 332 int ref_frame_flags; |
333 | 333 |
334 SPEED_FEATURES sf; | 334 SPEED_FEATURES sf; |
335 | 335 |
336 unsigned int max_mv_magnitude; | 336 unsigned int max_mv_magnitude; |
337 int mv_step_param; | 337 int mv_step_param; |
338 | 338 |
| 339 int allow_comp_inter_inter; |
| 340 |
339 // Default value is 1. From first pass stats, encode_breakout may be disabled. | 341 // Default value is 1. From first pass stats, encode_breakout may be disabled. |
340 ENCODE_BREAKOUT_TYPE allow_encode_breakout; | 342 ENCODE_BREAKOUT_TYPE allow_encode_breakout; |
341 | 343 |
342 // Get threshold from external input. A suggested threshold is 800 for HD | 344 // Get threshold from external input. A suggested threshold is 800 for HD |
343 // clips, and 300 for < HD clips. | 345 // clips, and 300 for < HD clips. |
344 int encode_breakout; | 346 int encode_breakout; |
345 | 347 |
346 unsigned char *segmentation_map; | 348 unsigned char *segmentation_map; |
347 | 349 |
348 // segment threashold for encode breakout | 350 // segment threashold for encode breakout |
349 int segment_encode_breakout[MAX_SEGMENTS]; | 351 int segment_encode_breakout[MAX_SEGMENTS]; |
350 | 352 |
351 unsigned char *complexity_map; | |
352 | |
353 CYCLIC_REFRESH *cyclic_refresh; | 353 CYCLIC_REFRESH *cyclic_refresh; |
354 | 354 |
355 fractional_mv_step_fp *find_fractional_mv_step; | 355 fractional_mv_step_fp *find_fractional_mv_step; |
356 vp9_full_search_fn_t full_search_sad; | 356 vp9_full_search_fn_t full_search_sad; |
357 vp9_diamond_search_fn_t diamond_search_sad; | 357 vp9_diamond_search_fn_t diamond_search_sad; |
358 vp9_variance_fn_ptr_t fn_ptr[BLOCK_SIZES]; | 358 vp9_variance_fn_ptr_t fn_ptr[BLOCK_SIZES]; |
359 uint64_t time_receive_data; | 359 uint64_t time_receive_data; |
360 uint64_t time_compress_data; | 360 uint64_t time_compress_data; |
361 uint64_t time_pick_lpf; | 361 uint64_t time_pick_lpf; |
362 uint64_t time_encode_sb_row; | 362 uint64_t time_encode_sb_row; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS]; | 435 int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS]; |
436 int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES]; | 436 int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES]; |
437 | 437 |
438 int multi_arf_allowed; | 438 int multi_arf_allowed; |
439 int multi_arf_enabled; | 439 int multi_arf_enabled; |
440 int multi_arf_last_grp_enabled; | 440 int multi_arf_last_grp_enabled; |
441 | 441 |
442 #if CONFIG_VP9_TEMPORAL_DENOISING | 442 #if CONFIG_VP9_TEMPORAL_DENOISING |
443 VP9_DENOISER denoiser; | 443 VP9_DENOISER denoiser; |
444 #endif | 444 #endif |
| 445 |
| 446 // Multi-threading |
| 447 int num_workers; |
| 448 VP9Worker *workers; |
445 } VP9_COMP; | 449 } VP9_COMP; |
446 | 450 |
447 void vp9_initialize_enc(); | 451 void vp9_initialize_enc(void); |
448 | 452 |
449 struct VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf); | 453 struct VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf); |
450 void vp9_remove_compressor(VP9_COMP *cpi); | 454 void vp9_remove_compressor(VP9_COMP *cpi); |
451 | 455 |
452 void vp9_change_config(VP9_COMP *cpi, const VP9EncoderConfig *oxcf); | 456 void vp9_change_config(VP9_COMP *cpi, const VP9EncoderConfig *oxcf); |
453 | 457 |
454 // receive a frames worth of data. caller can assume that a copy of this | 458 // receive a frames worth of data. caller can assume that a copy of this |
455 // frame is made and not just a copy of the pointer.. | 459 // frame is made and not just a copy of the pointer.. |
456 int vp9_receive_raw_frame(VP9_COMP *cpi, unsigned int frame_flags, | 460 int vp9_receive_raw_frame(VP9_COMP *cpi, unsigned int frame_flags, |
457 YV12_BUFFER_CONFIG *sd, int64_t time_stamp, | 461 YV12_BUFFER_CONFIG *sd, int64_t time_stamp, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 | 527 |
524 // Get the allocated token size for a tile. It does the same calculation as in | 528 // Get the allocated token size for a tile. It does the same calculation as in |
525 // the frame token allocation. | 529 // the frame token allocation. |
526 static INLINE int allocated_tokens(TileInfo tile) { | 530 static INLINE int allocated_tokens(TileInfo tile) { |
527 int tile_mb_rows = (tile.mi_row_end - tile.mi_row_start + 1) >> 1; | 531 int tile_mb_rows = (tile.mi_row_end - tile.mi_row_start + 1) >> 1; |
528 int tile_mb_cols = (tile.mi_col_end - tile.mi_col_start + 1) >> 1; | 532 int tile_mb_cols = (tile.mi_col_end - tile.mi_col_start + 1) >> 1; |
529 | 533 |
530 return get_token_alloc(tile_mb_rows, tile_mb_cols); | 534 return get_token_alloc(tile_mb_rows, tile_mb_cols); |
531 } | 535 } |
532 | 536 |
533 int vp9_get_y_sse(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b); | 537 int64_t vp9_get_y_sse(const YV12_BUFFER_CONFIG *a, const YV12_BUFFER_CONFIG *b); |
534 #if CONFIG_VP9_HIGHBITDEPTH | 538 #if CONFIG_VP9_HIGHBITDEPTH |
535 int vp9_highbd_get_y_sse(const YV12_BUFFER_CONFIG *a, | 539 int64_t vp9_highbd_get_y_sse(const YV12_BUFFER_CONFIG *a, |
536 const YV12_BUFFER_CONFIG *b, | 540 const YV12_BUFFER_CONFIG *b); |
537 vpx_bit_depth_t bit_depth); | |
538 #endif // CONFIG_VP9_HIGHBITDEPTH | 541 #endif // CONFIG_VP9_HIGHBITDEPTH |
539 | 542 |
540 void vp9_alloc_compressor_data(VP9_COMP *cpi); | 543 void vp9_alloc_compressor_data(VP9_COMP *cpi); |
541 | 544 |
542 void vp9_scale_references(VP9_COMP *cpi); | 545 void vp9_scale_references(VP9_COMP *cpi); |
543 | 546 |
544 void vp9_update_reference_frames(VP9_COMP *cpi); | 547 void vp9_update_reference_frames(VP9_COMP *cpi); |
545 | 548 |
546 void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv); | 549 void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv); |
547 | 550 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 | 582 |
580 static INLINE int *cond_cost_list(const struct VP9_COMP *cpi, int *cost_list) { | 583 static INLINE int *cond_cost_list(const struct VP9_COMP *cpi, int *cost_list) { |
581 return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL; | 584 return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL; |
582 } | 585 } |
583 | 586 |
584 #ifdef __cplusplus | 587 #ifdef __cplusplus |
585 } // extern "C" | 588 } // extern "C" |
586 #endif | 589 #endif |
587 | 590 |
588 #endif // VP9_ENCODER_VP9_ENCODER_H_ | 591 #endif // VP9_ENCODER_VP9_ENCODER_H_ |
OLD | NEW |