OLD | NEW |
1 // Copyright 2014 Google Inc. All Rights Reserved. | 1 // Copyright 2014 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 // Clipping tables for filtering | 10 // Clipping tables for filtering |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 // and make sure it's set to true _last_ (so as to be thread-safe) | 337 // and make sure it's set to true _last_ (so as to be thread-safe) |
338 static volatile int tables_ok = 0; | 338 static volatile int tables_ok = 0; |
339 | 339 |
340 #endif | 340 #endif |
341 | 341 |
342 const int8_t* const VP8ksclip1 = &sclip1[1020]; | 342 const int8_t* const VP8ksclip1 = &sclip1[1020]; |
343 const int8_t* const VP8ksclip2 = &sclip2[112]; | 343 const int8_t* const VP8ksclip2 = &sclip2[112]; |
344 const uint8_t* const VP8kclip1 = &clip1[255]; | 344 const uint8_t* const VP8kclip1 = &clip1[255]; |
345 const uint8_t* const VP8kabs0 = &abs0[255]; | 345 const uint8_t* const VP8kabs0 = &abs0[255]; |
346 | 346 |
347 void VP8InitClipTables(void) { | 347 WEBP_TSAN_IGNORE_FUNCTION void VP8InitClipTables(void) { |
348 #if !defined(USE_STATIC_TABLES) | 348 #if !defined(USE_STATIC_TABLES) |
349 int i; | 349 int i; |
350 if (!tables_ok) { | 350 if (!tables_ok) { |
351 for (i = -255; i <= 255; ++i) { | 351 for (i = -255; i <= 255; ++i) { |
352 abs0[255 + i] = (i < 0) ? -i : i; | 352 abs0[255 + i] = (i < 0) ? -i : i; |
353 } | 353 } |
354 for (i = -1020; i <= 1020; ++i) { | 354 for (i = -1020; i <= 1020; ++i) { |
355 sclip1[1020 + i] = (i < -128) ? -128 : (i > 127) ? 127 : i; | 355 sclip1[1020 + i] = (i < -128) ? -128 : (i > 127) ? 127 : i; |
356 } | 356 } |
357 for (i = -112; i <= 112; ++i) { | 357 for (i = -112; i <= 112; ++i) { |
358 sclip2[112 + i] = (i < -16) ? -16 : (i > 15) ? 15 : i; | 358 sclip2[112 + i] = (i < -16) ? -16 : (i > 15) ? 15 : i; |
359 } | 359 } |
360 for (i = -255; i <= 255 + 255; ++i) { | 360 for (i = -255; i <= 255 + 255; ++i) { |
361 clip1[255 + i] = (i < 0) ? 0 : (i > 255) ? 255 : i; | 361 clip1[255 + i] = (i < 0) ? 0 : (i > 255) ? 255 : i; |
362 } | 362 } |
363 tables_ok = 1; | 363 tables_ok = 1; |
364 } | 364 } |
365 #endif // USE_STATIC_TABLES | 365 #endif // USE_STATIC_TABLES |
366 } | 366 } |
OLD | NEW |