mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-23 18:14:06 +00:00
Rename config_t to kvz_config.
This commit is contained in:
parent
17d720363a
commit
cecea44d37
14
src/config.c
14
src/config.c
|
@ -34,9 +34,9 @@
|
|||
* \brief Allocate memory for config object
|
||||
* \return pointer to allocated memory
|
||||
*/
|
||||
config_t *config_alloc(void)
|
||||
kvz_config *config_alloc(void)
|
||||
{
|
||||
config_t *cfg = (config_t *)malloc(sizeof(config_t));
|
||||
kvz_config *cfg = (kvz_config *)malloc(sizeof(kvz_config));
|
||||
if (!cfg) {
|
||||
fprintf(stderr, "Failed to allocate a config object!\n");
|
||||
return cfg;
|
||||
|
@ -52,7 +52,7 @@ config_t *config_alloc(void)
|
|||
* \param cfg config object
|
||||
* \return 1 on success, 0 on failure
|
||||
*/
|
||||
int config_init(config_t *cfg)
|
||||
int config_init(kvz_config *cfg)
|
||||
{
|
||||
cfg->input = NULL;
|
||||
cfg->output = NULL;
|
||||
|
@ -123,7 +123,7 @@ int config_init(config_t *cfg)
|
|||
* \param cfg config object
|
||||
* \return 1 on success, 0 on failure
|
||||
*/
|
||||
int config_destroy(config_t *cfg)
|
||||
int config_destroy(kvz_config *cfg)
|
||||
{
|
||||
FREE_POINTER(cfg->input);
|
||||
FREE_POINTER(cfg->output);
|
||||
|
@ -302,7 +302,7 @@ static int parse_slice_specification(const char* const arg, int32_t * const nsli
|
|||
return 1;
|
||||
}
|
||||
|
||||
int config_parse(config_t *cfg, const char *name, const char *value)
|
||||
int config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||
{
|
||||
static const char * const me_names[] = { "hexbs", "tz", NULL };
|
||||
|
||||
|
@ -492,7 +492,7 @@ int config_parse(config_t *cfg, const char *name, const char *value)
|
|||
* \param argv argument list
|
||||
* \return 1 on success, 0 on failure
|
||||
*/
|
||||
int config_read(config_t *cfg,int argc, char *argv[])
|
||||
int config_read(kvz_config *cfg,int argc, char *argv[])
|
||||
{
|
||||
static char short_options[] = "i:o:d:w:h:n:q:p:r:";
|
||||
static struct option long_options[] =
|
||||
|
@ -602,7 +602,7 @@ int config_read(config_t *cfg,int argc, char *argv[])
|
|||
* \param cfg config to check
|
||||
* \return 1 if the config is ok, otherwise 1
|
||||
*/
|
||||
int config_validate(config_t const *const cfg)
|
||||
int config_validate(const kvz_config *const cfg)
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
|
|
14
src/config.h
14
src/config.h
|
@ -29,12 +29,12 @@
|
|||
#include "global.h"
|
||||
|
||||
/* Function definitions */
|
||||
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_parse(config_t *cfg, const char *name, const char *value);
|
||||
int config_validate(config_t const *cfg);
|
||||
int config_set_owf_auto(config_t *cfg);
|
||||
kvz_config *config_alloc(void);
|
||||
int config_init(kvz_config *cfg);
|
||||
int config_destroy(kvz_config *cfg);
|
||||
int config_read(kvz_config *cfg,int argc, char *argv[]);
|
||||
int config_parse(kvz_config *cfg, const char *name, const char *value);
|
||||
int config_validate(const kvz_config *cfg);
|
||||
int config_set_owf_auto(kvz_config *cfg);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -85,7 +85,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
int retval = EXIT_SUCCESS;
|
||||
|
||||
config_t *cfg = NULL; //!< Global configuration
|
||||
kvz_config *cfg = NULL; //!< Global configuration
|
||||
kvz_encoder* enc = NULL;
|
||||
FILE *input = NULL; //!< input file (YUV)
|
||||
FILE *output = NULL; //!< output file (HEVC NAL stream)
|
||||
|
|
|
@ -51,7 +51,7 @@ static int size_of_wpp_ends(int threads)
|
|||
return 4 * threads * threads - 2 * threads;
|
||||
}
|
||||
|
||||
static int select_owf_auto(config_t const* const cfg)
|
||||
static int select_owf_auto(const kvz_config *const cfg)
|
||||
{
|
||||
if (cfg->wpp) {
|
||||
// If wpp is on, select owf such that less than 15% of the
|
||||
|
@ -103,7 +103,7 @@ static int select_owf_auto(config_t const* const cfg)
|
|||
* \param cfg encoder configuration
|
||||
* \return initialized encoder control or NULL on failure
|
||||
*/
|
||||
encoder_control_t* encoder_control_init(const config_t *const cfg) {
|
||||
encoder_control_t* encoder_control_init(const kvz_config *const cfg) {
|
||||
encoder_control_t *encoder = NULL;
|
||||
|
||||
if (!cfg) {
|
||||
|
@ -526,7 +526,7 @@ void encoder_control_input_init(encoder_control_t * const encoder,
|
|||
static int encoder_control_init_gop_layer_weights(encoder_control_t * const encoder)
|
||||
{
|
||||
|
||||
gop_config_t const * const gop = encoder->cfg->gop;
|
||||
kvz_gop_config const * const gop = encoder->cfg->gop;
|
||||
const int8_t gop_len = encoder->cfg->gop_len;
|
||||
|
||||
int num_layers = 0;
|
||||
|
|
|
@ -42,7 +42,7 @@ enum { FORMAT_400 = 0, FORMAT_420, FORMAT_422, FORMAT_444 };
|
|||
typedef struct encoder_control_t
|
||||
{
|
||||
/* Configuration */
|
||||
const config_t *cfg;
|
||||
const kvz_config *cfg;
|
||||
|
||||
/* Input */
|
||||
struct {
|
||||
|
@ -151,7 +151,7 @@ typedef struct encoder_control_t
|
|||
|
||||
} encoder_control_t;
|
||||
|
||||
encoder_control_t* encoder_control_init(const config_t *cfg);
|
||||
encoder_control_t* encoder_control_init(const kvz_config *cfg);
|
||||
void encoder_control_free(encoder_control_t *encoder);
|
||||
|
||||
void encoder_control_input_init(encoder_control_t *encoder, int32_t width, int32_t height);
|
||||
|
|
|
@ -472,7 +472,7 @@ static void encoder_state_write_bitstream_prefix_sei_version(encoder_state_t * c
|
|||
int i, length;
|
||||
char buf[STR_BUF_LEN] = { 0 };
|
||||
char *s = buf + 16;
|
||||
const config_t * const cfg = state->encoder_control->cfg;
|
||||
const kvz_config * const cfg = state->encoder_control->cfg;
|
||||
|
||||
// random uuid_iso_iec_11578 generated with www.famkruithof.net/uuid/uuidgen
|
||||
static const uint8_t uuid[16] = {
|
||||
|
|
|
@ -774,7 +774,7 @@ static void encoder_state_new_frame(encoder_state_t * const state) {
|
|||
state->global->QP = lambda_to_QP(lambda);
|
||||
} else {
|
||||
if (encoder->cfg->gop_len > 0 && state->global->slicetype != SLICE_I) {
|
||||
gop_config_t const * const gop =
|
||||
kvz_gop_config const * const gop =
|
||||
encoder->cfg->gop + state->global->gop_offset;
|
||||
state->global->QP = encoder->cfg->qp + gop->qp_offset;
|
||||
state->global->QP_factor = gop->qp_factor;
|
||||
|
@ -872,7 +872,7 @@ void encode_one_frame(encoder_state_t * const state)
|
|||
int encoder_feed_frame(encoder_state_t *const state, kvz_picture *const img_in)
|
||||
{
|
||||
const encoder_control_t* const encoder = state->encoder_control;
|
||||
const config_t* const cfg = encoder->cfg;
|
||||
const kvz_config* const cfg = encoder->cfg;
|
||||
|
||||
// TODO: Get rid of static variables.
|
||||
static kvz_picture *gop_buffer[2 * KVZ_MAX_GOP_LENGTH] = { NULL };
|
||||
|
|
|
@ -47,7 +47,7 @@ static void kvazaar_close(kvz_encoder *encoder)
|
|||
}
|
||||
|
||||
|
||||
static kvz_encoder * kvazaar_open(config_t *cfg)
|
||||
static kvz_encoder * kvazaar_open(kvz_config *cfg)
|
||||
{
|
||||
kvz_encoder *encoder = NULL;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ typedef uint16_t pixel_t;
|
|||
/**
|
||||
* \brief GoP picture configuration.
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct kvz_gop_config {
|
||||
double qp_factor;
|
||||
int8_t qp_offset; /*!< \brief QP offset */
|
||||
int8_t poc_offset; /*!< \brief POC offset */
|
||||
|
@ -59,12 +59,12 @@ typedef struct {
|
|||
int8_t ref_pos[16]; /*!< \brief reference picture offset list */
|
||||
int8_t ref_neg_count;/*!< \brief Reference picture count */
|
||||
int8_t ref_neg[16]; /*!< \brief reference picture offset list */
|
||||
} gop_config_t;
|
||||
} kvz_gop_config;
|
||||
|
||||
/**
|
||||
* \brief Struct which contains all configuration data
|
||||
*/
|
||||
typedef struct config_t
|
||||
typedef struct kvz_config
|
||||
{
|
||||
char *input; /*!< \brief Pointer to input filename */
|
||||
char *output; /*!< \brief Pointer to output filename */
|
||||
|
@ -127,12 +127,11 @@ typedef struct config_t
|
|||
|
||||
int32_t add_encoder_info;
|
||||
int8_t gop_len; /*!< \brief length of GOP for the video sequence */
|
||||
gop_config_t gop[KVZ_MAX_GOP_LENGTH]; /*!< \brief Array of GOP settings */
|
||||
kvz_gop_config gop[KVZ_MAX_GOP_LENGTH]; /*!< \brief Array of GOP settings */
|
||||
|
||||
int32_t target_bitrate;
|
||||
} config_t;
|
||||
} kvz_config;
|
||||
|
||||
typedef struct config_t kvz_cfg;
|
||||
typedef struct encoder_state_t encoder_state_t;
|
||||
typedef struct encoder_control_t encoder_control_t;
|
||||
typedef struct bitstream_chunk_t kvz_payload;
|
||||
|
@ -174,12 +173,12 @@ typedef struct kvz_encoder {
|
|||
} kvz_encoder;
|
||||
|
||||
typedef struct kvz_api {
|
||||
kvz_cfg * (*config_alloc)(void);
|
||||
int (*config_destroy)(kvz_cfg *);
|
||||
int (*config_init)(kvz_cfg *);
|
||||
int (*config_parse)(kvz_cfg *, const char *name, const char *value);
|
||||
kvz_config * (*config_alloc)(void);
|
||||
int (*config_destroy)(kvz_config *);
|
||||
int (*config_init)(kvz_config *);
|
||||
int (*config_parse)(kvz_config *, const char *name, const char *value);
|
||||
|
||||
kvz_encoder * (*encoder_open)(kvz_cfg *);
|
||||
kvz_encoder * (*encoder_open)(kvz_config *);
|
||||
void (*encoder_close)(kvz_encoder *);
|
||||
|
||||
// \brief Encode one picture.
|
||||
|
|
Loading…
Reference in a new issue