mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-18 23:14:35 +08:00
[mpp_enc_impl: Add software encode path
1. Remove encoder reset / flush / callback function. 2. Add sw_enc for software encode path. Signed-off-by: Herman Chen <herman.chen@rock-chips.com> Change-Id: I0c62bdc1ae28272dc30922781be8188ed49f9e9f
This commit is contained in:
@@ -799,6 +799,4 @@ const EncImplApi api_h264e = {
|
||||
h264e_proc_hal,
|
||||
h264e_add_sei,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -46,8 +46,7 @@ typedef struct {
|
||||
MppEncCfgSet *cfg;
|
||||
MppEncCfgSet *set;
|
||||
|
||||
H265eSyntax syntax;
|
||||
H265eFeedback feedback;
|
||||
H265eSyntax syntax;
|
||||
} H265eCtx;
|
||||
|
||||
static MPP_RET h265e_init(void *ctx, EncImplCfg *ctrlCfg)
|
||||
@@ -125,34 +124,6 @@ static MPP_RET h265e_encode(void *ctx, HalEncTask *task)
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
static MPP_RET h265e_reset(void *ctx)
|
||||
{
|
||||
H265eCtx *p = (H265eCtx *)ctx;
|
||||
if (p == NULL) {
|
||||
mpp_err_f("error: p == NULL");
|
||||
return MPP_NOK;
|
||||
}
|
||||
|
||||
h265e_dbg_func("enter ctx %p\n", ctx);
|
||||
h265e_dbg_func("leave ctx %p\n", ctx);
|
||||
(void)ctx;
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
static MPP_RET h265e_flush(void *ctx)
|
||||
{
|
||||
H265eCtx *p = (H265eCtx *)ctx;
|
||||
if (p == NULL) {
|
||||
mpp_err_f("error: p == NULL");
|
||||
return MPP_NOK;
|
||||
}
|
||||
|
||||
h265e_dbg_func("enter ctx %p\n", ctx);
|
||||
h265e_dbg_func("leave ctx %p\n", ctx);
|
||||
(void)ctx;
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
static MPP_RET h265e_config(void *ctx, MpiCmd cmd, void *param)
|
||||
{
|
||||
H265eCtx *p = (H265eCtx *)ctx;
|
||||
@@ -175,28 +146,6 @@ static MPP_RET h265e_config(void *ctx, MpiCmd cmd, void *param)
|
||||
return ret;
|
||||
}
|
||||
|
||||
MPP_RET h265e_callback(void *ctx, void *feedback)
|
||||
{
|
||||
H265eCtx *p = (H265eCtx *)ctx;
|
||||
H265eFeedback *result = NULL;
|
||||
H265eFeedback *back = (H265eFeedback*)feedback;
|
||||
if (p == NULL || feedback == NULL) {
|
||||
mpp_err_f("error: p == NULL");
|
||||
return MPP_NOK;
|
||||
}
|
||||
|
||||
result = &p->feedback;
|
||||
h265e_dbg_func("enter ctx %p\n", ctx);
|
||||
memcpy(result, back, sizeof(H265eFeedback));
|
||||
h265e_dbg_func("***********************h265 encoder result************************\n");
|
||||
h265e_dbg_func("status size pic_cnt pic_type poc src_idx gop_idx avg_qp\n");
|
||||
h265e_dbg_func("[%4d] [%6d] [%4d] [%4d] [%4d] [%4d] [%4d] [%4d]\n", result->status, result->bs_size,
|
||||
result->enc_pic_cnt, result->pic_type, result->poc, result->src_idx, result->gop_idx, result->avg_ctu_qp);
|
||||
h265e_dbg_func("******************************************************************\n");
|
||||
h265e_dbg_func("leave ctx %p\n", ctx);
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
const EncImplApi api_h265e_controller = {
|
||||
"h265e_control",
|
||||
MPP_VIDEO_CodingHEVC,
|
||||
@@ -210,7 +159,5 @@ const EncImplApi api_h265e_controller = {
|
||||
NULL,
|
||||
h265e_encode,
|
||||
NULL,
|
||||
h265e_reset,
|
||||
h265e_flush,
|
||||
h265e_callback,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -595,6 +595,4 @@ const EncImplApi api_h265e = {
|
||||
h265e_proc_hal,
|
||||
h265e_add_sei,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -575,7 +575,5 @@ const EncImplApi api_jpege = {
|
||||
.proc_dpb = NULL,
|
||||
.proc_hal = jpege_proc_hal,
|
||||
.add_prefix = jpege_add_Prefix,
|
||||
.reset = NULL,
|
||||
.flush = NULL,
|
||||
.callback = NULL,
|
||||
.sw_enc = NULL,
|
||||
};
|
||||
|
||||
@@ -144,20 +144,6 @@ static MPP_RET vp8e_start(void *ctx, HalEncTask *task)
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
static MPP_RET vp8e_reset(void *ctx)
|
||||
{
|
||||
(void)ctx;
|
||||
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
static MPP_RET vp8e_flush(void *ctx)
|
||||
{
|
||||
Vp8eCtx *p = (Vp8eCtx *)ctx;
|
||||
(void)p;
|
||||
|
||||
return MPP_OK;
|
||||
}
|
||||
static MPP_RET vp8e_proc_prep_cfg(MppEncPrepCfg *dst, MppEncPrepCfg *src)
|
||||
{
|
||||
MPP_RET ret = MPP_OK;
|
||||
@@ -380,7 +366,5 @@ const EncImplApi api_vp8e = {
|
||||
.proc_dpb = NULL,
|
||||
.proc_hal = vp8e_proc_hal,
|
||||
.add_prefix = NULL,
|
||||
.reset = vp8e_reset,
|
||||
.flush = vp8e_flush,
|
||||
.callback = NULL,
|
||||
.sw_enc = NULL,
|
||||
};
|
||||
|
||||
@@ -75,9 +75,7 @@ typedef struct EncImplApi_t {
|
||||
MPP_RET (*add_prefix)(MppPacket pkt, RK_S32 *length, RK_U8 uuid[16],
|
||||
const void *data, RK_S32 size);
|
||||
|
||||
MPP_RET (*reset)(void *ctx);
|
||||
MPP_RET (*flush)(void *ctx);
|
||||
MPP_RET (*callback)(void *ctx, void *feedback);
|
||||
MPP_RET (*sw_enc)(void *ctx, HalEncTask *task);
|
||||
} EncImplApi;
|
||||
|
||||
#endif /*__ENC_IMPL_API_H__*/
|
||||
|
||||
@@ -38,7 +38,7 @@ MPP_RET enc_impl_proc_hal(EncImpl impl, HalEncTask *task);
|
||||
MPP_RET enc_impl_add_prefix(EncImpl impl, MppPacket pkt, RK_S32 *length,
|
||||
RK_U8 uuid[16], const void *data, RK_S32 size);
|
||||
|
||||
MPP_RET hal_enc_callback(void* impl, void *err_info);
|
||||
MPP_RET enc_impl_sw_enc(EncImpl impl, HalEncTask *task);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -221,17 +221,17 @@ MPP_RET enc_impl_add_prefix(EncImpl impl, MppPacket pkt, RK_S32 *length,
|
||||
return ret;
|
||||
}
|
||||
|
||||
MPP_RET hal_enc_callback(void *impl, void *err_info)
|
||||
MPP_RET enc_impl_sw_enc(EncImpl impl, HalEncTask *task)
|
||||
{
|
||||
if (NULL == impl) {
|
||||
if (NULL == impl || NULL == task) {
|
||||
mpp_err_f("found NULL input\n");
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
MPP_RET ret = MPP_OK;
|
||||
EncImplCtx *p = (EncImplCtx *)impl;
|
||||
if (p->api->callback)
|
||||
ret = p->api->callback(p->ctx, err_info);
|
||||
if (p->api->sw_enc)
|
||||
ret = p->api->sw_enc(p->ctx, task);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user