diff --git a/src/config.h b/src/config.h index e894605a..4bb53938 100644 --- a/src/config.h +++ b/src/config.h @@ -30,11 +30,15 @@ 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; + 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 */ + int8_t ref_pos_count;/*!< \brief Reference picture count */ + 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; /*! \brief Struct which contains all configuration data @@ -98,7 +102,7 @@ typedef struct } pu_depth_inter, pu_depth_intra; int8_t gop_len; /*!< \brief length of GOP for the video sequence */ - gop_config gop[MAX_GOP]; /*!< \brief Array of GOP settings */ + gop_config_t gop[MAX_GOP]; /*!< \brief Array of GOP settings */ } config_t; diff --git a/src/encmain.c b/src/encmain.c index 933f6cb9..51722273 100644 --- a/src/encmain.c +++ b/src/encmain.c @@ -266,14 +266,38 @@ int main(int argc, char *argv[]) // GOP cfg->gop_len = 8; - 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[1].poc_offset = 4; cfg->gop[1].qp_offset = 2; cfg->gop[1].layer = 2; cfg->gop[1].qp_factor = 0.3536; - 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[3].poc_offset = 1; cfg->gop[3].qp_offset = 4; cfg->gop[3].layer = 4; cfg->gop[3].qp_factor = 0.68; - 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[5].poc_offset = 6; cfg->gop[5].qp_offset = 3; cfg->gop[5].layer = 3; cfg->gop[5].qp_factor = 0.3536; - 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[7].poc_offset = 7; cfg->gop[7].qp_offset = 4; cfg->gop[7].layer = 4; cfg->gop[7].qp_factor = 0.68; + 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 = 1; + 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; + if (!encoder_control_init(&encoder, cfg)) { goto exit_failure;