media: s5p-mfc: Add support for rate controls in MFCv12

In MFCv12, the rc configs are changed with support for CBR loose,
CBR tight and Variable Bitrate (VBR) added.

Cc: linux-fsd@tesla.com
Signed-off-by: Smitha T Murthy <smithatmurthy@gmail.com>
Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
Aakarsh Jain 2023-12-13 13:41:00 +05:30 committed by Hans Verkuil
parent 6f1466123d
commit c639899bb6
2 changed files with 19 additions and 4 deletions

View File

@ -992,10 +992,24 @@ static int s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx)
/* reaction coefficient */
if (p->rc_frame) {
if (p->rc_reaction_coeff < TIGHT_CBR_MAX) /* tight CBR */
writel(1, mfc_regs->e_rc_mode);
else /* loose CBR */
writel(2, mfc_regs->e_rc_mode);
if (IS_MFCV12(dev)) {
/* loose CBR */
if (p->rc_reaction_coeff < LOOSE_CBR_MAX)
writel(1, mfc_regs->e_rc_mode);
/* tight CBR */
else if (p->rc_reaction_coeff < TIGHT_CBR_MAX)
writel(0, mfc_regs->e_rc_mode);
/* VBR */
else
writel(2, mfc_regs->e_rc_mode);
} else {
/* tight CBR */
if (p->rc_reaction_coeff < TIGHT_CBR_MAX)
writel(1, mfc_regs->e_rc_mode);
/* loose CBR */
else
writel(2, mfc_regs->e_rc_mode);
}
}
/* seq header ctrl */

View File

@ -40,6 +40,7 @@
#define ENC_H264_LEVEL_MAX 42
#define ENC_MPEG4_VOP_TIME_RES_MAX ((1 << 16) - 1)
#define FRAME_DELTA_H264_H263 1
#define LOOSE_CBR_MAX 5
#define TIGHT_CBR_MAX 10
#define ENC_HEVC_RC_FRAME_RATE_MAX ((1 << 16) - 1)
#define ENC_HEVC_QP_INDEX_MIN -12