| 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 // Rescaling functions | 10 // Rescaling functions |
| 11 // | 11 // |
| 12 // Author: Skal (pascal.massimino@gmail.com) | 12 // Author: Skal (pascal.massimino@gmail.com) |
| 13 | 13 |
| 14 #include <assert.h> | 14 #include <assert.h> |
| 15 | 15 |
| 16 #include "./dsp.h" | 16 #include "./dsp.h" |
| 17 #include "../utils/rescaler.h" | 17 #include "../utils/rescaler_utils.h" |
| 18 | 18 |
| 19 //------------------------------------------------------------------------------ | 19 //------------------------------------------------------------------------------ |
| 20 // Implementations of critical functions ImportRow / ExportRow | 20 // Implementations of critical functions ImportRow / ExportRow |
| 21 | 21 |
| 22 #define ROUNDER (WEBP_RESCALER_ONE >> 1) | 22 #define ROUNDER (WEBP_RESCALER_ONE >> 1) |
| 23 #define MULT_FIX(x, y) (((uint64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX) | 23 #define MULT_FIX(x, y) (((uint64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX) |
| 24 | 24 |
| 25 //------------------------------------------------------------------------------ | 25 //------------------------------------------------------------------------------ |
| 26 // Row import | 26 // Row import |
| 27 | 27 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 WebPRescalerImportRowFunc WebPRescalerImportRowExpand; | 193 WebPRescalerImportRowFunc WebPRescalerImportRowExpand; |
| 194 WebPRescalerImportRowFunc WebPRescalerImportRowShrink; | 194 WebPRescalerImportRowFunc WebPRescalerImportRowShrink; |
| 195 | 195 |
| 196 WebPRescalerExportRowFunc WebPRescalerExportRowExpand; | 196 WebPRescalerExportRowFunc WebPRescalerExportRowExpand; |
| 197 WebPRescalerExportRowFunc WebPRescalerExportRowShrink; | 197 WebPRescalerExportRowFunc WebPRescalerExportRowShrink; |
| 198 | 198 |
| 199 extern void WebPRescalerDspInitSSE2(void); | 199 extern void WebPRescalerDspInitSSE2(void); |
| 200 extern void WebPRescalerDspInitMIPS32(void); | 200 extern void WebPRescalerDspInitMIPS32(void); |
| 201 extern void WebPRescalerDspInitMIPSdspR2(void); | 201 extern void WebPRescalerDspInitMIPSdspR2(void); |
| 202 extern void WebPRescalerDspInitMSA(void); |
| 202 extern void WebPRescalerDspInitNEON(void); | 203 extern void WebPRescalerDspInitNEON(void); |
| 203 | 204 |
| 204 static volatile VP8CPUInfo rescaler_last_cpuinfo_used = | 205 static volatile VP8CPUInfo rescaler_last_cpuinfo_used = |
| 205 (VP8CPUInfo)&rescaler_last_cpuinfo_used; | 206 (VP8CPUInfo)&rescaler_last_cpuinfo_used; |
| 206 | 207 |
| 207 WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInit(void) { | 208 WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInit(void) { |
| 208 if (rescaler_last_cpuinfo_used == VP8GetCPUInfo) return; | 209 if (rescaler_last_cpuinfo_used == VP8GetCPUInfo) return; |
| 209 | 210 |
| 210 WebPRescalerImportRowExpand = WebPRescalerImportRowExpandC; | 211 WebPRescalerImportRowExpand = WebPRescalerImportRowExpandC; |
| 211 WebPRescalerImportRowShrink = WebPRescalerImportRowShrinkC; | 212 WebPRescalerImportRowShrink = WebPRescalerImportRowShrinkC; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 226 #if defined(WEBP_USE_MIPS32) | 227 #if defined(WEBP_USE_MIPS32) |
| 227 if (VP8GetCPUInfo(kMIPS32)) { | 228 if (VP8GetCPUInfo(kMIPS32)) { |
| 228 WebPRescalerDspInitMIPS32(); | 229 WebPRescalerDspInitMIPS32(); |
| 229 } | 230 } |
| 230 #endif | 231 #endif |
| 231 #if defined(WEBP_USE_MIPS_DSP_R2) | 232 #if defined(WEBP_USE_MIPS_DSP_R2) |
| 232 if (VP8GetCPUInfo(kMIPSdspR2)) { | 233 if (VP8GetCPUInfo(kMIPSdspR2)) { |
| 233 WebPRescalerDspInitMIPSdspR2(); | 234 WebPRescalerDspInitMIPSdspR2(); |
| 234 } | 235 } |
| 235 #endif | 236 #endif |
| 237 #if defined(WEBP_USE_MSA) |
| 238 if (VP8GetCPUInfo(kMSA)) { |
| 239 WebPRescalerDspInitMSA(); |
| 240 } |
| 241 #endif |
| 236 } | 242 } |
| 237 rescaler_last_cpuinfo_used = VP8GetCPUInfo; | 243 rescaler_last_cpuinfo_used = VP8GetCPUInfo; |
| 238 } | 244 } |
| OLD | NEW |