Skip to content

Commit

Permalink
Linear generator (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierbrgt authored Oct 15, 2024
1 parent d5f9b03 commit 286e282
Show file tree
Hide file tree
Showing 30 changed files with 16,065 additions and 84,871 deletions.
246 changes: 246 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
---
Language: Cpp
# BasedOnStyle: Microsoft
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterExternBlock: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: false
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Custom
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
KeepEmptyLinesAtEOF: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakScopeResolution: 500
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 1000
PointerAlignment: Right
PPIndentWidth: -1
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SkipMacroDefinitionBody: false
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterPlacementOperator: true
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInParensOptions:
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
...

6 changes: 6 additions & 0 deletions ARM.CMSIS-CV.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
<file category="source" name="Source/arm_cv_common.c"/>
<file category="source" name="Source/FeatureDetection/arm_cannysobel.c"/>
<file category="source" name="Source/LinearFilters/arm_gaussian.c"/>
<file category="source" name="Source/LinearFilters/arm_sobel_vertical.c"/>
<file category="source" name="Source/LinearFilters/arm_sobel_horizontal.c"/>
<file category="source" name="Source/LinearFilters/arm_linear_common.c"/>
<file category="source" name="Source/LinearFilters/arm_gaussian_5x5.c"/>
<file category="source" name="Source/LinearFilters/arm_gaussian_7x7_buffer_15.c"/>
<file category="source" name="Source/LinearFilters/arm_gaussian_7x7_buffer_31.c"/>
<file category="source" name="Source/ColorTransforms/arm_yuv420_to_gray8.c"/>
<file category="source" name="Source/ColorTransforms/arm_bgr_8U3C_to_gray8.c"/>
<file category="source" name="Source/ColorTransforms/arm_gray8_to_rgb24.c"/>
Expand Down
106 changes: 95 additions & 11 deletions Include/cv/linear_filters.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,116 @@
#ifndef ARM_CV_LINEAR_FILTER_H
#define ARM_CV_LINEAR_FILTER_H


//this include contain the specific types of the library
// this include contain the specific types of the library
#include "arm_cv_types.h"

#ifdef __cplusplus
#ifdef __cplusplus
extern "C"
{
#endif

#define ARM_CV_BORDER_NEAREST 1
#define ARM_CV_BORDER_WRAP 2
#define ARM_CV_BORDER_REFLECT 3

/**
* @brief Return the scratch size for generic linear filter function using a q15 buffer
*
* @param[in] width The width of the image
* @return Scratch size in bytes
*/
extern uint16_t arm_get_linear_scratch_size_buffer_15(const int width);

/**
* @brief Return the scratch size for generic linear filter function using a q31 buffer
*
* @param[in] width The width of the image
* @return Scratch size in bytes
*/
extern uint16_t arm_get_linear_scratch_size_buffer_31(const int width);

/**
* @brief Gaussian filter applying a 3x3 kernel and using q15 as intermediate values
*
* @param[in] imageIn The input image
* @param[out] imageOut The output image
* @param[in,out] scratch Temporary buffer
* @param[in] borderType Type of border to use, supported are Nearest, Wrap and Reflect
*
*/
extern void arm_gaussian_filter_3x3_fixp(const arm_cv_image_gray8_t *imageIn, arm_cv_image_gray8_t *imageOut,
q15_t *scratch, const int8_t borderType);

/**
* @brief Gaussian filter applying a 5x5 kernel and using q15 as intermediate values
*
* @param[in] imageIn The input image
* @param[out] imageOut The output image
* @param[in,out] scratch Temporary buffer
* @param[in] borderType Type of border to use, supported are Nearest, Wrap and Reflect
*
*/
extern void arm_gaussian_filter_5x5_fixp(const arm_cv_image_gray8_t *imageIn, arm_cv_image_gray8_t *imageOut,
q15_t *scratch, const int8_t borderType);

/**
* @brief Gaussian filter applying a 7x7 kernel and using q15 as intermediate values
*
* @param[in] imageIn The input image
* @param[out] imageOut The output image
* @param[in,out] scratch Temporary buffer
* @param[in] borderType Type of border to use, supported are Nearest, Wrap and Reflect
*
*/
extern void arm_gaussian_filter_7x7_buffer_15_fixp(const arm_cv_image_gray8_t *imageIn, arm_cv_image_gray8_t *imageOut,
q15_t *scratch, const int8_t borderType);

/**
* @brief Gaussian filter applying a 7x7 kernel and using q31 as intermediate values
*
* @param[in] imageIn The input image
* @param[out] imageOut The output image
* @param[in,out] scratch Temporary buffer
* @param[in] borderType Type of border to use, supported are Nearest, Wrap and Reflect
*
*/
extern void arm_gaussian_filter_7x7_buffer_31_fixp(const arm_cv_image_gray8_t *imageIn, arm_cv_image_gray8_t *imageOut,
q31_t *scratch, const int8_t borderType);

/**
* @brief Gaussian filter for grayscale data computing in q15
/**
* @brief Return the scratch size for sobel functions using a q15 buffer
*
* @param[in] ImageIn The input image
* @param ImageOut The output image
* @param[in] width The width of the image
* @return Scratch size in bytes
*/
extern void arm_gaussian_filter_3x3_fixp(const arm_cv_image_gray8_t* ImageIn,
arm_cv_image_gray8_t* ImageOut);
extern uint16_t arm_get_scratch_size_sobel(const int width);

/**
* @brief Sobel filter computing the gradient on the vertical axis
*
* @param[in] imageIn The input image
* @param[out] imageOut The output image
* @param[in,out] scratch Buffer of q15
* @param[in] borderType Type of border to use, supported are Nearest, Wrap and Reflect
*
*/
extern void arm_sobel_vertical(const arm_cv_image_gray8_t *ImageIn, arm_cv_image_q15_t *ImageOut, q15_t *Buffer,
const int8_t borderType);

/**
* @brief Sobel filter computing the gradient on the horizontal axis
*
* @param[in] imageIn The input image
* @param[out] imageOut The output image
* @param[in,out] scratch Buffer of q15
* @param[in] borderType Type of border to use, supported are Nearest, Wrap and Reflect
*
*/
extern void arm_sobel_horizontal(const arm_cv_image_gray8_t *imageIn, arm_cv_image_q15_t *imageOut, q15_t *scratch,
const int8_t borderType);

#ifdef __cplusplus
#ifdef __cplusplus
}
#endif


#endif
Loading

0 comments on commit 286e282

Please sign in to comment.