| 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_alloccommon.h" |
| 20 #include "vp9/common/vp9_ppflags.h" | 21 #include "vp9/common/vp9_ppflags.h" |
| 21 #include "vp9/common/vp9_entropymode.h" | 22 #include "vp9/common/vp9_entropymode.h" |
| 22 #include "vp9/common/vp9_thread_common.h" | 23 #include "vp9/common/vp9_thread_common.h" |
| 23 #include "vp9/common/vp9_onyxc_int.h" | 24 #include "vp9/common/vp9_onyxc_int.h" |
| 24 #include "vp9/common/vp9_thread.h" | 25 #include "vp9/common/vp9_thread.h" |
| 25 | 26 |
| 26 #include "vp9/encoder/vp9_aq_cyclicrefresh.h" | 27 #include "vp9/encoder/vp9_aq_cyclicrefresh.h" |
| 27 #include "vp9/encoder/vp9_context_tree.h" | 28 #include "vp9/encoder/vp9_context_tree.h" |
| 28 #include "vp9/encoder/vp9_encodemb.h" | 29 #include "vp9/encoder/vp9_encodemb.h" |
| 29 #include "vp9/encoder/vp9_firstpass.h" | 30 #include "vp9/encoder/vp9_firstpass.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 | 41 |
| 41 #if CONFIG_VP9_TEMPORAL_DENOISING | 42 #if CONFIG_VP9_TEMPORAL_DENOISING |
| 42 #include "vp9/encoder/vp9_denoiser.h" | 43 #include "vp9/encoder/vp9_denoiser.h" |
| 43 #endif | 44 #endif |
| 44 | 45 |
| 45 #ifdef __cplusplus | 46 #ifdef __cplusplus |
| 46 extern "C" { | 47 extern "C" { |
| 47 #endif | 48 #endif |
| 48 | 49 |
| 49 #define DEFAULT_GF_INTERVAL 10 | 50 #define DEFAULT_GF_INTERVAL 10 |
| 50 #define INVALID_REF_BUFFER_IDX -1 // Marks an invalid reference buffer id. | |
| 51 | 51 |
| 52 typedef struct { | 52 typedef struct { |
| 53 int nmvjointcost[MV_JOINTS]; | 53 int nmvjointcost[MV_JOINTS]; |
| 54 int nmvcosts[2][MV_VALS]; | 54 int nmvcosts[2][MV_VALS]; |
| 55 int nmvcosts_hp[2][MV_VALS]; | 55 int nmvcosts_hp[2][MV_VALS]; |
| 56 | 56 |
| 57 vp9_prob segment_pred_probs[PREDICTION_PROBS]; | 57 vp9_prob segment_pred_probs[PREDICTION_PROBS]; |
| 58 | 58 |
| 59 unsigned char *last_frame_seg_map_copy; | 59 unsigned char *last_frame_seg_map_copy; |
| 60 | 60 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 void vp9_set_svc(VP9_COMP *cpi, int use_svc); | 510 void vp9_set_svc(VP9_COMP *cpi, int use_svc); |
| 511 | 511 |
| 512 int vp9_get_quantizer(struct VP9_COMP *cpi); | 512 int vp9_get_quantizer(struct VP9_COMP *cpi); |
| 513 | 513 |
| 514 static INLINE int frame_is_kf_gf_arf(const VP9_COMP *cpi) { | 514 static INLINE int frame_is_kf_gf_arf(const VP9_COMP *cpi) { |
| 515 return frame_is_intra_only(&cpi->common) || | 515 return frame_is_intra_only(&cpi->common) || |
| 516 cpi->refresh_alt_ref_frame || | 516 cpi->refresh_alt_ref_frame || |
| 517 (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref); | 517 (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref); |
| 518 } | 518 } |
| 519 | 519 |
| 520 static INLINE int get_ref_frame_idx(const VP9_COMP *cpi, | 520 static INLINE int get_ref_frame_map_idx(const VP9_COMP *cpi, |
| 521 MV_REFERENCE_FRAME ref_frame) { | 521 MV_REFERENCE_FRAME ref_frame) { |
| 522 if (ref_frame == LAST_FRAME) { | 522 if (ref_frame == LAST_FRAME) { |
| 523 return cpi->lst_fb_idx; | 523 return cpi->lst_fb_idx; |
| 524 } else if (ref_frame == GOLDEN_FRAME) { | 524 } else if (ref_frame == GOLDEN_FRAME) { |
| 525 return cpi->gld_fb_idx; | 525 return cpi->gld_fb_idx; |
| 526 } else { | 526 } else { |
| 527 return cpi->alt_fb_idx; | 527 return cpi->alt_fb_idx; |
| 528 } | 528 } |
| 529 } | 529 } |
| 530 | 530 |
| 531 static INLINE int get_ref_frame_buf_idx(const VP9_COMP *const cpi, |
| 532 int ref_frame) { |
| 533 const VP9_COMMON *const cm = &cpi->common; |
| 534 const int map_idx = get_ref_frame_map_idx(cpi, ref_frame); |
| 535 return (map_idx != INVALID_IDX) ? cm->ref_frame_map[map_idx] : INVALID_IDX; |
| 536 } |
| 537 |
| 531 static INLINE YV12_BUFFER_CONFIG *get_ref_frame_buffer( | 538 static INLINE YV12_BUFFER_CONFIG *get_ref_frame_buffer( |
| 532 VP9_COMP *cpi, MV_REFERENCE_FRAME ref_frame) { | 539 VP9_COMP *cpi, MV_REFERENCE_FRAME ref_frame) { |
| 533 VP9_COMMON *const cm = &cpi->common; | 540 VP9_COMMON *const cm = &cpi->common; |
| 534 BufferPool *const pool = cm->buffer_pool; | 541 const int buf_idx = get_ref_frame_buf_idx(cpi, ref_frame); |
| 535 return &pool->frame_bufs[cm->ref_frame_map[get_ref_frame_idx(cpi, ref_frame)]] | 542 return |
| 536 .buf; | 543 buf_idx != INVALID_IDX ? &cm->buffer_pool->frame_bufs[buf_idx].buf : NULL; |
| 537 } | 544 } |
| 538 | 545 |
| 539 static INLINE int get_token_alloc(int mb_rows, int mb_cols) { | 546 static INLINE int get_token_alloc(int mb_rows, int mb_cols) { |
| 540 // TODO(JBB): double check we can't exceed this token count if we have a | 547 // TODO(JBB): double check we can't exceed this token count if we have a |
| 541 // 32x32 transform crossing a boundary at a multiple of 16. | 548 // 32x32 transform crossing a boundary at a multiple of 16. |
| 542 // mb_rows, cols are in units of 16 pixels. We assume 3 planes all at full | 549 // mb_rows, cols are in units of 16 pixels. We assume 3 planes all at full |
| 543 // resolution. We assume up to 1 token per pixel, and then allow | 550 // resolution. We assume up to 1 token per pixel, and then allow |
| 544 // a head room of 4. | 551 // a head room of 4. |
| 545 return mb_rows * mb_cols * (16 * 16 * 3 + 4); | 552 return mb_rows * mb_cols * (16 * 16 * 3 + 4); |
| 546 } | 553 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL; | 611 return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL; |
| 605 } | 612 } |
| 606 | 613 |
| 607 void vp9_new_framerate(VP9_COMP *cpi, double framerate); | 614 void vp9_new_framerate(VP9_COMP *cpi, double framerate); |
| 608 | 615 |
| 609 #ifdef __cplusplus | 616 #ifdef __cplusplus |
| 610 } // extern "C" | 617 } // extern "C" |
| 611 #endif | 618 #endif |
| 612 | 619 |
| 613 #endif // VP9_ENCODER_VP9_ENCODER_H_ | 620 #endif // VP9_ENCODER_VP9_ENCODER_H_ |
| OLD | NEW |