Index: cc/resources/video_resource_updater.cc |
diff --git a/cc/resources/video_resource_updater.cc b/cc/resources/video_resource_updater.cc |
index e56c3853fbe383d95bcf46d4f5d6f6615e02e738..da89033e5416d7aabd770197a0d80181b91474b2 100644 |
--- a/cc/resources/video_resource_updater.cc |
+++ b/cc/resources/video_resource_updater.cc |
@@ -22,6 +22,7 @@ |
#include "media/renderers/skcanvas_video_renderer.h" |
#include "third_party/khronos/GLES2/gl2.h" |
#include "third_party/khronos/GLES2/gl2ext.h" |
+#include "third_party/libyuv/include/libyuv.h" |
#include "third_party/skia/include/core/SkCanvas.h" |
#include "ui/gfx/geometry/size_conversions.h" |
@@ -298,19 +299,8 @@ void VideoResourceUpdater::MakeHalfFloats(const uint16_t* src, |
int bits_per_channel, |
size_t num, |
uint16_t* dst) { |
- // TODO(hubbe): Make AVX and neon versions of this code. |
- |
- // This magic constant is 2^-112. Multiplying by this |
- // is the same as subtracting 112 from the exponent, which |
- // is the difference in exponent bias between 32-bit and |
- // 16-bit floats. Once we've done this subtraction, we can |
- // simply extract the low bits of the exponent and the high |
- // bits of the mantissa from our float and we're done. |
- float mult = 1.9259299444e-34f / ((1 << bits_per_channel) - 1); |
- for (size_t i = 0; i < num; i++) { |
- float value = src[i] * mult; |
- dst[i] = (*(uint32_t*)&value) >> 13; |
- } |
+ libyuv::HalfFloatPlane(src, 0, dst, 0, 1.0f / ((1 << bits_per_channel) - 1), |
danakj
2016/10/03 22:48:15
Can you use a temp var to give "1.0f / ((1 << bits
hubbe
2016/10/03 23:30:49
Better?
danakj
2016/10/03 23:47:43
Much, thanks.
hubbe
2016/10/03 23:56:35
Acknowledged.
|
+ num, 1); |
} |
VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes( |