Hello community,

here is the log from the commit of package zimg for openSUSE:Factory checked in 
at 2018-01-16 09:42:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/zimg (Old)
 and      /work/SRC/openSUSE:Factory/.zimg.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "zimg"

Tue Jan 16 09:42:51 2018 rev:23 rq:564426 version:2.7.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/zimg/zimg.changes        2018-01-01 
22:34:47.504785637 +0100
+++ /work/SRC/openSUSE:Factory/.zimg.new/zimg.changes   2018-01-16 
09:42:52.868255182 +0100
@@ -1,0 +2,9 @@
+Sun Jan 14 19:07:35 UTC 2018 - [email protected]
+
+- Update to 2.7.1
+  * colorspace: fix incorrect ST.428 primaries (introduced in 2.7)
+  * colorspace: preserve BTB/WTW when approximate_gamma is set
+  * colorspace: optimize handling of IEC 61966-2-4 transfer
+    characteristics
+
+-------------------------------------------------------------------

Old:
----
  release-2.7.tar.gz

New:
----
  release-2.7.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ zimg.spec ++++++
--- /var/tmp/diff_new_pack.S3LKtx/_old  2018-01-16 09:42:53.376231405 +0100
+++ /var/tmp/diff_new_pack.S3LKtx/_new  2018-01-16 09:42:53.380231218 +0100
@@ -18,7 +18,7 @@
 
 %define         sover 2
 Name:           zimg
-Version:        2.7
+Version:        2.7.1
 Release:        0
 Summary:        Scaling, colorspace conversion, and dithering library
 License:        WTFPL

