mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-01-23 18:11:11 +01:00
fixup! lavc/rkmppenc: add RKMPP H264 and HEVC encoder
fix rgb2yuv CSC when the input is RGB formats. Signed-off-by: nyanmisaka <nst799610810@gmail.com>
This commit is contained in:
parent
7d7212cb3f
commit
8d49209ccd
1 changed files with 13 additions and 4 deletions
|
|
@ -341,7 +341,11 @@ static int rkmpp_set_enc_cfg_prep(AVCodecContext *avctx, AVFrame *frame)
|
|||
mpp_enc_cfg_set_s32(cfg, "prep:width", avctx->width);
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:height", avctx->height);
|
||||
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:colorspace", avctx->colorspace);
|
||||
if (pix_desc->flags & AV_PIX_FMT_FLAG_RGB) /* RGB -> BT709 CSC */
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:colorspace", AVCOL_SPC_BT709);
|
||||
else
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:colorspace", avctx->colorspace);
|
||||
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:colorprim", avctx->color_primaries);
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:colortrc", avctx->color_trc);
|
||||
|
||||
|
|
@ -388,7 +392,7 @@ static int rkmpp_set_enc_cfg(AVCodecContext *avctx)
|
|||
{
|
||||
RKMPPEncContext *r = avctx->priv_data;
|
||||
MppEncCfg cfg = r->mcfg;
|
||||
|
||||
const AVPixFmtDescriptor *pix_desc;
|
||||
RK_U32 rc_mode, fps_num, fps_den;
|
||||
MppEncHeaderMode header_mode;
|
||||
MppEncSeiMode sei_mode;
|
||||
|
|
@ -400,12 +404,17 @@ static int rkmpp_set_enc_cfg(AVCodecContext *avctx)
|
|||
mpp_enc_cfg_set_s32(cfg, "prep:height", avctx->height);
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:hor_stride", FFALIGN(avctx->width, 64));
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:ver_stride", FFALIGN(avctx->height, 64));
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:format", MPP_FMT_YUV420SP);
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:format", r->mpp_fmt);
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:mirroring", 0);
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:rotation", 0);
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:flip", 0);
|
||||
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:colorspace", avctx->colorspace);
|
||||
pix_desc = av_pix_fmt_desc_get(r->pix_fmt);
|
||||
if (pix_desc->flags & AV_PIX_FMT_FLAG_RGB) /* RGB -> BT709 CSC */
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:colorspace", AVCOL_SPC_BT709);
|
||||
else
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:colorspace", avctx->colorspace);
|
||||
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:colorprim", avctx->color_primaries);
|
||||
mpp_enc_cfg_set_s32(cfg, "prep:colortrc", avctx->color_trc);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue