mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-01-01 03:12:16 +08:00
use attribute to alias for punning float to int
Bug: libyuv:791 Test: g++ -Iinclude -I../libvpx/third_party/libwebm -I../libvpx/vp8 -I../libvpx/vp8 -I../libvpx/vp9 -I../libvpx/vp9 -Iinclude -m64 -DNDEBUG -O3 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wdisabled-optimization -Wfloat-conversion -Wpointer-arith -Wtype-limits -Wcast-qual -Wvla -Wuninitialized -Wunused -Wextra -I. -I"../libvpx" -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -Wno-unused-parameter -c -o third_party/libyuv/source/row_common.cc.o source/row_common.cc Change-Id: Ia006cb9212b671ae668cab5ec0b29759024a2c8a Reviewed-on: https://chromium-review.googlesource.com/1012462 Reviewed-by: Johann Koenig <johannkoenig@google.com> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
parent
2edf6745e0
commit
7e5e12757b
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 1708
|
||||
Version: 1709
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 1708
|
||||
#define LIBYUV_VERSION 1709
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
@ -2762,6 +2762,13 @@ void ARGBPolynomialRow_C(const uint8_t* src_argb,
|
||||
// simply extract the low bits of the exponent and the high
|
||||
// bits of the mantissa from our float and we're done.
|
||||
|
||||
// Work around GCC 7 punning warning -Wstrict-aliasing
|
||||
#if defined(__GNUC__)
|
||||
typedef uint32_t __attribute__((__may_alias__)) uint32_alias_t;
|
||||
#else
|
||||
typedef uint32_t uint32_alias_t;
|
||||
#endif
|
||||
|
||||
void HalfFloatRow_C(const uint16_t* src,
|
||||
uint16_t* dst,
|
||||
float scale,
|
||||
@ -2770,7 +2777,7 @@ void HalfFloatRow_C(const uint16_t* src,
|
||||
float mult = 1.9259299444e-34f * scale;
|
||||
for (i = 0; i < width; ++i) {
|
||||
float value = src[i] * mult;
|
||||
dst[i] = (uint16_t)((*(uint32_t*)&value) >> 13);
|
||||
dst[i] = (uint16_t)((*(const uint32_alias_t*)&value) >> 13);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user