| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 | 12 |
| 13 #include "vp9/encoder/vp9_aq_variance.h" | 13 #include "vp9/encoder/vp9_aq_variance.h" |
| 14 | 14 |
| 15 #include "vp9/common/vp9_seg_common.h" | 15 #include "vp9/common/vp9_seg_common.h" |
| 16 | 16 |
| 17 #include "vp9/encoder/vp9_ratectrl.h" | 17 #include "vp9/encoder/vp9_ratectrl.h" |
| 18 #include "vp9/encoder/vp9_rd.h" | 18 #include "vp9/encoder/vp9_rd.h" |
| 19 #include "vp9/encoder/vp9_segmentation.h" | 19 #include "vp9/encoder/vp9_segmentation.h" |
| 20 #include "vp9/common/vp9_systemdependent.h" | 20 #include "vp9/common/vp9_systemdependent.h" |
| 21 | 21 |
| 22 #define ENERGY_MIN (-1) | 22 #define ENERGY_MIN (-4) |
| 23 #define ENERGY_MAX (1) | 23 #define ENERGY_MAX (1) |
| 24 #define ENERGY_SPAN (ENERGY_MAX - ENERGY_MIN + 1) | 24 #define ENERGY_SPAN (ENERGY_MAX - ENERGY_MIN + 1) |
| 25 #define ENERGY_IN_BOUNDS(energy)\ | 25 #define ENERGY_IN_BOUNDS(energy)\ |
| 26 assert((energy) >= ENERGY_MIN && (energy) <= ENERGY_MAX) | 26 assert((energy) >= ENERGY_MIN && (energy) <= ENERGY_MAX) |
| 27 | 27 |
| 28 static const double rate_ratio[MAX_SEGMENTS] = | 28 static const double rate_ratio[MAX_SEGMENTS] = |
| 29 {1.143, 1.0, 0.875, 1.0, 1.0, 1.0, 1.0, 1.0}; | 29 {2.5, 2.0, 1.5, 1.0, 0.75, 1.0, 1.0, 1.0}; |
| 30 static const int segment_id[ENERGY_SPAN] = {0, 1, 2}; | 30 static const int segment_id[ENERGY_SPAN] = {0, 1, 1, 2, 3, 4}; |
| 31 | 31 |
| 32 #define SEGMENT_ID(i) segment_id[(i) - ENERGY_MIN] | 32 #define SEGMENT_ID(i) segment_id[(i) - ENERGY_MIN] |
| 33 | 33 |
| 34 DECLARE_ALIGNED(16, static const uint8_t, vp9_64_zeros[64]) = {0}; | 34 DECLARE_ALIGNED(16, static const uint8_t, vp9_64_zeros[64]) = {0}; |
| 35 #if CONFIG_VP9_HIGHBITDEPTH | 35 #if CONFIG_VP9_HIGHBITDEPTH |
| 36 DECLARE_ALIGNED(16, static const uint16_t, vp9_highbd_64_zeros[64]) = {0}; | 36 DECLARE_ALIGNED(16, static const uint16_t, vp9_highbd_64_zeros[64]) = {0}; |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 unsigned int vp9_vaq_segment_id(int energy) { | 39 unsigned int vp9_vaq_segment_id(int energy) { |
| 40 ENERGY_IN_BOUNDS(energy); | 40 ENERGY_IN_BOUNDS(energy); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 #define DEFAULT_E_MIDPOINT 10.0 | 141 #define DEFAULT_E_MIDPOINT 10.0 |
| 142 int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) { | 142 int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) { |
| 143 double energy; | 143 double energy; |
| 144 double energy_midpoint; | 144 double energy_midpoint; |
| 145 vp9_clear_system_state(); | 145 vp9_clear_system_state(); |
| 146 energy_midpoint = | 146 energy_midpoint = |
| 147 (cpi->oxcf.pass == 2) ? cpi->twopass.mb_av_energy : DEFAULT_E_MIDPOINT; | 147 (cpi->oxcf.pass == 2) ? cpi->twopass.mb_av_energy : DEFAULT_E_MIDPOINT; |
| 148 energy = vp9_log_block_var(cpi, x, bs) - energy_midpoint; | 148 energy = vp9_log_block_var(cpi, x, bs) - energy_midpoint; |
| 149 return clamp((int)round(energy), ENERGY_MIN, ENERGY_MAX); | 149 return clamp((int)round(energy), ENERGY_MIN, ENERGY_MAX); |
| 150 } | 150 } |
| OLD | NEW |