++++++ release-2.7.tar.gz -> release-2.7.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/zimg-release-2.7/ChangeLog 
new/zimg-release-2.7.1/ChangeLog
--- old/zimg-release-2.7/ChangeLog      2017-12-21 03:35:58.000000000 +0100
+++ new/zimg-release-2.7.1/ChangeLog    2018-01-14 00:39:46.000000000 +0100
@@ -1,3 +1,8 @@
+2.7.1
+colorspace: fix incorrect ST.428 primaries (introduced in 2.7)
+colorspace: preserve BTB/WTW when approximate_gamma is set
+colorspace: optimize handling of IEC 61966-2-4 transfer characteristics
+
 2.7
 colorspace: add support for additional matrix/transfer/primaries
 graph: reduce buffer copies when converting from grey to color
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/zimg-release-2.7/configure.ac 
new/zimg-release-2.7.1/configure.ac
--- old/zimg-release-2.7/configure.ac   2017-12-21 03:35:58.000000000 +0100
+++ new/zimg-release-2.7.1/configure.ac 2018-01-14 00:39:46.000000000 +0100
@@ -1,4 +1,4 @@
-AC_INIT([zimg], [2.7.0], [https://github.com/sekrit-twc/zimg/pulls], [zimg], 
[https://github.com/sekrit-twc/zimg])
+AC_INIT([zimg], [2.7.1], [https://github.com/sekrit-twc/zimg/pulls], [zimg], 
[https://github.com/sekrit-twc/zimg])
 AC_CONFIG_MACRO_DIR([m4])
 
 : ${CFLAGS=""}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/zimg-release-2.7/src/testapp/table.cpp 
new/zimg-release-2.7.1/src/testapp/table.cpp
--- old/zimg-release-2.7/src/testapp/table.cpp  2017-12-21 03:35:58.000000000 
+0100
+++ new/zimg-release-2.7.1/src/testapp/table.cpp        2018-01-14 
00:39:46.000000000 +0100
@@ -101,7 +101,7 @@
        { "709",       ColorPrimaries::REC_709 },
        { "film",      ColorPrimaries::FILM },
        { "2020",      ColorPrimaries::REC_2020 },
-       { "st_428",    ColorPrimaries::ST_428 },
+       { "xyz",       ColorPrimaries::XYZ },
        { "dcip3",     ColorPrimaries::DCI_P3 },
        { "dcip3_d65", ColorPrimaries::DCI_P3_D65 },
        { "jedec_p22", ColorPrimaries::JEDEC_P22 },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/zimg-release-2.7/src/zimg/api/zimg++.hpp 
new/zimg-release-2.7.1/src/zimg/api/zimg++.hpp
--- old/zimg-release-2.7/src/zimg/api/zimg++.hpp        2017-12-21 
03:35:58.000000000 +0100
+++ new/zimg-release-2.7.1/src/zimg/api/zimg++.hpp      2018-01-14 
00:39:46.000000000 +0100
@@ -141,7 +141,6 @@
 };
 
 class FilterGraph {
-private:
        zimg_filter_graph *m_graph;
 
        FilterGraph(const FilterGraph &);
@@ -164,6 +163,10 @@
        }
 
 #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
+       FilterGraph() : m_graph()
+       {
+       }
+
        FilterGraph(FilterGraph &&other) : m_graph(other.m_graph)
        {
                other.m_graph = 0;
@@ -179,6 +182,11 @@
 
                return *this;
        }
+
+       explicit operator bool() const
+       {
+               return m_graph != 0;
+       }
 #endif
 
        size_t get_tmp_size() const
@@ -209,6 +217,17 @@
                check(zimg_filter_graph_process(m_graph, &src, &dst, tmp, 
unpack_cb, unpack_user, pack_cb, pack_user));
        }
 
+#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
+       static FilterGraph build(const zimg_image_format &src_format, const 
zimg_image_format &dst_format, const zimg_graph_builder_params *params = 0)
+       {
+               zimg_filter_graph *graph;
+
+               if (!(graph = zimg_filter_graph_build(&src_format, &dst_format, 
params)))
+                       throw zerror();
+
+               return FilterGraph(graph);
+       }
+#else
        static zimg_filter_graph *build(const zimg_image_format &src_format, 
const zimg_image_format &dst_format, const zimg_graph_builder_params *params = 
0)
        {
                zimg_filter_graph *graph;
@@ -218,6 +237,7 @@
 
                return graph;
        }
+#endif
 };
 
 } // namespace zimgxx
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/zimg-release-2.7/src/zimg/api/zimg.cpp 
new/zimg-release-2.7.1/src/zimg/api/zimg.cpp
--- old/zimg-release-2.7/src/zimg/api/zimg.cpp  2017-12-21 03:35:58.000000000 
+0100
+++ new/zimg-release-2.7.1/src/zimg/api/zimg.cpp        2018-01-14 
00:39:46.000000000 +0100
@@ -36,7 +36,7 @@
 thread_local zimg_error_code_e g_last_error = ZIMG_ERROR_SUCCESS;
 thread_local std::string g_last_error_msg;
 
-constexpr unsigned VERSION_INFO[] = { 2, 7, 0 };
+constexpr unsigned VERSION_INFO[] = { 2, 7, 1 };
 
 
 template <class T, class U>
@@ -285,7 +285,7 @@
                { ZIMG_PRIMARIES_240M,        ColorPrimaries::SMPTE_C },
                { ZIMG_PRIMARIES_FILM,        ColorPrimaries::FILM },
                { ZIMG_PRIMARIES_2020,        ColorPrimaries::REC_2020 },
-               { ZIMG_PRIMARIES_ST428,       ColorPrimaries::ST_428 },
+               { ZIMG_PRIMARIES_ST428,       ColorPrimaries::XYZ },
                { ZIMG_PRIMARIES_ST431_2,     ColorPrimaries::DCI_P3 },
                { ZIMG_PRIMARIES_ST432_1,     ColorPrimaries::DCI_P3_D65 },
                { ZIMG_PRIMARIES_EBU3213_E,   ColorPrimaries::JEDEC_P22 },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/zimg-release-2.7/src/zimg/api/zimg.h 
new/zimg-release-2.7.1/src/zimg/api/zimg.h
--- old/zimg-release-2.7/src/zimg/api/zimg.h    2017-12-21 03:35:58.000000000 
+0100
+++ new/zimg-release-2.7.1/src/zimg/api/zimg.h  2018-01-14 00:39:46.000000000 
+0100
@@ -348,6 +348,7 @@
   * The circular array holds a power-of-2 number of image scanlines,
   * where the beginning of the i-th row of the p-th plane is stored at
   * (plane[p].data + (ptrdiff_t)(i & plane[p].mask) * plane[p].stride).
+  * The plane order is R-G-B, Y-U-V, or X-Y-Z.
   *
   * The row index mask can be set to the special value of
   * {@link ZIMG_BUFFER_MAX} to indicate a fully allocated image plane. Filter
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/zimg-release-2.7/src/zimg/colorspace/colorspace.h 
new/zimg-release-2.7.1/src/zimg/colorspace/colorspace.h
--- old/zimg-release-2.7/src/zimg/colorspace/colorspace.h       2017-12-21 
03:35:58.000000000 +0100
+++ new/zimg-release-2.7.1/src/zimg/colorspace/colorspace.h     2018-01-14 
00:39:46.000000000 +0100
@@ -57,7 +57,7 @@
        REC_709,
        FILM,
        REC_2020,
-       ST_428,
+       XYZ,
        DCI_P3,
        DCI_P3_D65,
        JEDEC_P22,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/zimg-release-2.7/src/zimg/colorspace/colorspace_param.cpp 
new/zimg-release-2.7.1/src/zimg/colorspace/colorspace_param.cpp
--- old/zimg-release-2.7/src/zimg/colorspace/colorspace_param.cpp       
2017-12-21 03:35:58.000000000 +0100
+++ new/zimg-release-2.7.1/src/zimg/colorspace/colorspace_param.cpp     
2018-01-14 00:39:46.000000000 +0100
@@ -2,6 +2,7 @@
 #include "common/except.h"
 #include "colorspace.h"
 #include "colorspace_param.h"
+#include "matrix3.h"
 
 namespace zimg {
 namespace colorspace {
@@ -58,7 +59,7 @@
        case ColorPrimaries::REC_470_M:
        case ColorPrimaries::FILM:
                return xy_to_xyz(ILLUMINANT_C[0], ILLUMINANT_C[1]);
-       case ColorPrimaries::ST_428:
+       case ColorPrimaries::XYZ:
                return xy_to_xyz(ILLUMINANT_E[0], ILLUMINANT_E[1]);
        case ColorPrimaries::DCI_P3:
                return xy_to_xyz(ILLUMINANT_DCI[0], ILLUMINANT_DCI[1]);
@@ -88,9 +89,6 @@
        case ColorPrimaries::REC_2020:
                memcpy(out, REC_2020_PRIMARIES, sizeof(REC_2020_PRIMARIES));
                break;
-       case ColorPrimaries::ST_428:
-               memcpy(out, ST_428_PRIMARIES, sizeof(ST_428_PRIMARIES));
-               break;
        case ColorPrimaries::DCI_P3:
        case ColorPrimaries::DCI_P3_D65:
                memcpy(out, DCI_P3_PRIMARIES, sizeof(DCI_P3_PRIMARIES));
@@ -242,6 +240,9 @@
 // http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
 Matrix3x3 gamut_rgb_to_xyz_matrix(ColorPrimaries primaries)
 {
+       if (primaries == ColorPrimaries::XYZ)
+               return Matrix3x3::identity();
+
        Matrix3x3 xyz_matrix = get_primaries_xyz(primaries);
        Vector3 white_xyz = get_white_point(primaries);
 
@@ -253,6 +254,9 @@
 
 Matrix3x3 gamut_xyz_to_rgb_matrix(ColorPrimaries primaries)
 {
+       if (primaries == ColorPrimaries::XYZ)
+               return Matrix3x3::identity();
+
        return inverse(gamut_rgb_to_xyz_matrix(primaries));
 }
 
@@ -268,13 +272,8 @@
        Vector3 white_in = get_white_point(in);
        Vector3 white_out = get_white_point(out);
 
-       if (white_in == white_out) {
-               return {
-                       { 1.0, 0.0, 0.0 },
-                       { 0.0, 1.0, 0.0 },
-                       { 0.0, 0.0, 1.0 }
-               };
-       }
+       if (white_in == white_out)
+               return Matrix3x3::identity();
 
        Vector3 rgb_in = bradford * white_in;
        Vector3 rgb_out = bradford * white_out;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/zimg-release-2.7/src/zimg/colorspace/colorspace_param.h 
new/zimg-release-2.7.1/src/zimg/colorspace/colorspace_param.h
--- old/zimg-release-2.7/src/zimg/colorspace/colorspace_param.h 2017-12-21 
03:35:58.000000000 +0100
+++ new/zimg-release-2.7.1/src/zimg/colorspace/colorspace_param.h       
2018-01-14 00:39:46.000000000 +0100
@@ -31,7 +31,6 @@
 constexpr double FILM_PRIMARIES[3][2] = { { 0.681, 0.319 }, { 0.243, 0.692 }, 
{ 0.145, 0.049 } };
 constexpr double REC_2020_PRIMARIES[3][2] = { { 0.708, 0.292 }, { 0.170, 0.797 
}, { 0.131, 0.046 } };
 constexpr double DCI_P3_PRIMARIES[3][2] = { { 0.680, 0.320 } , { 0.265, 0.690 
}, { 0.150, 0.060 } };
-constexpr double ST_428_PRIMARIES[3][2] = { { 0.735, 0.265 }, { 0.274, 0.718 
}, { 0.167, 0.009 } };
 constexpr double JEDEC_P22_PRIMARIES[3][2] = { { 0.630, 0.340 }, { 0.295, 
0.605 }, { 0.155, 0.077 } };
 
 // White points in XY.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/zimg-release-2.7/src/zimg/colorspace/matrix3.h 
new/zimg-release-2.7.1/src/zimg/colorspace/matrix3.h
--- old/zimg-release-2.7/src/zimg/colorspace/matrix3.h  2017-12-21 
03:35:58.000000000 +0100
+++ new/zimg-release-2.7.1/src/zimg/colorspace/matrix3.h        2018-01-14 
00:39:46.000000000 +0100
@@ -28,6 +28,15 @@
        constexpr Matrix3x3(const Vector3 &a, const Vector3 &b, const Vector3 
&c) :
                std::array<Vector3, 3>{ { a, b, c } }
        {}
+
+       static constexpr Matrix3x3 identity()
+       {
+               return{
+                       { 1.0, 0.0, 0.0 },
+                       { 0.0, 1.0, 0.0 },
+                       { 0.0, 0.0, 1.0 }
+               };
+       }
 };
 
 /**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/zimg-release-2.7/src/zimg/colorspace/operation.cpp 
new/zimg-release-2.7.1/src/zimg/colorspace/operation.cpp
--- old/zimg-release-2.7/src/zimg/colorspace/operation.cpp      2017-12-21 
03:35:58.000000000 +0100
+++ new/zimg-release-2.7.1/src/zimg/colorspace/operation.cpp    2018-01-14 
00:39:46.000000000 +0100
@@ -68,9 +68,6 @@
        zassert_d(in.matrix == MatrixCoefficients::RGB && out.matrix == 
MatrixCoefficients::RGB, "must be RGB");
        zassert_d(in.transfer != TransferCharacteristics::LINEAR && 
out.transfer == TransferCharacteristics::LINEAR, "wrong transfer 
characteristics");
 
-       if (in.transfer == TransferCharacteristics::XVYCC || out.transfer == 
TransferCharacteristics::XVYCC)
-               cpu = CPUClass::NONE;
-
        if (in.transfer == TransferCharacteristics::ARIB_B67 && 
use_display_referred_b67(in.primaries, params))
                return 
create_inverse_arib_b67_operation(ncl_rgb_to_yuv_matrix_from_primaries(in.primaries),
 params);
        else
@@ -83,9 +80,6 @@
        zassert_d(in.matrix == MatrixCoefficients::RGB && out.matrix == 
MatrixCoefficients::RGB, "must be RGB");
        zassert_d(in.transfer == TransferCharacteristics::LINEAR && 
out.transfer != TransferCharacteristics::LINEAR, "wrong transfer 
characteristics");
 
-       if (in.transfer == TransferCharacteristics::XVYCC || out.transfer == 
TransferCharacteristics::XVYCC)
-               cpu = CPUClass::NONE;
-
        if (out.transfer == TransferCharacteristics::ARIB_B67 && 
use_display_referred_b67(out.primaries, params))
                return 
create_arib_b67_operation(ncl_rgb_to_yuv_matrix_from_primaries(out.primaries), 
params);
        else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/zimg-release-2.7/src/zimg/colorspace/x86/operation_impl_avx2.cpp 
new/zimg-release-2.7.1/src/zimg/colorspace/x86/operation_impl_avx2.cpp
--- old/zimg-release-2.7/src/zimg/colorspace/x86/operation_impl_avx2.cpp        
2017-12-21 03:35:58.000000000 +0100
+++ new/zimg-release-2.7.1/src/zimg/colorspace/x86/operation_impl_avx2.cpp      
2018-01-14 00:39:46.000000000 +0100
@@ -16,22 +16,23 @@
 
 namespace {
 
-constexpr unsigned LUT_DEPTH = 15;
+constexpr unsigned LUT_DEPTH = 16;
 
 void to_linear_lut_filter_line(const float *RESTRICT lut, unsigned lut_depth, 
const float *src, float *dst, unsigned left, unsigned right)
 {
        unsigned vec_left = ceil_n(left, 8);
        unsigned vec_right = floor_n(right, 8);
 
-       const int lut_limit = 1 << lut_depth;
+       const int32_t lut_limit = static_cast<int32_t>(1) << lut_depth;
 
-       const __m256 scale = _mm256_set1_ps(static_cast<float>(lut_limit));
+       const __m256 scale = _mm256_set1_ps(0.5f * lut_limit);
+       const __m256 offset = _mm256_set1_ps(0.25f * lut_limit);
        const __m256i zero = _mm256_setzero_si256();
        const __m256i limit = _mm256_set1_epi32(lut_limit);
 
        for (unsigned j = left; j < vec_left; ++j) {
                __m128 x = _mm_load_ss(src + j);
-               int idx = _mm_cvt_ss2si(_mm_mul_ss(x, 
_mm256_castps256_ps128(scale)));
+               int idx = _mm_cvt_ss2si(_mm_fmadd_ss(x, 
_mm256_castps256_ps128(scale), _mm256_castps256_ps128(offset)));
                dst[j] = lut[std::min(std::max(idx, 0), lut_limit)];
        }
        for (unsigned j = vec_left; j < vec_right; j += 8) {
@@ -39,7 +40,7 @@
                __m256i xi;
 
                x = _mm256_load_ps(src + j);
-               x = _mm256_mul_ps(x, scale);
+               x = _mm256_fmadd_ps(x, scale, offset);
                xi = _mm256_cvtps_epi32(x);
                xi = _mm256_max_epi32(xi, zero);
                xi = _mm256_min_epi32(xi, limit);
@@ -48,7 +49,7 @@
        }
        for (unsigned j = vec_right; j < right; ++j) {
                __m128 x = _mm_load_ss(src + j);
-               int idx = _mm_cvt_ss2si(_mm_mul_ss(x, 
_mm256_castps256_ps128(scale)));
+               int idx = _mm_cvt_ss2si(_mm_fmadd_ss(x, 
_mm256_castps256_ps128(scale), _mm256_castps256_ps128(offset)));
                dst[j] = lut[std::min(std::max(idx, 0), lut_limit)];
        }
 }
@@ -85,14 +86,14 @@
        unsigned m_lut_depth;
 public:
        ToLinearLutOperationAVX2(gamma_func func, unsigned lut_depth, float 
postscale) :
-               m_lut((1 << lut_depth) + 1),
+               m_lut((1UL << lut_depth) + 1),
                m_lut_depth{ lut_depth }
        {
                EnsureSinglePrecision x87;
 
                // Allocate an extra LUT entry so that indexing can be done by 
multipying by a power of 2.
-               for (unsigned i = 0; i < m_lut.size(); ++i) {
-                       float x = static_cast<float>(i) / (1 << lut_depth);
+               for (size_t i = 0; i < m_lut.size(); ++i) {
+                       float x = static_cast<float>(i) / (1 << lut_depth) * 
2.0f - 0.5f;
                        m_lut[i] = func(x) * postscale;
                }
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/zimg-release-2.7/src/zimg/colorspace/x86/operation_impl_sse2.cpp 
new/zimg-release-2.7.1/src/zimg/colorspace/x86/operation_impl_sse2.cpp
--- old/zimg-release-2.7/src/zimg/colorspace/x86/operation_impl_sse2.cpp        
2017-12-21 03:35:58.000000000 +0100
+++ new/zimg-release-2.7.1/src/zimg/colorspace/x86/operation_impl_sse2.cpp      
2018-01-14 00:39:46.000000000 +0100
@@ -18,23 +18,24 @@
 
 namespace {
 
-constexpr unsigned LUT_DEPTH = 15;
+constexpr unsigned LUT_DEPTH = 16;
 
 void lut_filter_line(const float *RESTRICT lut, unsigned lut_depth, float 
prescale, const float *src, float *dst, unsigned left, unsigned right)
 {
        unsigned vec_left = ceil_n(left, 4);
        unsigned vec_right = floor_n(right, 4);
 
-       const int lut_limit = 1 << lut_depth;
+       const int32_t lut_limit = static_cast<int32_t>(1) << lut_depth;
 
-       const __m128 scale = _mm_set_ps1(prescale * lut_limit);
-       const __m128i limit = _mm_set1_epi16(lut_limit + INT16_MIN);
+       const __m128 scale = _mm_set_ps1(0.5f * prescale * lut_limit);
+       const __m128 offset = _mm_set_ps1(0.25f * lut_limit);
+       const __m128i limit = _mm_set1_epi16(std::min(lut_limit + INT16_MIN, 
static_cast<int32_t>(INT16_MAX)));
        const __m128i bias_epi16 = _mm_set1_epi16(INT16_MIN);
        const __m128i bias_epi32 = _mm_set1_epi32(INT16_MIN);
 
        for (unsigned j = left; j < vec_left; ++j) {
                __m128 x = _mm_load_ss(src + j);
-               int idx = _mm_cvt_ss2si(_mm_mul_ss(x, scale));
+               int idx = _mm_cvt_ss2si(_mm_add_ss(_mm_mul_ss(x, scale), 
offset));
                dst[j] = lut[std::min(std::max(idx, 0), lut_limit)];
        }
        for (ptrdiff_t j = vec_left; j < static_cast<ptrdiff_t>(vec_right); j 
+= 4) {
@@ -43,20 +44,21 @@
 
                x = _mm_load_ps(src + j);
                x = _mm_mul_ps(x, scale);
+               x = _mm_add_ps(x, offset);
                xi = _mm_cvtps_epi32(x);
                xi = _mm_add_epi32(xi, bias_epi32);
                xi = _mm_packs_epi32(xi, xi);
                xi = _mm_min_epi16(xi, limit);
                xi = _mm_sub_epi16(xi, bias_epi16);
 
-               dst[j + 0] = lut[_mm_extract_epi16(xi, 0)];
-               dst[j + 1] = lut[_mm_extract_epi16(xi, 1)];
-               dst[j + 2] = lut[_mm_extract_epi16(xi, 2)];
-               dst[j + 3] = lut[_mm_extract_epi16(xi, 3)];
+               dst[j + 0] = lut[static_cast<unsigned>(_mm_extract_epi16(xi, 
0))];
+               dst[j + 1] = lut[static_cast<unsigned>(_mm_extract_epi16(xi, 
1))];
+               dst[j + 2] = lut[static_cast<unsigned>(_mm_extract_epi16(xi, 
2))];
+               dst[j + 3] = lut[static_cast<unsigned>(_mm_extract_epi16(xi, 
3))];
        }
        for (unsigned j = vec_right; j < right; ++j) {
                __m128 x = _mm_load_ss(src + j);
-               int idx = _mm_cvt_ss2si(_mm_mul_ss(x, scale));
+               int idx = _mm_cvt_ss2si(_mm_add_ss(_mm_mul_ss(x, scale), 
offset));
                dst[j] = lut[std::min(std::max(idx, 0), lut_limit)];
        }
 }
@@ -68,15 +70,15 @@
        float m_prescale;
 public:
        LutOperationSSE2(gamma_func func, unsigned lut_depth, float prescale, 
float postscale) :
-               m_lut((1 << lut_depth) + 1),
+               m_lut((1UL << lut_depth) + 1),
                m_lut_depth{ lut_depth },
                m_prescale{ static_cast<float>(prescale) }
        {
                EnsureSinglePrecision x87;
 
                // Allocate an extra LUT entry so that indexing can be done by 
multipying by a power of 2.
-               for (unsigned i = 0; i < m_lut.size(); ++i) {
-                       float x = static_cast<float>(i) / (1 << lut_depth);
+               for (size_t i = 0; i < m_lut.size(); ++i) {
+                       float x = static_cast<float>(i) / (1 << lut_depth) * 
2.0f - 0.5f;
                        m_lut[i] = func(x) * postscale;
                }
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/zimg-release-2.7/test/colorspace/x86/colorspace_avx2_test.cpp 
new/zimg-release-2.7.1/test/colorspace/x86/colorspace_avx2_test.cpp
--- old/zimg-release-2.7/test/colorspace/x86/colorspace_avx2_test.cpp   
2017-12-21 03:35:58.000000000 +0100
+++ new/zimg-release-2.7.1/test/colorspace/x86/colorspace_avx2_test.cpp 
2018-01-14 00:39:46.000000000 +0100
@@ -48,7 +48,7 @@
 
        const char *expected_sha1[][3] = {
                {
-                       "3c7196b6a704e2f3d88c2a02143d77dbdefdb234",
+                       "910ce7272eb8fac2e82424e9307eadffefbdb445",
                        "fa7ab9deaee4790fa49a1d9d8249e5d323674ec2",
                        "162687e701627cdc17283a32c36ea711d28a953e"
                },
@@ -58,7 +58,7 @@
                        "f7763076e0226260bb46890dff425756bb83b978"
                },
                {
-                       "48c1ec7de50653817c678ea87ee6e1c84ef014d5",
+                       "4c0b5ffe768a7812d1ef102b4d8d52614838bc8e",
                        "58eb1dde0eb88fff043364836e1844aa766b64c5",
                        "85a277a80dfca2e21789cedd76aaee307dbc4562"
                },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/zimg-release-2.7/test/colorspace/x86/colorspace_sse2_test.cpp 
new/zimg-release-2.7.1/test/colorspace/x86/colorspace_sse2_test.cpp
--- old/zimg-release-2.7/test/colorspace/x86/colorspace_sse2_test.cpp   
2017-12-21 03:35:58.000000000 +0100
+++ new/zimg-release-2.7.1/test/colorspace/x86/colorspace_sse2_test.cpp 
2018-01-14 00:39:46.000000000 +0100
@@ -48,24 +48,24 @@
 
        const char *expected_sha1[][3] = {
                {
-                       "3c7196b6a704e2f3d88c2a02143d77dbdefdb234",
+                       "910ce7272eb8fac2e82424e9307eadffefbdb445",
                        "fa7ab9deaee4790fa49a1d9d8249e5d323674ec2",
                        "162687e701627cdc17283a32c36ea711d28a953e"
                },
                {
-                       "ac27dc26b2cef34cc017155052ffb071d1d9e9d6",
+                       "492587e7ed75b7e3ab868bead6ade7a4137c6ea1",
                        "3b0694e9fbce61466cb5a575f300d784089b6cad",
                        "b68f103f52ccafae867d664d7f27fe56ae9208af"
                },
                {
-                       "48c1ec7de50653817c678ea87ee6e1c84ef014d5",
+                       "4c0b5ffe768a7812d1ef102b4d8d52614838bc8e",
                        "58eb1dde0eb88fff043364836e1844aa766b64c5",
                        "85a277a80dfca2e21789cedd76aaee307dbc4562"
                },
                {
-                       "098e8372af7b8c64c3d0fb34ad8dd2165ec3ca3d",
-                       "b4b84f60f3c6f1141a9e910cf8deda704a20e2ab",
-                       "8192c78230f86f2ea5d39904ad84d51ea4b9cfe2"
+                       "df546ce0ad6f859499a96d2d697d896067e60e38",
+                       "f0041b8a008ab45f0ea1319090ac7e8be0990d92",
+                       "06880efb598e41f96fa79e04dbdfcccd50d6dc6f"
                },
        };
        const double expected_tolinear_snr = 80.0;


Reply via email to