| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 | 11 |
| 12 #ifndef VP9_ENCODER_VP9_AQ_CYCLICREFRESH_H_ | 12 #ifndef VP9_ENCODER_VP9_AQ_CYCLICREFRESH_H_ |
| 13 #define VP9_ENCODER_VP9_AQ_CYCLICREFRESH_H_ | 13 #define VP9_ENCODER_VP9_AQ_CYCLICREFRESH_H_ |
| 14 | 14 |
| 15 #include "vp9/common/vp9_blockd.h" | 15 #include "vp9/common/vp9_blockd.h" |
| 16 | 16 |
| 17 #ifdef __cplusplus | 17 #ifdef __cplusplus |
| 18 extern "C" { | 18 extern "C" { |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 // The segment ids used in cyclic refresh: from base (no boost) to increasing | 21 // The segment ids used in cyclic refresh: from base (no boost) to increasing |
| 22 // boost (higher delta-qp). | 22 // boost (higher delta-qp). |
| 23 #define CR_SEGMENT_ID_BASE 0 | 23 #define CR_SEGMENT_ID_BASE 0 |
| 24 #define CR_SEGMENT_ID_BOOST1 1 | 24 #define CR_SEGMENT_ID_BOOST1 1 |
| 25 #define CR_SEGMENT_ID_BOOST2 2 | 25 #define CR_SEGMENT_ID_BOOST2 2 |
| 26 | 26 |
| 27 // Maximum rate target ratio for setting segment delta-qp. | 27 // Maximum rate target ratio for setting segment delta-qp. |
| 28 #define CR_MAX_RATE_TARGET_RATIO 4.0 | 28 #define CR_MAX_RATE_TARGET_RATIO 4.0 |
| 29 | 29 |
| 30 // Boost factor for rate target ratio, for segment CR_SEGMENT_ID_BOOST2. | |
| 31 #define CR_BOOST2_FAC 1.7 | |
| 32 | |
| 33 struct VP9_COMP; | 30 struct VP9_COMP; |
| 34 | 31 |
| 35 struct CYCLIC_REFRESH; | 32 struct CYCLIC_REFRESH; |
| 36 typedef struct CYCLIC_REFRESH CYCLIC_REFRESH; | 33 typedef struct CYCLIC_REFRESH CYCLIC_REFRESH; |
| 37 | 34 |
| 38 CYCLIC_REFRESH *vp9_cyclic_refresh_alloc(int mi_rows, int mi_cols); | 35 CYCLIC_REFRESH *vp9_cyclic_refresh_alloc(int mi_rows, int mi_cols); |
| 39 | 36 |
| 40 void vp9_cyclic_refresh_free(CYCLIC_REFRESH *cr); | 37 void vp9_cyclic_refresh_free(CYCLIC_REFRESH *cr); |
| 41 | 38 |
| 42 // Estimate the bits, incorporating the delta-q from segment 1, after encoding | 39 // Estimate the bits, incorporating the delta-q from segment 1, after encoding |
| (...skipping 28 matching lines...) Expand all Loading... |
| 71 void vp9_cyclic_refresh_check_golden_update(struct VP9_COMP *const cpi); | 68 void vp9_cyclic_refresh_check_golden_update(struct VP9_COMP *const cpi); |
| 72 | 69 |
| 73 // Set/update global/frame level refresh parameters. | 70 // Set/update global/frame level refresh parameters. |
| 74 void vp9_cyclic_refresh_update_parameters(struct VP9_COMP *const cpi); | 71 void vp9_cyclic_refresh_update_parameters(struct VP9_COMP *const cpi); |
| 75 | 72 |
| 76 // Setup cyclic background refresh: set delta q and segmentation map. | 73 // Setup cyclic background refresh: set delta q and segmentation map. |
| 77 void vp9_cyclic_refresh_setup(struct VP9_COMP *const cpi); | 74 void vp9_cyclic_refresh_setup(struct VP9_COMP *const cpi); |
| 78 | 75 |
| 79 int vp9_cyclic_refresh_get_rdmult(const CYCLIC_REFRESH *cr); | 76 int vp9_cyclic_refresh_get_rdmult(const CYCLIC_REFRESH *cr); |
| 80 | 77 |
| 78 void vp9_cyclic_refresh_reset_resize(struct VP9_COMP *const cpi); |
| 79 |
| 81 static INLINE int cyclic_refresh_segment_id_boosted(int segment_id) { | 80 static INLINE int cyclic_refresh_segment_id_boosted(int segment_id) { |
| 82 return segment_id == CR_SEGMENT_ID_BOOST1 || | 81 return segment_id == CR_SEGMENT_ID_BOOST1 || |
| 83 segment_id == CR_SEGMENT_ID_BOOST2; | 82 segment_id == CR_SEGMENT_ID_BOOST2; |
| 84 } | 83 } |
| 85 | 84 |
| 86 static INLINE int cyclic_refresh_segment_id(int segment_id) { | 85 static INLINE int cyclic_refresh_segment_id(int segment_id) { |
| 87 if (segment_id == CR_SEGMENT_ID_BOOST1) | 86 if (segment_id == CR_SEGMENT_ID_BOOST1) |
| 88 return CR_SEGMENT_ID_BOOST1; | 87 return CR_SEGMENT_ID_BOOST1; |
| 89 else if (segment_id == CR_SEGMENT_ID_BOOST2) | 88 else if (segment_id == CR_SEGMENT_ID_BOOST2) |
| 90 return CR_SEGMENT_ID_BOOST2; | 89 return CR_SEGMENT_ID_BOOST2; |
| 91 else | 90 else |
| 92 return CR_SEGMENT_ID_BASE; | 91 return CR_SEGMENT_ID_BASE; |
| 93 } | 92 } |
| 94 | 93 |
| 95 #ifdef __cplusplus | 94 #ifdef __cplusplus |
| 96 } // extern "C" | 95 } // extern "C" |
| 97 #endif | 96 #endif |
| 98 | 97 |
| 99 #endif // VP9_ENCODER_VP9_AQ_CYCLICREFRESH_H_ | 98 #endif // VP9_ENCODER_VP9_AQ_CYCLICREFRESH_H_ |
| OLD | NEW |