| OLD | NEW |
| 1 // Copyright 2013 Google Inc. All Rights Reserved. | 1 // Copyright 2013 Google Inc. All Rights Reserved. |
| 2 // | 2 // |
| 3 // Use of this source code is governed by a BSD-style license | 3 // Use of this source code is governed by a BSD-style license |
| 4 // that can be found in the COPYING file in the root of the source | 4 // that can be found in the COPYING file in the root of the source |
| 5 // tree. An additional intellectual property rights grant can be found | 5 // tree. An additional intellectual property rights grant can be found |
| 6 // in the file PATENTS. All contributing project authors may | 6 // in the file PATENTS. All contributing project authors may |
| 7 // be found in the AUTHORS file in the root of the source tree. | 7 // be found in the AUTHORS file in the root of the source tree. |
| 8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
| 9 // | 9 // |
| 10 // Implement gradient smoothing: we replace a current alpha value by its | 10 // Implement gradient smoothing: we replace a current alpha value by its |
| 11 // surrounding average if it's close enough (that is: the change will be less | 11 // surrounding average if it's close enough (that is: the change will be less |
| 12 // than the minimum distance between two quantized level). | 12 // than the minimum distance between two quantized level). |
| 13 // We use sliding window for computing the 2d moving average. | 13 // We use sliding window for computing the 2d moving average. |
| 14 // | 14 // |
| 15 // Author: Skal (pascal.massimino@gmail.com) | 15 // Author: Skal (pascal.massimino@gmail.com) |
| 16 | 16 |
| 17 #include "./quant_levels_dec.h" | 17 #include "./quant_levels_dec_utils.h" |
| 18 | 18 |
| 19 #include <string.h> // for memset | 19 #include <string.h> // for memset |
| 20 | 20 |
| 21 #include "./utils.h" | 21 #include "./utils.h" |
| 22 | 22 |
| 23 // #define USE_DITHERING // uncomment to enable ordered dithering (not vital) | 23 // #define USE_DITHERING // uncomment to enable ordered dithering (not vital) |
| 24 | 24 |
| 25 #define FIX 16 // fix-point precision for averaging | 25 #define FIX 16 // fix-point precision for averaging |
| 26 #define LFIX 2 // extra precision for look-up table | 26 #define LFIX 2 // extra precision for look-up table |
| 27 #define LUT_SIZE ((1 << (8 + LFIX)) - 1) // look-up table size | 27 #define LUT_SIZE ((1 << (8 + LFIX)) - 1) // look-up table size |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 if (p.row_ >= p.radius_) { | 275 if (p.row_ >= p.radius_) { |
| 276 HFilter(&p); | 276 HFilter(&p); |
| 277 ApplyFilter(&p); | 277 ApplyFilter(&p); |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 CleanupParams(&p); | 281 CleanupParams(&p); |
| 282 } | 282 } |
| 283 return 1; | 283 return 1; |
| 284 } | 284 } |
| OLD | NEW |