Add cli module and move interface stuff to there.

This commit is contained in:
Ari Koivula 2015-05-13 12:45:11 +03:00 committed by Arttu Ylä-Outinen
parent 1587a50be4
commit ea50d03e52
6 changed files with 194 additions and 111 deletions

View file

@ -127,6 +127,7 @@
<ItemGroup>
<ClCompile Include="..\..\src\bitstream.c" />
<ClCompile Include="..\..\src\cabac.c" />
<ClCompile Include="..\..\src\cli.c" />
<ClCompile Include="..\..\src\config.c" />
<ClCompile Include="..\..\src\context.c" />
<ClCompile Include="..\..\src\cu.c" />
@ -149,6 +150,7 @@
<ClCompile Include="..\..\src\scalinglist.c" />
<ClCompile Include="..\..\src\search.c" />
<ClInclude Include="..\..\src\checkpoint.h" />
<ClInclude Include="..\..\src\cli.h" />
<ClInclude Include="..\..\src\cu.h" />
<ClInclude Include="..\..\src\image.h" />
<ClInclude Include="..\..\src\imagelist.h" />

View file

@ -186,6 +186,9 @@
<ClCompile Include="..\..\src\strategies\generic\ipol-generic.c">
<Filter>Source Files\strategies\generic</Filter>
</ClCompile>
<ClCompile Include="..\..\src\cli.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\rate_control.c">
<Filter>Source Files</Filter>
</ClCompile>
@ -329,6 +332,9 @@
<ClInclude Include="..\..\src\strategies\avx2\ipol-avx2.h">
<Filter>Header Files\strategies\avx2</Filter>
</ClInclude>
<ClInclude Include="..\..\src\cli.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\rate_control.h">
<Filter>Header Files</Filter>
</ClInclude>

View file

@ -81,6 +81,7 @@ OBJS = \
bitstream.o \
cabac.o \
checkpoint.o \
cli.o \
config.o \
context.o \
cu.o \

148
src/cli.c Normal file
View file

