Skip to content

Commit 1db4d98

Browse files
committed
Update cvtRGBtoGray
1 parent 6fdba0a commit 1db4d98

36 files changed

+717
-260
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ ConstructorInitializerIndentWidth: 4
3939

4040
AlwaysBreakTemplateDeclarations: Yes
4141

42-
ColumnLimit: 80
42+
ColumnLimit: 79

.clangd

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
---
2+
If:
3+
PathMatch: [.*\.c, .*\.h]
4+
CompileFlags:
5+
Add: [-xc, -std=c11]
6+
Remove: [-xc++, -std=c++*]
7+
Diagnostics:
8+
ClangTidy:
9+
Remove:
10+
- modernize-*
11+
- cppcoreguidelines-*
12+
- performance-*
13+
- google-*
14+
- cert-dcl21-cpp
15+
- cert-dcl58-cpp
16+
- cert-err58-cpp
17+
- misc-new-delete-overloads
18+
- misc-non-private-member-variables-in-classes
19+
- misc-uniqueptr-reset-release
20+
---
21+
If:
22+
PathMatch: [.*\.cpp, .*\.cu, .*\.hpp, .*\.cuh]
123
CompileFlags:
224
Add:
325
- --no-cuda-version-check
@@ -35,9 +57,9 @@ Diagnostics:
3557

3658
CheckOptions:
3759
readability-identifier-naming.VariableCase: aNy_CasE
38-
readability-identifier-naming.ProtectedMemberCase: camelBack
39-
readability-identifier-naming.PrivateMemberCase: camelBack
40-
readability-identifier-naming.PublicMemberCase: camelBack
60+
readability-identifier-naming.ProtectedMemberCase: aNy_CasE
61+
readability-identifier-naming.PrivateMemberCase: aNy_CasE
62+
readability-identifier-naming.PublicMemberCase: aNy_CasE
4163
readability-identifier-naming.NamespaceCase: lower_case
4264
readability-identifier-naming.EnumCase: camelBack
4365
readability-identifier-naming.ClassCase: CamelCase

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@
2525
"--all-scopes-completion",
2626
"--completion-style=bundled",
2727
"--cross-file-rename",
28-
"--header-insertion=iwyu",
28+
"--header-insertion=never",
2929
"--header-insertion-decorators",
3030
"--background-index",
3131
"-j=8",
3232
"--pch-storage=memory",
3333
"--function-arg-placeholders=false",
3434
],
35+
"black-formatter.args": [
36+
"--line-length=79"
37+
]
3538
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pip install torch torchvision torchaudio
1313
To build the C++ part only (lib pmpp):
1414

1515
```bash
16-
bash scripts/build.sh -S ./csrc -B ./build
16+
bash scripts/build.sh
1717
```
1818

1919
Run ctest to test lib pmpp:

csrc/CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@ cmake_minimum_required(VERSION 3.30)
55
project(VSC-CMAKE-CXX-TEMPLATE VERSION 1.0.0)
66

77
# Common utility functions
8+
include(${PROJECT_SOURCE_DIR}/cmake/utils/logging.cmake)
89
include(${PROJECT_SOURCE_DIR}/cmake/utils/common.cmake)
910

10-
log_info(${CMAKE_TOOLCHAIN_FILE})
11+
log_info("CMake Tookchain File Path: ${CMAKE_TOOLCHAIN_FILE}")
1112

12-
# @see "./cmake/utils/variables.cmake"
1313
set_default_values(
14-
# CMake project namespace:
15-
# All the libs should have a alias with this namespace
16-
# [NOTE] Change this to your own namespace
1714
PROJECT_NAMESPACE "pmpp::"
1815
FORCE_COLORED_OUTPUT ON
1916
)

csrc/cmake/utils/common.cmake

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@ include(${CMAKE_CURRENT_LIST_DIR}/logging.cmake)
22

33
# @func set_default_values(<var1> <value1> <var2> <value2> ...)
44
# @brief Set default values for variables;
5-
# The variable will not be overwrite if it already has a value.
5+
# The variable will not be overwrite if it already has a value.
66
function(set_default_values)
77
math(EXPR ARG_COUNT "${ARGC} % 2")
8+
89
if(NOT ${ARG_COUNT} EQUAL 0)
910
log_error("`set_default_values()` requires pairs of VAR_NAME and DEFAULT_VALUE")
1011
endif()
1112

