Skip to content

Commit c639899

Browse files
Aakarsh JainHans Verkuil
authored andcommitted
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>
1 parent 6f14661 commit c639899

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -992,10 +992,24 @@ static int s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx)
992992

993993
/* reaction coefficient */
994994
if (p->rc_frame) {
995-
if (p->rc_reaction_coeff < TIGHT_CBR_MAX) /* tight CBR */
996-
writel(1, mfc_regs->e_rc_mode);
997-
else /* loose CBR */
998-
writel(2, mfc_regs->e_rc_mode);
995+
if (IS_MFCV12(dev)) {
996+
/* loose CBR */
997+
if (p->rc_reaction_coeff < LOOSE_CBR_MAX)
998+
writel(1, mfc_regs->e_rc_mode);
999+
/* tight CBR */
1000+
else if (p->rc_reaction_coeff < TIGHT_CBR_MAX)
1001+
writel(0, mfc_regs->e_rc_mode);
1002+
/* VBR */
1003+
else
1004+
writel(2, mfc_regs->e_rc_mode);
1005+
} else {
1006+
/* tight CBR */
1007+
if (p->rc_reaction_coeff < TIGHT_CBR_MAX)
1008+
writel(1, mfc_regs->e_rc_mode);
1009+
/* loose CBR */
1010+
else
1011+
writel(2, mfc_regs->e_rc_mode);
1012+
}
9991013
}
10001014

10011015
/* seq header ctrl */

drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#define ENC_H264_LEVEL_MAX 42
4141
#define ENC_MPEG4_VOP_TIME_RES_MAX ((1 << 16) - 1)
4242
#define FRAME_DELTA_H264_H263 1
43+
#define LOOSE_CBR_MAX 5
4344
#define TIGHT_CBR_MAX 10
4445
#define ENC_HEVC_RC_FRAME_RATE_MAX ((1 << 16) - 1)
4546
#define ENC_HEVC_QP_INDEX_MIN -12

0 commit comments

Comments
 (0)