@ -0,0 +1,148 @@
/*****************************************************************************
* This file is part of Kvazaar HEVC encoder.
*
* Copyright (C) 2013-2015 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 as published by the
* Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* 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/>.
****************************************************************************/
/*
* \file
*
*/
#include "config.h"
#include <stdio.h>
void print_version(void)
{
fprintf(stderr,
"/***********************************************/\n"
" * Kvazaar HEVC Encoder v. " VERSION_STRING " *\n"
" * Tampere University of Technology 2014 *\n"
"/***********************************************/\n\n");
}
void print_help(void)
{
fprintf(stderr,
"Usage:\n"
"kvazaar -i <input> --input-res <width>x<height> -o <output>\n"
"\n"
"Optional parameters:\n"
" -n, --frames <integer> : Number of frames to code [all]\n"
" --seek <integer> : First frame to code [0]\n"
" --input-res <int>x<int> : Input resolution (width x height)\n"
" --input-fps <number> : Framerate of the input video [25.0]\n"
" -q, --qp <integer> : Quantization Parameter [32]\n"
" -p, --period <integer> : Period of intra pictures [0]\n"
" 0: only first picture is intra\n"
" 1: all pictures are intra\n"
" 2-N: every Nth picture is intra\n"
" --vps-period <integer> : Specify how often the video parameter set is\n"
" re-sent. [0]\n"
" 0: only send VPS with the first frame\n"
" 1: send VPS with every intra frame\n"
" N: send VPS with every Nth intra frame\n"
" -r, --ref <integer> : Reference frames, range 1..15 [3]\n"
" --no-deblock : Disable deblocking filter\n"
" --deblock <beta:tc> : Deblocking filter parameters\n"
" beta and tc range is -6..6 [0:0]\n"
" --no-sao : Disable sample adaptive offset\n"
" --no-rdoq : Disable RDO quantization\n"
" --no-signhide : Disable sign hiding in quantization\n"
" --rd <integer> : Rate-Distortion Optimization level [1]\n"
" 0: no RDO\n"
" 1: estimated RDO\n"
" 2: full RDO\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"
" --no-transform-skip : Disable transform skip\n"
" --aud : Use access unit delimiters\n"
" --cqmfile <string> : Custom Quantization Matrices from a file\n"
" --debug <string> : Output encoders reconstruction.\n"
" --cpuid <integer> : Disable runtime cpu optimizations with value 0.\n"
" --subme <integer> : Set fractional pixel motion estimation level [1].\n"
" 0: only integer motion estimation\n"
" 1: fractional pixel motion estimation enabled\n"
" --pu-depth-inter <int>-<int> : Range for sizes of inter prediction units to try.\n"
" 0: 64x64, 1: 32x32, 2: 16x16, 3: 8x8\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"
" --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"
" --bipred : Enable bi-prediction search\n"
" --bitrate <integer> : Target bitrate. [0]\n"
" 0: disable rate-control\n"
" N: target N bits per second\n"
"\n"
" Video Usability Information:\n"
" --sar <width:height> : Specify Sample Aspect Ratio\n"
" --overscan <string> : Specify crop overscan setting [\"undef\"]\n"
" - undef, show, crop\n"
" --videoformat <string> : Specify video format [\"undef\"]\n"
" - component, pal, ntsc, secam, mac, undef\n"
" --range <string> : Specify color range [\"tv\"]\n"
" - tv, pc\n"
" --colorprim <string> : Specify color primaries [\"undef\"]\n"
" - undef, bt709, bt470m, bt470bg,\n"
" smpte170m, smpte240m, film, bt2020\n"
" --transfer <string> : Specify transfer characteristics [\"undef\"]\n"
" - undef, bt709, bt470m, bt470bg,\n"
" smpte170m, smpte240m, linear, log100,\n"
" log316, iec61966-2-4, bt1361e,\n"
" iec61966-2-1, bt2020-10, bt2020-12\n"
" --colormatrix <string> : Specify color matrix setting [\"undef\"]\n"
" - undef, bt709, fcc, bt470bg, smpte170m,\n"
" smpte240m, GBR, YCgCo, bt2020nc, bt2020c\n"
" --chromaloc <integer> : Specify chroma sample location (0 to 5) [0]\n"
"\n"
" Parallel processing:\n"
" --threads <integer> : Maximum number of threads to use.\n"
" Disable threads if set to 0.\n"
"\n"
" Tiles:\n"
" --tiles-width-split <string>|u<int> : \n"
" Specifies a comma separated list of pixel\n"
" positions of tiles columns separation coordinates.\n"
" Can also be u followed by and a single int n,\n"
" in which case it produces columns of uniform width.\n"
" --tiles-height-split <string>|u<int> : \n"
" Specifies a comma separated list of pixel\n"
" positions of tiles rows separation coordinates.\n"
" Can also be u followed by and a single int n,\n"
" in which case it produces rows of uniform height.\n"
"\n"
" Wpp:\n"
" --wpp : Enable wavefront parallel processing\n"
" --owf <integer>|auto : Number of parallel frames to process. 0 to disable.\n"
"\n"
" Slices:\n"
" --slice-addresses <string>|u<int>: \n"
" Specifies a comma separated list of LCU\n"
" positions in tile scan order of tile separations.\n"
" Can also be u followed by and a single int n,\n"
" in which case it produces uniform slice length.\n"
"\n"
" Deprecated parameters: (might be removed at some point)\n"
" Use --input-res:\n"
" -w, --width : Width of input in pixels\n"
" -h, --height : Height of input in pixels\n");
}

34
src/cli.h Normal file
View file

@ -0,0 +1,34 @@
#ifndef CLI_H_
#define CLI_H_
/*****************************************************************************
* This file is part of Kvazaar HEVC encoder.
*
* Copyright (C) 2013-2015 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 as published by the
* Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* 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/>.
****************************************************************************/
/*
* \file
* \brief Contains code related to command line interface.
*/
#include "global.h"
void print_version(void);
void print_help(void);
#endif

View file

