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

Side by Side Diff: webrtc/modules/video_processing/util/skin_detection.cc

Issue 1508793002: Clang format of video_processing folder. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 42
43 bool MbHasSkinColor(const uint8_t* y_src, 43 bool MbHasSkinColor(const uint8_t* y_src,
44 const uint8_t* u_src, 44 const uint8_t* u_src,
45 const uint8_t* v_src, 45 const uint8_t* v_src,
46 const int stride_y, 46 const int stride_y,
47 const int stride_u, 47 const int stride_u,
48 const int stride_v, 48 const int stride_v,
49 const int mb_row, 49 const int mb_row,
50 const int mb_col) { 50 const int mb_col) {
51 const uint8_t* y = 51 const uint8_t* y = y_src + ((mb_row << 4) + 8) * stride_y + (mb_col << 4) + 8;
52 y_src + ((mb_row << 4) + 8) * stride_y + (mb_col << 4) + 8; 52 const uint8_t* u = u_src + ((mb_row << 3) + 4) * stride_u + (mb_col << 3) + 4;
53 const uint8_t* u = 53 const uint8_t* v = v_src + ((mb_row << 3) + 4) * stride_v + (mb_col << 3) + 4;
54 u_src + ((mb_row << 3) + 4) * stride_u + (mb_col << 3) + 4;
55 const uint8_t* v =
56 v_src + ((mb_row << 3) + 4) * stride_v + (mb_col << 3) + 4;
57 // Use 2x2 average of center pixel to compute skin area. 54 // Use 2x2 average of center pixel to compute skin area.
58 uint8_t y_avg = 55 uint8_t y_avg = (*y + *(y + 1) + *(y + stride_y) + *(y + stride_y + 1)) >> 2;
59 (*y + *(y + 1) + *(y + stride_y) + *(y + stride_y + 1)) >> 2; 56 uint8_t u_avg = (*u + *(u + 1) + *(u + stride_u) + *(u + stride_u + 1)) >> 2;
60 uint8_t u_avg = 57 uint8_t v_avg = (*v + *(v + 1) + *(v + stride_v) + *(v + stride_v + 1)) >> 2;
61 (*u + *(u + 1) + *(u + stride_u) + *(u + stride_u + 1)) >> 2;
62 uint8_t v_avg =
63 (*v + *(v + 1) + *(v + stride_v) + *(v + stride_v + 1)) >> 2;
64 // Ignore MB with too high or low brightness. 58 // Ignore MB with too high or low brightness.
65 if (y_avg < y_low || y_avg > y_high) 59 if (y_avg < y_low || y_avg > y_high)
66 return false; 60 return false;
67 else 61 else
68 return (EvaluateSkinColorDifference(u_avg, v_avg) < skin_threshold); 62 return (EvaluateSkinColorDifference(u_avg, v_avg) < skin_threshold);
69 } 63 }
70 64
71 } // namespace webrtc 65 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698