Add a script for updating README

Adds script tools/update_readme.sh for regenerating the "Using Kvazaar"
section of README.md from the output of "kvazaar --help".
This commit is contained in:
Arttu Ylä-Outinen 2016-02-05 16:16:18 +02:00
parent aac5373095
commit 40c7198f7d
5 changed files with 182 additions and 140 deletions

View file

@ -13,6 +13,8 @@ http://ultravideo.cs.tut.fi/#encoder for more information.
##Using Kvazaar ##Using Kvazaar
[comment]: # (BEGIN KVAZAAR HELP MESSAGE)
```
Usage: Usage:
kvazaar -i <input> --input-res <width>x<height> -o <output> kvazaar -i <input> --input-res <width>x<height> -o <output>
@ -70,10 +72,10 @@ http://ultravideo.cs.tut.fi/#encoder for more information.
--pu-depth-intra <int>-<int> : Range for sizes of intra prediction units to try. --pu-depth-intra <int>-<int> : Range for sizes of intra prediction units to try.
0: 64x64, 1: 32x32, 2: 16x16, 3: 8x8, 4: 4x4 0: 64x64, 1: 32x32, 2: 16x16, 3: 8x8, 4: 4x4
--no-info : Don't add information about the encoder to settings. --no-info : Don't add information about the encoder to settings.
--gop <string> : Definition for GOP [0] --gop <string> : Definition of GOP structure [0]
- 0 disabled "0": disabled
- 8 B-frame pyramid of length 8 "8": B-frame pyramid of length 8
- lp-gop syntax, defined below (example: g8d4r3t2) "lp-<string>": lp-gop definition (e.g. lp-g8d4r3t2)
--bipred : Enable bi-prediction search --bipred : Enable bi-prediction search
--bitrate <integer> : Target bitrate. [0] --bitrate <integer> : Target bitrate. [0]
0: disable rate-control 0: disable rate-control
@ -135,7 +137,8 @@ http://ultravideo.cs.tut.fi/#encoder for more information.
Use --input-res: Use --input-res:
-w, --width : Width of input in pixels -w, --width : Width of input in pixels
-h, --height : Height of input in pixels -h, --height : Height of input in pixels
```
[comment]: # (END KVAZAAR HELP MESSAGE)
###For example: ###For example:

View file

@ -19,7 +19,7 @@ EOF
kvazaar --help 2>&1 | tail -n+5 | head -n-4 | \ kvazaar --help 2>&1 | tail -n+5 | head -n-4 | \
sed 's| : |\n|g; sed 's| : |\n|g;
s|>: $|>|g; s| :$||g;
s|^ --|.TP\n\\fB--|g; s|^ --|.TP\n\\fB--|g;
s|^ --|.TP\n\\fB--|g; s|^ --|.TP\n\\fB--|g;
s|^ -|.TP\n\\fB-|g; s|^ -|.TP\n\\fB-|g;

View file

