| 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 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #define FILTER_BITS 7 | 22 #define FILTER_BITS 7 |
| 23 | 23 |
| 24 #define INTERP_TAPS 8 | 24 #define INTERP_TAPS 8 |
| 25 #define SUBPEL_BITS 5 | 25 #define SUBPEL_BITS 5 |
| 26 #define SUBPEL_MASK ((1 << SUBPEL_BITS) - 1) | 26 #define SUBPEL_MASK ((1 << SUBPEL_BITS) - 1) |
| 27 #define INTERP_PRECISION_BITS 32 | 27 #define INTERP_PRECISION_BITS 32 |
| 28 | 28 |
| 29 typedef int16_t interp_kernel[INTERP_TAPS]; | 29 typedef int16_t interp_kernel[INTERP_TAPS]; |
| 30 | 30 |
| 31 // Filters for interpolation (0.5-band) - note this also filters integer pels. | 31 // Filters for interpolation (0.5-band) - note this also filters integer pels. |
| 32 const interp_kernel vp9_filteredinterp_filters500[(1 << SUBPEL_BITS)] = { | 32 static const interp_kernel filteredinterp_filters500[(1 << SUBPEL_BITS)] = { |
| 33 {-3, 0, 35, 64, 35, 0, -3, 0}, | 33 {-3, 0, 35, 64, 35, 0, -3, 0}, |
| 34 {-3, -1, 34, 64, 36, 1, -3, 0}, | 34 {-3, -1, 34, 64, 36, 1, -3, 0}, |
| 35 {-3, -1, 32, 64, 38, 1, -3, 0}, | 35 {-3, -1, 32, 64, 38, 1, -3, 0}, |
| 36 {-2, -2, 31, 63, 39, 2, -3, 0}, | 36 {-2, -2, 31, 63, 39, 2, -3, 0}, |
| 37 {-2, -2, 29, 63, 41, 2, -3, 0}, | 37 {-2, -2, 29, 63, 41, 2, -3, 0}, |
| 38 {-2, -2, 28, 63, 42, 3, -4, 0}, | 38 {-2, -2, 28, 63, 42, 3, -4, 0}, |
| 39 {-2, -3, 27, 63, 43, 4, -4, 0}, | 39 {-2, -3, 27, 63, 43, 4, -4, 0}, |
| 40 {-2, -3, 25, 62, 45, 5, -4, 0}, | 40 {-2, -3, 25, 62, 45, 5, -4, 0}, |
| 41 {-2, -3, 24, 62, 46, 5, -4, 0}, | 41 {-2, -3, 24, 62, 46, 5, -4, 0}, |
| 42 {-2, -3, 23, 61, 47, 6, -4, 0}, | 42 {-2, -3, 23, 61, 47, 6, -4, 0}, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 58 {0, -4, 5, 45, 62, 25, -3, -2}, | 58 {0, -4, 5, 45, 62, 25, -3, -2}, |
| 59 {0, -4, 4, 43, 63, 27, -3, -2}, | 59 {0, -4, 4, 43, 63, 27, -3, -2}, |
| 60 {0, -4, 3, 42, 63, 28, -2, -2}, | 60 {0, -4, 3, 42, 63, 28, -2, -2}, |
| 61 {0, -3, 2, 41, 63, 29, -2, -2}, | 61 {0, -3, 2, 41, 63, 29, -2, -2}, |
| 62 {0, -3, 2, 39, 63, 31, -2, -2}, | 62 {0, -3, 2, 39, 63, 31, -2, -2}, |
| 63 {0, -3, 1, 38, 64, 32, -1, -3}, | 63 {0, -3, 1, 38, 64, 32, -1, -3}, |
| 64 {0, -3, 1, 36, 64, 34, -1, -3} | 64 {0, -3, 1, 36, 64, 34, -1, -3} |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 // Filters for interpolation (0.625-band) - note this also filters integer pels. | 67 // Filters for interpolation (0.625-band) - note this also filters integer pels. |
| 68 const interp_kernel vp9_filteredinterp_filters625[(1 << SUBPEL_BITS)] = { | 68 static const interp_kernel filteredinterp_filters625[(1 << SUBPEL_BITS)] = { |
| 69 {-1, -8, 33, 80, 33, -8, -1, 0}, | 69 {-1, -8, 33, 80, 33, -8, -1, 0}, |
| 70 {-1, -8, 30, 80, 35, -8, -1, 1}, | 70 {-1, -8, 30, 80, 35, -8, -1, 1}, |
| 71 {-1, -8, 28, 80, 37, -7, -2, 1}, | 71 {-1, -8, 28, 80, 37, -7, -2, 1}, |
| 72 {0, -8, 26, 79, 39, -7, -2, 1}, | 72 {0, -8, 26, 79, 39, -7, -2, 1}, |
| 73 {0, -8, 24, 79, 41, -7, -2, 1}, | 73 {0, -8, 24, 79, 41, -7, -2, 1}, |
| 74 {0, -8, 22, 78, 43, -6, -2, 1}, | 74 {0, -8, 22, 78, 43, -6, -2, 1}, |
| 75 {0, -8, 20, 78, 45, -5, -3, 1}, | 75 {0, -8, 20, 78, 45, -5, -3, 1}, |
| 76 {0, -8, 18, 77, 48, -5, -3, 1}, | 76 {0, -8, 18, 77, 48, -5, -3, 1}, |
| 77 {0, -8, 16, 76, 50, -4, -3, 1}, | 77 {0, -8, 16, 76, 50, -4, -3, 1}, |
| 78 {0, -8, 15, 75, 52, -3, -4, 1}, | 78 {0, -8, 15, 75, 52, -3, -4, 1}, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 94 {1, -3, -5, 48, 77, 18, -8, 0}, | 94 {1, -3, -5, 48, 77, 18, -8, 0}, |
| 95 {1, -3, -5, 45, 78, 20, -8, 0}, | 95 {1, -3, -5, 45, 78, 20, -8, 0}, |
| 96 {1, -2, -6, 43, 78, 22, -8, 0}, | 96 {1, -2, -6, 43, 78, 22, -8, 0}, |
| 97 {1, -2, -7, 41, 79, 24, -8, 0}, | 97 {1, -2, -7, 41, 79, 24, -8, 0}, |
| 98 {1, -2, -7, 39, 79, 26, -8, 0}, | 98 {1, -2, -7, 39, 79, 26, -8, 0}, |
| 99 {1, -2, -7, 37, 80, 28, -8, -1}, | 99 {1, -2, -7, 37, 80, 28, -8, -1}, |
| 100 {1, -1, -8, 35, 80, 30, -8, -1}, | 100 {1, -1, -8, 35, 80, 30, -8, -1}, |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 // Filters for interpolation (0.75-band) - note this also filters integer pels. | 103 // Filters for interpolation (0.75-band) - note this also filters integer pels. |
| 104 const interp_kernel vp9_filteredinterp_filters750[(1 << SUBPEL_BITS)] = { | 104 static const interp_kernel filteredinterp_filters750[(1 << SUBPEL_BITS)] = { |
| 105 {2, -11, 25, 96, 25, -11, 2, 0}, | 105 {2, -11, 25, 96, 25, -11, 2, 0}, |
| 106 {2, -11, 22, 96, 28, -11, 2, 0}, | 106 {2, -11, 22, 96, 28, -11, 2, 0}, |
| 107 {2, -10, 19, 95, 31, -11, 2, 0}, | 107 {2, -10, 19, 95, 31, -11, 2, 0}, |
| 108 {2, -10, 17, 95, 34, -12, 2, 0}, | 108 {2, -10, 17, 95, 34, -12, 2, 0}, |
| 109 {2, -9, 14, 94, 37, -12, 2, 0}, | 109 {2, -9, 14, 94, 37, -12, 2, 0}, |
| 110 {2, -8, 12, 93, 40, -12, 1, 0}, | 110 {2, -8, 12, 93, 40, -12, 1, 0}, |
| 111 {2, -8, 9, 92, 43, -12, 1, 1}, | 111 {2, -8, 9, 92, 43, -12, 1, 1}, |
| 112 {2, -7, 7, 91, 46, -12, 1, 0}, | 112 {2, -7, 7, 91, 46, -12, 1, 0}, |
| 113 {2, -7, 5, 90, 49, -12, 1, 0}, | 113 {2, -7, 5, 90, 49, -12, 1, 0}, |
| 114 {2, -6, 3, 88, 52, -12, 0, 1}, | 114 {2, -6, 3, 88, 52, -12, 0, 1}, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 130 {0, 1, -12, 46, 91, 7, -7, 2}, | 130 {0, 1, -12, 46, 91, 7, -7, 2}, |
| 131 {1, 1, -12, 43, 92, 9, -8, 2}, | 131 {1, 1, -12, 43, 92, 9, -8, 2}, |
| 132 {0, 1, -12, 40, 93, 12, -8, 2}, | 132 {0, 1, -12, 40, 93, 12, -8, 2}, |
| 133 {0, 2, -12, 37, 94, 14, -9, 2}, | 133 {0, 2, -12, 37, 94, 14, -9, 2}, |
| 134 {0, 2, -12, 34, 95, 17, -10, 2}, | 134 {0, 2, -12, 34, 95, 17, -10, 2}, |
| 135 {0, 2, -11, 31, 95, 19, -10, 2}, | 135 {0, 2, -11, 31, 95, 19, -10, 2}, |
| 136 {0, 2, -11, 28, 96, 22, -11, 2} | 136 {0, 2, -11, 28, 96, 22, -11, 2} |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 // Filters for interpolation (0.875-band) - note this also filters integer pels. | 139 // Filters for interpolation (0.875-band) - note this also filters integer pels. |
| 140 const interp_kernel vp9_filteredinterp_filters875[(1 << SUBPEL_BITS)] = { | 140 static const interp_kernel filteredinterp_filters875[(1 << SUBPEL_BITS)] = { |
| 141 {3, -8, 13, 112, 13, -8, 3, 0}, | 141 {3, -8, 13, 112, 13, -8, 3, 0}, |
| 142 {3, -7, 10, 112, 17, -9, 3, -1}, | 142 {3, -7, 10, 112, 17, -9, 3, -1}, |
| 143 {2, -6, 7, 111, 21, -9, 3, -1}, | 143 {2, -6, 7, 111, 21, -9, 3, -1}, |
| 144 {2, -5, 4, 111, 24, -10, 3, -1}, | 144 {2, -5, 4, 111, 24, -10, 3, -1}, |
| 145 {2, -4, 1, 110, 28, -11, 3, -1}, | 145 {2, -4, 1, 110, 28, -11, 3, -1}, |
| 146 {1, -3, -1, 108, 32, -12, 4, -1}, | 146 {1, -3, -1, 108, 32, -12, 4, -1}, |
| 147 {1, -2, -3, 106, 36, -13, 4, -1}, | 147 {1, -2, -3, 106, 36, -13, 4, -1}, |
| 148 {1, -1, -6, 105, 40, -14, 4, -1}, | 148 {1, -1, -6, 105, 40, -14, 4, -1}, |
| 149 {1, -1, -7, 102, 44, -14, 4, -1}, | 149 {1, -1, -7, 102, 44, -14, 4, -1}, |
| 150 {1, 0, -9, 100, 48, -15, 4, -1}, | 150 {1, 0, -9, 100, 48, -15, 4, -1}, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 166 {-1, 4, -14, 40, 105, -6, -1, 1}, | 166 {-1, 4, -14, 40, 105, -6, -1, 1}, |
| 167 {-1, 4, -13, 36, 106, -3, -2, 1}, | 167 {-1, 4, -13, 36, 106, -3, -2, 1}, |
| 168 {-1, 4, -12, 32, 108, -1, -3, 1}, | 168 {-1, 4, -12, 32, 108, -1, -3, 1}, |
| 169 {-1, 3, -11, 28, 110, 1, -4, 2}, | 169 {-1, 3, -11, 28, 110, 1, -4, 2}, |
| 170 {-1, 3, -10, 24, 111, 4, -5, 2}, | 170 {-1, 3, -10, 24, 111, 4, -5, 2}, |
| 171 {-1, 3, -9, 21, 111, 7, -6, 2}, | 171 {-1, 3, -9, 21, 111, 7, -6, 2}, |
| 172 {-1, 3, -9, 17, 112, 10, -7, 3} | 172 {-1, 3, -9, 17, 112, 10, -7, 3} |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 // Filters for interpolation (full-band) - no filtering for integer pixels | 175 // Filters for interpolation (full-band) - no filtering for integer pixels |
| 176 const interp_kernel vp9_filteredinterp_filters1000[(1 << SUBPEL_BITS)] = { | 176 static const interp_kernel filteredinterp_filters1000[(1 << SUBPEL_BITS)] = { |
| 177 {0, 0, 0, 128, 0, 0, 0, 0}, | 177 {0, 0, 0, 128, 0, 0, 0, 0}, |
| 178 {0, 1, -3, 128, 3, -1, 0, 0}, | 178 {0, 1, -3, 128, 3, -1, 0, 0}, |
| 179 {-1, 2, -6, 127, 7, -2, 1, 0}, | 179 {-1, 2, -6, 127, 7, -2, 1, 0}, |
| 180 {-1, 3, -9, 126, 12, -4, 1, 0}, | 180 {-1, 3, -9, 126, 12, -4, 1, 0}, |
| 181 {-1, 4, -12, 125, 16, -5, 1, 0}, | 181 {-1, 4, -12, 125, 16, -5, 1, 0}, |
| 182 {-1, 4, -14, 123, 20, -6, 2, 0}, | 182 {-1, 4, -14, 123, 20, -6, 2, 0}, |
| 183 {-1, 5, -15, 120, 25, -8, 2, 0}, | 183 {-1, 5, -15, 120, 25, -8, 2, 0}, |
| 184 {-1, 5, -17, 118, 30, -9, 3, -1}, | 184 {-1, 5, -17, 118, 30, -9, 3, -1}, |
| 185 {-1, 6, -18, 114, 35, -10, 3, -1}, | 185 {-1, 6, -18, 114, 35, -10, 3, -1}, |
| 186 {-1, 6, -19, 111, 41, -12, 3, -1}, | 186 {-1, 6, -19, 111, 41, -12, 3, -1}, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 208 {0, 0, -1, 3, 128, -3, 1, 0} | 208 {0, 0, -1, 3, 128, -3, 1, 0} |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 // Filters for factor of 2 downsampling. | 211 // Filters for factor of 2 downsampling. |
| 212 static const int16_t vp9_down2_symeven_half_filter[] = {56, 12, -3, -1}; | 212 static const int16_t vp9_down2_symeven_half_filter[] = {56, 12, -3, -1}; |
| 213 static const int16_t vp9_down2_symodd_half_filter[] = {64, 35, 0, -3}; | 213 static const int16_t vp9_down2_symodd_half_filter[] = {64, 35, 0, -3}; |
| 214 | 214 |
| 215 static const interp_kernel *choose_interp_filter(int inlength, int outlength) { | 215 static const interp_kernel *choose_interp_filter(int inlength, int outlength) { |
| 216 int outlength16 = outlength * 16; | 216 int outlength16 = outlength * 16; |
| 217 if (outlength16 >= inlength * 16) | 217 if (outlength16 >= inlength * 16) |
| 218 return vp9_filteredinterp_filters1000; | 218 return filteredinterp_filters1000; |
| 219 else if (outlength16 >= inlength * 13) | 219 else if (outlength16 >= inlength * 13) |
| 220 return vp9_filteredinterp_filters875; | 220 return filteredinterp_filters875; |
| 221 else if (outlength16 >= inlength * 11) | 221 else if (outlength16 >= inlength * 11) |
| 222 return vp9_filteredinterp_filters750; | 222 return filteredinterp_filters750; |
| 223 else if (outlength16 >= inlength * 9) | 223 else if (outlength16 >= inlength * 9) |
| 224 return vp9_filteredinterp_filters625; | 224 return filteredinterp_filters625; |
| 225 else | 225 else |
| 226 return vp9_filteredinterp_filters500; | 226 return filteredinterp_filters500; |
| 227 } | 227 } |
| 228 | 228 |
| 229 static void interpolate(const uint8_t *const input, int inlength, | 229 static void interpolate(const uint8_t *const input, int inlength, |
| 230 uint8_t *output, int outlength) { | 230 uint8_t *output, int outlength) { |
| 231 const int64_t delta = (((uint64_t)inlength << 32) + outlength / 2) / | 231 const int64_t delta = (((uint64_t)inlength << 32) + outlength / 2) / |
| 232 outlength; | 232 outlength; |
| 233 const int64_t offset = inlength > outlength ? | 233 const int64_t offset = inlength > outlength ? |
| 234 (((int64_t)(inlength - outlength) << 31) + outlength / 2) / outlength : | 234 (((int64_t)(inlength - outlength) << 31) + outlength / 2) / outlength : |
| 235 -(((int64_t)(outlength - inlength) << 31) + outlength / 2) / outlength; | 235 -(((int64_t)(outlength - inlength) << 31) + outlength / 2) / outlength; |
| 236 uint8_t *optr = output; | 236 uint8_t *optr = output; |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 uint8_t *ou, uint8_t *ov, int ouv_stride, | 916 uint8_t *ou, uint8_t *ov, int ouv_stride, |
| 917 int oheight, int owidth, int bd) { | 917 int oheight, int owidth, int bd) { |
| 918 vp9_highbd_resize_plane(y, height, width, y_stride, | 918 vp9_highbd_resize_plane(y, height, width, y_stride, |
| 919 oy, oheight, owidth, oy_stride, bd); | 919 oy, oheight, owidth, oy_stride, bd); |
| 920 vp9_highbd_resize_plane(u, height, width, uv_stride, | 920 vp9_highbd_resize_plane(u, height, width, uv_stride, |
| 921 ou, oheight, owidth, ouv_stride, bd); | 921 ou, oheight, owidth, ouv_stride, bd); |
| 922 vp9_highbd_resize_plane(v, height, width, uv_stride, | 922 vp9_highbd_resize_plane(v, height, width, uv_stride, |
| 923 ov, oheight, owidth, ouv_stride, bd); | 923 ov, oheight, owidth, ouv_stride, bd); |
| 924 } | 924 } |
| 925 #endif // CONFIG_VP9_HIGHBITDEPTH | 925 #endif // CONFIG_VP9_HIGHBITDEPTH |
| OLD | NEW |