MLK-19764:VPU encoder:implement force key frame
Signed-off-by: ming_qian <ming.qian@nxp.com>pull/10/head
parent
479b42a611
commit
3ec2df99d8
|
@ -276,7 +276,7 @@ typedef struct {
|
|||
u_int32 uLumaBase;
|
||||
u_int32 uChromaBase;
|
||||
u_int32 uParamIdx;
|
||||
|
||||
u_int32 uKeyFrame;
|
||||
} MEDIAIP_ENC_YUV_BUFFER_DESC, *pMEDIAIP_ENC_YUV_BUFFER_DESC;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -1246,6 +1246,10 @@ static bool update_yuv_addr(struct vpu_ctx *ctx, u_int32 uStrIdx)
|
|||
|
||||
/* keeps increasing, so just a frame input count rather than a Frame buffer ID */
|
||||
pParamYuvBuffDesc->uFrameID = p_data_req->id;
|
||||
if (test_and_clear_bit(VPU_ENC_STATUS_KEY_FRAME, &ctx->status))
|
||||
pParamYuvBuffDesc->uKeyFrame = 1;
|
||||
else
|
||||
pParamYuvBuffDesc->uKeyFrame = 0;
|
||||
list_del(&p_data_req->list);
|
||||
}
|
||||
up(&This->drv_q_lock);
|
||||
|
|
|
@ -239,7 +239,8 @@ struct buffer_addr {
|
|||
|
||||
enum {
|
||||
VPU_ENC_STATUS_CONFIGURED = 29,
|
||||
VPU_ENC_STATUS_HANG = 30
|
||||
VPU_ENC_STATUS_HANG = 30,
|
||||
VPU_ENC_STATUS_KEY_FRAME = 31
|
||||
};
|
||||
|
||||
struct vpu_statistic {
|
||||
|
|
|
@ -192,6 +192,15 @@ static int set_display_re_ordering(struct v4l2_ctrl *ctrl)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int set_force_key_frame(struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
struct vpu_ctx *ctx = v4l2_ctrl_to_ctx(ctrl);
|
||||
|
||||
set_bit(VPU_ENC_STATUS_KEY_FRAME, &ctx->status);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int add_ctrl_h264_profile(struct vpu_ctx *ctx)
|
||||
{
|
||||
static const struct v4l2_ctrl_ops ctrl_h264_profile_ops = {
|
||||
|
@ -453,6 +462,25 @@ static int add_ctrl_display_re_ordering(struct vpu_ctx *ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int add_ctrl_force_key_frame(struct vpu_ctx *ctx)
|
||||
{
|
||||
static const struct v4l2_ctrl_ops force_key_frame_ops = {
|
||||
.s_ctrl = set_force_key_frame,
|
||||
};
|
||||
struct v4l2_ctrl *ctrl;
|
||||
|
||||
ctrl = v4l2_ctrl_new_std(&ctx->ctrl_handler,
|
||||
&force_key_frame_ops,
|
||||
V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME,
|
||||
0, 0, 0, 0);
|
||||
if (!ctrl) {
|
||||
vpu_dbg(LVL_ERR, "add ctrl force key frame fail\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vpu_enc_register_ctrls(struct vpu_ctx *ctx)
|
||||
{
|
||||
add_ctrl_h264_profile(ctx);
|
||||
|
@ -467,6 +495,7 @@ static int vpu_enc_register_ctrls(struct vpu_ctx *ctx)
|
|||
add_ctrl_b_frame_qp(ctx);
|
||||
add_ctrl_min_buffers_for_output(ctx);
|
||||
add_ctrl_display_re_ordering(ctx);
|
||||
add_ctrl_force_key_frame(ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue