From: "Chen, Wenbin" <wenbin.chen-at-intel.com@ffmpeg.org> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH v2] libavcodec/qsvenc_hevc: encode RGB format rawvideo Date: Fri, 18 Feb 2022 01:45:27 +0000 Message-ID: <MN2PR11MB38868CCEB7EE0850B3114214F8379@MN2PR11MB3886.namprd11.prod.outlook.com> (raw) In-Reply-To: <18b30d9b80e2212d617249512b1eee2aaefb06f8.camel@intel.com> > On Tue, 2022-02-15 at 15:00 +0800, Wenbin Chen wrote: > > Add support for hevc_qsv to input RGB format frame. It will > > transform frame to yuv inside MediaSDK instead of using auto > > scale. Now hevc_qsv supports directly encoding BGRA and X2RGB10 > > format. X2RGB10 is only supported in VDENC (-low_power 1). > > The X2RGB10 correspond to the A2RGB20 format in MediaSDK. > > > > Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> > > --- > > libavcodec/qsv.c | 16 ++++++++++++++++ > > libavcodec/qsvenc.c | 13 +++++++++++++ > > libavcodec/qsvenc_hevc.c | 6 ++++++ > > 3 files changed, 35 insertions(+) > > > > diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c > > index 1a432dbd82..b75877e698 100644 > > --- a/libavcodec/qsv.c > > +++ b/libavcodec/qsv.c > > @@ -189,6 +189,12 @@ enum AVPixelFormat ff_qsv_map_fourcc(uint32_t > fourcc) > > case MFX_FOURCC_NV12: return AV_PIX_FMT_NV12; > > case MFX_FOURCC_P010: return AV_PIX_FMT_P010; > > case MFX_FOURCC_P8: return AV_PIX_FMT_PAL8; > > +#if QSV_VERSION_ATLEAST(1, 9) > > + case MFX_FOURCC_A2RGB10: return AV_PIX_FMT_X2RGB10; > > +#endif > > +#if QSV_VERSION_ATLEAST(1, 17) > > + case MFX_FOURCC_RGB4: return AV_PIX_FMT_BGRA; > > +#endif > > #if CONFIG_VAAPI > > case MFX_FOURCC_YUY2: return AV_PIX_FMT_YUYV422; > > #if QSV_VERSION_ATLEAST(1, 27) > > @@ -211,6 +217,16 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat > format, uint32_t > > *fourcc) > > case AV_PIX_FMT_P010: > > *fourcc = MFX_FOURCC_P010; > > return AV_PIX_FMT_P010; > > +#if QSV_VERSION_ATLEAST(1, 9) > > + case AV_PIX_FMT_X2RGB10: > > + *fourcc = MFX_FOURCC_A2RGB10; > > + return AV_PIX_FMT_X2RGB10; > > +#endif > > +#if QSV_VERSION_ATLEAST(1, 17) > > + case AV_PIX_FMT_BGRA: > > + *fourcc = MFX_FOURCC_RGB4; > > + return AV_PIX_FMT_BGRA; > > +#endif > > #if CONFIG_VAAPI > > case AV_PIX_FMT_YUV422P: > > case AV_PIX_FMT_YUYV422: > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c > > index 07be4287b7..104133fc59 100644 > > --- a/libavcodec/qsvenc.c > > +++ b/libavcodec/qsvenc.c > > @@ -715,6 +715,11 @@ static int init_video_param(AVCodecContext > *avctx, > > QSVEncContext *q) > > if (ret < 0) > > return AVERROR_BUG; > > > > + if (sw_format == AV_PIX_FMT_X2RGB10 && q->low_power != 1) { > > The SDK may choose a workable mode if low_power is set to auto. > > Thanks > Haihao Thanks for your information. I will update patch. > > > + av_log(avctx, AV_LOG_ERROR, "Only VDENC support encoding > x2rgb10\n"); > > + return AVERROR(EINVAL); > > + } > > + > > q->param.mfx.FrameInfo.CropX = 0; > > q->param.mfx.FrameInfo.CropY = 0; > > q->param.mfx.FrameInfo.CropW = avctx->width; > > @@ -1616,6 +1621,14 @@ static int submit_frame(QSVEncContext *q, > const AVFrame > > *frame, > > qf->surface.Data.V = qf->surface.Data.UV + 2; > > break; > > > > + case AV_PIX_FMT_X2RGB10: > > + case AV_PIX_FMT_BGRA: > > + qf->surface.Data.B = qf->frame->data[0]; > > + qf->surface.Data.G = qf->frame->data[0] + 1; > > + qf->surface.Data.R = qf->frame->data[0] + 2; > > + qf->surface.Data.A = qf->frame->data[0] + 3; > > + break; > > + > > default: > > /* should not reach here */ > > av_assert0(0); > > diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c > > index 5cac141c4d..ade546d4ca 100644 > > --- a/libavcodec/qsvenc_hevc.c > > +++ b/libavcodec/qsvenc_hevc.c > > @@ -304,6 +304,12 @@ const AVCodec ff_hevc_qsv_encoder = { > > .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, > > AV_PIX_FMT_P010, > > AV_PIX_FMT_QSV, > > +#if QSV_VERSION_ATLEAST(1, 17) > > + AV_PIX_FMT_BGRA, > > +#endif > > +#if QSV_VERSION_ATLEAST(1, 9) > > + AV_PIX_FMT_X2RGB10, > > +#endif > > AV_PIX_FMT_NONE }, > > .priv_class = &class, > > .defaults = qsv_enc_defaults, > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2022-02-18 1:45 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-15 7:00 Wenbin Chen 2022-02-17 1:44 ` Xiang, Haihao 2022-02-18 1:45 ` Chen, Wenbin [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=MN2PR11MB38868CCEB7EE0850B3114214F8379@MN2PR11MB3886.namprd11.prod.outlook.com \ --to=wenbin.chen-at-intel.com@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git