@ -22,7 +22,7 @@ Input resolution (width x height) or
auto auto
try to detect from file name [auto] try to detect from file name [auto]
.TP .TP
\fB\-\-input\-fps <number> \fB\-\-input\-fps <num>/<denom>
Framerate of the input video [25.0] Framerate of the input video [25.0]
.TP .TP
\fB\-q\fR, \fB\-\-qp <integer> \fB\-q\fR, \fB\-\-qp <integer>
@ -78,12 +78,6 @@ Enable Rate\-Distortion Optimized motion vector costs
\fB\-\-full\-intra\-search \fB\-\-full\-intra\-search
Try all intra modes. Try all intra modes.
.TP .TP
\fB\-\-me <string>
Set integer motion estimation algorithm ["hexbs"]
"hexbs": Hexagon Based Search (faster)
"tz": Test Zone Search (better quality)
"full": Full Search (super slow)
.TP
\fB\-\-no\-transform\-skip \fB\-\-no\-transform\-skip
Disable transform skip Disable transform skip
.TP .TP
@ -99,6 +93,12 @@ Output encoders reconstruction.
\fB\-\-cpuid <integer> \fB\-\-cpuid <integer>
Disable runtime cpu optimizations with value 0. Disable runtime cpu optimizations with value 0.
.TP .TP
\fB\-\-me <string>
Set integer motion estimation algorithm ["hexbs"]
"hexbs": Hexagon Based Search (faster)
"tz": Test Zone Search (better quality)
"full": Full Search (super slow)
.TP
\fB\-\-subme <integer> \fB\-\-subme <integer>
Set fractional pixel motion estimation level [1]. Set fractional pixel motion estimation level [1].
0: only integer motion estimation 0: only integer motion estimation
@ -121,8 +121,11 @@ Range for sizes of intra prediction units to try.
\fB\-\-no\-info \fB\-\-no\-info
Don't add information about the encoder to settings. Don't add information about the encoder to settings.
.TP .TP
\fB\-\-gop <int> \fB\-\-gop <string>
Length of Group of Pictures, must be 8 or 0 [0] Definition of GOP structure [0]
"0": disabled
"8": B\-frame pyramid of length 8
"lp\-<string>": lp\-gop definition (e.g. lp\-g8d4r3t2)
.TP .TP
\fB\-\-bipred \fB\-\-bipred
Enable bi\-prediction search Enable bi\-prediction search
@ -133,7 +136,7 @@ Target bitrate. [0]
N: target N bits per second N: target N bits per second
.TP .TP
\fB\-\-preset <string> \fB\-\-preset <string>
Use preset Use preset. This will override previous options.
ultrafast, superfast,veryfast, faster, ultrafast, superfast,veryfast, faster,
fast, medium, slow, slower, veryslow, placebo fast, medium, slow, slower, veryslow, placebo
.TP .TP
@ -186,14 +189,12 @@ Disable threads if set to 0.
.SS "Tiles:" .SS "Tiles:"
.TP .TP
\fB\-\-tiles\-width\-split <string>|u<int> \fB\-\-tiles\-width\-split <string>|u<int>
Specifies a comma separated list of pixel Specifies a comma separated list of pixel
positions of tiles columns separation coordinates. positions of tiles columns separation coordinates.
Can also be u followed by and a single int n, Can also be u followed by and a single int n,
in which case it produces columns of uniform width. in which case it produces columns of uniform width.
.TP .TP
\fB\-\-tiles\-height\-split <string>|u<int> \fB\-\-tiles\-height\-split <string>|u<int>
Specifies a comma separated list of pixel Specifies a comma separated list of pixel
positions of tiles rows separation coordinates. positions of tiles rows separation coordinates.
Can also be u followed by and a single int n, Can also be u followed by and a single int n,

View file

