mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-01 15:32:08 +08:00
[utils]: Add gop ref config util function
Signed-off-by: Herman Chen <herman.chen@rock-chips.com> Change-Id: I9b82e4a2a6e8451c9e63599329c3d3ddc74ff59c
This commit is contained in:
@@ -209,167 +209,6 @@ MPP_RET test_ctx_deinit(MpiEncTestData **data)
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
static void setup_gop_ref(MppEncGopRef *ref, RK_S32 gop_mode)
|
||||
{
|
||||
// rockchip tsvc config
|
||||
MppGopRefInfo *gop = &ref->gop_info[0];
|
||||
|
||||
mpp_log("gop_mode %d", gop_mode);
|
||||
|
||||
ref->change = 1;
|
||||
ref->gop_cfg_enable = 1;
|
||||
|
||||
// default no LTR
|
||||
ref->lt_ref_interval = 0;
|
||||
ref->max_lt_ref_cnt = 0;
|
||||
|
||||
if (gop_mode == 3) {
|
||||
// tsvc4
|
||||
// /-> P1 /-> P3 /-> P5 /-> P7
|
||||
// / / / /
|
||||
// //--------> P2 //--------> P6
|
||||
// // //
|
||||
// ///---------------------> P4
|
||||
// ///
|
||||
// P0 ------------------------------------------------> P8
|
||||
ref->ref_gop_len = 8;
|
||||
ref->layer_weight[0] = 800;
|
||||
ref->layer_weight[1] = 400;
|
||||
ref->layer_weight[2] = 400;
|
||||
ref->layer_weight[3] = 400;
|
||||
|
||||
gop[0].temporal_id = 0;
|
||||
gop[0].ref_idx = 0;
|
||||
gop[0].is_non_ref = 0;
|
||||
gop[0].is_lt_ref = 1;
|
||||
gop[0].lt_idx = 0;
|
||||
|
||||
gop[1].temporal_id = 3;
|
||||
gop[1].ref_idx = 0;
|
||||
gop[1].is_non_ref = 1;
|
||||
gop[1].is_lt_ref = 0;
|
||||
gop[1].lt_idx = 0;
|
||||
|
||||
gop[2].temporal_id = 2;
|
||||
gop[2].ref_idx = 0;
|
||||
gop[2].is_non_ref = 0;
|
||||
gop[2].is_lt_ref = 0;
|
||||
gop[2].lt_idx = 0;
|
||||
|
||||
gop[3].temporal_id = 3;
|
||||
gop[3].ref_idx = 2;
|
||||
gop[3].is_non_ref = 1;
|
||||
gop[3].is_lt_ref = 0;
|
||||
gop[3].lt_idx = 0;
|
||||
|
||||
gop[4].temporal_id = 1;
|
||||
gop[4].ref_idx = 0;
|
||||
gop[4].is_non_ref = 0;
|
||||
gop[4].is_lt_ref = 1;
|
||||
gop[4].lt_idx = 1;
|
||||
|
||||
gop[5].temporal_id = 3;
|
||||
gop[5].ref_idx = 4;
|
||||
gop[5].is_non_ref = 1;
|
||||
gop[5].is_lt_ref = 0;
|
||||
gop[5].lt_idx = 0;
|
||||
|
||||
gop[6].temporal_id = 2;
|
||||
gop[6].ref_idx = 4;
|
||||
gop[6].is_non_ref = 0;
|
||||
gop[6].is_lt_ref = 0;
|
||||
gop[6].lt_idx = 0;
|
||||
|
||||
gop[7].temporal_id = 3;
|
||||
gop[7].ref_idx = 6;
|
||||
gop[7].is_non_ref = 1;
|
||||
gop[7].is_lt_ref = 0;
|
||||
gop[7].lt_idx = 0;
|
||||
|
||||
gop[8].temporal_id = 0;
|
||||
gop[8].ref_idx = 0;
|
||||
gop[8].is_non_ref = 0;
|
||||
gop[8].is_lt_ref = 1;
|
||||
gop[8].lt_idx = 0;
|
||||
|
||||
ref->max_lt_ref_cnt = 2;
|
||||
} else if (gop_mode == 2) {
|
||||
// tsvc3
|
||||
// /-> P1 /-> P3
|
||||
// / /
|
||||
// //--------> P2
|
||||
// //
|
||||
// P0/---------------------> P4
|
||||
ref->ref_gop_len = 4;
|
||||
ref->layer_weight[0] = 1000;
|
||||
ref->layer_weight[1] = 500;
|
||||
ref->layer_weight[2] = 500;
|
||||
ref->layer_weight[3] = 0;
|
||||
|
||||
gop[0].temporal_id = 0;
|
||||
gop[0].ref_idx = 0;
|
||||
gop[0].is_non_ref = 0;
|
||||
gop[0].is_lt_ref = 0;
|
||||
gop[0].lt_idx = 0;
|
||||
|
||||
gop[1].temporal_id = 2;
|
||||
gop[1].ref_idx = 0;
|
||||
gop[1].is_non_ref = 1;
|
||||
gop[1].is_lt_ref = 0;
|
||||
gop[1].lt_idx = 0;
|
||||
|
||||
gop[2].temporal_id = 1;
|
||||
gop[2].ref_idx = 0;
|
||||
gop[2].is_non_ref = 0;
|
||||
gop[2].is_lt_ref = 0;
|
||||
gop[2].lt_idx = 0;
|
||||
|
||||
gop[3].temporal_id = 2;
|
||||
gop[3].ref_idx = 2;
|
||||
gop[3].is_non_ref = 1;
|
||||
gop[3].is_lt_ref = 0;
|
||||
gop[3].lt_idx = 0;
|
||||
|
||||
gop[4].temporal_id = 0;
|
||||
gop[4].ref_idx = 0;
|
||||
gop[4].is_non_ref = 0;
|
||||
gop[4].is_lt_ref = 0;
|
||||
gop[4].lt_idx = 0;
|
||||
|
||||
// set to lt_ref interval with looping LTR idx
|
||||
ref->lt_ref_interval = 10;
|
||||
ref->max_lt_ref_cnt = 3;
|
||||
} else if (gop_mode == 1) {
|
||||
// tsvc2
|
||||
// /-> P1
|
||||
// /
|
||||
// P0--------> P2
|
||||
ref->ref_gop_len = 2;
|
||||
ref->layer_weight[0] = 1400;
|
||||
ref->layer_weight[1] = 600;
|
||||
ref->layer_weight[2] = 0;
|
||||
ref->layer_weight[3] = 0;
|
||||
|
||||
gop[0].temporal_id = 0;
|
||||
gop[0].ref_idx = 0;
|
||||
gop[0].is_non_ref = 0;
|
||||
gop[0].is_lt_ref = 0;
|
||||
gop[0].lt_idx = 0;
|
||||
|
||||
gop[1].temporal_id = 1;
|
||||
gop[1].ref_idx = 0;
|
||||
gop[1].is_non_ref = 1;
|
||||
gop[1].is_lt_ref = 0;
|
||||
gop[1].lt_idx = 0;
|
||||
|
||||
gop[2].temporal_id = 0;
|
||||
gop[2].ref_idx = 0;
|
||||
gop[2].is_non_ref = 0;
|
||||
gop[2].is_lt_ref = 0;
|
||||
gop[2].lt_idx = 0;
|
||||
}
|
||||
}
|
||||
|
||||
MPP_RET test_mpp_setup(MpiEncTestData *p)
|
||||
{
|
||||
MPP_RET ret;
|
||||
@@ -541,7 +380,7 @@ MPP_RET test_mpp_setup(MpiEncTestData *p)
|
||||
}
|
||||
|
||||
if (p->gop_mode && p->gop_mode < 4) {
|
||||
setup_gop_ref(&p->ref, p->gop_mode);
|
||||
mpi_enc_gen_gop_ref(&p->ref, p->gop_mode);
|
||||
|
||||
mpp_log_f("MPP_ENC_SET_GOPREF start gop mode %d\n", p->gop_mode);
|
||||
|
||||
|
Reference in New Issue
Block a user