summaryrefslogtreecommitdiff
path: root/compute/ARMComputeEx/src/core/NEON/kernels/NECastKernel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'compute/ARMComputeEx/src/core/NEON/kernels/NECastKernel.cpp')
-rw-r--r--compute/ARMComputeEx/src/core/NEON/kernels/NECastKernel.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/compute/ARMComputeEx/src/core/NEON/kernels/NECastKernel.cpp b/compute/ARMComputeEx/src/core/NEON/kernels/NECastKernel.cpp
index 7e4fc129b..fbb9dbca9 100644
--- a/compute/ARMComputeEx/src/core/NEON/kernels/NECastKernel.cpp
+++ b/compute/ARMComputeEx/src/core/NEON/kernels/NECastKernel.cpp
@@ -1,5 +1,20 @@
/*
* Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
* Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
@@ -22,6 +37,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
+
#include "arm_compute/core/NEON/kernels/NECastKernel.h"
#include "arm_compute/core/AccessWindowStatic.h"
@@ -394,7 +410,8 @@ template <typename FromT> void run_cast(const ITensor *input, ITensor *output, c
case DataType::QASYMM8:
{
using to_vector = typename cast_vector<float>::type;
- const QuantizationInfo &qinfo_out = output->info()->quantization_info();
+ const UniformQuantizationInfo &qinfo_out =
+ output->info()->quantization_info().uniform();
const auto vf = vcast<to_vector, from_vector>(vin);
const auto vout = vquantize(vf, qinfo_out);
store_result<qasymm8_t>(reinterpret_cast<qasymm8_t *>(out.ptr()) + x, vout);
@@ -440,7 +457,8 @@ template <typename FromT> void run_cast(const ITensor *input, ITensor *output, c
case DataType::QASYMM8:
{
const QuantizationInfo &qinfo_out = output->info()->quantization_info();
- const auto qval = qinfo_out.quantize(static_cast<float>(val), rounding_policy);
+ const auto qval =
+ quantize_qasymm8(static_cast<float>(val), qinfo_out, rounding_policy);
*(reinterpret_cast<qasymm8_t *>(out.ptr()) + x) = qval;
break;
}
@@ -486,8 +504,8 @@ void run_cast_qasymm8(const ITensor *input, ITensor *output, const Window &windo
#else //__aarch64__
constexpr RoundingPolicy rounding_policy = RoundingPolicy::TO_ZERO;
#endif //__aarch64__
- const auto &qinfo_in = input->info()->quantization_info();
- const auto &qinfo_out = output->info()->quantization_info();
+ const auto &qinfo_in = input->info()->quantization_info().uniform();
+ const auto &qinfo_out = output->info()->quantization_info().uniform();
execute_window_loop(
win_collapsed,
@@ -547,7 +565,7 @@ void run_cast_qasymm8(const ITensor *input, ITensor *output, const Window &windo
for (; x < window_end_x; ++x)
{
qasymm8_t qval_in = *(in_ptr + x);
- const auto val = qinfo_in.dequantize(qval_in);
+ const auto val = dequantize_qasymm8(qval_in, qinfo_in);
switch (output->info()->data_type())
{
@@ -558,7 +576,7 @@ void run_cast_qasymm8(const ITensor *input, ITensor *output, const Window &windo
}
case DataType::QASYMM8:
{
- const auto qval_out = qinfo_out.quantize(val, rounding_policy);
+ const auto qval_out = quantize_qasymm8(val, qinfo_out, rounding_policy);
*(reinterpret_cast<qasymm8_t *>(out.ptr()) + x) = qval_out;
break;
}