| 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_rdopt.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 (-1) |
| 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 double q_ratio[MAX_SEGMENTS] = { 1, 1, 1, 1, 1, 1, 1, 1 }; | 28 static double q_ratio[MAX_SEGMENTS] = { 1, 1, 1, 1, 1, 1, 1, 1 }; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) { | 140 int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) { |
| 141 double energy; | 141 double energy; |
| 142 unsigned int var = block_variance(cpi, x, bs); | 142 unsigned int var = block_variance(cpi, x, bs); |
| 143 | 143 |
| 144 vp9_clear_system_state(); | 144 vp9_clear_system_state(); |
| 145 | 145 |
| 146 energy = 0.9 * (log(var + 1.0) - 10.0); | 146 energy = 0.9 * (log(var + 1.0) - 10.0); |
| 147 return clamp((int)round(energy), ENERGY_MIN, ENERGY_MAX); | 147 return clamp((int)round(energy), ENERGY_MIN, ENERGY_MAX); |
| 148 } | 148 } |
| OLD | NEW |