@ -300,7 +300,7 @@ void print_help(void)
" --seek <integer> : First frame to code [0]\n" " --seek <integer> : First frame to code [0]\n"
" --input-res <int>x<int> : Input resolution (width x height) or\n" " --input-res <int>x<int> : Input resolution (width x height) or\n"
" auto : try to detect from file name [auto]\n" " auto : try to detect from file name [auto]\n"
" --input-fps <number> : Framerate of the input video [25.0]\n" " --input-fps <num>/<denom> : Framerate of the input video [25.0]\n"
" -q, --qp <integer> : Quantization Parameter [32]\n" " -q, --qp <integer> : Quantization Parameter [32]\n"
" -p, --period <integer> : Period of intra pictures [0]\n" " -p, --period <integer> : Period of intra pictures [0]\n"
" 0: only first picture is intra\n" " 0: only first picture is intra\n"
@ -326,15 +326,15 @@ void print_help(void)
" 2: full RDO\n" " 2: full RDO\n"
" --mv-rdo : Enable Rate-Distortion Optimized motion vector costs\n" " --mv-rdo : Enable Rate-Distortion Optimized motion vector costs\n"
" --full-intra-search : Try all intra modes.\n" " --full-intra-search : Try all intra modes.\n"
" --me <string> : Set integer motion estimation algorithm [\"hexbs\"]\n"
" \"hexbs\": Hexagon Based Search (faster)\n"
" \"tz\": Test Zone Search (better quality)\n"
" \"full\": Full Search (super slow)\n"
" --no-transform-skip : Disable transform skip\n" " --no-transform-skip : Disable transform skip\n"
" --aud : Use access unit delimiters\n" " --aud : Use access unit delimiters\n"
" --cqmfile <string> : Custom Quantization Matrices from a file\n" " --cqmfile <string> : Custom Quantization Matrices from a file\n"
" --debug <string> : Output encoders reconstruction.\n" " --debug <string> : Output encoders reconstruction.\n"
" --cpuid <integer> : Disable runtime cpu optimizations with value 0.\n" " --cpuid <integer> : Disable runtime cpu optimizations with value 0.\n"
" --me <string> : Set integer motion estimation algorithm [\"hexbs\"]\n"
" \"hexbs\": Hexagon Based Search (faster)\n"
" \"tz\": Test Zone Search (better quality)\n"
" \"full\": Full Search (super slow)\n"
" --subme <integer> : Set fractional pixel motion estimation level [1].\n" " --subme <integer> : Set fractional pixel motion estimation level [1].\n"
" 0: only integer motion estimation\n" " 0: only integer motion estimation\n"
" 1: fractional pixel motion estimation enabled\n" " 1: fractional pixel motion estimation enabled\n"
@ -347,12 +347,15 @@ void print_help(void)
" --pu-depth-intra <int>-<int> : Range for sizes of intra prediction units to try.\n" " --pu-depth-intra <int>-<int> : Range for sizes of intra prediction units to try.\n"
" 0: 64x64, 1: 32x32, 2: 16x16, 3: 8x8, 4: 4x4\n" " 0: 64x64, 1: 32x32, 2: 16x16, 3: 8x8, 4: 4x4\n"
" --no-info : Don't add information about the encoder to settings.\n" " --no-info : Don't add information about the encoder to settings.\n"
" --gop <int> : Length of Group of Pictures, must be 8 or 0 [0]\n" " --gop <string> : Definition of GOP structure [0]\n"
" \"0\": disabled\n"
" \"8\": B-frame pyramid of length 8\n"
" \"lp-<string>\": lp-gop definition (e.g. lp-g8d4r3t2)\n"
" --bipred : Enable bi-prediction search\n" " --bipred : Enable bi-prediction search\n"
" --bitrate <integer> : Target bitrate. [0]\n" " --bitrate <integer> : Target bitrate. [0]\n"
" 0: disable rate-control\n" " 0: disable rate-control\n"
" N: target N bits per second\n" " N: target N bits per second\n"
" --preset <string> : Use preset\n" " --preset <string> : Use preset. This will override previous options.\n"
" ultrafast, superfast,veryfast, faster,\n" " ultrafast, superfast,veryfast, faster,\n"
" fast, medium, slow, slower, veryslow, placebo\n" " fast, medium, slow, slower, veryslow, placebo\n"
" --no-psnr : Don't calculate PSNR for frames\n" " --no-psnr : Don't calculate PSNR for frames\n"

35
tools/update_readme.sh Executable file
View file

@ -0,0 +1,35 @@
#!/bin/bash
# This file is part of Kvazaar HEVC encoder.
#
# Copyright (C) 2013-2016 Tampere University of Technology and others (see
# COPYING file).
#
# Kvazaar is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 2.1 as
# published by the Free Software Foundation.
#
# Kvazaar is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Kvazaar. If not, see <http://www.gnu.org/licenses/>.
if [[ $# != 1 ]]; then
printf "Usage: $0 README.md\n"
exit 1
fi
tmpfile="$(mktemp)"
{
sed '/BEGIN KVAZAAR HELP MESSAGE/q' -- "$1";
printf '```\n';
kvazaar --help;
printf '```\n';
sed -n '/END KVAZAAR HELP MESSAGE/{:a;p;n;ba}' -- "$1";
} >> "$tmpfile"
mv -- "$tmpfile" "$1"