OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 "differ_block.h" |
| 6 |
| 7 #include <stdlib.h> |
| 8 |
| 9 namespace remoting { |
| 10 |
| 11 // TODO(fbarchard): Use common header for block size. |
| 12 int kBlockWidth = 32; |
| 13 int kBlockHeight = 32; |
| 14 int kBytesPerPixel = 3; |
| 15 |
| 16 int BlockDifference(const uint8* image1, const uint8* image2, int stride) { |
| 17 int diff = 0; |
| 18 for (int y = 0; y < kBlockHeight; ++y) { |
| 19 for (int x = 0; x < kBlockWidth * kBytesPerPixel; ++x) { |
| 20 diff += abs(image1[x] - image2[x]); |
| 21 } |
| 22 image1 += stride; |
| 23 image2 += stride; |
| 24 } |
| 25 return diff; |
| 26 } |
| 27 |
| 28 } // namespace remoting |
OLD | NEW |