| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Routines for encoding and decoding a small number of bits into an image | 5 // Routines for encoding and decoding a small number of bits into an image |
| 6 // in a way that is decodable even after scaling/encoding/cropping. | 6 // in a way that is decodable even after scaling/encoding/cropping. |
| 7 // | 7 // |
| 8 // The encoding is very simple: | 8 // The encoding is very simple: |
| 9 // | 9 // |
| 10 // #### #### ######## #### #### #### | 10 // #### #### ######## #### #### #### |
| 11 // #### #### ######## #### #### #### | 11 // #### #### ######## #### #### #### |
| 12 // #### #### ######## #### #### #### | 12 // #### #### ######## #### #### #### |
| 13 // #### #### ######## #### #### #### | 13 // #### #### ######## #### #### #### |
| 14 // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 14 // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
| 15 // <-----start----><--one-bit-><-zero bit-><----stop----> | 15 // <-----start----><--one-bit-><-zero bit-><----stop----> |
| 16 // | 16 // |
| 17 // We use a basic unit, depicted here as four characters wide. | 17 // We use a basic unit, depicted here as four characters wide. |
| 18 // We start with 1u black 1u white 1u black 1u white. (1-4 above) | 18 // We start with 1u black 1u white 1u black 1u white. (1-4 above) |
| 19 // From there on, a "one" bit is encoded as 2u black and 1u white, | 19 // From there on, a "one" bit is encoded as 2u black and 1u white, |
| 20 // and a zero bit is encoded as 1u black and 2u white. After | 20 // and a zero bit is encoded as 1u black and 2u white. After |
| 21 // all the bits we end the pattern with the same pattern as the | 21 // all the bits we end the pattern with the same pattern as the |
| 22 // start of the pattern. | 22 // start of the pattern. |
| 23 | 23 |
| 24 #include <algorithm> |
| 24 #include <deque> | 25 #include <deque> |
| 25 #include <vector> | 26 #include <vector> |
| 26 | 27 |
| 27 #include "base/logging.h" | 28 #include "base/logging.h" |
| 28 #include "media/base/video_frame.h" | 29 #include "media/base/video_frame.h" |
| 29 #include "media/cast/test/utility/barcode.h" | 30 #include "media/cast/test/utility/barcode.h" |
| 30 | 31 |
| 31 namespace media { | 32 namespace media { |
| 32 namespace cast { | 33 namespace cast { |
| 33 namespace test { | 34 namespace test { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 if (DecodeBarCodeRows(frame, output, 0, std::min(5, rows))) { | 166 if (DecodeBarCodeRows(frame, output, 0, std::min(5, rows))) { |
| 166 return true; | 167 return true; |
| 167 } | 168 } |
| 168 | 169 |
| 169 return false; | 170 return false; |
| 170 } | 171 } |
| 171 | 172 |
| 172 } // namespace test | 173 } // namespace test |
| 173 } // namespace cast | 174 } // namespace cast |
| 174 } // namespace media | 175 } // namespace media |
| OLD | NEW |