hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 * Copyright 2015 Rockchip Electronics Co. LTD
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
#ifndef __MPP_ENC_REFS_H__
#define __MPP_ENC_REFS_H__
 
#include "mpp_enc_cfg.h"
#include "mpp_enc_ref.h"
 
/*
 * MppEncRefs has two runtime mode:
 *
 * 1. dryrun mode
 * This mode is for estimating the dpb size and configure check.
 *
 * 2. runtime mode
 * Thie mode is for real dpb loop in real encoder workflow.
 *
 * When encoder is running user can change the frame property by MppEncRefFrmUsrCfg.
 */
#define ENC_FORCE_IDR           (0x00000001)
#define ENC_FORCE_PSKIP         (0x00000002)
#define ENC_FORCE_NONREF        (0x00000004)
#define ENC_FORCE_LT_REF_IDX    (0x00000008)
#define ENC_FORCE_TEMPORAL_ID   (0x00000010)
#define ENC_FORCE_REF_MODE      (0x00000020)
 
typedef struct MppEncRefFrmForceCfg_t {
    RK_U32              force_flag;
    RK_S32              force_idr;
    RK_S32              force_pskip;
    RK_S32              force_nonref;
    RK_S32              force_lt_idx;
    RK_S32              force_temporal_id;
    MppEncRefMode       force_ref_mode;
    RK_S32              force_ref_arg;
} MppEncRefFrmUsrCfg;
 
typedef void* MppEncRefs;
 
#ifdef __cplusplus
extern "C" {
#endif
 
MPP_RET mpp_enc_refs_init(MppEncRefs *refs);
MPP_RET mpp_enc_refs_deinit(MppEncRefs *refs);
 
MPP_RET mpp_enc_refs_set_cfg(MppEncRefs refs, MppEncRefCfg ref_cfg);
MPP_RET mpp_enc_refs_set_usr_cfg(MppEncRefs refs, MppEncRefFrmUsrCfg *force);
MPP_RET mpp_enc_refs_set_rc_igop(MppEncRefs refs, RK_S32 igop);
 
/* return hdr need update or not */
RK_S32  mpp_enc_refs_update_hdr(MppEncRefs refs);
 
/* get dpb size */
MPP_RET mpp_enc_refs_get_cpb_info(MppEncRefs refs, MppEncCpbInfo *info);
/* get status for next frame */
MPP_RET mpp_enc_refs_get_cpb(MppEncRefs refs, EncCpbStatus *status);
/* dryrun and check all configure */
MPP_RET mpp_enc_refs_dryrun(MppEncRefs refs);
 
MPP_RET mpp_enc_refs_stash(MppEncRefs refs);
MPP_RET mpp_enc_refs_rollback(MppEncRefs refs);
 
/* two-pass encoding functions */
/* check next frame is intra or not */
RK_S32  mpp_enc_refs_next_frm_is_intra(MppEncRefs refs);
MPP_RET mpp_enc_refs_get_cpb_pass1(MppEncRefs refs, EncCpbStatus *status);
 
#define dump_frm(frm)   _dump_frm(frm, __FUNCTION__, __LINE__)
 
void _dump_frm(EncFrmStatus *frm, const char *func, RK_S32 line);
 
#ifdef __cplusplus
}
#endif
 
#endif /*__MPP_ENC_REFS_H__*/