onnxruntime/winml/lib/Api.Image/inc/NominalRangeConverter.h
Xiang Zhang 170fee0987
User/xianz/fixbuild (#4906)
* support Normalized_0_1 and Normalized_1_1

* add tests for Normalized_1_1

* fix build error

* fix imagetests failure

* support denterization and add more tests

* fix build

* remove added models

* disable gpu tests for CPU pipeline

* refactor based on comments and moved two added models

* merge normalizer and Denomalizer into NominalRangeConverter

* add comments

* little change

* fix build failure for amd64
2020-08-25 15:08:55 -07:00

35 lines
No EOL
800 B
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "inc/ImageConversionTypes.h"
namespace _winml {
class NominalRangeConverter {
public:
NominalRangeConverter() = delete;
NominalRangeConverter(ImageNominalPixelRange pixelRange);
float Normalize(float val) const;
DirectX::PackedVector::HALF Normalize(DirectX::PackedVector::HALF val) const;
#if defined(_M_AMD64) || defined(_M_IX86)
__m128 Normalize(__m128 sse_data) const;
#endif
float Denormalize(float val) const;
DirectX::PackedVector::HALF Denormalize(DirectX::PackedVector::HALF val) const;
#if defined(_M_AMD64) || defined(_M_IX86)
__m128 Denormalize(__m128 sse_data) const;
#endif
private:
float scale;
int32_t shift;
};
} // namespace _winml