Message ID | 20220221072833.967303-1-wenbin.chen@intel.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,v2] libavcodec/qsvenc: add more ChromaFormat support to mjpeg_qsv | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_aarch64_jetson | success | Make finished |
andriy/make_fate_aarch64_jetson | success | Make fate finished |
andriy/make_armv7_RPi4 | success | Make finished |
andriy/make_fate_armv7_RPi4 | success | Make fate finished |
On Mon, 2022-02-21 at 15:28 +0800, Wenbin Chen wrote: > ChromaForamt for mjpeg-qsv is always set to yuv420, and this will be > wrong when encode other pixel format (for example yuyv422). ChromaFormat > is changed to be adaptive to pix_fmt. > > Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> > --- > libavcodec/qsvenc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c > index 07be4287b7..3d9dfb13b0 100644 > --- a/libavcodec/qsvenc.c > +++ b/libavcodec/qsvenc.c > @@ -616,7 +616,8 @@ static int init_video_param_jpeg(AVCodecContext *avctx, > QSVEncContext *q) > q->param.mfx.FrameInfo.CropH = avctx->height; > q->param.mfx.FrameInfo.AspectRatioW = avctx->sample_aspect_ratio.num; > q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den; > - q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; > + q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420 + > + !desc->log2_chroma_w + !desc- > >log2_chroma_h; > q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; > q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; > q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8; LGTM and applied, thx -Haihao
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 07be4287b7..3d9dfb13b0 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -616,7 +616,8 @@ static int init_video_param_jpeg(AVCodecContext *avctx, QSVEncContext *q) q->param.mfx.FrameInfo.CropH = avctx->height; q->param.mfx.FrameInfo.AspectRatioW = avctx->sample_aspect_ratio.num; q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den; - q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; + q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420 + + !desc->log2_chroma_w + !desc->log2_chroma_h; q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8;
ChromaForamt for mjpeg-qsv is always set to yuv420, and this will be wrong when encode other pixel format (for example yuyv422). ChromaFormat is changed to be adaptive to pix_fmt. Signed-off-by: Wenbin Chen <wenbin.chen@intel.com> --- libavcodec/qsvenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)