1213
math(EXPR LAST_INDEX "${ARGC} - 1")
14+
1315
foreach(IDX RANGE 0 ${LAST_INDEX} 2)
1416
math(EXPR VALUE_IDX "${IDX} + 1")
1517
list(GET ARGV ${IDX} VAR_NAME)
1618
list(GET ARGV ${VALUE_IDX} DEFAULT_VALUE)
17-
19+
1820
if(NOT DEFINED ${VAR_NAME})
1921
set(${VAR_NAME} ${DEFAULT_VALUE} PARENT_SCOPE)
2022
endif()
@@ -23,10 +25,10 @@ endfunction()
2325

2426
# @func try_get_value(<var> HINTS <hint1> <hint2> ...)
2527
# @brief Try to assign value to <var> from hints or env:hints.
26-
# $<var>_FOUND will be set to true if one of the hint found; Otherwise false.
28+
# $<var>_FOUND will be set to true if one of the hint found; Otherwise false.
2729
function(try_get_value VAR)
2830
cmake_parse_arguments(PARSE_ARGV 1 ARG "" "" "HINTS")
29-
31+
3032
# First try each hint as a CMake variable
3133
foreach(hint IN LISTS ARG_HINTS)
3234
if(DEFINED ${hint})
@@ -35,7 +37,7 @@ function(try_get_value VAR)
3537
return()
3638
endif()
3739
endforeach()
38-
40+
3941
# Then try each hint as an environment variable
4042
foreach(hint IN LISTS ARG_HINTS)
4143
if(DEFINED ENV{${hint}})
@@ -44,7 +46,7 @@ function(try_get_value VAR)
4446
return()
4547
endif()
4648
endforeach()
47-
49+
4850
# If nothing found
4951
set(${VAR} "" PARENT_SCOPE)
5052
set(${VAR}_FOUND FALSE PARENT_SCOPE)

csrc/cmake/vcpkg-triplets/x64-linux-no-cxx11abi.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ set(VCPKG_LIBRARY_LINKAGE static)
44

55
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
66

7-
# Force old ABI off
7+
# Forcing the use of the old ABI
88
set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
99
set(ENV{CFLAGS} "$ENV{CFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#pragma once
2+
3+
#include <spdlog/common.h>
4+
#include <spdlog/sinks/stdout_color_sinks.h>
5+
#include <spdlog/spdlog.h>
6+
#include <string>
7+
#include <utility>
8+
9+
namespace pmpp::basic
10+
{
11+
class LoggableBase
12+
{
13+
public:
14+
explicit LoggableBase(
15+
const std::string& loggerName,
16+
spdlog::level::level_enum level = spdlog::level::info,
17+
const std::string& pattern =
18+
"[%Y-%m-%d %H:%M:%S.%e] [%^%l%$] [%n] [%t] %v")
19+
: m_logger(spdlog::stdout_color_mt(loggerName))
20+
{
21+
m_logger->set_level(level);
22+
m_logger->set_pattern(pattern);
23+
}
24+
25+
auto getLogger() -> std::shared_ptr<spdlog::logger>
26+
{
27+
return m_logger;
28+
}
29+
30+
void setLogger(std::shared_ptr<spdlog::logger> logger)
31+
{
32+
m_logger = std::move(logger);
33+
}
34+
35+
void setLevel(spdlog::level::level_enum level)
36+
{
37+
m_logger->set_level(level);
38+
}
39+
40+
void setPattern(const std::string& pattern)
41+
{
42+
m_logger->set_pattern(pattern);
43+
}
44+
45+
protected:
46+
std::shared_ptr<spdlog::logger> m_logger;
47+
};
48+
} // namespace pmpp::basic

csrc/include/pmpp/ops/cvt_rgb_to_gray.hpp

Lines changed: 0 additions & 25 deletions
This file was deleted.

csrc/include/pmpp/ops/vec_add.hpp

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)