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

Side by Side Diff: services/shape_detection/face_detection_impl_mac.mm

Issue 2692123002: Revert of Shape detection unittests mac (QR and Face) in GPU bots (Closed)
Patch Set: Created 3 years, 10 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #include "services/shape_detection/face_detection_impl_mac.h" 5 #include "services/shape_detection/face_detection_impl_mac.h"
6 6
7 #import <QuartzCore/QuartzCore.h>
8
7 #include "base/mac/scoped_cftyperef.h" 9 #include "base/mac/scoped_cftyperef.h"
8 #include "media/capture/video/scoped_result_callback.h" 10 #include "media/capture/video/scoped_result_callback.h"
9 #include "mojo/public/cpp/bindings/strong_binding.h" 11 #include "mojo/public/cpp/bindings/strong_binding.h"
10 #include "services/shape_detection/detection_utils_mac.h" 12 #include "services/shape_detection/detection_utils_mac.h"
11 #include "services/shape_detection/face_detection_provider_impl.h" 13 #include "services/shape_detection/face_detection_provider_impl.h"
12 14
13 namespace shape_detection { 15 namespace shape_detection {
14 16
15 namespace { 17 namespace {
16 18
(...skipping 13 matching lines...) Expand all
30 void FaceDetectionProviderImpl::CreateFaceDetection( 32 void FaceDetectionProviderImpl::CreateFaceDetection(
31 shape_detection::mojom::FaceDetectionRequest request, 33 shape_detection::mojom::FaceDetectionRequest request,
32 shape_detection::mojom::FaceDetectorOptionsPtr options) { 34 shape_detection::mojom::FaceDetectorOptionsPtr options) {
33 mojo::MakeStrongBinding( 35 mojo::MakeStrongBinding(
34 base::MakeUnique<FaceDetectionImplMac>(std::move(options)), 36 base::MakeUnique<FaceDetectionImplMac>(std::move(options)),
35 std::move(request)); 37 std::move(request));
36 } 38 }
37 39
38 FaceDetectionImplMac::FaceDetectionImplMac( 40 FaceDetectionImplMac::FaceDetectionImplMac(
39 shape_detection::mojom::FaceDetectorOptionsPtr options) { 41 shape_detection::mojom::FaceDetectorOptionsPtr options) {
40 NSString* const accuracy = 42 NSDictionary* const opts = @{CIDetectorAccuracy : CIDetectorAccuracyHigh};
41 options->fast_mode ? CIDetectorAccuracyHigh : CIDetectorAccuracyLow;
42 NSDictionary* const detector_options = @{CIDetectorAccuracy : accuracy};
43 detector_.reset([[CIDetector detectorOfType:CIDetectorTypeFace 43 detector_.reset([[CIDetector detectorOfType:CIDetectorTypeFace
44 context:nil 44 context:nil
45 options:detector_options] retain]); 45 options:opts] retain]);
46 } 46 }
47 47
48 FaceDetectionImplMac::~FaceDetectionImplMac() {} 48 FaceDetectionImplMac::~FaceDetectionImplMac() {}
49 49
50 void FaceDetectionImplMac::Detect(mojo::ScopedSharedBufferHandle frame_data, 50 void FaceDetectionImplMac::Detect(mojo::ScopedSharedBufferHandle frame_data,
51 uint32_t width, 51 uint32_t width,
52 uint32_t height, 52 uint32_t height,
53 const DetectCallback& callback) { 53 const DetectCallback& callback) {
54 media::ScopedResultCallback<DetectCallback> scoped_callback( 54 media::ScopedResultCallback<DetectCallback> scoped_callback(
55 base::Bind(&RunCallbackWithFaces, callback), 55 base::Bind(&RunCallbackWithFaces, callback),
(...skipping 14 matching lines...) Expand all
70 // We need to adjust |y| coordinate of bounding box before sending it. 70 // We need to adjust |y| coordinate of bounding box before sending it.
71 gfx::RectF boundingbox(f.bounds.origin.x, 71 gfx::RectF boundingbox(f.bounds.origin.x,
72 height - f.bounds.origin.y - f.bounds.size.height, 72 height - f.bounds.origin.y - f.bounds.size.height,
73 f.bounds.size.width, f.bounds.size.height); 73 f.bounds.size.width, f.bounds.size.height);
74 faces->bounding_boxes.push_back(boundingbox); 74 faces->bounding_boxes.push_back(boundingbox);
75 } 75 }
76 scoped_callback.Run(std::move(faces)); 76 scoped_callback.Run(std::move(faces));
77 } 77 }
78 78
79 } // namespace shape_detection 79 } // namespace shape_detection
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698