2013-09-19 07:35:34 +00:00
|
|
|
#ifndef CONFIG_H_
|
|
|
|
#define CONFIG_H_
|
2015-02-23 11:18:48 +00:00
|
|
|
/*****************************************************************************
|
2014-01-24 10:37:15 +00:00
|
|
|
* This file is part of Kvazaar HEVC encoder.
|
2014-02-21 13:00:20 +00:00
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* Copyright (C) 2013-2015 Tampere University of Technology and others (see
|
2014-01-24 10:37:15 +00:00
|
|
|
* COPYING file).
|
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* 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.
|
2014-01-24 10:37:15 +00:00
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* 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.
|
2014-01-24 10:37:15 +00:00
|
|
|
*
|
2015-02-23 11:18:48 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with Kvazaar. If not, see <http://www.gnu.org/licenses/>.
|
2014-01-24 10:37:15 +00:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2013-09-18 14:29:30 +00:00
|
|
|
* \file
|
|
|
|
* \brief Handles parsing and storing of configuration of the encoder.
|
2012-05-30 12:10:23 +00:00
|
|
|
*/
|
|
|
|
|
2013-09-18 09:16:03 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
|
|
|
|
2015-03-03 10:21:45 +00:00
|
|
|
typedef struct {
|
|
|
|
double qp_factor;
|
|
|
|
int8_t qp_offset; /*!< \brief QP offset */
|
|
|
|
int8_t poc_offset; /*!< \brief POC offset */
|
|
|
|
int8_t layer; /*!< \brief Current layer */
|
|
|
|
int8_t is_ref; /*!< \brief Flag if this picture is used as a reference */
|
|
|
|
} gop_config;
|
|
|
|
|
2012-05-30 12:10:23 +00:00
|
|
|
/*!
|
|
|
|
\brief Struct which contains all configuration data
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
2012-06-05 11:01:47 +00:00
|
|
|
char *input; /*!< \brief Pointer to input filename */
|
|
|
|
char *output; /*!< \brief Pointer to output filename */
|
|
|
|
char *debug; /*!< \brief Pointer to debug output */
|
2014-02-21 13:15:59 +00:00
|
|
|
int32_t qp; /*!< \brief Quantization parameter */
|
|
|
|
int32_t intra_period; /*!< \brief the period of intra frames in stream */
|
2015-02-18 11:41:03 +00:00
|
|
|
int32_t vps_period; /*!< \brief how often the vps is re-sent */
|
2013-04-18 11:04:15 +00:00
|
|
|
int32_t frames; /*!< \brief Number of frames to decode */
|
|
|
|
int32_t width; /*!< \brief frame width */
|
|
|
|
int32_t height; /*!< \brief frame height */
|
2014-02-21 13:15:59 +00:00
|
|
|
int32_t deblock_enable; /*!< \brief Flag to enable deblocking filter */
|
|
|
|
int32_t sao_enable; /*!< \brief Flag to enable sample adaptive offset filter */
|
2014-03-05 14:56:00 +00:00
|
|
|
int32_t rdoq_enable; /*!< \brief Flag to enable RD optimized quantization. */
|
2015-01-24 18:10:21 +00:00
|
|
|
bool signhide_enable;
|
2014-04-07 11:36:01 +00:00
|
|
|
int32_t rdo; /*!< \brief RD-calculation level (0..2) */
|
2014-06-17 12:32:05 +00:00
|
|
|
bool full_intra_search; /*!< \brief Don't skip modes in intra search.e */
|
2014-04-02 11:41:40 +00:00
|
|
|
int32_t trskip_enable; /*!< \brief Flag to enable transform skip (for 4x4 blocks). */
|
2014-05-30 14:19:41 +00:00
|
|
|
int32_t tr_depth_intra; /*!< \brief Maximum transform depth for intra. */
|
2014-11-20 12:59:04 +00:00
|
|
|
int32_t fme_level; /*!< \brief Fractional pixel motion estimation level (0: disabled, 1: enabled). */
|
2014-02-21 13:15:59 +00:00
|
|
|
int32_t deblock_beta; /*!< \brief (deblocking) beta offset (div 2), range -6...6 */
|
|
|
|
int32_t deblock_tc; /*!< \brief (deblocking) tc offset (div 2), range -6...6 */
|
2014-02-06 19:45:37 +00:00
|
|
|
struct
|
|
|
|
{
|
2014-02-21 13:15:59 +00:00
|
|
|
int32_t sar_width; /*!< \brief the horizontal size of the sample aspect ratio (in arbitrary units) */
|
|
|
|
int32_t sar_height; /*!< \brief the vertical size of the sample aspect ratio (in the same arbitrary units as sar_width). */
|
2014-02-06 19:45:37 +00:00
|
|
|
int8_t overscan; /*!< \brief Crop overscan setting */
|
|
|
|
int8_t videoformat; /*!< \brief Video format */
|
|
|
|
int8_t fullrange; /*!< \brief Flag to indicate full-range */
|
|
|
|
int8_t colorprim; /*!< \brief Color primaries */
|
|
|
|
int8_t transfer; /*!< \brief Transfer characteristics */
|
|
|
|
int8_t colormatrix; /*!< \brief Color matrix coefficients */
|
2014-02-21 13:15:59 +00:00
|
|
|
int32_t chroma_loc; /*!< \brief Chroma sample location */
|
2014-02-06 19:45:37 +00:00
|
|
|
} vui;
|
2014-02-21 13:15:59 +00:00
|
|
|
int32_t aud_enable; /*!< \brief Flag to use access unit delimiters */
|
|
|
|
int32_t ref_frames; /*!< \brief number of reference frames to use */
|
config: Add --cqmfile to use custom quantization matrices from a file.
The coefficients in a matrix are stored in up-right diagonal order.
The following indicates the default matrices specified in the spec.
INTRA4X4_LUMA
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16
INTRA4X4_CHROMAU
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16
INTRA4X4_CHROMAV
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16
INTER4X4_LUMA
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16
INTER4X4_CHROMAU
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16
INTER4X4_CHROMAV
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16,
16, 16, 16, 16
INTRA8X8_LUMA
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115
INTRA8X8_CHROMAU
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115
INTRA8X8_CHROMAV
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115
INTER8X8_LUMA
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91
INTER8X8_CHROMAU
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91
INTER8X8_CHROMAV
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91
INTRA16X16_LUMA
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115
INTRA16X16_CHROMAU
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115
INTRA16X16_CHROMAV
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115
INTER16X16_LUMA
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91
INTER16X16_CHROMAU
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91
INTER16X16_CHROMAV
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91
INTRA32X32_LUMA
16, 16, 16, 16, 17, 18, 21, 24,
16, 16, 16, 16, 17, 19, 22, 25,
16, 16, 17, 18, 20, 22, 25, 29,
16, 16, 18, 21, 24, 27, 31, 36,
17, 17, 20, 24, 30, 35, 41, 47,
18, 19, 22, 27, 35, 44, 54, 65,
21, 22, 25, 31, 41, 54, 70, 88,
24, 25, 29, 36, 47, 65, 88, 115
INTER32X32_LUMA
16, 16, 16, 16, 17, 18, 20, 24,
16, 16, 16, 17, 18, 20, 24, 25,
16, 16, 17, 18, 20, 24, 25, 28,
16, 17, 18, 20, 24, 25, 28, 33,
17, 18, 20, 24, 25, 28, 33, 41,
18, 20, 24, 25, 28, 33, 41, 54,
20, 24, 25, 28, 33, 41, 54, 71,
24, 25, 28, 33, 41, 54, 71, 91
INTRA16X16_LUMA_DC
16
INTRA16X16_CHROMAU_DC
16
INTRA16X16_CHROMAV_DC
16
INTER16X16_LUMA_DC
16
INTER16X16_CHROMAU_DC
16
INTER16X16_CHROMAV_DC
16
INTRA32X32_LUMA_DC
16
INTER32X32_LUMA_DC
16
2014-02-11 10:55:21 +00:00
|
|
|
char * cqmfile; /*!< \brief Pointer to custom quantization matrices filename */
|
2014-03-10 12:58:57 +00:00
|
|
|
int32_t seek; /*!< \brief Number of frames to skip in the beginning of input. */
|
2014-05-01 11:58:13 +00:00
|
|
|
|
2014-04-02 08:38:03 +00:00
|
|
|
int32_t tiles_width_count; /*!< \brief number of tiles separation in x direction */
|
|
|
|
int32_t tiles_height_count; /*!< \brief number of tiles separation in y direction */
|
|
|
|
int32_t* tiles_width_split; /*!< \brief tiles split x coordinates (dimension: tiles_width_count) */
|
|
|
|
int32_t* tiles_height_split; /*!< \brief tiles split y coordinates (dimension: tiles_height_count) */
|
2014-05-05 13:17:22 +00:00
|
|
|
|
|
|
|
int wpp;
|
2014-06-16 06:26:24 +00:00
|
|
|
int owf;
|
2014-05-05 13:17:22 +00:00
|
|
|
|
|
|
|
int32_t slice_count;
|
|
|
|
int32_t* slice_addresses_in_ts;
|
2014-05-13 09:52:10 +00:00
|
|
|
|
|
|
|
int32_t threads;
|
2014-10-14 09:01:56 +00:00
|
|
|
int32_t cpuid;
|
2015-01-09 10:04:23 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
int32_t min;
|
|
|
|
int32_t max;
|
|
|
|
} pu_depth_inter, pu_depth_intra;
|
2015-03-03 10:21:45 +00:00
|
|
|
|
|
|
|
int8_t gop_len; /*!< \brief length of GOP for the video sequence */
|
|
|
|
gop_config gop[MAX_GOP]; /*!< \brief Array of GOP settings */
|
2015-03-10 07:37:25 +00:00
|
|
|
|
2015-03-04 11:30:26 +00:00
|
|
|
} config_t;
|
2012-05-30 12:10:23 +00:00
|
|
|
|
|
|
|
/* Function definitions */
|
2015-03-04 11:30:26 +00:00
|
|
|
config_t *config_alloc(void);
|
|
|
|
int config_init(config_t *cfg);
|
|
|
|
int config_destroy(config_t *cfg);
|
|
|
|
int config_read(config_t *cfg,int argc, char *argv[]);
|
|
|
|
int config_validate(config_t *cfg);
|
|
|
|
int config_set_owf_auto(config_t *cfg);
|
2012-05-30 12:10:23 +00:00
|
|
|
|
2014-02-03 14:32:54 +00:00
|
|
|
#endif
|