mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-11 06:58:18 +00:00
lavc/qsv: specify Shift for each format too
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
This commit is contained in:
parent
1496e7c173
commit
3f28116ea2
@ -217,35 +217,42 @@ enum AVPixelFormat ff_qsv_map_fourcc(uint32_t fourcc)
|
|||||||
return AV_PIX_FMT_NONE;
|
return AV_PIX_FMT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc)
|
int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc, uint16_t *shift)
|
||||||
{
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case AV_PIX_FMT_YUV420P:
|
case AV_PIX_FMT_YUV420P:
|
||||||
case AV_PIX_FMT_YUVJ420P:
|
case AV_PIX_FMT_YUVJ420P:
|
||||||
case AV_PIX_FMT_NV12:
|
case AV_PIX_FMT_NV12:
|
||||||
*fourcc = MFX_FOURCC_NV12;
|
*fourcc = MFX_FOURCC_NV12;
|
||||||
|
*shift = 0;
|
||||||
return AV_PIX_FMT_NV12;
|
return AV_PIX_FMT_NV12;
|
||||||
case AV_PIX_FMT_YUV420P10:
|
case AV_PIX_FMT_YUV420P10:
|
||||||
case AV_PIX_FMT_P010:
|
case AV_PIX_FMT_P010:
|
||||||
*fourcc = MFX_FOURCC_P010;
|
*fourcc = MFX_FOURCC_P010;
|
||||||
|
*shift = 1;
|
||||||
return AV_PIX_FMT_P010;
|
return AV_PIX_FMT_P010;
|
||||||
case AV_PIX_FMT_X2RGB10:
|
case AV_PIX_FMT_X2RGB10:
|
||||||
*fourcc = MFX_FOURCC_A2RGB10;
|
*fourcc = MFX_FOURCC_A2RGB10;
|
||||||
|
*shift = 1;
|
||||||
return AV_PIX_FMT_X2RGB10;
|
return AV_PIX_FMT_X2RGB10;
|
||||||
case AV_PIX_FMT_BGRA:
|
case AV_PIX_FMT_BGRA:
|
||||||
*fourcc = MFX_FOURCC_RGB4;
|
*fourcc = MFX_FOURCC_RGB4;
|
||||||
|
*shift = 0;
|
||||||
return AV_PIX_FMT_BGRA;
|
return AV_PIX_FMT_BGRA;
|
||||||
#if CONFIG_VAAPI
|
#if CONFIG_VAAPI
|
||||||
case AV_PIX_FMT_YUV422P:
|
case AV_PIX_FMT_YUV422P:
|
||||||
case AV_PIX_FMT_YUYV422:
|
case AV_PIX_FMT_YUYV422:
|
||||||
*fourcc = MFX_FOURCC_YUY2;
|
*fourcc = MFX_FOURCC_YUY2;
|
||||||
|
*shift = 0;
|
||||||
return AV_PIX_FMT_YUYV422;
|
return AV_PIX_FMT_YUYV422;
|
||||||
case AV_PIX_FMT_YUV422P10:
|
case AV_PIX_FMT_YUV422P10:
|
||||||
case AV_PIX_FMT_Y210:
|
case AV_PIX_FMT_Y210:
|
||||||
*fourcc = MFX_FOURCC_Y210;
|
*fourcc = MFX_FOURCC_Y210;
|
||||||
|
*shift = 1;
|
||||||
return AV_PIX_FMT_Y210;
|
return AV_PIX_FMT_Y210;
|
||||||
case AV_PIX_FMT_VUYX:
|
case AV_PIX_FMT_VUYX:
|
||||||
*fourcc = MFX_FOURCC_AYUV;
|
*fourcc = MFX_FOURCC_AYUV;
|
||||||
|
*shift = 0;
|
||||||
return AV_PIX_FMT_VUYX;
|
return AV_PIX_FMT_VUYX;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
@ -132,7 +132,7 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id);
|
|||||||
|
|
||||||
enum AVPixelFormat ff_qsv_map_fourcc(uint32_t fourcc);
|
enum AVPixelFormat ff_qsv_map_fourcc(uint32_t fourcc);
|
||||||
|
|
||||||
int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc);
|
int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc, uint16_t *shift);
|
||||||
enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type);
|
enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type);
|
||||||
|
|
||||||
enum AVFieldOrder ff_qsv_map_picstruct(int mfx_pic_struct);
|
enum AVFieldOrder ff_qsv_map_picstruct(int mfx_pic_struct);
|
||||||
|
@ -553,7 +553,7 @@ static int init_video_param_jpeg(AVCodecContext *avctx, QSVEncContext *q)
|
|||||||
if (!desc)
|
if (!desc)
|
||||||
return AVERROR_BUG;
|
return AVERROR_BUG;
|
||||||
|
|
||||||
ret = ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
|
ret = ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC, &q->param.mfx.FrameInfo.Shift);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return AVERROR_BUG;
|
return AVERROR_BUG;
|
||||||
|
|
||||||
@ -567,7 +567,6 @@ static int init_video_param_jpeg(AVCodecContext *avctx, QSVEncContext *q)
|
|||||||
!desc->log2_chroma_w + !desc->log2_chroma_h;
|
!desc->log2_chroma_w + !desc->log2_chroma_h;
|
||||||
q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth;
|
q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth;
|
||||||
q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth;
|
q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth;
|
||||||
q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8;
|
|
||||||
|
|
||||||
q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, 16);
|
q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, 16);
|
||||||
q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 16);
|
q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 16);
|
||||||
@ -653,7 +652,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
|
|||||||
if (!desc)
|
if (!desc)
|
||||||
return AVERROR_BUG;
|
return AVERROR_BUG;
|
||||||
|
|
||||||
ret = ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC);
|
ret = ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC, &q->param.mfx.FrameInfo.Shift);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return AVERROR_BUG;
|
return AVERROR_BUG;
|
||||||
|
|
||||||
@ -667,7 +666,6 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
|
|||||||
!desc->log2_chroma_w + !desc->log2_chroma_h;
|
!desc->log2_chroma_w + !desc->log2_chroma_h;
|
||||||
q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth;
|
q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth;
|
||||||
q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth;
|
q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth;
|
||||||
q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8;
|
|
||||||
|
|
||||||
// If the minor version is greater than or equal to 19,
|
// If the minor version is greater than or equal to 19,
|
||||||
// then can use the same alignment settings as H.264 for HEVC
|
// then can use the same alignment settings as H.264 for HEVC
|
||||||
|
Loading…
Reference in New Issue
Block a user