Move GOP definition to a separate file

Moves definition of the 8-GOP from cfg.c to gop.h.
This commit is contained in:
Arttu Ylä-Outinen 2018-02-14 15:08:40 +02:00 committed by Ari Lemmetti
parent 6e1007a3e7
commit f37dcd5879
2 changed files with 120 additions and 32 deletions

View file

@ -19,6 +19,7 @@
****************************************************************************/ ****************************************************************************/
#include "cfg.h" #include "cfg.h"
#include "gop.h"
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
@ -938,39 +939,9 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
cfg->gop_lp_definition.t = gop.t; cfg->gop_lp_definition.t = gop.t;
} else if (atoi(value) == 8) { } else if (atoi(value) == 8) {
cfg->gop_lowdelay = 0; cfg->gop_lowdelay = 0;
// GOP cfg->gop_len = sizeof(kvz_gop_ra8) / sizeof(kvz_gop_ra8[0]);
cfg->gop_len = 8; memcpy(cfg->gop, kvz_gop_ra8, sizeof(kvz_gop_ra8));
cfg->gop[0].poc_offset = 8; cfg->gop[0].qp_offset = 1; cfg->gop[0].layer = 1; cfg->gop[0].qp_factor = 0.442; cfg->gop[0].is_ref = 1;
cfg->gop[0].ref_pos_count = 0;
cfg->gop[0].ref_neg_count = 3; cfg->gop[0].ref_neg[0] = 8; cfg->gop[0].ref_neg[1] = 12; cfg->gop[0].ref_neg[2] = 16;
cfg->gop[1].poc_offset = 4; cfg->gop[1].qp_offset = 2; cfg->gop[1].layer = 2; cfg->gop[1].qp_factor = 0.3536; cfg->gop[1].is_ref = 1;
cfg->gop[1].ref_neg_count = 2; cfg->gop[1].ref_neg[0] = 4; cfg->gop[1].ref_neg[1] = 8;
cfg->gop[1].ref_pos_count = 1; cfg->gop[1].ref_pos[0] = 4;
cfg->gop[2].poc_offset = 2; cfg->gop[2].qp_offset = 3; cfg->gop[2].layer = 3; cfg->gop[2].qp_factor = 0.3536; cfg->gop[2].is_ref = 1;
cfg->gop[2].ref_neg_count = 2; cfg->gop[2].ref_neg[0] = 2; cfg->gop[2].ref_neg[1] = 6;
cfg->gop[2].ref_pos_count = 2; cfg->gop[2].ref_pos[0] = 2; cfg->gop[2].ref_pos[1] = 6;
cfg->gop[3].poc_offset = 1; cfg->gop[3].qp_offset = 4; cfg->gop[3].layer = 4; cfg->gop[3].qp_factor = 0.68; cfg->gop[3].is_ref = 0;
cfg->gop[3].ref_neg_count = 1; cfg->gop[3].ref_neg[0] = 1;
cfg->gop[3].ref_pos_count = 3; cfg->gop[3].ref_pos[0] = 1; cfg->gop[3].ref_pos[1] = 3; cfg->gop[3].ref_pos[2] = 7;
cfg->gop[4].poc_offset = 3; cfg->gop[4].qp_offset = 4; cfg->gop[4].layer = 4; cfg->gop[4].qp_factor = 0.68; cfg->gop[4].is_ref = 0;
cfg->gop[4].ref_neg_count = 2; cfg->gop[4].ref_neg[0] = 1; cfg->gop[4].ref_neg[1] = 3;
cfg->gop[4].ref_pos_count = 2; cfg->gop[4].ref_pos[0] = 1; cfg->gop[4].ref_pos[1] = 5;
cfg->gop[5].poc_offset = 6; cfg->gop[5].qp_offset = 3; cfg->gop[5].layer = 3; cfg->gop[5].qp_factor = 0.3536; cfg->gop[5].is_ref = 1;
cfg->gop[5].ref_neg_count = 2; cfg->gop[5].ref_neg[0] = 2; cfg->gop[5].ref_neg[1] = 6;
cfg->gop[5].ref_pos_count = 1; cfg->gop[5].ref_pos[0] = 2;
cfg->gop[6].poc_offset = 5; cfg->gop[6].qp_offset = 4; cfg->gop[6].layer = 4; cfg->gop[6].qp_factor = 0.68; cfg->gop[6].is_ref = 0;
cfg->gop[6].ref_neg_count = 2; cfg->gop[6].ref_neg[0] = 1; cfg->gop[6].ref_neg[1] = 5;
cfg->gop[6].ref_pos_count = 2; cfg->gop[6].ref_pos[0] = 1; cfg->gop[6].ref_pos[1] = 3;
cfg->gop[7].poc_offset = 7; cfg->gop[7].qp_offset = 4; cfg->gop[7].layer = 4; cfg->gop[7].qp_factor = 0.68; cfg->gop[7].is_ref = 0;
cfg->gop[7].ref_neg_count = 3; cfg->gop[7].ref_neg[0] = 1; cfg->gop[7].ref_neg[1] = 3; cfg->gop[7].ref_neg[2] = 7;
cfg->gop[7].ref_pos_count = 1; cfg->gop[7].ref_pos[0] = 1;
} else if (atoi(value) == 0) { } else if (atoi(value) == 0) {
//Disable gop //Disable gop
cfg->gop_len = 0; cfg->gop_len = 0;

117
src/gop.h Normal file
View file

@ -0,0 +1,117 @@
#ifndef GOP_H_
#define GOP_H_
/*****************************************************************************
* This file is part of Kvazaar HEVC encoder.
*
* Copyright (C) 2018 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/>.
****************************************************************************/
#include <kvazaar.h>
static const kvz_gop_config kvz_gop_ra8[8] = {
{
.poc_offset = 8,
.layer = 1,
.qp_offset = 1,
.qp_factor = 0.442,
.is_ref = 1,
.ref_neg_count = 3,
.ref_neg = { 8, 12, 16 },
.ref_pos_count = 0,
.ref_pos = { 0 },
},
{
.poc_offset = 4,
.layer = 2,
.qp_offset = 2,
.qp_factor = 0.3536,
.is_ref = 1,
.ref_neg_count = 2,
.ref_neg = { 4, 8 },
.ref_pos_count = 1,
.ref_pos = { 4 },
},
{
.poc_offset = 2,
.layer = 3,
.qp_offset = 3,
.qp_factor = 0.3536,
.is_ref = 1,
.ref_neg_count = 2,
.ref_neg = { 2, 6 },
.ref_pos_count = 2,
.ref_pos = { 2, 6 },
},
{
.poc_offset = 1,
.layer = 4,
.qp_offset = 4,
.qp_factor = 0.68,
.is_ref = 0,
.ref_neg_count = 1,
.ref_neg = { 1 },
.ref_pos_count = 3,
.ref_pos = { 1, 3, 7 },
},
{
.poc_offset = 3,
.layer = 4,
.qp_offset = 4,
.qp_factor = 0.68,
.is_ref = 0,
.ref_neg_count = 2,
.ref_neg = { 1, 3 },
.ref_pos_count = 2,
.ref_pos = { 1, 5 },
},
{
.poc_offset = 6,
.layer = 3,
.qp_offset = 3,
.qp_factor = 0.3536,
.is_ref = 1,
.ref_neg_count = 2,
.ref_neg = { 2, 6 },
.ref_pos_count = 1,
.ref_pos = { 2 },
},
{
.poc_offset = 5,
.layer = 4,
.qp_offset = 4,
.qp_factor = 0.68,
.is_ref = 0,
.ref_neg_count = 2,
.ref_neg = { 1, 5 },
.ref_pos_count = 2,
.ref_pos = { 1, 3 },
},
{
.poc_offset = 7,
.layer = 4,
.qp_offset = 4,
.qp_factor = 0.68,
.is_ref = 0,
.ref_neg_count = 3,
.ref_neg = { 1, 3, 7 },
.ref_pos_count = 1,
.ref_pos = { 1 },
},
};
#endif // GOP_H_