Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup: Convert tabs to spaces and remove trailing spaces #302

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ After coding, make sure to trim any trailing white space and convert any tabs to
### For bash

``` bash
find . -name <Filename> -type f -exec sed -i 's/\t/ /;s/[[:space:]]*$//' {} +
find . -type f -name <Filename> ! -wholename "./.git/*" ! -name "*.png" ! -wholename "./Bin/*" ! -wholename "./Build/*" -exec sed -i 's/\t/ /g;s/[[:space:]]*$//g' {} +
```

Where `<Filename>` is `"*.c"` or `"*.(your file extention here)"`\
Expand All @@ -127,11 +127,18 @@ Search the `find` man page or tips and tricks for more options.\
Alternatively, for single file(s):

``` bash
sed -i 's/\t/ /;s/[[:space:]]*$//' <Filename/Filepath>
sed -i 's/\t/ /g;s/[[:space:]]*$//g' <Filename/Filepath>
```

Note: For macOS and BSD related distros, you may need to use `sed -i ''` inplace due to differences with GNU sed.

``` bash
git grep --cached -Ilz '' | while IFS= read -rd '' f; do tail -c1 < "$f" | read -r _ || echo >> "$f"; done
```

Use this to auto append a newline to the end of the file for any files that are under git.
Taken from [here](https://unix.stackexchange.com/a/161853)

### For Powershell/pwsh

``` Powershell
Expand Down
46 changes: 23 additions & 23 deletions Source/API/EbApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ typedef struct EB_H265_ENC_CONFIGURATION

/* A preset defining the quality vs density tradeoff point that the encoding
* is to be performed at. 0 is the highest quality mode, 11 is the highest
* density mode.
*
* density mode.
*
* [0, 11] for >= 4k resolution.
* [0, 10] for >= 1080p resolution.
* [0, 9] for all resolution.
*
*
* Default is 7. */
uint8_t encMode;

Expand All @@ -190,8 +190,8 @@ typedef struct EB_H265_ENC_CONFIGURATION
*/
uint8_t tune;

/* Flag to enable for lower latency mode. The change is lossless.
*
/* Flag to enable for lower latency mode. The change is lossless.
*
* Default is 0. */
uint8_t latencyMode;

Expand Down Expand Up @@ -225,7 +225,7 @@ typedef struct EB_H265_ENC_CONFIGURATION

/* Prediction structure used to construct GOP. There are two main structures
* supported, which are: Low Delay (P or B) and Random Access.
*
*
* In Low Delay structure, pictures within a mini GOP refer to the previously
* encoded pictures in display order. In other words, pictures with display
* order N can only be referenced by pictures with display order greater than
Expand Down Expand Up @@ -261,7 +261,7 @@ typedef struct EB_H265_ENC_CONFIGURATION
*
* Default is 0. */
uint32_t sourceHeight;

/* The frequecy of images being displayed. If the number is less than 1000,
* the input frame rate is an integer number between 1 and 60, else the input
* number is in Q16 format, shifted by 16 bits, where max allowed is 240 fps.
Expand Down Expand Up @@ -319,7 +319,7 @@ typedef struct EB_H265_ENC_CONFIGURATION

/* Enables subjective quality algorithms to reduce the output bitrate with
* minimal or no subjective visual quality impact. Only applicable to tune 0.
*
*
* Default is 0. */
uint8_t bitRateReduction;

Expand Down Expand Up @@ -352,7 +352,7 @@ typedef struct EB_H265_ENC_CONFIGURATION
uint32_t qp;

/* Path to file that contains qp values.
*
*
* Default is null.*/
uint8_t useQpFile;

Expand All @@ -377,7 +377,7 @@ typedef struct EB_H265_ENC_CONFIGURATION


// Motion Estimation Tools

/* Flag to enable the use of default ME HME parameters.
*
* Default is 1. */
Expand Down Expand Up @@ -412,7 +412,7 @@ typedef struct EB_H265_ENC_CONFIGURATION


// Rate Control

/* Rate control mode.
*
* 0 = Constant QP.
Expand Down Expand Up @@ -477,7 +477,7 @@ typedef struct EB_H265_ENC_CONFIGURATION
uint32_t highDynamicRangeInput;

/* Flag to simplify the detection of boundary between access units.
*
*
* Default is 0. */
uint32_t accessUnitDelimiter;

Expand Down Expand Up @@ -542,24 +542,24 @@ typedef struct EB_H265_ENC_CONFIGURATION

// VBV Parameters
/* Sets the maximum rate the VBV buffer should be assumed to refill at
*
*
* Default is 0. */
uint32_t vbvMaxrate;

/* Sets the size of the VBV buffer in bits.
/* Sets the size of the VBV buffer in bits.
*
* Default is 0. */
uint32_t vbvBufsize;

/* Sets how full the VBV buffer must be before playback starts. If picture
* number is 0, then the initial fill is vbv-init * vbvBufferSize.
* Otherwise, it is interpreted as the initial fill in bits.
* number is 0, then the initial fill is vbv-init * vbvBufferSize.
* Otherwise, it is interpreted as the initial fill in bits.
*
* Default is 90. */
uint64_t vbvBufInit;

/* Enables the buffering period SEI and picture timing SEI to signal the HRD
* parameters.
* parameters.
*
* 0 = disable.
* 1 = enable.
Expand Down Expand Up @@ -602,16 +602,16 @@ typedef struct EB_H265_ENC_CONFIGURATION
uint32_t threadCount;

// ASM Type

/* Assembly instruction set used by encoder.
*
* 0 = non-AVX2, C only.
* 1 = up to AVX512, auto-select highest assembly instruction set supported.
*
*
* Default is 1. */
uint32_t asmType;


// Demo features

/* Flag to enable the Speed Control functionality to achieve the real-time
Expand All @@ -637,7 +637,7 @@ typedef struct EB_H265_ENC_CONFIGURATION

// Debug tools

/* Output reconstructed yuv used for debug purposes. The value is set through
/* Output reconstructed yuv used for debug purposes. The value is set through
* ReconFile token (-o) and using the feature will affect the speed of encoder.
*
* Default is 0. */
Expand Down Expand Up @@ -683,7 +683,7 @@ EB_API EB_ERRORTYPE EbInitHandle(
/* STEP 2: Set all configuration parameters.
*
* Parameter:
* @ *h265EncComponent Encoder handler.
* @ *h265EncComponent Encoder handler.
* @ *pComponentParameterStructure Encoder and buffer configurations will be copied to the library. */
EB_API EB_ERRORTYPE EbH265EncSetParameter(
EB_COMPONENTTYPE *h265EncComponent,
Expand All @@ -699,7 +699,7 @@ EB_API EB_ERRORTYPE EbInitEncoder(
/* OPTIONAL: Get VPS / SPS / PPS headers at init time.
*
* Parameter:
* @ *h265EncComponent Encoder handler.
* @ *h265EncComponent Encoder handler.
* @ **outputStreamPtr Output stream. */
EB_API EB_ERRORTYPE EbH265EncStreamHeader(
EB_COMPONENTTYPE *h265EncComponent,
Expand Down
24 changes: 12 additions & 12 deletions Source/App/EbAppConfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@
#define HRD_TOKEN "-hrd"
#define MAX_QP_TOKEN "-max-qp"
#define MIN_QP_TOKEN "-min-qp"
#define TEMPORAL_ID "-temporal-id" // no Eval
#define TEMPORAL_ID "-temporal-id" // no Eval
#define LOOK_AHEAD_DIST_TOKEN "-lad"
#define SCENE_CHANGE_DETECTION_TOKEN "-scd"
#define INJECTOR_TOKEN "-inj" // no Eval
#define INJECTOR_FRAMERATE_TOKEN "-inj-frm-rt" // no Eval
#define SPEED_CONTROL_TOKEN "-speed-ctrl"
#define ASM_TYPE_TOKEN "-asm" // no Eval
#define ASM_TYPE_TOKEN "-asm" // no Eval
#define THREAD_MGMNT "-lp"
#define TARGET_SOCKET "-ss"
#define THREAD_COUNT "-thread-count"
Expand Down Expand Up @@ -176,7 +176,7 @@ static void SetCfgSegmentOvFile(const char *value, EbConfig_t *cfg)
else
printf("Error segment Override file: %s does not exist, won't use\n",value);
};
static void SetCfgDolbyVisionRpuFile (const char *value, EbConfig_t *cfg)
static void SetCfgDolbyVisionRpuFile (const char *value, EbConfig_t *cfg)
{
if (cfg->dolbyVisionRpuFile) { fclose(cfg->dolbyVisionRpuFile); }
FOPEN(cfg->dolbyVisionRpuFile, value, "rb");
Expand Down Expand Up @@ -234,10 +234,10 @@ static void SetEnableConstrainedIntra (const char *value, EbConfig_t *
static void SetCfgTune (const char *value, EbConfig_t *cfg) {cfg->tune = (uint8_t)strtoul(value, NULL, 0); };
static void SetBitRateReduction (const char *value, EbConfig_t *cfg) {cfg->bitRateReduction = (EB_BOOL)strtol(value, NULL, 0); };
static void SetImproveSharpness (const char *value, EbConfig_t *cfg) {cfg->improveSharpness = (EB_BOOL)strtol(value, NULL, 0);};
static void SetVbvMaxrate (const char *value, EbConfig_t *cfg) { cfg->vbvMaxRate = strtoul(value, NULL, 0);};
static void SetVbvBufsize (const char *value, EbConfig_t *cfg) { cfg->vbvBufsize = strtoul(value, NULL, 0);};
static void SetVbvBufInit (const char *value, EbConfig_t *cfg) { cfg->vbvBufInit = strtoul(value, NULL, 0);};
static void SetHrdFlag (const char *value, EbConfig_t *cfg) { cfg->hrdFlag = strtoul(value, NULL, 0);};
static void SetVbvMaxrate (const char *value, EbConfig_t *cfg) { cfg->vbvMaxRate = strtoul(value, NULL, 0);};
static void SetVbvBufsize (const char *value, EbConfig_t *cfg) { cfg->vbvBufsize = strtoul(value, NULL, 0);};
static void SetVbvBufInit (const char *value, EbConfig_t *cfg) { cfg->vbvBufInit = strtoul(value, NULL, 0);};
static void SetHrdFlag (const char *value, EbConfig_t *cfg) { cfg->hrdFlag = strtoul(value, NULL, 0);};
static void SetVideoUsabilityInfo (const char *value, EbConfig_t *cfg) {cfg->videoUsabilityInfo = strtol(value, NULL, 0);};
static void SetHighDynamicRangeInput (const char *value, EbConfig_t *cfg) {cfg->highDynamicRangeInput = strtol(value, NULL, 0);};
static void SetAccessUnitDelimiter (const char *value, EbConfig_t *cfg) {cfg->accessUnitDelimiter = strtol(value, NULL, 0);};
Expand Down Expand Up @@ -379,7 +379,7 @@ config_entry_t config_entry[] = {
{ SINGLE_INPUT, CONSTRAINED_INTRA_ENABLE_TOKEN, "ConstrainedIntra", SetEnableConstrainedIntra },

// Rate Control
{ SINGLE_INPUT, RATE_CONTROL_ENABLE_TOKEN, "RateControlMode", SetRateControlMode },
{ SINGLE_INPUT, RATE_CONTROL_ENABLE_TOKEN, "RateControlMode", SetRateControlMode },
{ SINGLE_INPUT, TARGET_BIT_RATE_TOKEN, "TargetBitRate", SetTargetBitRate },
{ SINGLE_INPUT, MAX_QP_TOKEN, "MaxQpAllowed", SetMaxQpAllowed },
{ SINGLE_INPUT, MIN_QP_TOKEN, "MinQpAllowed", SetMinQpAllowed },
Expand Down Expand Up @@ -593,7 +593,7 @@ void EbConfigCtor(EbConfig_t *configPtr)

configPtr->performanceContext.encodeStartTime[0]= 0;
configPtr->performanceContext.encodeStartTime[1]= 0;

configPtr->performanceContext.totalExecutionTime= 0;
configPtr->performanceContext.totalEncodeTime = 0;
configPtr->performanceContext.frameCount = 0;
Expand Down Expand Up @@ -840,7 +840,7 @@ static int32_t FindToken(
**********************************/
static int32_t ReadConfigFile(
EbConfig_t *config,
char *configPath,
char *configPath,
uint32_t instanceIdx)
{
int32_t return_error = 0;
Expand Down Expand Up @@ -1217,8 +1217,8 @@ EB_ERRORTYPE ReadCommandLine(
{

EB_ERRORTYPE return_error = EB_ErrorBadParameter;
char config_string[COMMAND_LINE_MAX_SIZE]; // for one input options
char *config_strings[MAX_CHANNEL_NUMBER]; // for multiple input options
char config_string[COMMAND_LINE_MAX_SIZE]; // for one input options
char *config_strings[MAX_CHANNEL_NUMBER]; // for multiple input options
char *cmd_copy[MAX_NUM_TOKENS]; // keep track of extra tokens
uint32_t index = 0;
int32_t cmd_token_cnt = 0; // total number of tokens
Expand Down
Loading