Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: media/video/half_float_maker_xor.cc

Issue 2763503002: Move HalfFloatMaker to media (Closed)
Patch Set: Moved HalffloatMaker and its implementation from cc to media Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/video/half_float_maker_xor.h"
6
7 namespace media {
8
9 HalfFloatMaker_xor::HalfFloatMaker_xor(int bits_per_channel)
10 : bits_per_channel_(bits_per_channel) {}
11
12 float HalfFloatMaker_xor::Multiplier() const {
13 int max_input_value = (1 << bits_per_channel_) - 1;
14 // 2 << 11 = 2048 would be 1.0 with our exponent.
15 return 2048.0 / max_input_value;
16 }
17
18 float HalfFloatMaker_xor::Offset() const {
19 return 0.5;
20 }
21
22 void HalfFloatMaker_xor::MakeHalfFloats(const uint16_t* src,
23 size_t num,
24 uint16_t* dst) {
25 // Micro-benchmarking indicates that the compiler does
26 // a good enough job of optimizing this loop that trying
27 // to manually operate on one uint64 at a time is not
28 // actually helpful.
29 // Note to future optimizers: Benchmark your optimizations!
30 for (size_t i = 0; i < num; i++)
31 dst[i] = src[i] | 0x3800;
32 }
33
34 } // namespace media
OLDNEW
« media/video/half_float_maker_xor.h ('K') | « media/video/half_float_maker_xor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698