Apollo 10.0
自动驾驶开放平台
utils.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2024 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#pragma once
18
20
21namespace apollo {
22namespace perception {
23namespace camera {
24
26
27// save semantic label in last four digits
28inline void SetSemanticLabel(PointSemanticLabel label, uint8_t* value) {
29 *value &= 240; // 240: 11110000
30 *value |= static_cast<uint8_t>(label);
31}
32
33inline PointSemanticLabel GetSemanticLabel(uint8_t value) {
34 return static_cast<PointSemanticLabel>(value & 15);
35}
36
37inline bool IsSemanticLabel(PointSemanticLabel label, uint8_t value) {
38 return (value & 15) == static_cast<uint8_t>(label);
39}
40
41// save scene-flow label in first four digits
42inline void SetSceneFlowLabel(PointSemanticLabel label, uint8_t* value) {
43 *value &= 15; // 15: 00001111
44 *value = (static_cast<uint8_t>(label) << 4) | (*value);
45}
46
47inline PointSemanticLabel GetSceneFlowLabel(uint8_t value) {
48 return static_cast<PointSemanticLabel>(value >> 4);
49}
50
51inline bool IsSceneFlowLabelEqual(PointSemanticLabel label, uint8_t value) {
52 return (value >> 4) == static_cast<uint8_t>(label);
53}
54
55} // namespace camera
56} // namespace perception
57} // namespace apollo
void SetSceneFlowLabel(PointSemanticLabel label, uint8_t *value)
Definition utils.h:42
bool IsSceneFlowLabelEqual(PointSemanticLabel label, uint8_t value)
Definition utils.h:51
PointSemanticLabel GetSceneFlowLabel(uint8_t value)
Definition utils.h:47
bool IsSemanticLabel(PointSemanticLabel label, uint8_t value)
Definition utils.h:37
void SetSemanticLabel(PointSemanticLabel label, uint8_t *value)
Definition utils.h:28
PointSemanticLabel GetSemanticLabel(uint8_t value)
Definition utils.h:33
class register implement
Definition arena_queue.h:37