[FFmpeg-devel] [PATCH 1/2] avformat/sbgdec: Use avio_read_to_bprint() where appropriate
Note: There is a slight difference in the handling of the max_file_size option: The earlier code used it to mean to limit the size of the buffer to allocate; the new code treats it more literally as maximum size to read from the input. Signed-off-by: Andreas Rheinhardt --- libavformat/sbgdec.c | 63 ++-- 1 file changed, 25 insertions(+), 38 deletions(-) diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c index 5edb9664cc..c1995759a8 100644 --- a/libavformat/sbgdec.c +++ b/libavformat/sbgdec.c @@ -22,6 +22,7 @@ #include #include #include +#include "libavutil/bprint.h" #include "libavutil/channel_layout.h" #include "libavutil/intreadwrite.h" #include "libavutil/log.h" @@ -859,37 +860,20 @@ fail: return r; } -static int read_whole_file(AVIOContext *io, int max_size, char **rbuf) +static int read_whole_file(AVIOContext *io, int max_size, AVBPrint *rbuf) { -char *buf = NULL; -int size = 0, bufsize = 0, r; - -while (1) { -if (bufsize - size < 1024) { -bufsize = FFMIN(FFMAX(2 * bufsize, 8192), max_size); -if (bufsize - size < 2) { -size = AVERROR(EFBIG); -goto fail; -} -buf = av_realloc_f(buf, bufsize, 1); -if (!buf) { -size = AVERROR(ENOMEM); -goto fail; -} -} -r = avio_read(io, buf, bufsize - size - 1); -if (r == AVERROR_EOF) -break; -if (r < 0) -goto fail; -size += r; -} -buf[size] = 0; -*rbuf = buf; -return size; -fail: -av_free(buf); -return size; +int ret = avio_read_to_bprint(io, rbuf, max_size); +if (ret < 0) +return ret; +if (!av_bprint_is_complete(rbuf)) +return AVERROR(ENOMEM); +/* Check if we have read the whole file. AVIOContext.eof_reached is only + * set after a read failed due to EOF, so this check is incorrect in case + * max_size equals the actual file size, but checking for that would + * require attempting to read beyond max_size. */ +if (!io->eof_reached) +return AVERROR(EFBIG); +return 0; } static int expand_timestamps(void *log, struct sbg_script *s) @@ -1407,19 +1391,21 @@ static av_cold int sbg_read_probe(const AVProbeData *p) static av_cold int sbg_read_header(AVFormatContext *avf) { struct sbg_demuxer *sbg = avf->priv_data; +AVBPrint bprint; int r; -char *buf = NULL; struct sbg_script script = { 0 }; AVStream *st; FFStream *sti; struct ws_intervals inter = { 0 }; -r = read_whole_file(avf->pb, sbg->max_file_size, ); +av_bprint_init(, 0, sbg->max_file_size + 1U); +r = read_whole_file(avf->pb, sbg->max_file_size, ); if (r < 0) -goto fail; -r = parse_script(avf, buf, r, ); +goto fail2; + +r = parse_script(avf, bprint.str, bprint.len, ); if (r < 0) -goto fail; +goto fail2; if (!sbg->sample_rate) sbg->sample_rate = script.sample_rate; else @@ -1431,8 +1417,8 @@ static av_cold int sbg_read_header(AVFormatContext *avf) "-m is ignored and mix channels will be silent.\n"); r = expand_script(avf, ); if (r < 0) -goto fail; -av_freep(); +goto fail2; +av_bprint_finalize(, NULL); r = generate_intervals(avf, , sbg->sample_rate, ); if (r < 0) goto fail; @@ -1467,10 +1453,11 @@ static av_cold int sbg_read_header(AVFormatContext *avf) free_script(); return 0; +fail2: +av_bprint_finalize(, NULL); fail: av_free(inter.inter); free_script(); -av_free(buf); return r; } -- 2.34.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] lsws/ppc/yuv2rgb_altivec: Fix build in non-VSX environments with Clang
lsws/ppc/yuv2rgb_altivec: Fix build in non-VSX environments with Clang libswscale/ppc/yuv2rgb_altivec.c:288:36: error: redeclaration of 'vec_xl' must have the 'overloadable' attribute --- libswscale/ppc/yuv2rgb_altivec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/ppc/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c index 5e1033a973..6ef2441d8a 100644 --- a/libswscale/ppc/yuv2rgb_altivec.c +++ b/libswscale/ppc/yuv2rgb_altivec.c @@ -284,7 +284,7 @@ static inline void cvtyuvtoRGB(SwsContext *c, vector signed short Y, * -- */ -#if !HAVE_VSX +#if !HAVE_VSX && !defined(__clang__) static inline vector unsigned char vec_xl(signed long long offset, const ubyte *addr) { const vector unsigned char *v_addr = (const vector unsigned char *) (addr + offset); @@ -292,7 +292,7 @@ static inline vector unsigned char vec_xl(signed long long offset, const ubyte * return (vector unsigned char) vec_perm(v_addr[0], v_addr[1], align_perm); } -#endif /* !HAVE_VSX */ +#endif /* !HAVE_VSX && !__clang__ */ #define DEFCSP420_CVT(name, out_pixels) \ static int altivec_ ## name(SwsContext *c, const unsigned char **in, \ -- 2.41.0 ___ 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 v3 6/6] lavc/vaapi_encode: Add VAAPI AV1 encoder
On 03/08/2023 07:01, fei.w.wang-at-intel@ffmpeg.org wrote: From: Fei Wang Signed-off-by: Fei Wang --- Changelog |1 + configure |3 + doc/encoders.texi | 13 + libavcodec/Makefile |1 + libavcodec/allcodecs.c|1 + libavcodec/vaapi_encode.c | 125 +++- libavcodec/vaapi_encode.h | 12 + libavcodec/vaapi_encode_av1.c | 1229 + libavcodec/version.h |2 +- 9 files changed, 1368 insertions(+), 19 deletions(-) create mode 100644 libavcodec/vaapi_encode_av1.c I assume this is tested on Intel hardware. Is it tested on AMD as well? (Apparently working in recent Mesa.) diff --git a/Changelog b/Changelog index bbda4f4fd4..e86f742cd3 100644 --- a/Changelog +++ b/Changelog @@ -27,6 +27,7 @@ version : - Bitstream filter for converting VVC from MP4 to Annex B - scale_vt filter for videotoolbox - transpose_vt filter for videotoolbox +- VAAPI AV1 encoder version 6.0: - Radiance HDR image support diff --git a/configure b/configure index 99388e7664..68a238a819 100755 --- a/configure +++ b/configure @@ -3322,6 +3322,8 @@ av1_qsv_decoder_select="qsvdec" av1_qsv_encoder_select="qsvenc" av1_qsv_encoder_deps="libvpl" av1_amf_encoder_deps="amf" +av1_vaapi_encoder_deps="VAEncPictureParameterBufferAV1" +av1_vaapi_encoder_select="cbs_av1 vaapi_encode" # parsers aac_parser_select="adts_header mpeg4audio" @@ -7106,6 +7108,7 @@ if enabled vaapi; then check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG" check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8" check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9" +check_type "va/va.h va/va_enc_av1.h" "VAEncPictureParameterBufferAV1" fi if enabled_all opencl libdrm ; then diff --git a/doc/encoders.texi b/doc/encoders.texi index 25d6b7f09e..fb331ebd8e 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3991,6 +3991,19 @@ Average variable bitrate. Each encoder also has its own specific options: @table @option +@item av1_vaapi +@option{profile} sets the value of @emph{seq_profile}. +@option{tier} sets the value of @emph{seq_tier}. +@option{level} sets the value of @emph{seq_level_idx}. + +@table @option +@item tiles +Set the number of tiles to encode the input video with, as columns x rows. +(default is 1x1). Probably needs some clarification that large resolutions must be split into tiles? Maybe an "auto" value for this (meaning use as few as possible), and let explicit "1x1" fail if the resolution is too large. +@item tile_groups +Set tile groups number (default is 1). Meaning what? It splits into tile group OBUs containing equal numbers of tiles, or of equal size in bits, or something else? +@end table + @item h264_vaapi @option{profile} sets the value of @emph{profile_idc} and the @emph{constraint_set*_flag}s. @option{level} sets the value of @emph{level_idc}. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index a6b2ecbb22..473afb4471 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -258,6 +258,7 @@ OBJS-$(CONFIG_AV1_MEDIACODEC_DECODER) += mediacodecdec.o OBJS-$(CONFIG_AV1_MEDIACODEC_ENCODER) += mediacodecenc.o OBJS-$(CONFIG_AV1_NVENC_ENCODER) += nvenc_av1.o nvenc.o OBJS-$(CONFIG_AV1_QSV_ENCODER) += qsvenc_av1.o +OBJS-$(CONFIG_AV1_VAAPI_ENCODER) += vaapi_encode_av1.o av1_levels.o OBJS-$(CONFIG_AVRN_DECODER)+= avrndec.o OBJS-$(CONFIG_AVRP_DECODER)+= r210dec.o OBJS-$(CONFIG_AVRP_ENCODER)+= r210enc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 8775d15a4f..c43c1d7b48 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -844,6 +844,7 @@ extern const FFCodec ff_av1_nvenc_encoder; extern const FFCodec ff_av1_qsv_decoder; extern const FFCodec ff_av1_qsv_encoder; extern const FFCodec ff_av1_amf_encoder; +extern const FFCodec ff_av1_vaapi_encoder; extern const FFCodec ff_libopenh264_encoder; extern const FFCodec ff_libopenh264_decoder; extern const FFCodec ff_h264_amf_encoder; diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 2604f12b9e..2907e159fb 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -669,6 +669,15 @@ static int vaapi_encode_set_output_timestamp(AVCodecContext *avctx, { VAAPIEncodeContext *ctx = avctx->priv_data; +// AV1 packs P frame and next B frame into one pkt, and uses the other +// repeat frame header pkt at the display order position of the P frame +// to indicate its frame index. Each frame has a corresponding pkt in its +// display order position. So don't need to consider delay for AV1 timestamp. +if (avctx->codec_id == AV_CODEC_ID_AV1) { +pkt->dts = pkt->pts - ctx->dts_pts_diff; +return 0; +} This doesn't get you the right
Re: [FFmpeg-devel] [PATCH v3 5/6] lavc/vaapi_encode: Separate reference frame into previous/future list
On 03/08/2023 07:01, fei.w.wang-at-intel@ffmpeg.org wrote: From: Fei Wang To support more reference frames from different directions. Signed-off-by: Fei Wang --- libavcodec/vaapi_encode.c | 112 +--- libavcodec/vaapi_encode.h | 15 +++-- libavcodec/vaapi_encode_h264.c | 94 +-- libavcodec/vaapi_encode_h265.c | 76 +- libavcodec/vaapi_encode_mpeg2.c | 6 +- libavcodec/vaapi_encode_vp8.c | 6 +- libavcodec/vaapi_encode_vp9.c | 26 7 files changed, 208 insertions(+), 127 deletions(-) But why? VAAPI at the top level doesn't care which direction the reference is in, it only cares about the set of reference pictures in the DPB and used as reference. It's up to the per-codec code to decide how it needs to structure that, like how it builds L0/L1 for H.264 but for VP9 it's just a flat set. Thanks, - Mark ___ 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 v3 4/6] lavc/vaapi_encode: Extract set output pkt timestamp function
On 03/08/2023 07:01, fei.w.wang-at-intel@ffmpeg.org wrote: From: Fei Wang Signed-off-by: Fei Wang --- libavcodec/vaapi_encode.c | 37 - 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 8c9f14df66..c8545cd8db 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -650,6 +650,27 @@ fail_at_end: return err; } +static int vaapi_encode_set_output_timestamp(AVCodecContext *avctx, + VAAPIEncodePicture *pic, + AVPacket *pkt) +{ +VAAPIEncodeContext *ctx = avctx->priv_data; + +if (ctx->output_delay == 0) { +pkt->dts = pkt->pts; +} else if (pic->encode_order < ctx->decode_delay) { +if (ctx->ts_ring[pic->encode_order] < INT64_MIN + ctx->dts_pts_diff) +pkt->dts = INT64_MIN; +else +pkt->dts = ctx->ts_ring[pic->encode_order] - ctx->dts_pts_diff; +} else { +pkt->dts = ctx->ts_ring[(pic->encode_order - ctx->decode_delay) % +(3 * ctx->output_delay + ctx->async_depth)]; +} + +return 0; +} + static int vaapi_encode_output(AVCodecContext *avctx, VAAPIEncodePicture *pic, AVPacket *pkt) { @@ -1273,19 +1294,9 @@ int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt) return err; } -if (ctx->output_delay == 0) { -pkt->dts = pkt->pts; -} else if (pic->encode_order < ctx->decode_delay) { -if (ctx->ts_ring[pic->encode_order] < INT64_MIN + ctx->dts_pts_diff) -pkt->dts = INT64_MIN; -else -pkt->dts = ctx->ts_ring[pic->encode_order] - ctx->dts_pts_diff; -} else { -pkt->dts = ctx->ts_ring[(pic->encode_order - ctx->decode_delay) % -(3 * ctx->output_delay + ctx->async_depth)]; -} -av_log(avctx, AV_LOG_DEBUG, "Output packet: pts %"PRId64" dts %"PRId64".\n", - pkt->pts, pkt->dts); +vaapi_encode_set_output_timestamp(avctx, pic, pkt); +av_log(avctx, AV_LOG_DEBUG, "Output packet: pts %"PRId64", dts %"PRId64", " + "size %u bytes.\n", pkt->pts, pkt->dts, pkt->size); Packet size is not unsigned. ctx->output_order = pic->encode_order; vaapi_encode_clear_old(avctx); Seems fair to extract this to its own function, LGTM. Thanks, - Mark ___ 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] configure: use just the pkg-config for sndio
On 2023-08-07 3:30 p.m., Michael Niedermayer wrote: On Mon, Aug 07, 2023 at 03:04:35PM -0400, Brad Smith wrote: On 2023-07-20 3:17 p.m., Brad Smith wrote: On 7/7/2023 3:16 PM, Brad Smith wrote: On 2023-07-01 2:58 p.m., Brad Smith wrote: On 2023-06-23 7:36 p.m., Brad Smith wrote: On 2023-06-23 7:35 p.m., Michael Niedermayer wrote: On Fri, Jun 23, 2023 at 06:56:30PM -0400, Brad Smith wrote: On 2023-06-23 6:55 p.m., Michael Niedermayer wrote: On Fri, Jun 23, 2023 at 06:41:08PM -0400, Brad Smith wrote: ping. On 2023-06-17 6:48 p.m., Brad Smith wrote: On Sun, Jun 18, 2023 at 12:01:14AM +0200, Michael Niedermayer wrote: this breaks a plain configure here on ubuntu ./configure ERROR: sndio not found using pkg-config If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the ffmpeg-u...@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat. Include the log file "ffbuild/config.log" produced by configure as this will help solve the problem. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The misfortune of the wise is better than the prosperity of the fool. -- Epicurus This is what I had intended. You intended to break a plain ./configure on ubuntu ? If so i think we better dont apply that patch :) thx No, there was a second patch there. oops i missed that, the 2nd patch works fine on ubuntu no objections from me thx ping. ping. ping. Is there something wrong with the patch? no, i was just a bit hesitant because i didnt know if anyone or anything would depend on that removed case ill apply it thx Ah, Ok. I was wondering what the issue was since there was no further communication. Thank you. ___ 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] configure: use just the pkg-config for sndio
On Mon, Aug 07, 2023 at 03:04:35PM -0400, Brad Smith wrote: > On 2023-07-20 3:17 p.m., Brad Smith wrote: > > On 7/7/2023 3:16 PM, Brad Smith wrote: > > > On 2023-07-01 2:58 p.m., Brad Smith wrote: > > > > On 2023-06-23 7:36 p.m., Brad Smith wrote: > > > > > On 2023-06-23 7:35 p.m., Michael Niedermayer wrote: > > > > > > On Fri, Jun 23, 2023 at 06:56:30PM -0400, Brad Smith wrote: > > > > > > > On 2023-06-23 6:55 p.m., Michael Niedermayer wrote: > > > > > > > > On Fri, Jun 23, 2023 at 06:41:08PM -0400, Brad Smith wrote: > > > > > > > > > ping. > > > > > > > > > > > > > > > > > > On 2023-06-17 6:48 p.m., Brad Smith wrote: > > > > > > > > > > On Sun, Jun 18, 2023 at 12:01:14AM > > > > > > > > > > +0200, Michael Niedermayer wrote: > > > > > > > > > > > this breaks a plain configure > > > > > > > > > > > here on ubuntu > > > > > > > > > > > > > > > > > > > > > > ./configure > > > > > > > > > > > ERROR: sndio not found using pkg-config > > > > > > > > > > > > > > > > > > > > > > If you think configure made a > > > > > > > > > > > mistake, make sure you are using the > > > > > > > > > > > latest > > > > > > > > > > > version from Git. If the latest > > > > > > > > > > > version fails, report the problem to > > > > > > > > > > > the > > > > > > > > > > > ffmpeg-u...@ffmpeg.org mailing list > > > > > > > > > > > or IRC #ffmpeg on irc.libera.chat. > > > > > > > > > > > Include the log file > > > > > > > > > > > "ffbuild/config.log" produced by > > > > > > > > > > > configure as this will help > > > > > > > > > > > solve the problem. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > [...] > > > > > > > > > > > -- > > > > > > > > > > > Michael GnuPG fingerprint: > > > > > > > > > > > 9FF2128B147EF6730BADF133611EC787040B0FAB > > > > > > > > > > > > > > > > > > > > > > The misfortune of the wise is better > > > > > > > > > > > than the prosperity of the fool. > > > > > > > > > > > -- Epicurus > > > > > > > > > > This is what I had intended. > > > > > > > > You intended to break a plain ./configure on ubuntu ? > > > > > > > > If so i think we better dont apply that patch :) > > > > > > > > > > > > > > > > thx > > > > > > > No, there was a second patch there. > > > > > > oops i missed that, the 2nd patch works fine on ubuntu > > > > > > no objections from me > > > > > > > > > > > > thx > > > > > > > > > > > > ping. > > > > > > > > > > ping. > > > > > > ping. > > > Is there something wrong with the patch? no, i was just a bit hesitant because i didnt know if anyone or anything would depend on that removed case ill apply it thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have often repented speaking, but never of holding my tongue. -- Xenocrates signature.asc Description: PGP signature ___ 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] Hijack of FATE instances
To whom it may concern, It has come to Remlab Tmi's attention that the FATE samples suite has recently been abused to contain non-multimedia files. This is a breach of your trust and we feel that this is totally inappropriate. The FATE instances were explicitly setup and sponsored by Tmi Remlab only for FFmpeg & multimedia. Remlab's FATE instances will no longer be synchronising the sample suite. This comes in effect immediately. All blame for consequent failures should be directed to whoever is mismanaging the FATE suite. If this is not resolved, Remlab reserves the rights to terminate all its FATE instances without notice. -- レミ・デニ-クールモン http://www.remlab.net/ ___ 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] configure: use just the pkg-config for sndio
On 2023-07-20 3:17 p.m., Brad Smith wrote: On 7/7/2023 3:16 PM, Brad Smith wrote: On 2023-07-01 2:58 p.m., Brad Smith wrote: On 2023-06-23 7:36 p.m., Brad Smith wrote: On 2023-06-23 7:35 p.m., Michael Niedermayer wrote: On Fri, Jun 23, 2023 at 06:56:30PM -0400, Brad Smith wrote: On 2023-06-23 6:55 p.m., Michael Niedermayer wrote: On Fri, Jun 23, 2023 at 06:41:08PM -0400, Brad Smith wrote: ping. On 2023-06-17 6:48 p.m., Brad Smith wrote: On Sun, Jun 18, 2023 at 12:01:14AM +0200, Michael Niedermayer wrote: this breaks a plain configure here on ubuntu ./configure ERROR: sndio not found using pkg-config If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the ffmpeg-u...@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat. Include the log file "ffbuild/config.log" produced by configure as this will help solve the problem. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The misfortune of the wise is better than the prosperity of the fool. -- Epicurus This is what I had intended. You intended to break a plain ./configure on ubuntu ? If so i think we better dont apply that patch :) thx No, there was a second patch there. oops i missed that, the 2nd patch works fine on ubuntu no objections from me thx ping. ping. ping. Is there something wrong with the patch? ___ 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] avfilter: add libvmaf_cuda
Hi, Adds the new avfilter `libvmaf_cuda`, integrating the new vmaf_cuda_* apis in libvmaf. Patch attached. Thanks, Kyle 0001-avfilter-add-libvmaf_cuda.patch Description: Binary data ___ 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 8/8] cbs_h266: slice_header, fix inference for pred_weight_table
--- libavcodec/cbs_h266_syntax_template.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index b26d7c1a72..4075897b9a 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3226,17 +3226,16 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, } else { infer(sh_collocated_ref_idx, 0); } -if (!pps->pps_wp_info_in_ph_flag && -((pps->pps_weighted_pred_flag && - current->sh_slice_type == VVC_SLICE_TYPE_P) || - (pps->pps_weighted_bipred_flag && - current->sh_slice_type == VVC_SLICE_TYPE_B))) { -CHECK(FUNC(pred_weight_table) (ctx, rw, sps, pps, ref_pic_lists, - current->num_ref_idx_active, - >sh_pred_weight_table)); -} } - +if (!pps->pps_wp_info_in_ph_flag && +((pps->pps_weighted_pred_flag && +current->sh_slice_type == VVC_SLICE_TYPE_P) || +(pps->pps_weighted_bipred_flag && +current->sh_slice_type == VVC_SLICE_TYPE_B))) { +CHECK(FUNC(pred_weight_table) (ctx, rw, sps, pps, ref_pic_lists, + current->num_ref_idx_active, + >sh_pred_weight_table)); +} } qp_bd_offset = 6 * sps->sps_bitdepth_minus8; if (!pps->pps_qp_delta_info_in_ph_flag) -- 2.25.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 7/8] cbs_h266: H266RawSliceHeader, expose NumRefIdxActive[]
--- libavcodec/cbs_h266.h | 1 + libavcodec/cbs_h266_syntax_template.c | 41 +-- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h index 87a2d02cfd..3a6f6d96b5 100644 --- a/libavcodec/cbs_h266.h +++ b/libavcodec/cbs_h266.h @@ -833,6 +833,7 @@ typedef struct H266RawSliceHeader { // derived values uint32_t num_entry_points; ///< NumEntryPoints +uint8_t num_ref_idx_active[2]; ///< NumRefIdxActive[] } H266RawSliceHeader; diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 501c066faa..b26d7c1a72 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3191,39 +3191,38 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, } else { infer(sh_num_ref_idx_active_override_flag, 1); } + +for (i = 0; i < 2; i++) { +if (current->sh_slice_type == VVC_SLICE_TYPE_B || +(current->sh_slice_type == VVC_SLICE_TYPE_P && i == 0)) { +if (current->sh_num_ref_idx_active_override_flag) { +current->num_ref_idx_active[i] = current->sh_num_ref_idx_active_minus1[i] + 1; +} else { +current->num_ref_idx_active[i] = +FFMIN(ref_pic_lists->rpl_ref_list[i].num_ref_entries, +pps->pps_num_ref_idx_default_active_minus1[i] + 1); +} +} else { +current->num_ref_idx_active[i] = 0; +} +} + if (current->sh_slice_type != VVC_SLICE_TYPE_I) { if (pps->pps_cabac_init_present_flag) flag(sh_cabac_init_flag); else infer(sh_cabac_init_flag, 0); if (ph->ph_temporal_mvp_enabled_flag && !pps->pps_rpl_info_in_ph_flag) { -uint8_t num_ref_idx_active[2]; -for (i = 0; i < 2; i++) { -if (current->sh_slice_type == VVC_SLICE_TYPE_B || -(current->sh_slice_type == VVC_SLICE_TYPE_P && i == 0)) { -if (current->sh_num_ref_idx_active_override_flag) { -num_ref_idx_active[i] = -current->sh_num_ref_idx_active_minus1[i] + 1; -} else { -num_ref_idx_active[i] = - FFMIN(ref_pic_lists->rpl_ref_list[i].num_ref_entries, - pps->pps_num_ref_idx_default_active_minus1[i] + 1); -} -} else { -num_ref_idx_active[i] = 0; -} -} - if (current->sh_slice_type == VVC_SLICE_TYPE_B) flag(sh_collocated_from_l0_flag); else infer(sh_collocated_from_l0_flag, 1); if ((current->sh_collocated_from_l0_flag && - num_ref_idx_active[0] > 1) || + current->num_ref_idx_active[0] > 1) || (!current->sh_collocated_from_l0_flag && - num_ref_idx_active[1] > 1)) { + current->num_ref_idx_active[1] > 1)) { unsigned int idx = current->sh_collocated_from_l0_flag ? 0 : 1; -ue(sh_collocated_ref_idx, 0, num_ref_idx_active[idx] - 1); +ue(sh_collocated_ref_idx, 0, current->num_ref_idx_active[idx] - 1); } else { infer(sh_collocated_ref_idx, 0); } @@ -3233,7 +3232,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, (pps->pps_weighted_bipred_flag && current->sh_slice_type == VVC_SLICE_TYPE_B))) { CHECK(FUNC(pred_weight_table) (ctx, rw, sps, pps, ref_pic_lists, - num_ref_idx_active, + current->num_ref_idx_active, >sh_pred_weight_table)); } } -- 2.25.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 6/8] cbs_h266: H266RawPredWeightTable, expose num_weights_l0 and num_weights_l1
--- libavcodec/cbs_h266.h | 3 ++ libavcodec/cbs_h266_syntax_template.c | 43 +-- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h index 1d80c74feb..87a2d02cfd 100644 --- a/libavcodec/cbs_h266.h +++ b/libavcodec/cbs_h266.h @@ -666,6 +666,9 @@ typedef struct H266RawPredWeightTable { int8_t luma_offset_l1[15]; int8_t delta_chroma_weight_l1[15][2]; int16_t delta_chroma_offset_l1[15][2]; + +uint8_t num_weights_l0; ///< NumWeightsL0 +uint8_t num_weights_l1; ///< NumWeightsL1 } H266RawPredWeightTable; typedef struct H266RawPictureHeader { diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index d0d1ccadd2..501c066faa 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -2507,7 +2507,6 @@ static int FUNC(pred_weight_table) (CodedBitstreamContext *ctx, RWContext *rw, H266RawPredWeightTable *current) { int err, i, j; -uint8_t num_weights_l0, num_weights_l1; ue(luma_log2_weight_denom, 0, 7); if (sps->sps_chroma_format_idc != 0) { se(delta_chroma_log2_weight_denom, @@ -2516,21 +2515,21 @@ static int FUNC(pred_weight_table) (CodedBitstreamContext *ctx, RWContext *rw, } else { infer(delta_chroma_log2_weight_denom, 0); } -if (pps->pps_wp_info_in_ph_flag) +if (pps->pps_wp_info_in_ph_flag) { ue(num_l0_weights, 0, FFMIN(15, ref_lists->rpl_ref_list[0].num_ref_entries)); -else -infer(num_l0_weights, 0); -num_weights_l0 = pps->pps_wp_info_in_ph_flag ? -current->num_l0_weights : num_ref_idx_active[0]; -for (i = 0; i < num_weights_l0; i++) { +infer(num_weights_l0, current->num_l0_weights); +} else { +infer(num_weights_l0, num_ref_idx_active[0]); +} +for (i = 0; i < current->num_weights_l0; i++) { flags(luma_weight_l0_flag[i], 1, i); } if (sps->sps_chroma_format_idc != 0) { -for (i = 0; i < num_weights_l0; i++) +for (i = 0; i < current->num_weights_l0; i++) flags(chroma_weight_l0_flag[i], 1, i); } -for (i = 0; i < num_weights_l0; i++) { +for (i = 0; i < current->num_weights_l0; i++) { if (current->luma_weight_l0_flag[i]) { ses(delta_luma_weight_l0[i], -128, 127, 1, i); ses(luma_offset_l0[i], -128, 127, 1, i); @@ -2546,28 +2545,26 @@ static int FUNC(pred_weight_table) (CodedBitstreamContext *ctx, RWContext *rw, } } -if (pps->pps_weighted_bipred_flag && pps->pps_wp_info_in_ph_flag && +if (pps->pps_weighted_bipred_flag && ref_lists->rpl_ref_list[1].num_ref_entries > 0) { -ue(num_l1_weights, 0, - FFMIN(15, ref_lists->rpl_ref_list[1].num_ref_entries)); -} -if (!pps->pps_weighted_bipred_flag || -(pps->pps_wp_info_in_ph_flag && - ref_lists->rpl_ref_list[1].num_ref_entries == 0)) { -num_weights_l1 = 0; -} else if (pps->pps_wp_info_in_ph_flag) { -num_weights_l1 = current->num_l1_weights; +if (pps->pps_wp_info_in_ph_flag) { +ue(num_l1_weights, 0, + FFMIN(15, ref_lists->rpl_ref_list[1].num_ref_entries)); +infer(num_weights_l1, current->num_l1_weights); +} else { +infer(num_weights_l1, num_ref_idx_active[1]); +} } else { -num_weights_l1 = num_ref_idx_active[1]; +infer(num_weights_l1, 0); } -for (i = 0; i < num_weights_l1; i++) +for (i = 0; i < current->num_weights_l1; i++) flags(luma_weight_l1_flag[i], 1, i); if (sps->sps_chroma_format_idc != 0) { -for (i = 0; i < num_weights_l1; i++) +for (i = 0; i < current->num_weights_l1; i++) flags(chroma_weight_l1_flag[i], 1, i); } -for (i = 0; i < num_weights_l1; i++) { +for (i = 0; i < current->num_weights_l1; i++) { if (current->luma_weight_l1_flag[i]) { ses(delta_luma_weight_l1[i], -128, 127, 1, i); ses(luma_offset_l1[i], -128, 127, 1, i); -- 2.25.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 1/8] cbs_h266: fix inference for sh_lmcs_used_flag and sh_explicit_scaling_list_used_flag
On Mon, Aug 7, 2023 at 11:17 PM James Almer wrote: > On 8/7/2023 11:55 AM, Nuo Mi wrote: > > if sh_picture_header_in_slice_header_flag is true > > sh_lmcs_used_flag and sh_explicit_scaling_list_used_flag are infered > from ph > > --- > > libavcodec/cbs_h266_syntax_template.c | 24 ++-- > > 1 file changed, 14 insertions(+), 10 deletions(-) > > > > diff --git a/libavcodec/cbs_h266_syntax_template.c > b/libavcodec/cbs_h266_syntax_template.c > > index 98a8e033bf..857882655b 100644 > > --- a/libavcodec/cbs_h266_syntax_template.c > > +++ b/libavcodec/cbs_h266_syntax_template.c > > @@ -3151,17 +3151,21 @@ static int FUNC(slice_header) > (CodedBitstreamContext *ctx, RWContext *rw, > > infer(sh_alf_enabled_flag, 0); > > } > > > > -if (ph->ph_lmcs_enabled_flag && > > -!current->sh_picture_header_in_slice_header_flag) > > -flag(sh_lmcs_used_flag); > > -else > > -infer(sh_lmcs_used_flag, 0); > > +if (current->sh_picture_header_in_slice_header_flag) { > > +infer(sh_lmcs_used_flag, ph->ph_lmcs_enabled_flag); > > +infer(sh_explicit_scaling_list_used_flag, > > +ph->ph_explicit_scaling_list_enabled_flag); > > +} else { > > +if (ph->ph_lmcs_enabled_flag) > > +flag(sh_lmcs_used_flag); > > +else > > +infer(sh_lmcs_used_flag, 0); > > > > -if (ph->ph_explicit_scaling_list_enabled_flag && > > -!current->sh_picture_header_in_slice_header_flag) > > -flag(sh_explicit_scaling_list_used_flag); > > -else > > -infer(sh_explicit_scaling_list_used_flag, 0); > > +if (ph->ph_explicit_scaling_list_enabled_flag) > > +flag(sh_explicit_scaling_list_used_flag); > > +else > > +infer(sh_explicit_scaling_list_used_flag, 0); > > +} > > > > if (!pps->pps_rpl_info_in_ph_flag && > > ((nal_unit_type != VVC_IDR_W_RADL && > > Do you know which samples from the conformance suite exercise this, and > patches 2 and 3? > Thank you for the review Good idea. will send out v2 and add a clips list > ___ > 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".
Re: [FFmpeg-devel] [PATCH v3 2/6] lavc/av1: Add common code and unit test for level handling
James Almer: > On 8/3/2023 3:01 AM, fei.w.wang-at-intel@ffmpeg.org wrote: >> From: Fei Wang >> >> Signed-off-by: Fei Wang >> --- >> update: >> 1. Rename libavcodec/av1_levels*. >> 2. Use array instead of handle for AV1LevelDescriptor.name. >> 3. Compile libavcodec/av1_levels* only when enable vaapi av1 encoder. >> >> libavcodec/Makefile | 1 + >> libavcodec/av1_levels.c | 92 + >> libavcodec/av1_levels.h | 58 >> libavcodec/tests/.gitignore | 1 + >> libavcodec/tests/av1_levels.c | 124 ++ >> tests/fate/libavcodec.mak | 5 ++ >> 6 files changed, 281 insertions(+) >> create mode 100644 libavcodec/av1_levels.c >> create mode 100644 libavcodec/av1_levels.h >> create mode 100644 libavcodec/tests/av1_levels.c >> >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile >> index 3c16b51462..a6b2ecbb22 100644 >> --- a/libavcodec/Makefile >> +++ b/libavcodec/Makefile >> @@ -1319,6 +1319,7 @@ TESTPROGS = >> avcodec \ >> >> jpeg2000dwt \ >> >> mathops \ >> +TESTPROGS-$(CONFIG_AV1_VAAPI_ENCODER) += av1_levels > > This encoder does not exist at the point this patch would be applied. > It's introduced in patch 6/6. > > Squash libavcodec/av1_levels.c into patch 6/6 (Its first user), and then > add the test in a new patch 7. Alternatively, add the file, but without the Makefile parts, which are then to be added 6/6. - Andreas ___ 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] What is FFmpeg and what should it be
Le sunnuntaina 6. elokuuta 2023, 22.53.23 EEST Michael Niedermayer a écrit : > > > > Did you ask people to do that? > > > > > > yes, multiple times. > > > Also normally patch objections come with a path forward, that was not > > > the case here. > > > > Not necessarily, sometimes preventing a bad idea from happening is a > > positive thing in itself, and no path forward is needed. > > That is missing that people suggest a path forward but > with too few details to easily walk that path. Uh, I hate to state the patently obvious, but if "no path forward is needed", then there should logically be _no_ "details to walk [a] path". Conversely, if avradio does not belong in FFmpeg, as Kieran, Tomas and others have been arguing, then there is no path forward to be given on FFmpeg-devel. And besides I don't think it's even fair to state that "too few details" were given. People did suggest making this a new separate project properly isolated from FFmpeg internals, and/or joining efforts with existing OSS SDR projects rather than FFmpeg. Some specific projects have even been cited. As far as FFmpeg(-devel) is concerned, I can't think how it could/should reasonably get any more specific than that. -- Rémi Denis-Courmont http://www.remlab.net/ ___ 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 1/8] cbs_h266: fix inference for sh_lmcs_used_flag and sh_explicit_scaling_list_used_flag
On 8/7/2023 11:55 AM, Nuo Mi wrote: if sh_picture_header_in_slice_header_flag is true sh_lmcs_used_flag and sh_explicit_scaling_list_used_flag are infered from ph --- libavcodec/cbs_h266_syntax_template.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 98a8e033bf..857882655b 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3151,17 +3151,21 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, infer(sh_alf_enabled_flag, 0); } -if (ph->ph_lmcs_enabled_flag && -!current->sh_picture_header_in_slice_header_flag) -flag(sh_lmcs_used_flag); -else -infer(sh_lmcs_used_flag, 0); +if (current->sh_picture_header_in_slice_header_flag) { +infer(sh_lmcs_used_flag, ph->ph_lmcs_enabled_flag); +infer(sh_explicit_scaling_list_used_flag, +ph->ph_explicit_scaling_list_enabled_flag); +} else { +if (ph->ph_lmcs_enabled_flag) +flag(sh_lmcs_used_flag); +else +infer(sh_lmcs_used_flag, 0); -if (ph->ph_explicit_scaling_list_enabled_flag && -!current->sh_picture_header_in_slice_header_flag) -flag(sh_explicit_scaling_list_used_flag); -else -infer(sh_explicit_scaling_list_used_flag, 0); +if (ph->ph_explicit_scaling_list_enabled_flag) +flag(sh_explicit_scaling_list_used_flag); +else +infer(sh_explicit_scaling_list_used_flag, 0); +} if (!pps->pps_rpl_info_in_ph_flag && ((nal_unit_type != VVC_IDR_W_RADL && Do you know which samples from the conformance suite exercise this, and patches 2 and 3? ___ 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 5/8] cbs_h266: H266RawSliceHeader, expose NumEntryPoints
--- libavcodec/cbs_h266.h | 3 +++ libavcodec/cbs_h266_syntax_template.c | 17 + 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h index 0196f46bc0..1d80c74feb 100644 --- a/libavcodec/cbs_h266.h +++ b/libavcodec/cbs_h266.h @@ -828,6 +828,9 @@ typedef struct H266RawSliceHeader { uint8_t sh_entry_offset_len_minus1; uint32_t sh_entry_point_offset_minus1[VVC_MAX_ENTRY_POINTS]; +// derived values +uint32_t num_entry_points; ///< NumEntryPoints + } H266RawSliceHeader; typedef struct H266RawSlice { diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 43b3346359..d0d1ccadd2 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3374,8 +3374,9 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, for (i = 0; i < current->sh_slice_header_extension_length; i++) us(8, sh_slice_header_extension_data_byte[i], 0x00, 0xff, 1, i); } + +current->num_entry_points = 0; if (sps->sps_entry_point_offsets_present_flag) { -int num_entry_points = 0; uint8_t entropy_sync = sps->sps_entropy_coding_sync_enabled_flag; int height; if (pps->pps_rect_slice_flag) { @@ -3392,7 +3393,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, else height = pps->pps_slice_height_in_tiles_minus1[slice_idx] + 1; -num_entry_points = width_in_tiles * height; +current->num_entry_points = width_in_tiles * height; } else { int tile_idx; int tile_y; @@ -3402,18 +3403,18 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, current->sh_num_tiles_in_slice_minus1; tile_idx++) { tile_y = tile_idx / pps->num_tile_rows; height = pps->row_height_val[tile_y]; -num_entry_points += (entropy_sync ? height : 1); +current->num_entry_points += (entropy_sync ? height : 1); } } -num_entry_points--; -if (num_entry_points > VVC_MAX_ENTRY_POINTS) { +current->num_entry_points--; +if (current->num_entry_points > VVC_MAX_ENTRY_POINTS) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Too many entry points: " - "%" PRIu16 ".\n", num_entry_points); + "%" PRIu16 ".\n", current->num_entry_points); return AVERROR_PATCHWELCOME; } -if (num_entry_points > 0) { +if (current->num_entry_points > 0) { ue(sh_entry_offset_len_minus1, 0, 31); -for (i = 0; i < num_entry_points; i++) { +for (i = 0; i < current->num_entry_points; i++) { ubs(current->sh_entry_offset_len_minus1 + 1, sh_entry_point_offset_minus1[i], 1, i); } -- 2.25.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 4/8] cbs_h266: fix slice_height_in_ctus for single slice tile
--- libavcodec/cbs_h266_syntax_template.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 7277154c40..43b3346359 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -1984,6 +1984,7 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw, 0, current->row_height_val[tile_y] - 1, 1, i); if (current->pps_num_exp_slices_in_tile[i] == 0) { num_slices_in_tile = 1; +current->slice_height_in_ctus[i] = current->row_height_val[tile_y]; slice_top_left_ctu_x[i] = ctu_x; slice_top_left_ctu_y[i] = ctu_y; } else { -- 2.25.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 3/8] cbs_h266: fix inference for xh_deblocking_filter_disabled_flag
if !ph_deblocking_params_present_flag is true, ph_deblocking_filter_disabled_flag infered from pps if !sh_deblocking_params_present_flag is true, sh_deblocking_filter_disabled_flag infered from ph --- libavcodec/cbs_h266_syntax_template.c | 76 ++- 1 file changed, 28 insertions(+), 48 deletions(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 801feedb4a..7277154c40 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -2938,20 +2938,14 @@ static int FUNC(picture_header) (CodedBitstreamContext *ctx, RWContext *rw, infer(ph_sao_chroma_enabled_flag, 0); } -if (pps->pps_dbf_info_in_ph_flag) { +if (pps->pps_dbf_info_in_ph_flag) flag(ph_deblocking_params_present_flag); -if (current->ph_deblocking_params_present_flag) { -if (!pps->pps_deblocking_filter_disabled_flag) { -flag(ph_deblocking_filter_disabled_flag); -} else { -if (pps->pps_deblocking_filter_disabled_flag && -current->ph_deblocking_params_present_flag) { -infer(ph_deblocking_filter_disabled_flag, 0); -} else { -infer(ph_deblocking_filter_disabled_flag, - pps->pps_deblocking_filter_disabled_flag); -} -} +else +infer(ph_deblocking_params_present_flag, 0); + +if (current->ph_deblocking_params_present_flag) { +if (!pps->pps_deblocking_filter_disabled_flag) { +flag(ph_deblocking_filter_disabled_flag); if (!current->ph_deblocking_filter_disabled_flag) { se(ph_luma_beta_offset_div2, -12, 12); se(ph_luma_tc_offset_div2, -12, 12); @@ -2970,25 +2964,19 @@ static int FUNC(picture_header) (CodedBitstreamContext *ctx, RWContext *rw, infer(ph_cr_tc_offset_div2, current->ph_luma_tc_offset_div2); } -} else { -infer(ph_luma_beta_offset_div2, pps->pps_luma_beta_offset_div2); -infer(ph_luma_tc_offset_div2, pps->pps_luma_tc_offset_div2); -if (pps->pps_chroma_tool_offsets_present_flag) { -infer(ph_cb_beta_offset_div2, pps->pps_cb_beta_offset_div2); -infer(ph_cb_tc_offset_div2, pps->pps_cb_tc_offset_div2); -infer(ph_cr_beta_offset_div2, pps->pps_cr_beta_offset_div2); -infer(ph_cr_tc_offset_div2, pps->pps_cr_tc_offset_div2); -} else { -infer(ph_cb_beta_offset_div2, - current->ph_luma_beta_offset_div2); -infer(ph_cb_tc_offset_div2, - current->ph_luma_tc_offset_div2); -infer(ph_cr_beta_offset_div2, - current->ph_luma_beta_offset_div2); -infer(ph_cr_tc_offset_div2, - current->ph_luma_tc_offset_div2); -} } +} else { +infer(ph_deblocking_filter_disabled_flag, 0); +} +} else { +infer(ph_deblocking_filter_disabled_flag, pps->pps_deblocking_filter_disabled_flag); +if (!current->ph_deblocking_filter_disabled_flag) { +infer(ph_luma_beta_offset_div2, pps->pps_luma_beta_offset_div2); +infer(ph_luma_tc_offset_div2, pps->pps_luma_tc_offset_div2); +infer(ph_cb_beta_offset_div2, pps->pps_cb_beta_offset_div2); +infer(ph_cb_tc_offset_div2, pps->pps_cb_tc_offset_div2); +infer(ph_cr_beta_offset_div2, pps->pps_cr_beta_offset_div2); +infer(ph_cr_tc_offset_div2, pps->pps_cr_tc_offset_div2); } } @@ -3321,9 +3309,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, if (!pps->pps_deblocking_filter_disabled_flag) flag(sh_deblocking_filter_disabled_flag); else -infer(sh_deblocking_filter_disabled_flag, - !(pps->pps_deblocking_filter_disabled_flag && -current->sh_deblocking_params_present_flag)); +infer(sh_deblocking_filter_disabled_flag, 0); if (!current->sh_deblocking_filter_disabled_flag) { se(sh_luma_beta_offset_div2, -12, 12); se(sh_luma_tc_offset_div2, -12, 12); @@ -3340,22 +3326,16 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, current->sh_luma_beta_offset_div2); infer(sh_cr_tc_offset_div2, current->sh_luma_tc_offset_div2); } -} else { +} +} else { +infer(sh_deblocking_filter_disabled_flag, ph->ph_deblocking_filter_disabled_flag); +if (!current->sh_deblocking_filter_disabled_flag) { infer(sh_luma_beta_offset_div2,
[FFmpeg-devel] [PATCH 2/8] cbs_h266: fix inference for sh_alf_enabled_flag
if pps_alf_info_in_ph_flag is true sh_alf_enabled_flag infered from ph --- libavcodec/cbs_h266_syntax_template.c | 81 --- 1 file changed, 47 insertions(+), 34 deletions(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 857882655b..801feedb4a 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3111,44 +3111,57 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, if (nal_unit_type == VVC_IDR_W_RADL || nal_unit_type == VVC_IDR_N_LP || nal_unit_type == VVC_CRA_NUT || nal_unit_type == VVC_GDR_NUT) flag(sh_no_output_of_prior_pics_flag); -if (sps->sps_alf_enabled_flag && !pps->pps_alf_info_in_ph_flag) { -flag(sh_alf_enabled_flag); -if (current->sh_alf_enabled_flag) { -ub(3, sh_num_alf_aps_ids_luma); -for (i = 0; i < current->sh_num_alf_aps_ids_luma; i++) -ubs(3, sh_alf_aps_id_luma[i], 1, i); -if (sps->sps_chroma_format_idc != 0) { -flag(sh_alf_cb_enabled_flag); -flag(sh_alf_cr_enabled_flag); -} else { + +if (sps->sps_alf_enabled_flag) { +if (!pps->pps_alf_info_in_ph_flag) { +flag(sh_alf_enabled_flag); +if (current->sh_alf_enabled_flag) { +ub(3, sh_num_alf_aps_ids_luma); +for (i = 0; i < current->sh_num_alf_aps_ids_luma; i++) +ubs(3, sh_alf_aps_id_luma[i], 1, i); + +if (sps->sps_chroma_format_idc != 0) { +flag(sh_alf_cb_enabled_flag); +flag(sh_alf_cr_enabled_flag); +} +if (current->sh_alf_cb_enabled_flag || +current->sh_alf_cr_enabled_flag) { +ub(3, sh_alf_aps_id_chroma); +} + +if (sps->sps_ccalf_enabled_flag) { +flag(sh_alf_cc_cb_enabled_flag); +if (current->sh_alf_cc_cb_enabled_flag) +ub(3, sh_alf_cc_cb_aps_id); + +flag(sh_alf_cc_cr_enabled_flag); +if (current->sh_alf_cc_cr_enabled_flag) +ub(3, sh_alf_cc_cr_aps_id); +} +} +} else { +infer(sh_alf_enabled_flag, ph->ph_alf_enabled_flag); +if (current->sh_alf_enabled_flag) { +infer(sh_num_alf_aps_ids_luma, ph->ph_num_alf_aps_ids_luma); +for (i = 0; i < current->sh_num_alf_aps_ids_luma; i++) +infer(sh_alf_aps_id_luma[i], ph->ph_alf_aps_id_luma[i]); + infer(sh_alf_cb_enabled_flag, ph->ph_alf_cb_enabled_flag); infer(sh_alf_cr_enabled_flag, ph->ph_alf_cr_enabled_flag); -} -if (current->sh_alf_cb_enabled_flag || -current->sh_alf_cr_enabled_flag) -ub(3, sh_alf_aps_id_chroma); -else -infer(sh_alf_aps_id_chroma, ph->ph_alf_aps_id_chroma); -if (sps->sps_ccalf_enabled_flag) { -flag(sh_alf_cc_cb_enabled_flag); -if (current->sh_alf_cc_cb_enabled_flag) -ub(3, sh_alf_cc_cb_aps_id); -else -infer(sh_alf_cc_cb_aps_id, ph->ph_alf_cc_cb_aps_id); -flag(sh_alf_cc_cr_enabled_flag); -if (current->sh_alf_cc_cr_enabled_flag) -ub(3, sh_alf_cc_cr_aps_id); -else -infer(sh_alf_cc_cr_aps_id, ph->ph_alf_cc_cr_aps_id); -} else { -infer(sh_alf_cc_cb_enabled_flag, ph->ph_alf_cc_cb_enabled_flag); -infer(sh_alf_cc_cr_enabled_flag, ph->ph_alf_cc_cr_enabled_flag); -infer(sh_alf_cc_cb_aps_id, ph->ph_alf_cc_cb_aps_id); -infer(sh_alf_cc_cr_aps_id, ph->ph_alf_cc_cr_aps_id); +if (current->sh_alf_cb_enabled_flag ||current->sh_alf_cr_enabled_flag) +infer(sh_alf_aps_id_chroma, ph->ph_alf_aps_id_chroma); + +if (sps->sps_ccalf_enabled_flag) { +infer(sh_alf_cc_cb_enabled_flag, ph->ph_alf_cc_cb_enabled_flag); +if (current->sh_alf_cc_cb_enabled_flag) +infer(sh_alf_cc_cb_aps_id, ph->ph_alf_cc_cb_aps_id); + +infer(sh_alf_cc_cr_enabled_flag, ph->ph_alf_cc_cr_enabled_flag); +if (current->sh_alf_cc_cr_enabled_flag) +infer(sh_alf_cc_cr_aps_id, ph->ph_alf_cc_cr_aps_id); +} } } -} else { -infer(sh_alf_enabled_flag, 0); } if (current->sh_picture_header_in_slice_header_flag) { -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To
[FFmpeg-devel] [PATCH 1/8] cbs_h266: fix inference for sh_lmcs_used_flag and sh_explicit_scaling_list_used_flag
if sh_picture_header_in_slice_header_flag is true sh_lmcs_used_flag and sh_explicit_scaling_list_used_flag are infered from ph --- libavcodec/cbs_h266_syntax_template.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 98a8e033bf..857882655b 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3151,17 +3151,21 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, infer(sh_alf_enabled_flag, 0); } -if (ph->ph_lmcs_enabled_flag && -!current->sh_picture_header_in_slice_header_flag) -flag(sh_lmcs_used_flag); -else -infer(sh_lmcs_used_flag, 0); +if (current->sh_picture_header_in_slice_header_flag) { +infer(sh_lmcs_used_flag, ph->ph_lmcs_enabled_flag); +infer(sh_explicit_scaling_list_used_flag, +ph->ph_explicit_scaling_list_enabled_flag); +} else { +if (ph->ph_lmcs_enabled_flag) +flag(sh_lmcs_used_flag); +else +infer(sh_lmcs_used_flag, 0); -if (ph->ph_explicit_scaling_list_enabled_flag && -!current->sh_picture_header_in_slice_header_flag) -flag(sh_explicit_scaling_list_used_flag); -else -infer(sh_explicit_scaling_list_used_flag, 0); +if (ph->ph_explicit_scaling_list_enabled_flag) +flag(sh_explicit_scaling_list_used_flag); +else +infer(sh_explicit_scaling_list_used_flag, 0); +} if (!pps->pps_rpl_info_in_ph_flag && ((nal_unit_type != VVC_IDR_W_RADL && -- 2.25.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 v3 2/6] lavc/av1: Add common code and unit test for level handling
On 8/3/2023 3:01 AM, fei.w.wang-at-intel@ffmpeg.org wrote: From: Fei Wang Signed-off-by: Fei Wang --- update: 1. Rename libavcodec/av1_levels*. 2. Use array instead of handle for AV1LevelDescriptor.name. 3. Compile libavcodec/av1_levels* only when enable vaapi av1 encoder. libavcodec/Makefile | 1 + libavcodec/av1_levels.c | 92 + libavcodec/av1_levels.h | 58 libavcodec/tests/.gitignore | 1 + libavcodec/tests/av1_levels.c | 124 ++ tests/fate/libavcodec.mak | 5 ++ 6 files changed, 281 insertions(+) create mode 100644 libavcodec/av1_levels.c create mode 100644 libavcodec/av1_levels.h create mode 100644 libavcodec/tests/av1_levels.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3c16b51462..a6b2ecbb22 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1319,6 +1319,7 @@ TESTPROGS = avcodec \ jpeg2000dwt \ mathops\ +TESTPROGS-$(CONFIG_AV1_VAAPI_ENCODER) += av1_levels This encoder does not exist at the point this patch would be applied. It's introduced in patch 6/6. Squash libavcodec/av1_levels.c into patch 6/6 (Its first user), and then add the test in a new patch 7. ___ 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 v2] wmavoice: convert DCT-I/DST-I to lavu/tx
No real changes from V1, just used a CMP_TARGET for the FATE tests, and changed the _new suffix to _ref for the references. New references are here, to be uploaded to FATE under the same names: https://files.lynne.ee/streaming_CBR-7K_ref.pcm https://files.lynne.ee/streaming_CBR-11K_ref.pcm https://files.lynne.ee/streaming_CBR-19K_ref.pcm Before and after comparisons for 11K, if anyone is interested: https://files.lynne.ee/wmavoice_current.png https://files.lynne.ee/wmavoice_new.png https://files.lynne.ee/wmavoice_microsoft.png >From a2cdeddb8be7e4c6a93de51edc9533accbff2a87 Mon Sep 17 00:00:00 2001 From: Lynne Date: Fri, 4 Aug 2023 21:16:30 +0200 Subject: [PATCH v2] wmavoice: convert DCT-I/DST-I to lavu/tx This is the very last user of any lavc transform code. This also *corrects* wmavoice decoding, as the previous DCT/DST transforms were incorrect, bringing it closer to Microsoft's own wmavoice decoder. --- libavcodec/wmavoice.c | 29 + tests/fate/wma.mak| 11 +++ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index 5ae92e2dbc..915315cb8a 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -42,8 +42,6 @@ #include "acelp_vectors.h" #include "acelp_filters.h" #include "lsp.h" -#include "dct.h" -#include "rdft.h" #include "sinewin.h" #define MAX_BLOCKS 8 ///< maximum number of blocks per frame @@ -266,8 +264,8 @@ typedef struct WMAVoiceContext { */ AVTXContext *rdft, *irdft;///< contexts for FFT-calculation in the av_tx_fn rdft_fn, irdft_fn; ///< postfilter (for denoise filter) -DCTContext dct, dst; ///< contexts for phase shift (in Hilbert - ///< transform, part of postfilter) +AVTXContext *dct, *dst; ///< contexts for phase shift (in Hilbert +av_tx_fn dct_fn, dst_fn; ///< transform, part of postfilter) float sin[511], cos[511]; ///< 8-bit cosine/sine windows over [-pi,pi] ///< range float postfilter_agc; ///< gain control memory, used in @@ -391,10 +389,6 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx) if (s->do_apf) { float scale = 1.0f; -if ((ret = ff_dct_init (>dct, 6,DCT_I)) < 0 || -(ret = ff_dct_init (>dst, 6,DST_I)) < 0) -return ret; - ret = av_tx_init(>rdft, >rdft_fn, AV_TX_FLOAT_RDFT, 0, 1 << 7, , 0); if (ret < 0) return ret; @@ -403,6 +397,16 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx) if (ret < 0) return ret; +scale = 1.0 / (1 << 6); +ret = av_tx_init(>dct, >dct_fn, AV_TX_FLOAT_DCT_I, 0, 1 << 6, , 0); +if (ret < 0) +return ret; + +scale = 1.0 / (1 << 6); +ret = av_tx_init(>dst, >dst_fn, AV_TX_FLOAT_DST_I, 0, 1 << 6, , 0); +if (ret < 0) +return ret; + ff_sine_window_init(s->cos, 256); memcpy(>sin[255], s->cos, 256 * sizeof(s->cos[0])); for (n = 0; n < 255; n++) { @@ -612,6 +616,7 @@ static void calc_input_response(WMAVoiceContext *s, float *lpcs_src, float irange, angle_mul, gain_mul, range, sq; LOCAL_ALIGNED_32(float, coeffs, [0x82]); LOCAL_ALIGNED_32(float, lpcs, [0x82]); +LOCAL_ALIGNED_32(float, lpcs_dct, [0x82]); int n, idx; memcpy(coeffs, coeffs_dst, 0x82*sizeof(float)); @@ -662,8 +667,8 @@ static void calc_input_response(WMAVoiceContext *s, float *lpcs_src, * is a sine input) by doing a phase shift (in theory, H(sin())=cos()). * Hilbert_Transform(RDFT(x)) = Laplace_Transform(x), which calculates the * "moment" of the LPCs in this filter. */ -s->dct.dct_calc(>dct, lpcs); -s->dst.dct_calc(>dst, lpcs); +s->dct_fn(s->dct, lpcs_dct, lpcs, sizeof(float)); +s->dst_fn(s->dst, lpcs, lpcs_dct, sizeof(float)); /* Split out the coefficient indexes into phase/magnitude pairs */ idx = 255 + av_clip(lpcs[64], -255, 255); @@ -2003,8 +2008,8 @@ static av_cold int wmavoice_decode_end(AVCodecContext *ctx) if (s->do_apf) { av_tx_uninit(>rdft); av_tx_uninit(>irdft); -ff_dct_end(>dct); -ff_dct_end(>dst); +av_tx_uninit(>dct); +av_tx_uninit(>dst); } return 0; diff --git a/tests/fate/wma.mak b/tests/fate/wma.mak index c13874ebfc..ed2ac24c65 100644 --- a/tests/fate/wma.mak +++ b/tests/fate/wma.mak @@ -20,18 +20,21 @@ fate-wmapro: $(FATE_WMAPRO-yes) FATE_WMAVOICE-$(call DEMDEC, ASF, WMAVOICE) += fate-wmavoice-7k fate-wmavoice-7k: CMD = pcm -i $(TARGET_SAMPLES)/wmavoice/streaming_CBR-7K.wma -fate-wmavoice-7k: REF = $(SAMPLES)/wmavoice/streaming_CBR-7K.pcm +fate-wmavoice-7k: REF = $(SAMPLES)/wmavoice/streaming_CBR-7K_ref.pcm +fate-wmavoice-7k: CMP_TARGET = 1368.61 fate-wmavoice-7k: FUZZ = 3 FATE_WMAVOICE-$(call DEMDEC, ASF,
Re: [FFmpeg-devel] [PATCH 2/5] avcodec/mv30: Check the input length before allocation
NAK ___ 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 v3 1/6] avcodec/cbs_av1: Add tx mode enum values
On Do, 2023-08-03 at 14:01 +0800, fei.w.wang-at-intel@ffmpeg.org wrote: > From: Fei Wang > > Signed-off-by: Fei Wang > --- > libavcodec/av1.h | 7 +++ > libavcodec/cbs_av1_syntax_template.c | 4 ++-- > 2 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/av1.h b/libavcodec/av1.h > index 384f7cddc7..8704bc41c1 100644 > --- a/libavcodec/av1.h > +++ b/libavcodec/av1.h > @@ -175,6 +175,13 @@ enum { > AV1_RESTORE_SWITCHABLE = 3, > }; > > +// TX mode (section 6.8.21) > +enum { > + AV1_ONLY_4X4 = 0, > + AV1_TX_MODE_LARGEST = 1, > + AV1_TX_MODE_SELECT = 2, > +}; > + > // Sequence Headers are actually unbounded because one can use > // an arbitrary number of leading zeroes when encoding via uvlc. > // The following estimate is based around using the lowest number > diff --git a/libavcodec/cbs_av1_syntax_template.c > b/libavcodec/cbs_av1_syntax_template.c > index a747e17784..3a5cafbfb7 100644 > --- a/libavcodec/cbs_av1_syntax_template.c > +++ b/libavcodec/cbs_av1_syntax_template.c > @@ -1028,9 +1028,9 @@ static int FUNC(read_tx_mode)(CodedBitstreamContext > *ctx, RWContext *rw, > int err; > > if (priv->coded_lossless) > - infer(tx_mode, 0); > + infer(tx_mode, AV1_ONLY_4X4); > else > - increment(tx_mode, 1, 2); > + increment(tx_mode, AV1_TX_MODE_LARGEST, AV1_TX_MODE_SELECT); > > return 0; > } This patchset looks good and works well for me. I'll push it in a few days if there are no comments. 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 v2] lavc/vaapi_encode: Add filler_data option
v2: Add description in encoders.texi --- doc/encoders.texi | 3 +++ libavcodec/vaapi_encode.c | 1 + libavcodec/vaapi_encode.h | 9 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 25d6b7f09e..f146942aa5 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3963,6 +3963,9 @@ Set the allowed max size in bytes for each frame. If the frame size exceeds the limitation, encoder will adjust the QP value to control the frame size. Invalid in CQP rate control mode. +@item filler_data +Insert filler data in CBR rate control mode to ensure target bitrate. + @item rc_mode Set the rate control mode to use. A given driver may only support a subset of modes. diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index bfca315a7a..f161c76304 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -1860,6 +1860,7 @@ rc_mode_found: #if VA_CHECK_VERSION(1, 3, 0) .quality_factor = rc_quality, #endif +.rc_flags.bits.disable_bit_stuffing = !ctx->filler_data, }; vaapi_encode_add_global_param(avctx, VAEncMiscParameterTypeRateControl, diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h index a1e639f56b..a2170cb8b0 100644 --- a/libavcodec/vaapi_encode.h +++ b/libavcodec/vaapi_encode.h @@ -198,6 +198,9 @@ typedef struct VAAPIEncodeContext { // Max Frame Size int max_frame_size; +// Filler Data +int filler_data; + // Explicitly set RC mode (otherwise attempt to pick from // available modes). int explicit_rc_mode; @@ -490,7 +493,11 @@ int ff_vaapi_encode_close(AVCodecContext *avctx); { "max_frame_size", \ "Maximum frame size (in bytes)",\ OFFSET(common.max_frame_size), AV_OPT_TYPE_INT, \ - { .i64 = 0 }, 0, INT_MAX, FLAGS } + { .i64 = 0 }, 0, INT_MAX, FLAGS }, \ +{ "filler_data", \ + "Enable filler data", \ + OFFSET(common.filler_data), AV_OPT_TYPE_BOOL, \ + { .i64 = 1 }, 0, 1, FLAGS } #define VAAPI_ENCODE_RC_MODE(name, desc) \ { #name, desc, 0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_ ## name }, \ -- 2.41.0 ___ 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".