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_loopfilter_thread.h" | 22 #include "vp9/common/vp9_thread_common.h" |
23 #include "vp9/common/vp9_onyxc_int.h" | 23 #include "vp9/common/vp9_onyxc_int.h" |
24 #include "vp9/common/vp9_thread.h" | 24 #include "vp9/common/vp9_thread.h" |
25 | 25 |
26 #include "vp9/encoder/vp9_aq_cyclicrefresh.h" | 26 #include "vp9/encoder/vp9_aq_cyclicrefresh.h" |
27 #include "vp9/encoder/vp9_context_tree.h" | 27 #include "vp9/encoder/vp9_context_tree.h" |
28 #include "vp9/encoder/vp9_encodemb.h" | 28 #include "vp9/encoder/vp9_encodemb.h" |
29 #include "vp9/encoder/vp9_firstpass.h" | 29 #include "vp9/encoder/vp9_firstpass.h" |
30 #include "vp9/encoder/vp9_lookahead.h" | 30 #include "vp9/encoder/vp9_lookahead.h" |
31 #include "vp9/encoder/vp9_mbgraph.h" | 31 #include "vp9/encoder/vp9_mbgraph.h" |
32 #include "vp9/encoder/vp9_mcomp.h" | 32 #include "vp9/encoder/vp9_mcomp.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 PICK_MODE_CONTEXT *leaf_tree; | 262 PICK_MODE_CONTEXT *leaf_tree; |
263 PC_TREE *pc_tree; | 263 PC_TREE *pc_tree; |
264 PC_TREE *pc_root; | 264 PC_TREE *pc_root; |
265 } ThreadData; | 265 } ThreadData; |
266 | 266 |
267 struct EncWorkerData; | 267 struct EncWorkerData; |
268 | 268 |
269 typedef struct VP9_COMP { | 269 typedef struct VP9_COMP { |
270 QUANTS quants; | 270 QUANTS quants; |
271 ThreadData td; | 271 ThreadData td; |
| 272 DECLARE_ALIGNED(16, int16_t, y_dequant[QINDEX_RANGE][8]); |
| 273 DECLARE_ALIGNED(16, int16_t, uv_dequant[QINDEX_RANGE][8]); |
272 VP9_COMMON common; | 274 VP9_COMMON common; |
273 VP9EncoderConfig oxcf; | 275 VP9EncoderConfig oxcf; |
274 struct lookahead_ctx *lookahead; | 276 struct lookahead_ctx *lookahead; |
275 struct lookahead_entry *alt_ref_source; | 277 struct lookahead_entry *alt_ref_source; |
276 | 278 |
277 YV12_BUFFER_CONFIG *Source; | 279 YV12_BUFFER_CONFIG *Source; |
278 YV12_BUFFER_CONFIG *Last_Source; // NULL for first frame and alt_ref frames | 280 YV12_BUFFER_CONFIG *Last_Source; // NULL for first frame and alt_ref frames |
279 YV12_BUFFER_CONFIG *un_scaled_source; | 281 YV12_BUFFER_CONFIG *un_scaled_source; |
280 YV12_BUFFER_CONFIG scaled_source; | 282 YV12_BUFFER_CONFIG scaled_source; |
281 YV12_BUFFER_CONFIG *unscaled_last_source; | 283 YV12_BUFFER_CONFIG *unscaled_last_source; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES]; | 443 int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES]; |
442 | 444 |
443 int multi_arf_allowed; | 445 int multi_arf_allowed; |
444 int multi_arf_enabled; | 446 int multi_arf_enabled; |
445 int multi_arf_last_grp_enabled; | 447 int multi_arf_last_grp_enabled; |
446 | 448 |
447 #if CONFIG_VP9_TEMPORAL_DENOISING | 449 #if CONFIG_VP9_TEMPORAL_DENOISING |
448 VP9_DENOISER denoiser; | 450 VP9_DENOISER denoiser; |
449 #endif | 451 #endif |
450 | 452 |
| 453 int resize_pending; |
| 454 |
| 455 // VAR_BASED_PARTITION thresholds |
| 456 int64_t vbp_threshold; |
| 457 int64_t vbp_threshold_bsize_min; |
| 458 int64_t vbp_threshold_bsize_max; |
| 459 int64_t vbp_threshold_16x16; |
| 460 BLOCK_SIZE vbp_bsize_min; |
| 461 |
451 // Multi-threading | 462 // Multi-threading |
452 int num_workers; | 463 int num_workers; |
453 VP9Worker *workers; | 464 VP9Worker *workers; |
454 struct EncWorkerData *tile_thr_data; | 465 struct EncWorkerData *tile_thr_data; |
455 VP9LfSync lf_row_sync; | 466 VP9LfSync lf_row_sync; |
456 } VP9_COMP; | 467 } VP9_COMP; |
457 | 468 |
458 void vp9_initialize_enc(void); | 469 void vp9_initialize_enc(void); |
459 | 470 |
460 struct VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf); | 471 struct VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf, |
| 472 BufferPool *const pool); |
461 void vp9_remove_compressor(VP9_COMP *cpi); | 473 void vp9_remove_compressor(VP9_COMP *cpi); |
462 | 474 |
463 void vp9_change_config(VP9_COMP *cpi, const VP9EncoderConfig *oxcf); | 475 void vp9_change_config(VP9_COMP *cpi, const VP9EncoderConfig *oxcf); |
464 | 476 |
465 // receive a frames worth of data. caller can assume that a copy of this | 477 // receive a frames worth of data. caller can assume that a copy of this |
466 // frame is made and not just a copy of the pointer.. | 478 // frame is made and not just a copy of the pointer.. |
467 int vp9_receive_raw_frame(VP9_COMP *cpi, unsigned int frame_flags, | 479 int vp9_receive_raw_frame(VP9_COMP *cpi, unsigned int frame_flags, |
468 YV12_BUFFER_CONFIG *sd, int64_t time_stamp, | 480 YV12_BUFFER_CONFIG *sd, int64_t time_stamp, |
469 int64_t end_time_stamp); | 481 int64_t end_time_stamp); |
470 | 482 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 return cpi->lst_fb_idx; | 523 return cpi->lst_fb_idx; |
512 } else if (ref_frame == GOLDEN_FRAME) { | 524 } else if (ref_frame == GOLDEN_FRAME) { |
513 return cpi->gld_fb_idx; | 525 return cpi->gld_fb_idx; |
514 } else { | 526 } else { |
515 return cpi->alt_fb_idx; | 527 return cpi->alt_fb_idx; |
516 } | 528 } |
517 } | 529 } |
518 | 530 |
519 static INLINE YV12_BUFFER_CONFIG *get_ref_frame_buffer( | 531 static INLINE YV12_BUFFER_CONFIG *get_ref_frame_buffer( |
520 VP9_COMP *cpi, MV_REFERENCE_FRAME ref_frame) { | 532 VP9_COMP *cpi, MV_REFERENCE_FRAME ref_frame) { |
521 VP9_COMMON * const cm = &cpi->common; | 533 VP9_COMMON *const cm = &cpi->common; |
522 return &cm->frame_bufs[cm->ref_frame_map[get_ref_frame_idx(cpi, ref_frame)]] | 534 BufferPool *const pool = cm->buffer_pool; |
| 535 return &pool->frame_bufs[cm->ref_frame_map[get_ref_frame_idx(cpi, ref_frame)]] |
523 .buf; | 536 .buf; |
524 } | 537 } |
525 | 538 |
526 static INLINE int get_token_alloc(int mb_rows, int mb_cols) { | 539 static INLINE int get_token_alloc(int mb_rows, int mb_cols) { |
527 // TODO(JBB): double check we can't exceed this token count if we have a | 540 // TODO(JBB): double check we can't exceed this token count if we have a |
528 // 32x32 transform crossing a boundary at a multiple of 16. | 541 // 32x32 transform crossing a boundary at a multiple of 16. |
529 // mb_rows, cols are in units of 16 pixels. We assume 3 planes all at full | 542 // mb_rows, cols are in units of 16 pixels. We assume 3 planes all at full |
530 // resolution. We assume up to 1 token per pixel, and then allow | 543 // resolution. We assume up to 1 token per pixel, and then allow |
531 // a head room of 4. | 544 // a head room of 4. |
532 return mb_rows * mb_cols * (16 * 16 * 3 + 4); | 545 return mb_rows * mb_cols * (16 * 16 * 3 + 4); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 } | 597 } |
585 | 598 |
586 static INLINE int get_chessboard_index(const int frame_index) { | 599 static INLINE int get_chessboard_index(const int frame_index) { |
587 return frame_index & 0x1; | 600 return frame_index & 0x1; |
588 } | 601 } |
589 | 602 |
590 static INLINE int *cond_cost_list(const struct VP9_COMP *cpi, int *cost_list) { | 603 static INLINE int *cond_cost_list(const struct VP9_COMP *cpi, int *cost_list) { |
591 return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL; | 604 return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL; |
592 } | 605 } |
593 | 606 |
| 607 void vp9_new_framerate(VP9_COMP *cpi, double framerate); |
| 608 |
594 #ifdef __cplusplus | 609 #ifdef __cplusplus |
595 } // extern "C" | 610 } // extern "C" |
596 #endif | 611 #endif |
597 | 612 |
598 #endif // VP9_ENCODER_VP9_ENCODER_H_ | 613 #endif // VP9_ENCODER_VP9_ENCODER_H_ |
OLD | NEW |