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 "vpx_ports/mem.h" |
| 14 |
13 #include "vp9/encoder/vp9_aq_variance.h" | 15 #include "vp9/encoder/vp9_aq_variance.h" |
14 | 16 |
15 #include "vp9/common/vp9_seg_common.h" | 17 #include "vp9/common/vp9_seg_common.h" |
16 | 18 |
17 #include "vp9/encoder/vp9_ratectrl.h" | 19 #include "vp9/encoder/vp9_ratectrl.h" |
18 #include "vp9/encoder/vp9_rd.h" | 20 #include "vp9/encoder/vp9_rd.h" |
19 #include "vp9/encoder/vp9_segmentation.h" | 21 #include "vp9/encoder/vp9_segmentation.h" |
20 #include "vp9/common/vp9_systemdependent.h" | 22 #include "vp9/common/vp9_systemdependent.h" |
21 | 23 |
22 #define ENERGY_MIN (-4) | 24 #define ENERGY_MIN (-4) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ((-xd->mb_to_right_edge) >> 3) : 0; | 91 ((-xd->mb_to_right_edge) >> 3) : 0; |
90 int bottom_overflow = (xd->mb_to_bottom_edge < 0) ? | 92 int bottom_overflow = (xd->mb_to_bottom_edge < 0) ? |
91 ((-xd->mb_to_bottom_edge) >> 3) : 0; | 93 ((-xd->mb_to_bottom_edge) >> 3) : 0; |
92 | 94 |
93 if (right_overflow || bottom_overflow) { | 95 if (right_overflow || bottom_overflow) { |
94 const int bw = 8 * num_8x8_blocks_wide_lookup[bs] - right_overflow; | 96 const int bw = 8 * num_8x8_blocks_wide_lookup[bs] - right_overflow; |
95 const int bh = 8 * num_8x8_blocks_high_lookup[bs] - bottom_overflow; | 97 const int bh = 8 * num_8x8_blocks_high_lookup[bs] - bottom_overflow; |
96 int avg; | 98 int avg; |
97 #if CONFIG_VP9_HIGHBITDEPTH | 99 #if CONFIG_VP9_HIGHBITDEPTH |
98 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { | 100 if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { |
99 highbd_variance(x->plane[0].src.buf, x->plane[0].src.stride, | 101 highbd_8_variance(x->plane[0].src.buf, x->plane[0].src.stride, |
100 CONVERT_TO_BYTEPTR(vp9_highbd_64_zeros), 0, bw, bh, | 102 CONVERT_TO_BYTEPTR(vp9_highbd_64_zeros), 0, bw, bh, |
101 &sse, &avg); | 103 &sse, &avg); |
102 sse >>= 2 * (xd->bd - 8); | 104 sse >>= 2 * (xd->bd - 8); |
103 avg >>= (xd->bd - 8); | 105 avg >>= (xd->bd - 8); |
104 } else { | 106 } else { |
105 variance(x->plane[0].src.buf, x->plane[0].src.stride, | 107 variance(x->plane[0].src.buf, x->plane[0].src.stride, |
106 vp9_64_zeros, 0, bw, bh, &sse, &avg); | 108 vp9_64_zeros, 0, bw, bh, &sse, &avg); |
107 } | 109 } |
108 #else | 110 #else |
109 variance(x->plane[0].src.buf, x->plane[0].src.stride, | 111 variance(x->plane[0].src.buf, x->plane[0].src.stride, |
110 vp9_64_zeros, 0, bw, bh, &sse, &avg); | 112 vp9_64_zeros, 0, bw, bh, &sse, &avg); |
111 #endif // CONFIG_VP9_HIGHBITDEPTH | 113 #endif // CONFIG_VP9_HIGHBITDEPTH |
(...skipping 29 matching lines...) Expand all Loading... |
141 #define DEFAULT_E_MIDPOINT 10.0 | 143 #define DEFAULT_E_MIDPOINT 10.0 |
142 int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) { | 144 int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) { |
143 double energy; | 145 double energy; |
144 double energy_midpoint; | 146 double energy_midpoint; |
145 vp9_clear_system_state(); | 147 vp9_clear_system_state(); |
146 energy_midpoint = | 148 energy_midpoint = |
147 (cpi->oxcf.pass == 2) ? cpi->twopass.mb_av_energy : DEFAULT_E_MIDPOINT; | 149 (cpi->oxcf.pass == 2) ? cpi->twopass.mb_av_energy : DEFAULT_E_MIDPOINT; |
148 energy = vp9_log_block_var(cpi, x, bs) - energy_midpoint; | 150 energy = vp9_log_block_var(cpi, x, bs) - energy_midpoint; |
149 return clamp((int)round(energy), ENERGY_MIN, ENERGY_MAX); | 151 return clamp((int)round(energy), ENERGY_MIN, ENERGY_MAX); |
150 } | 152 } |
OLD | NEW |