Re: [FFmpeg-devel] [PATCH v2 1/3] avcodec/avs3_parser: set has_b_frames properly
> On May 13, 2022, at 6:12 PM, Zhao Zhili wrote: > > has_b_frames should be output_reorder_delay field in AVS3 sequence > header and larger than 1. The parser implementation doesn't parse > that field. Decoder can set has_b_frames properly, so use FFMAX > here to avoid resetting has_b_frames from output_reorder_delay to 1. > --- > libavcodec/avs3_parser.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c > index d04d96a03a..a9fd879e9d 100644 > --- a/libavcodec/avs3_parser.c > +++ b/libavcodec/avs3_parser.c > @@ -71,7 +71,7 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, > const uint8_t *buf, > if (buf[0] == 0x0 && buf[1] == 0x0 && buf[2] == 0x1) { > if (buf[3] == AVS3_SEQ_START_CODE) { > GetBitContext gb; > -int profile, ratecode; > +int profile, ratecode, low_delay; > > init_get_bits8(, buf + 4, buf_size - 4); > > @@ -114,7 +114,8 @@ static void parse_avs3_nal_units(AVCodecParserContext *s, > const uint8_t *buf, > //bitrate_high(12) > skip_bits(, 32); > > -avctx->has_b_frames = !get_bits(, 1); > +low_delay = get_bits(, 1); > +avctx->has_b_frames = FFMAX(avctx->has_b_frames, !low_delay); > > avctx->framerate.num = avctx->time_base.den = > ff_avs3_frame_rate_tab[ratecode].num; > avctx->framerate.den = avctx->time_base.num = > ff_avs3_frame_rate_tab[ratecode].den; > -- > 2.35.3 > Will apply this patchset tomorrow unless there are objections. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/libuavs3d: fix access uninitialized variable when draining
> On May 13, 2022, at 8:59 AM, myp...@gmail.com wrote: > > On Thu, May 12, 2022 at 5:55 PM Zhao Zhili wrote: >> >> buf_ptr is uninitialized and accessed when function return. >> --- >> libavcodec/libuavs3d.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/libavcodec/libuavs3d.c b/libavcodec/libuavs3d.c >> index 6966e00b62..23de4c8cd5 100644 >> --- a/libavcodec/libuavs3d.c >> +++ b/libavcodec/libuavs3d.c >> @@ -149,7 +149,7 @@ static int libuavs3d_decode_frame(AVCodecContext *avctx, >> AVFrame *frm, >> const uint8_t *buf = avpkt->data; >> int buf_size = avpkt->size; >> const uint8_t *buf_end; >> -const uint8_t *buf_ptr; >> +const uint8_t *buf_ptr = buf; >> int left_bytes; >> int ret, finish = 0; >> >> @@ -170,7 +170,6 @@ static int libuavs3d_decode_frame(AVCodecContext *avctx, >> AVFrame *frm, >> } else { >> uavs3d_io_frm_t *frm_dec = >dec_frame; >> >> -buf_ptr = buf; >> buf_end = buf + buf_size; >> frm_dec->pkt_pos = avpkt->pos; >> frm_dec->pkt_size = avpkt->size; >> -- >> 2.35.3 > Sounds Good To Me Applied, thanks! ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v7 1/2] lavc/vaapi_encode: add support for maxframesize
> -Original Message- > From: ffmpeg-devel On Behalf Of Fei > Wang > Sent: Thursday, May 5, 2022 5:07 PM > To: ffmpeg-devel@ffmpeg.org > Cc: Wang, Fei W ; Linjie Fu > Subject: [FFmpeg-devel] [PATCH v7 1/2] lavc/vaapi_encode: add support for > maxframesize > > From: Linjie Fu > > Add support for max frame size: > - max_frame_size (bytes) to indicate the max allowed size for frame. > > Control each encoded frame size into target limitation size by adjusting whole > frame's average QP value. The driver will use multi passes to adjust average > QP > setp by step to achieve the target, and the result may not strictly > guaranteed. > Frame size may exceed target alone with using the maximum average QP value. > The failure always happens on the intra(especially the first intra frame of a > new > GOP) frames or set max_frame_size with a very small number. > > example cmdline: > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -f rawvideo \ > -v verbose -s:v 352x288 -i ./input.yuv -vf format=nv12,hwupload \ > -c:v h264_vaapi -profile:v main -g 30 -rc_mode VBR -b:v 500k \ > -bf 3 -max_frame_size 4 -vframes 100 -y ./max_frame_size.h264 > > Max frame size was enabled since VA-API version (0, 33, 0), but query is > available > since (1, 5, 0). It will be passed as a parameter in picParam and should be > set for > each frame. > > Signed-off-by: Linjie Fu > Signed-off-by: Fei Wang > --- > update: > 1. return error when fail to set max frame size. > 2. refine commit and debug message. > > libavcodec/vaapi_encode.c | 74 > +++ > libavcodec/vaapi_encode.h | 10 +- > 2 files changed, 83 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index > 0e2f5ed447..284ce29888 100644 > --- a/libavcodec/vaapi_encode.c > +++ b/libavcodec/vaapi_encode.c > @@ -365,6 +365,17 @@ static int vaapi_encode_issue(AVCodecContext *avctx, > goto fail; > } > > +#if VA_CHECK_VERSION(1, 5, 0) > +if (ctx->max_frame_size) { > +err = vaapi_encode_make_misc_param_buffer(avctx, pic, > + > VAEncMiscParameterTypeMaxFrameSize, > + >mfs_params, > + sizeof(ctx->mfs_params)); > +if (err < 0) > +goto fail; > +} > +#endif > + > if (pic->type == PICTURE_TYPE_IDR) { > if (ctx->va_packed_headers & VA_ENC_PACKED_HEADER_SEQUENCE && > ctx->codec->write_sequence_header) { @@ -1869,6 +1880,63 @@ > rc_mode_found: > return 0; > } > > +static av_cold int vaapi_encode_init_max_frame_size(AVCodecContext > +*avctx) { #if VA_CHECK_VERSION(1, 5, 0) > +VAAPIEncodeContext *ctx = avctx->priv_data; > +VAConfigAttrib attr = { VAConfigAttribMaxFrameSize }; > +VAStatus vas; > + > +if (ctx->va_rc_mode == VA_RC_CQP) { > +ctx->max_frame_size = 0; > +av_log(avctx, AV_LOG_ERROR, "Max frame size is invalid in CQP rate " > + "control mode.\n"); > +return AVERROR(EINVAL); > +} > + > +vas = vaGetConfigAttributes(ctx->hwctx->display, > +ctx->va_profile, > +ctx->va_entrypoint, > +, 1); > +if (vas != VA_STATUS_SUCCESS) { > +ctx->max_frame_size = 0; > +av_log(avctx, AV_LOG_ERROR, "Failed to query max frame size " > + "config attribute: %d (%s).\n", vas, vaErrorStr(vas)); > +return AVERROR_EXTERNAL; > +} > + > +if (attr.value == VA_ATTRIB_NOT_SUPPORTED) { > +ctx->max_frame_size = 0; > +av_log(avctx, AV_LOG_ERROR, "Max frame size attribute " > + "is not supported.\n"); > +return AVERROR(EINVAL); > +} else { > +VAConfigAttribValMaxFrameSize attr_mfs; > +attr_mfs.value = attr.value; > +// Prefer to use VAEncMiscParameterTypeMaxFrameSize for max frame > size. > +if (!attr_mfs.bits.max_frame_size && attr_mfs.bits.multiple_pass) { > +ctx->max_frame_size = 0; > +av_log(avctx, AV_LOG_ERROR, "Driver only supports multiple pass " > + "max frame size which has not been implemented in > FFmpeg.\n"); > +return AVERROR(EINVAL); > +} > + > +ctx->mfs_params = (VAEncMiscParameterBufferMaxFrameSize){ > +.max_frame_size = ctx->max_frame_size * 8, > +}; > + > +av_log(avctx, AV_LOG_VERBOSE, "Set max frame size: %d bytes.\n", > + ctx->max_frame_size); > +} > +#else > +av_log(avctx, AV_LOG_ERROR, "The max frame size option is not supported > with " > + "this VAAPI version.\n"); > +return AVERROR(EINVAL); > +#endif > + > +return 0; > +} > + > static av_cold int vaapi_encode_init_gop_structure(AVCodecContext
[FFmpeg-devel] [PATCH 2/2] avformat/sctp: close socket on errors
This is untested as i have no testcase Fixes: CID1302709 Signed-off-by: Michael Niedermayer --- libavformat/sctp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/sctp.c b/libavformat/sctp.c index b8e23653d2..9d9e90097e 100644 --- a/libavformat/sctp.c +++ b/libavformat/sctp.c @@ -282,6 +282,8 @@ fail: goto restart; } fail1: +if (fd >= 0) +closesocket(fd); ret = AVERROR(EIO); freeaddrinfo(ai); return ret; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avcodec/flashsv: Check inflate() for failure
Fixes: CID1047223 Signed-off-by: Michael Niedermayer --- libavcodec/flashsv.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 0982161d49..d8943d9cf8 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -149,7 +149,9 @@ static int flashsv2_prime(FlashSVContext *s, const uint8_t *src, int size) zstream->avail_in = size; zstream->next_out = data; zstream->avail_out = s->block_size * 3; -inflate(zstream, Z_SYNC_FLUSH); +zret = inflate(zstream, Z_SYNC_FLUSH); +if (zret != Z_OK && zret != Z_STREAM_END) +return AVERROR_UNKNOWN; remaining = s->block_size * 3 - zstream->avail_out; if ((zret = inflateReset(zstream)) != Z_OK) { @@ -165,7 +167,9 @@ static int flashsv2_prime(FlashSVContext *s, const uint8_t *src, int size) * out of the output from above. See section 3.2.4 of RFC 1951. */ zstream->next_in = zlib_header; zstream->avail_in = sizeof(zlib_header); -inflate(zstream, Z_SYNC_FLUSH); +zret = inflate(zstream, Z_SYNC_FLUSH); +if (zret != Z_OK) +return AVERROR_UNKNOWN; while (remaining > 0) { unsigned block_size = FFMIN(UINT16_MAX, remaining); uint8_t header[5]; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] qsv: add requirement for the mininal version of libmfx
> -Original Message- > From: ffmpeg-devel On Behalf Of Haihao > Xiang > Sent: Sunday, May 22, 2022 2:19 PM > To: ffmpeg-devel@ffmpeg.org > Cc: Haihao Xiang > Subject: [FFmpeg-devel] [PATCH] qsv: add requirement for the mininal > version of libmfx > > libmfx 1.28 was released 3 years ago, it is easy to get a greater > version than 1.28. We may remove lots of compile-time checks if adding > the requirement for the minimal version in the configure script. > --- > configure | 7 +- > libavcodec/qsv.c | 24 -- > libavcodec/qsvenc.c| 471 + > libavcodec/qsvenc.h| 51 +--- > libavcodec/qsvenc_h264.c | 6 - > libavcodec/qsvenc_hevc.c | 10 - > libavfilter/vf_scale_qsv.c | 13 +- > libavfilter/vf_vpp_qsv.c | 143 ++- > libavutil/hwcontext_qsv.c | 2 - > 9 files changed, 249 insertions(+), 478 deletions(-) > > diff --git a/configure b/configure > index f115b21064..2337f0a8f2 100755 > --- a/configure > +++ b/configure > @@ -6566,8 +6566,11 @@ enabled liblensfun&& require_pkg_config > liblensfun lensfun lensfun.h lf_ > # Media SDK or Intel Media Server Studio, these don't come with > # pkg-config support. Instead, users should make sure that the build > # can find the libraries and headers through other means. > -enabled libmfx&& { check_pkg_config libmfx libmfx > "mfx/mfxvideo.h" MFXInit || > - { require libmfx "mfx/mfxvideo.h" MFXInit > "-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; > } } > +enabled libmfx&& { check_pkg_config libmfx "mfx >= 1.28" > "mfx/mfxvideo.h" MFXInit || > + { require libmfx "mfx/mfxvideo.h > mfx/mfxdefs.h" MFXInit "-llibmfx $advapi32_extralibs" && > + { test_cpp_condition mfx/mfxdefs.h > "MFX_VERSION >= 1028" || die "ERROR: libmfx version must be >= 1.28"; } > && > + warn "using libmfx without pkg-config"; > } } > + > if enabled libmfx; then > check_cc MFX_CODEC_VP9 "mfx/mfxvp9.h mfx/mfxstructures.h" > "MFX_CODEC_VP9" > fi > diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c > index b86c20b153..385b43bb6c 100644 > --- a/libavcodec/qsv.c > +++ b/libavcodec/qsv.c > @@ -38,34 +38,26 @@ > > #define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) > > -#if QSV_VERSION_ATLEAST(1, 12) > #include "mfx/mfxvp8.h" > -#endif > > int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id) > { > switch (codec_id) { > case AV_CODEC_ID_H264: > return MFX_CODEC_AVC; > -#if QSV_VERSION_ATLEAST(1, 8) > case AV_CODEC_ID_HEVC: > return MFX_CODEC_HEVC; > -#endif > case AV_CODEC_ID_MPEG1VIDEO: > case AV_CODEC_ID_MPEG2VIDEO: > return MFX_CODEC_MPEG2; > case AV_CODEC_ID_VC1: > return MFX_CODEC_VC1; > -#if QSV_VERSION_ATLEAST(1, 12) > case AV_CODEC_ID_VP8: > return MFX_CODEC_VP8; > -#endif > case AV_CODEC_ID_MJPEG: > return MFX_CODEC_JPEG; > -#if QSV_VERSION_ATLEAST(1, 19) > case AV_CODEC_ID_VP9: > return MFX_CODEC_VP9; > -#endif > #if QSV_VERSION_ATLEAST(1, 34) > case AV_CODEC_ID_AV1: > return MFX_CODEC_AV1; > @@ -189,17 +181,11 @@ 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) > case MFX_FOURCC_Y210: return AV_PIX_FMT_Y210; > -#endif > #endif > } > return AV_PIX_FMT_NONE; > @@ -217,27 +203,21 @@ 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: > *fourcc = MFX_FOURCC_YUY2; > return AV_PIX_FMT_YUYV422; > -#if QSV_VERSION_ATLEAST(1, 27) > case AV_PIX_FMT_YUV422P10: > case AV_PIX_FMT_Y210: > *fourcc = MFX_FOURCC_Y210; > return AV_PIX_FMT_Y210; > -#endif > #endif > default: > return AVERROR(ENOSYS); > @@ -438,9 +418,7 @@ int ff_qsv_init_internal_session(AVCodecContext > *avctx, QSVSession *qs, > const char *desc; > int ret; > > -#if
Re: [FFmpeg-devel] [RFC] QSV: Introduce min Compile-SDK Version and check for Runtime-Versions instead
> -Original Message- > From: ffmpeg-devel On Behalf Of Xiang, > Haihao > Sent: Sunday, May 22, 2022 2:25 PM > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [RFC] QSV: Introduce min Compile-SDK Version > and check for Runtime-Versions instead > > > > > -Original Message- > > > From: ffmpeg-devel On Behalf Of Soft > > > Works > > > Sent: Wednesday, January 12, 2022 4:37 AM > > > To: FFmpeg development discussions and patches > > de...@ffmpeg.org> > > > Subject: Re: [FFmpeg-devel] [RFC] QSV: Introduce min Compile-SDK > > > Version and check for Runtime-Versions instead > > > > [..] > > > > > > > Question > > > > > > > > > > Having both - run-time and compile-time checks all over the code > > > > > > is adding > > > > > a lot of complexity and makes it difficult to maintain and work > > > > > > with. > > > > > > > > > > Hence, I'm wondering whether we couldn't/shouldn't introduce a > > > > > > minimum > > > > > MSDK compile-time version, for example 1.22, or even later? > > > > > > > > > > This would allow simplification of the QSV code in many places > > > > > > where run- > > > > time > > > > > version checks are actually needed instead. > > > > > > > > > > Over time, there have been better and worse MSDK versions, and > > > > > > there > > > > > should still be enough room for choosing, but I don't think > > > > > > there's any > > > > > reason why somebody would still want to compile against some > > > > > > really old > > > > > (e.g. < 1.22) MSDK version. > > > > > > > > > > Please share your thoughts on this subject.. > > > > > > > > I agree we may add a requirement for the minimal compiling version > > > > > > in > > > > configure, > > > > version 1.28 was released 3 years ago, how about using this version > > > > > > as the > > > > minimal compiling version ? > > > > > > I'm fine with 1.28! > > > > > > Are there any objections towards setting 1.28 as a minimum requirement > > for the MSDK (QSV) compile-time version? > > > > I submitted https://ffmpeg.org/pipermail/ffmpeg-devel/2022- > May/296699.html,could you take a look when you have time ? Hi Haihao, thanks a lot for taking care of this, I just couldn't find the time since I had made the suggestion. I got it merged and going over it now. sw ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] qsv: add requirement for the mininal version of libmfx
On Sun, 22 May 2022, at 14:19, Haihao Xiang wrote: > libmfx 1.28 was released 3 years ago, it is easy to get a greater > version than 1.28. We may remove lots of compile-time checks if adding > the requirement for the minimal version in the configure script. I think this is reasonable. jb -- Jean-Baptiste Kempf - President +33 672 704 734 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [RFC] QSV: Introduce min Compile-SDK Version and check for Runtime-Versions instead
> > -Original Message- > > From: ffmpeg-devel On Behalf Of Soft > > Works > > Sent: Wednesday, January 12, 2022 4:37 AM > > To: FFmpeg development discussions and patches > de...@ffmpeg.org> > > Subject: Re: [FFmpeg-devel] [RFC] QSV: Introduce min Compile-SDK > > Version and check for Runtime-Versions instead > > [..] > > > > > Question > > > > > > > > Having both - run-time and compile-time checks all over the code > > > > is adding > > > > a lot of complexity and makes it difficult to maintain and work > > > > with. > > > > > > > > Hence, I'm wondering whether we couldn't/shouldn't introduce a > > > > minimum > > > > MSDK compile-time version, for example 1.22, or even later? > > > > > > > > This would allow simplification of the QSV code in many places > > > > where run- > > > time > > > > version checks are actually needed instead. > > > > > > > > Over time, there have been better and worse MSDK versions, and > > > > there > > > > should still be enough room for choosing, but I don't think > > > > there's any > > > > reason why somebody would still want to compile against some > > > > really old > > > > (e.g. < 1.22) MSDK version. > > > > > > > > Please share your thoughts on this subject.. > > > > > > I agree we may add a requirement for the minimal compiling version > > > > in > > > configure, > > > version 1.28 was released 3 years ago, how about using this version > > > > as the > > > minimal compiling version ? > > > > I'm fine with 1.28! > > > Are there any objections towards setting 1.28 as a minimum requirement > for the MSDK (QSV) compile-time version? > I submitted https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296699.html,could you take a look when you have time ? Thanks Haihao ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] qsv: add requirement for the mininal version of libmfx
libmfx 1.28 was released 3 years ago, it is easy to get a greater version than 1.28. We may remove lots of compile-time checks if adding the requirement for the minimal version in the configure script. --- configure | 7 +- libavcodec/qsv.c | 24 -- libavcodec/qsvenc.c| 471 + libavcodec/qsvenc.h| 51 +--- libavcodec/qsvenc_h264.c | 6 - libavcodec/qsvenc_hevc.c | 10 - libavfilter/vf_scale_qsv.c | 13 +- libavfilter/vf_vpp_qsv.c | 143 ++- libavutil/hwcontext_qsv.c | 2 - 9 files changed, 249 insertions(+), 478 deletions(-) diff --git a/configure b/configure index f115b21064..2337f0a8f2 100755 --- a/configure +++ b/configure @@ -6566,8 +6566,11 @@ enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h lf_ # Media SDK or Intel Media Server Studio, these don't come with # pkg-config support. Instead, users should make sure that the build # can find the libraries and headers through other means. -enabled libmfx&& { check_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit || - { require libmfx "mfx/mfxvideo.h" MFXInit "-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; } } +enabled libmfx&& { check_pkg_config libmfx "mfx >= 1.28" "mfx/mfxvideo.h" MFXInit || + { require libmfx "mfx/mfxvideo.h mfx/mfxdefs.h" MFXInit "-llibmfx $advapi32_extralibs" && + { test_cpp_condition mfx/mfxdefs.h "MFX_VERSION >= 1028" || die "ERROR: libmfx version must be >= 1.28"; } && + warn "using libmfx without pkg-config"; } } + if enabled libmfx; then check_cc MFX_CODEC_VP9 "mfx/mfxvp9.h mfx/mfxstructures.h" "MFX_CODEC_VP9" fi diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index b86c20b153..385b43bb6c 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -38,34 +38,26 @@ #define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) -#if QSV_VERSION_ATLEAST(1, 12) #include "mfx/mfxvp8.h" -#endif int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id) { switch (codec_id) { case AV_CODEC_ID_H264: return MFX_CODEC_AVC; -#if QSV_VERSION_ATLEAST(1, 8) case AV_CODEC_ID_HEVC: return MFX_CODEC_HEVC; -#endif case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: return MFX_CODEC_MPEG2; case AV_CODEC_ID_VC1: return MFX_CODEC_VC1; -#if QSV_VERSION_ATLEAST(1, 12) case AV_CODEC_ID_VP8: return MFX_CODEC_VP8; -#endif case AV_CODEC_ID_MJPEG: return MFX_CODEC_JPEG; -#if QSV_VERSION_ATLEAST(1, 19) case AV_CODEC_ID_VP9: return MFX_CODEC_VP9; -#endif #if QSV_VERSION_ATLEAST(1, 34) case AV_CODEC_ID_AV1: return MFX_CODEC_AV1; @@ -189,17 +181,11 @@ 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) case MFX_FOURCC_Y210: return AV_PIX_FMT_Y210; -#endif #endif } return AV_PIX_FMT_NONE; @@ -217,27 +203,21 @@ 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: *fourcc = MFX_FOURCC_YUY2; return AV_PIX_FMT_YUYV422; -#if QSV_VERSION_ATLEAST(1, 27) case AV_PIX_FMT_YUV422P10: case AV_PIX_FMT_Y210: *fourcc = MFX_FOURCC_Y210; return AV_PIX_FMT_Y210; -#endif #endif default: return AVERROR(ENOSYS); @@ -438,9 +418,7 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, const char *desc; int ret; -#if QSV_VERSION_ATLEAST(1, 16) init_par.GPUCopy= gpu_copy; -#endif init_par.Implementation = impl; init_par.Version= ver; ret = MFXInitEx(init_par, >session); @@ -791,9 +769,7 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, "from the session\n"); } -#if QSV_VERSION_ATLEAST(1, 16) init_par.GPUCopy= gpu_copy; -#endif init_par.Implementation = impl; init_par.Version= ver; err = MFXInitEx(init_par, ); diff --git
Re: [FFmpeg-devel] [PATCH v2 0/1] [WIP] avutil/csp changes
Would it make sense to regroup the structs like this? typedef struct AVCIExy { AVRational x, y; } AVCIExy; struct AVPrimaryCoefficients { AVCIExy r, g, b; AVCIExy wp; }; typedef AVCIExy AVWhitepointCoefficients; /* optional */ On Sun, 22 May 2022 01:31:43 -0400 Leo Izen wrote: > Changes in v2: > - increase precision for AVR() macro to 100k, at haasn's request > - add #define AVUTIL_CSP_DENOM 10 > - add 0.5 to the AVR macro definition to get exact values from truncation > > This patch is a work in progress example for swapping these > structs from doubles to AVRationals. > > There's two main discussions here to be had > - Is this API to be exposed as avpriv_ or av_? > - Should these structs use AVRational or double values? > > I don't believe a consensus has been reached on this yet, but I've attached > an AVRational version of it so we can see the pros/cons. > > Leo Izen (1): > avutil/csp: create public API for colorspace structs > > libavfilter/colorspace.c| 143 > libavfilter/colorspace.h| 31 +--- > libavfilter/fflcms2.c | 25 --- > libavfilter/fflcms2.h | 4 +- > libavfilter/vf_colorspace.c | 37 +- > libavfilter/vf_iccdetect.c | 5 +- > libavfilter/vf_tonemap.c| 17 + > libavutil/Makefile | 2 + > libavutil/csp.c | 121 ++ > libavutil/csp.h | 51 + > libavutil/version.h | 4 +- > 11 files changed, 252 insertions(+), 188 deletions(-) > create mode 100644 libavutil/csp.c > create mode 100644 libavutil/csp.h > > -- > 2.36.1 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@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-requ...@ffmpeg.org with subject "unsubscribe".