@ -46,6 +46,7 @@
#include "transform.h"
#include "scalinglist.h"
#include "strategyselector.h"
#include "cli.h"
/**
* \brief Program main function.
@ -85,117 +86,8 @@ int main(int argc, char *argv[])
// If problem with configuration, print banner and shutdown
if (!cfg || !config_init(cfg) || !config_read(cfg,argc,argv)) {
fprintf(stderr,
"/***********************************************/\n"
" * Kvazaar HEVC Encoder v. " VERSION_STRING " *\n"
" * Tampere University of Technology 2014 *\n"
"/***********************************************/\n\n");
fprintf(stderr,
"Usage:\n"
"kvazaar -i <input> --input-res <width>x<height> -o <output>\n"
"\n"
"Optional parameters:\n"
" -n, --frames <integer> : Number of frames to code [all]\n"
" --seek <integer> : First frame to code [0]\n"
" --input-res <int>x<int> : Input resolution (width x height)\n"
" --input-fps <number> : Framerate of the input video [25.0]\n"
" -q, --qp <integer> : Quantization Parameter [32]\n"
" -p, --period <integer> : Period of intra pictures [0]\n"
" 0: only first picture is intra\n"
" 1: all pictures are intra\n"
" 2-N: every Nth picture is intra\n"
" --vps-period <integer> : Specify how often the video parameter set is\n"
" re-sent. [0]\n"
" 0: only send VPS with the first frame\n"
" 1: send VPS with every intra frame\n"
" N: send VPS with every Nth intra frame\n"
" -r, --ref <integer> : Reference frames, range 1..15 [3]\n"
" --no-deblock : Disable deblocking filter\n"
" --deblock <beta:tc> : Deblocking filter parameters\n"
" beta and tc range is -6..6 [0:0]\n"
" --no-sao : Disable sample adaptive offset\n"
" --no-rdoq : Disable RDO quantization\n"
" --no-signhide : Disable sign hiding in quantization\n"
" --rd <integer> : Rate-Distortion Optimization level [1]\n"
" 0: no RDO\n"
" 1: estimated RDO\n"
" 2: full RDO\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"
" --no-transform-skip : Disable transform skip\n"
" --aud : Use access unit delimiters\n"
" --cqmfile <string> : Custom Quantization Matrices from a file\n"
" --debug <string> : Output encoders reconstruction.\n"
" --cpuid <integer> : Disable runtime cpu optimizations with value 0.\n"
" --subme <integer> : Set fractional pixel motion estimation level [1].\n"
" 0: only integer motion estimation\n"
" 1: fractional pixel motion estimation enabled\n"
" --pu-depth-inter <int>-<int> : Range for sizes of inter prediction units to try.\n"
" 0: 64x64, 1: 32x32, 2: 16x16, 3: 8x8\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"
" --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"
" --bipred : Enable bi-prediction search\n"
" --bitrate <integer> : Target bitrate. [0]\n"
" 0: disable rate-control\n"
" N: target N bits per second\n"
"\n"
" Video Usability Information:\n"
" --sar <width:height> : Specify Sample Aspect Ratio\n"
" --overscan <string> : Specify crop overscan setting [\"undef\"]\n"
" - undef, show, crop\n"
" --videoformat <string> : Specify video format [\"undef\"]\n"
" - component, pal, ntsc, secam, mac, undef\n"
" --range <string> : Specify color range [\"tv\"]\n"
" - tv, pc\n"
" --colorprim <string> : Specify color primaries [\"undef\"]\n"
" - undef, bt709, bt470m, bt470bg,\n"
" smpte170m, smpte240m, film, bt2020\n"
" --transfer <string> : Specify transfer characteristics [\"undef\"]\n"
" - undef, bt709, bt470m, bt470bg,\n"
" smpte170m, smpte240m, linear, log100,\n"
" log316, iec61966-2-4, bt1361e,\n"
" iec61966-2-1, bt2020-10, bt2020-12\n"
" --colormatrix <string> : Specify color matrix setting [\"undef\"]\n"
" - undef, bt709, fcc, bt470bg, smpte170m,\n"
" smpte240m, GBR, YCgCo, bt2020nc, bt2020c\n"
" --chromaloc <integer> : Specify chroma sample location (0 to 5) [0]\n"
"\n"
" Parallel processing:\n"
" --threads <integer> : Maximum number of threads to use.\n"
" Disable threads if set to 0.\n"
"\n"
" Tiles:\n"
" --tiles-width-split <string>|u<int> : \n"
" Specifies a comma separated list of pixel\n"
" positions of tiles columns separation coordinates.\n"
" Can also be u followed by and a single int n,\n"
" in which case it produces columns of uniform width.\n"
" --tiles-height-split <string>|u<int> : \n"
" Specifies a comma separated list of pixel\n"
" positions of tiles rows separation coordinates.\n"
" Can also be u followed by and a single int n,\n"
" in which case it produces rows of uniform height.\n"
"\n"
" Wpp:\n"
" --wpp : Enable wavefront parallel processing\n"
" --owf <integer>|auto : Number of parallel frames to process. 0 to disable.\n"
"\n"
" Slices:\n"
" --slice-addresses <string>|u<int>: \n"
" Specifies a comma separated list of LCU\n"
" positions in tile scan order of tile separations.\n"
" Can also be u followed by and a single int n,\n"
" in which case it produces uniform slice length.\n"
"\n"
" Deprecated parameters: (might be removed at some point)\n"
" Use --input-res:\n"
" -w, --width : Width of input in pixels\n"
" -h, --height : Height of input in pixels\n");
print_version();
print_help();
goto exit_failure;
}