You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
libavcodec/qsvenc.c: More correct selection of alignment of a frame height depending whether an encoded sequence progressive or not.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
committed by
Michael Niedermayer
parent
859731d642
commit
38402754b9
@@ -65,18 +65,29 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
|
|||||||
q->param.mfx.BufferSizeInKB = 0;
|
q->param.mfx.BufferSizeInKB = 0;
|
||||||
|
|
||||||
q->param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
|
q->param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
|
||||||
q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, 16);
|
|
||||||
q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 32);
|
|
||||||
q->param.mfx.FrameInfo.CropX = 0;
|
q->param.mfx.FrameInfo.CropX = 0;
|
||||||
q->param.mfx.FrameInfo.CropY = 0;
|
q->param.mfx.FrameInfo.CropY = 0;
|
||||||
q->param.mfx.FrameInfo.CropW = avctx->width;
|
q->param.mfx.FrameInfo.CropW = avctx->width;
|
||||||
q->param.mfx.FrameInfo.CropH = avctx->height;
|
q->param.mfx.FrameInfo.CropH = avctx->height;
|
||||||
q->param.mfx.FrameInfo.AspectRatioW = avctx->sample_aspect_ratio.num;
|
q->param.mfx.FrameInfo.AspectRatioW = avctx->sample_aspect_ratio.num;
|
||||||
q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den;
|
q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den;
|
||||||
q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
|
|
||||||
q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
|
q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
|
||||||
q->param.mfx.FrameInfo.BitDepthLuma = 8;
|
q->param.mfx.FrameInfo.BitDepthLuma = 8;
|
||||||
q->param.mfx.FrameInfo.BitDepthChroma = 8;
|
q->param.mfx.FrameInfo.BitDepthChroma = 8;
|
||||||
|
q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, 16);
|
||||||
|
|
||||||
|
if (avctx->flags & CODEC_FLAG_INTERLACED_DCT) {
|
||||||
|
/* A true field layout (TFF or BFF) is not important here,
|
||||||
|
it will specified later during frame encoding. But it is important
|
||||||
|
to specify is frame progressive or not because allowed heigh alignment
|
||||||
|
does depend by this.
|
||||||
|
*/
|
||||||
|
q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_FIELD_TFF;
|
||||||
|
q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 32);
|
||||||
|
} else {
|
||||||
|
q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
|
||||||
|
q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 16);
|
||||||
|
}
|
||||||
|
|
||||||
if (avctx->framerate.den > 0 && avctx->framerate.num > 0) {
|
if (avctx->framerate.den > 0 && avctx->framerate.num > 0) {
|
||||||
q->param.mfx.FrameInfo.FrameRateExtN = avctx->framerate.num;
|
q->param.mfx.FrameInfo.FrameRateExtN = avctx->framerate.num;
|
||||||
|
Reference in New Issue
Block a user