[FFmpeg-devel] [PATCH] avcodec/v4l2_m2m_dec: resolve resolution change
It shouldn't allocate buffer before the resolution change event appeared in decoder setup. And it should not apply to new resolution before the buffer from the previous sequence is dequeued. Change-Id: Id04550b0f17e1501b670a3bcbdd860d5836259bf Signed-off-by: Hsia-Jun(Randy) Li --- libavcodec/v4l2_context.c | 89 ++- libavcodec/v4l2_context.h | 6 +++ libavcodec/v4l2_m2m_dec.c | 14 +++--- 3 files changed, 73 insertions(+), 36 deletions(-) diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index a40be94690..87771601a9 100644 --- a/libavcodec/v4l2_context.c +++ b/libavcodec/v4l2_context.c @@ -169,30 +169,17 @@ static int v4l2_start_decode(V4L2Context *ctx) } /** - * handle resolution change event and end of stream event + * handle resolution change event * returns 1 if reinit was successful, negative if it failed * returns 0 if reinit was not executed */ -static int v4l2_handle_event(V4L2Context *ctx) +static int v4l2_handle_dyn_res_change(V4L2Context *ctx) { V4L2m2mContext *s = ctx_to_m2mctx(ctx); struct v4l2_format cap_fmt = s->capture.format; - struct v4l2_event evt = { 0 }; int ret; - ret = ioctl(s->fd, VIDIOC_DQEVENT, ); - if (ret < 0) { - av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_DQEVENT\n", ctx->name); - return 0; - } - - if (evt.type == V4L2_EVENT_EOS) { - ctx->done = 1; - return 0; - } - - if (evt.type != V4L2_EVENT_SOURCE_CHANGE) - return 0; + cap_fmt.type = s->capture.type; ret = ioctl(s->fd, VIDIOC_G_FMT, _fmt); if (ret) { @@ -201,11 +188,13 @@ static int v4l2_handle_event(V4L2Context *ctx) } if (v4l2_resolution_changed(>capture, _fmt)) { + s->capture.format.fmt.pix_mp.pixelformat = cap_fmt.fmt.pix_mp.pixelformat; s->capture.height = v4l2_get_height(_fmt); s->capture.width = v4l2_get_width(_fmt); s->capture.sample_aspect_ratio = v4l2_get_sar(>capture); } else { v4l2_start_decode(ctx); + ctx->pending_res_change = 0; return 0; } @@ -222,10 +211,41 @@ static int v4l2_handle_event(V4L2Context *ctx) return AVERROR(EINVAL); } + ctx->pending_res_change = 0; /* reinit executed */ return 1; } +/** + * capture resolution change event and end of stream event + * returns 1 or negative if it failed + * returns 0 if nothing went wrong + */ +static int v4l2_handle_event(V4L2Context *ctx) +{ + V4L2m2mContext *s = ctx_to_m2mctx(ctx); + struct v4l2_event evt = { 0 }; + int ret; + + ret = ioctl(s->fd, VIDIOC_DQEVENT, ); + if (ret < 0) { + av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_DQEVENT\n", ctx->name); + return errno; + } + + if (evt.type == V4L2_EVENT_EOS) { + ctx->done = 1; + return 0; + } + + if (evt.type != V4L2_EVENT_SOURCE_CHANGE) + return AVERROR(EINVAL); + + ctx->pending_res_change = 1; + + return 0; +} + static int v4l2_stop_decode(V4L2Context *ctx) { struct v4l2_decoder_cmd cmd = { @@ -342,16 +362,19 @@ start: /* 1. handle resolution changes */ if (pfd.revents & POLLPRI) { ret = v4l2_handle_event(ctx); - if (ret < 0) { - /* if re-init failed, abort */ - ctx->done = 1; - return NULL; - } if (ret) { - /* if re-init was successful drop the buffer (if there was one) - * since we had to reconfigure capture (unmap all buffers) - */ + /* if event handler failed, abort */ + ctx->done = 1; return NULL; + } else if (!V4L2_TYPE_IS_OUTPUT(ctx->type)) { + if (!ctx->streamon) + ret = v4l2_handle_dyn_res_change(ctx); + if (ret == 1) + return NULL; + } else { + /* Poll the device again, we want the buffer with the flag + * that answer to the event */ + return v4l2_dequeue_v4l2buf(ctx, timeout); } } @@ -391,17 +414,23 @@ dequeue: return NULL; } - if (ctx_to_m2mctx(ctx)->draining && !V4L2_TYPE_IS_OUTPUT(ctx->type)) { + if (!V4L2_TYPE_IS_OUTPUT(ctx->type)) { int bytesused = V4L2_TYPE_IS_MULTIPLANAR(buf.type) ? buf.m.planes[0].bytesused : buf.bytesused; + +#ifdef V4L2_BUF_FLAG_LAST + if (buf.flags & V4L2_BUF_FLAG_LAST) { + if (ctx_to_m2mctx(ctx)->draining) + ctx->done = 1; + if (ctx->pending_res_change) + ret = v4l2_handle_dyn_res_change(ctx); + } +#endif if (bytesused == 0) { - ctx->done = 1; + if (ctx_to_m2mctx(ctx)->draining) + ctx->done = 1; return NULL; } -#ifdef V4L2_BUF_FLAG_LAST - if (buf.flags & V4L2_BUF_FLAG_LAST) -
Re: [FFmpeg-devel] [PATCH v3] avformat/ivfenc: Set the "number of frames" in IVF header
> -Original Message- > From: ffmpeg-devel On Behalf Of > Ronald S. Bultje > Sent: Friday, June 30, 2023 1:27 AM > To: FFmpeg development discussions and patches de...@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH v3] avformat/ivfenc: Set the "number of > frames" in IVF header > > Hi, > > On Thu, Jun 29, 2023 at 8:54 AM Dai, Jianhui J < jianhui.j.dai-at- > intel@ffmpeg.org> wrote: > > > Should set "number of frames" to bytes 24-27 of IVF header, not > > duration. > > It is described by [1], and confirmed by parsing all IVF files in [2]. > > > > This commit also updates the md5sum of refs to pass fate-cbs. > > > > [1] Duck IVF - MultimediaWiki > > https://wiki.multimedia.cx/index.php/Duck_IVF > > > > [2] webm/vp8-test-vectors > > https://chromium.googlesource.com/webm/vp8-test-vectors > > > > Signed-off-by: Jianhui Dai > > --- > > libavformat/ivfdec.c| 6 +++--- > > libavformat/ivfenc.c| 13 + > > tests/ref/fate/cbs-vp9-vp90-2-03-deltaq | 2 +- > > tests/ref/fate/cbs-vp9-vp90-2-06-bilinear | 2 +- > > tests/ref/fate/cbs-vp9-vp90-2-09-lf_deltas | 2 +- > > .../ref/fate/cbs-vp9-vp90-2-10-show-existing-frame | 2 +- > > .../ref/fate/cbs-vp9-vp90-2-10-show-existing-frame2 | 2 +- > > tests/ref/fate/cbs-vp9-vp90-2-segmentation-aq-akiyo | 2 +- > > tests/ref/fate/cbs-vp9-vp90-2-segmentation-sf-akiyo | 2 +- > > tests/ref/fate/cbs-vp9-vp90-2-tiling-pedestrian | 2 +- > > tests/ref/fate/cbs-vp9-vp91-2-04-yuv440 | 2 +- > > tests/ref/fate/cbs-vp9-vp91-2-04-yuv444 | 2 +- > > tests/ref/fate/cbs-vp9-vp92-2-20-10bit-yuv420 | 2 +- > > tests/ref/fate/cbs-vp9-vp93-2-20-10bit-yuv422 | 2 +- > > tests/ref/fate/cbs-vp9-vp93-2-20-12bit-yuv444 | 2 +- > > 15 files changed, 21 insertions(+), 24 deletions(-) > > > > diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c index > > 511f2387ed..c71a28e0d3 100644 > > --- a/libavformat/ivfdec.c > > +++ b/libavformat/ivfdec.c > > @@ -51,9 +51,9 @@ static int read_header(AVFormatContext *s) > > st->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags, > > st->codecpar->codec_tag); > > st->codecpar->width = avio_rl16(s->pb); > > st->codecpar->height = avio_rl16(s->pb); > > -time_base.den = avio_rl32(s->pb); > > -time_base.num = avio_rl32(s->pb); > > -st->duration = avio_rl32(s->pb); > > +time_base.den= avio_rl32(s->pb); > > +time_base.num= avio_rl32(s->pb); > > +st->nb_frames= avio_rl32(s->pb); > > avio_skip(s->pb, 4); // unused > > > > ffstream(st)->need_parsing = AVSTREAM_PARSE_HEADERS; > > > > Is the removal of the st->duration assignment necessary? Applications using > this field will now see a regression. Thanks. It's good for me to set both st->nb_frames and st->duration. The accuracy of `duration` cannot be guaranteed. Luckily, the duration is often correct, because it is popular configure that time_base.den/time_base.num == fps. > > Ronald > ___ > 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".
[FFmpeg-devel] [PATCH 2/2] avformat/id3v2: Free buffer in decode_str()
Fixes: memleak Fixes: 60058/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-5665259244093440 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/id3v2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 38c86a8e79..69193933e0 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -309,8 +309,10 @@ static int decode_str(AVFormatContext *s, AVIOContext *pb, int encoding, avio_w8(dynbuf, 0); dynsize = avio_close_dyn_buf(dynbuf, dst); -if (dynsize <= 0) +if (dynsize <= 0) { +av_freep(dst); return AVERROR(ENOMEM); +} *maxread = left; return 0; -- 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/rka: Fix integer overflow in decode_filter()
Fixes: signed integer overflow: 2147443649 + 65535 cannot be represented in type 'int' Fixes: 60054/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-5095674572832768 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/rka.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/rka.c b/libavcodec/rka.c index d56f4faee4..7646d776be 100644 --- a/libavcodec/rka.c +++ b/libavcodec/rka.c @@ -745,7 +745,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns } ctx->buf1[off] = sum - ctx->buf0[off + -1]; ctx->buf0[off] = sum; -m += FFABS(ctx->buf1[off]); +m += (unsigned)FFABS(ctx->buf1[off]); } } if (ctx->cmode2 != 0) { -- 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] avcodec/hevc_ps: Constify VPS, SPS pointers when parsing PPS
Signed-off-by: Andreas Rheinhardt --- libavcodec/hevc_ps.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index d7930d3ac3..4c4c1e2c17 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -725,7 +725,8 @@ static void set_default_scaling_list_data(ScalingList *sl) memcpy(sl->sl[3][5], default_scaling_list_inter, 64); } -static int scaling_list_data(GetBitContext *gb, AVCodecContext *avctx, ScalingList *sl, HEVCSPS *sps) +static int scaling_list_data(GetBitContext *gb, AVCodecContext *avctx, + ScalingList *sl, const HEVCSPS *sps) { uint8_t scaling_list_pred_mode_flag; uint8_t scaling_list_dc_coef[2][6]; @@ -1412,7 +1413,7 @@ static int colour_mapping_table(GetBitContext *gb, AVCodecContext *avctx, HEVCPP } static int pps_multilayer_extension(GetBitContext *gb, AVCodecContext *avctx, -HEVCPPS *pps, HEVCSPS *sps, HEVCVPS *vps) +HEVCPPS *pps, const HEVCSPS *sps, const HEVCVPS *vps) { pps->poc_reset_info_present_flag = get_bits1(gb); pps->pps_infer_scaling_list_flag = get_bits1(gb); @@ -1483,7 +1484,7 @@ static void delta_dlt(GetBitContext *gb, HEVCPPS *pps) } static int pps_3d_extension(GetBitContext *gb, AVCodecContext *avctx, -HEVCPPS *pps, HEVCSPS *sps) +HEVCPPS *pps, const HEVCSPS *sps) { unsigned int pps_depth_layers_minus1; @@ -1507,7 +1508,7 @@ static int pps_3d_extension(GetBitContext *gb, AVCodecContext *avctx, } static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx, -HEVCPPS *pps, HEVCSPS *sps) +HEVCPPS *pps, const HEVCSPS *sps) { if (pps->transform_skip_enabled_flag) { pps->log2_max_transform_skip_block_size = get_ue_golomb_31(gb) + 2; @@ -1547,7 +1548,7 @@ static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx, } static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx, - HEVCPPS *pps, HEVCSPS *sps) + HEVCPPS *pps, const HEVCSPS *sps) { int num_comps, ret; @@ -1599,7 +1600,7 @@ static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx, } static inline int setup_pps(AVCodecContext *avctx, GetBitContext *gb, -HEVCPPS *pps, HEVCSPS *sps) +HEVCPPS *pps, const HEVCSPS *sps) { int log2_diff; int pic_area_in_ctbs; @@ -1733,8 +1734,8 @@ static inline int setup_pps(AVCodecContext *avctx, GetBitContext *gb, int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps) { -HEVCSPS *sps = NULL; -HEVCVPS *vps = NULL; +const HEVCSPS *sps = NULL; +const HEVCVPS *vps = NULL; int i, ret = 0; unsigned int pps_id = 0; ptrdiff_t nal_size; -- 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".
Re: [FFmpeg-devel] [PATCH] avcodec/evc_ps: Replace av_malloc+memset by av_mallocz
On 6/29/2023 7:28 PM, Andreas Rheinhardt wrote: Signed-off-by: Andreas Rheinhardt --- libavcodec/evc_ps.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavcodec/evc_ps.c b/libavcodec/evc_ps.c index ec405345ae..fc2105b352 100644 --- a/libavcodec/evc_ps.c +++ b/libavcodec/evc_ps.c @@ -143,12 +143,10 @@ int ff_evc_parse_sps(GetBitContext *gb, EVCParamSets *ps) if (sps_seq_parameter_set_id >= EVC_MAX_SPS_COUNT) return AVERROR_INVALIDDATA; -sps = av_malloc(sizeof(*sps)); +sps = av_mallocz(sizeof(*sps)); if (!sps) return AVERROR(ENOMEM); -memset(sps, 0, sizeof(*sps)); - sps->sps_seq_parameter_set_id = sps_seq_parameter_set_id; // the Baseline profile is indicated by profile_idc eqal to 0 @@ -318,12 +316,10 @@ int ff_evc_parse_pps(GetBitContext *gb, EVCParamSets *ps) if (pps_pic_parameter_set_id >= EVC_MAX_PPS_COUNT) return AVERROR_INVALIDDATA; -pps = av_malloc(sizeof(*pps)); +pps = av_mallocz(sizeof(*pps)); if (!pps) return AVERROR(ENOMEM); -memset(pps, 0, sizeof(*pps)); - pps->pps_pic_parameter_set_id = pps_pic_parameter_set_id; pps->pps_seq_parameter_set_id = get_ue_golomb(gb); LGTM. ___ 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/vvc_parser: Mark close function as av_cold
On 6/29/2023 7:28 PM, Andreas Rheinhardt wrote: Signed-off-by: Andreas Rheinhardt --- libavcodec/vvc_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c index 69696eef57..0a8ef9f177 100644 --- a/libavcodec/vvc_parser.c +++ b/libavcodec/vvc_parser.c @@ -496,7 +496,7 @@ static av_cold int vvc_parser_init(AVCodecParserContext *s) return ret; } -static void vvc_parser_close(AVCodecParserContext *s) +static av_cold void vvc_parser_close(AVCodecParserContext *s) { VVCParserContext *ctx = s->priv_data; Other parser don't seem to do this (only for init), but LGTM either way. ___ 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 v3 2/2] fate/cbs: add VVC tests
Signed-off-by: James Almer --- tests/fate/cbs.mak | 40 ++ tests/ref/fate/cbs-vvc-AUD_A_3 | 1 + tests/ref/fate/cbs-vvc-BOUNDARY_A_3| 1 + tests/ref/fate/cbs-vvc-BUMP_A_2| 1 + tests/ref/fate/cbs-vvc-CROP_B_4| 1 + tests/ref/fate/cbs-vvc-CodingToolsSets_A_2 | 1 + tests/ref/fate/cbs-vvc-HRD_A_3 | 1 + tests/ref/fate/cbs-vvc-PHSH_B_1| 1 + tests/ref/fate/cbs-vvc-POC_A_1 | 1 + tests/ref/fate/cbs-vvc-PPS_B_1 | 1 + tests/ref/fate/cbs-vvc-RAP_A_1 | 1 + tests/ref/fate/cbs-vvc-SAO_A_3 | 1 + tests/ref/fate/cbs-vvc-SCALING_A_1 | 1 + tests/ref/fate/cbs-vvc-SLICES_A_3 | 1 + tests/ref/fate/cbs-vvc-SPS_B_1 | 1 + tests/ref/fate/cbs-vvc-STILL_B_1 | 1 + tests/ref/fate/cbs-vvc-SUBPIC_A_3 | 1 + tests/ref/fate/cbs-vvc-TILE_A_2| 1 + tests/ref/fate/cbs-vvc-VPS_A_3 | 1 + tests/ref/fate/cbs-vvc-WPP_A_3 | 1 + tests/ref/fate/cbs-vvc-WP_A_3 | 1 + tests/ref/fate/cbs-vvc-WRAP_A_4| 1 + 22 files changed, 61 insertions(+) create mode 100644 tests/ref/fate/cbs-vvc-AUD_A_3 create mode 100644 tests/ref/fate/cbs-vvc-BOUNDARY_A_3 create mode 100644 tests/ref/fate/cbs-vvc-BUMP_A_2 create mode 100644 tests/ref/fate/cbs-vvc-CROP_B_4 create mode 100644 tests/ref/fate/cbs-vvc-CodingToolsSets_A_2 create mode 100644 tests/ref/fate/cbs-vvc-HRD_A_3 create mode 100644 tests/ref/fate/cbs-vvc-PHSH_B_1 create mode 100644 tests/ref/fate/cbs-vvc-POC_A_1 create mode 100644 tests/ref/fate/cbs-vvc-PPS_B_1 create mode 100644 tests/ref/fate/cbs-vvc-RAP_A_1 create mode 100644 tests/ref/fate/cbs-vvc-SAO_A_3 create mode 100644 tests/ref/fate/cbs-vvc-SCALING_A_1 create mode 100644 tests/ref/fate/cbs-vvc-SLICES_A_3 create mode 100644 tests/ref/fate/cbs-vvc-SPS_B_1 create mode 100644 tests/ref/fate/cbs-vvc-STILL_B_1 create mode 100644 tests/ref/fate/cbs-vvc-SUBPIC_A_3 create mode 100644 tests/ref/fate/cbs-vvc-TILE_A_2 create mode 100644 tests/ref/fate/cbs-vvc-VPS_A_3 create mode 100644 tests/ref/fate/cbs-vvc-WPP_A_3 create mode 100644 tests/ref/fate/cbs-vvc-WP_A_3 create mode 100644 tests/ref/fate/cbs-vvc-WRAP_A_4 diff --git a/tests/fate/cbs.mak b/tests/fate/cbs.mak index 0084c3d25c..344515a7fa 100644 --- a/tests/fate/cbs.mak +++ b/tests/fate/cbs.mak @@ -5,6 +5,7 @@ fate-cbs: fate-cbs-av1 fate-cbs-h264 fate-cbs-hevc fate-cbs-mpeg2 fate-cbs-vp9 FATE_CBS_DEPS = $(call ALLYES, $(1)_DEMUXER $(2)_PARSER $(3)_METADATA_BSF $(4)_DECODER $(5)_MUXER) +FATE_CBS_NO_DEC_DEPS = $(call ALLYES, $(1)_DEMUXER $(2)_PARSER $(3)_METADATA_BSF $(4)_MUXER) define FATE_CBS_TEST # (codec, test_name, sample_file, output_format) @@ -12,6 +13,12 @@ FATE_CBS_$(1) += fate-cbs-$(1)-$(2) fate-cbs-$(1)-$(2): CMD = md5 -c:v $(3) -i $(TARGET_SAMPLES)/$(4) -c:v copy -y -bsf:v $(1)_metadata -f $(5) endef +define FATE_CBS_NO_DEC_TEST +# (codec, test_name, sample_file, output_format) +FATE_CBS_$(1) += fate-cbs-$(1)-$(2) +fate-cbs-$(1)-$(2): CMD = md5 -i $(TARGET_SAMPLES)/$(3) -c:v copy -y -bsf:v $(1)_metadata -f $(4) +endef + define FATE_CBS_DISCARD_TEST # (codec, discard_type, sample_file, output_format, dep) FATE_CBS_$(1)_DISCARD += fate-cbs-$(1)-discard-$(2) @@ -163,6 +170,39 @@ FATE_CBS_HEVC-$(call ALLYES, MP4_MUXER, HEVC_PARSER, FILTER_UNITS_BSF, HEVC_MUXE FATE_SAMPLES_AVCONV += $(FATE_CBS_HEVC-yes) fate-cbs-hevc: $(FATE_CBS_HEVC-yes) +# H.266 read/write + +FATE_CBS_VVC_SAMPLES =\ +AUD_A_3.bit \ +BOUNDARY_A_3.bit \ +BUMP_A_2.bit \ +CodingToolsSets_A_2.bit \ +CROP_B_4.bit \ +HRD_A_3.bit \ +PHSH_B_1.bit \ +POC_A_1.bit \ +PPS_B_1.bit \ +RAP_A_1.bit \ +SAO_A_3.bit \ +SCALING_A_1.bit \ +SLICES_A_3.bit\ +SPS_B_1.bit \ +STILL_B_1.bit \ +SUBPIC_A_3.bit\ +TILE_A_2.bit \ +VPS_A_3.bit \ +WP_A_3.bit\ +WPP_A_3.bit \ +WRAP_A_4.bit \ + + +$(foreach N,$(FATE_CBS_VVC_SAMPLES),$(eval $(call FATE_CBS_NO_DEC_TEST,vvc,$(basename $(N)),vvc-conformance/$(N),vvc))) + +FATE_CBS_VVC-$(call FATE_CBS_NO_DEC_DEPS, HEVC, HEVC, HEVC, HEVC) = $(FATE_CBS_vvc) + +FATE_SAMPLES_AVCONV += $(FATE_CBS_VVC-yes) +fate-cbs-vvc: $(FATE_CBS_VVC-yes) + # MPEG-2 read/write FATE_CBS_MPEG2_SAMPLES = \ diff --git a/tests/ref/fate/cbs-vvc-AUD_A_3 b/tests/ref/fate/cbs-vvc-AUD_A_3 new file mode 100644 index 00..91dfc817b7 --- /dev/null +++ b/tests/ref/fate/cbs-vvc-AUD_A_3 @@ -0,0 +1 @@ +5a5bf4ec5e75d38958863ce8aa6c1fad diff --git a/tests/ref/fate/cbs-vvc-BOUNDARY_A_3 b/tests/ref/fate/cbs-vvc-BOUNDARY_A_3 new file mode 100644 index
[FFmpeg-devel] [PATCH v2 1/2] avcodec/cbs_h2645: fix parsing and storing Picture Header references in the context
Signed-off-by: James Almer --- libavcodec/cbs_h2645.c| 35 --- libavcodec/cbs_h266.h | 17 +++-- libavcodec/cbs_h266_syntax_template.c | 17 ++--- libavcodec/h266_metadata_bsf.c| 13 +- libavcodec/vvc_parser.c | 10 5 files changed, 50 insertions(+), 42 deletions(-) diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c index cdd7901518..68ccf6a7eb 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -525,12 +525,6 @@ static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx, if (frag->data_size == 0) return 0; -if (codec_id == AV_CODEC_ID_VVC) { -//we deactive picture header here to avoid reuse previous au's ph. -CodedBitstreamH266Context *h266 = ctx->priv_data; -h266->priv.ph = NULL; -} - if (header && frag->data[0] && codec_id == AV_CODEC_ID_H264) { // AVCC header. size_t size, start, end; @@ -793,19 +787,20 @@ cbs_h266_replace_ps(6, SPS, sps, sps_seq_parameter_set_id) cbs_h266_replace_ps(6, PPS, pps, pps_pic_parameter_set_id) static int cbs_h266_replace_ph(CodedBitstreamContext *ctx, - CodedBitstreamUnit *unit) + CodedBitstreamUnit *unit, + H266RawPictureHeader *ph) { CodedBitstreamH266Context *h266 = ctx->priv_data; int err; -h266->priv.ph = NULL; err = ff_cbs_make_unit_refcounted(ctx, unit); if (err < 0) return err; -err = av_buffer_replace(>priv.ph_ref, unit->content_ref); +av_assert0(unit->content_ref); +err = av_buffer_replace(>ph_ref, unit->content_ref); if (err < 0) return err; -h266->priv.ph = (H266RawPH*)h266->priv.ph_ref->data; +h266->ph = ph; return 0; } @@ -,7 +1106,7 @@ static int cbs_h266_read_nal_unit(CodedBitstreamContext *ctx, err = cbs_h266_read_ph(ctx, , ph); if (err < 0) return err; -err = cbs_h266_replace_ph(ctx, unit); +err = cbs_h266_replace_ph(ctx, unit, >ph_picture_header); if (err < 0) return err; } @@ -1139,6 +1134,12 @@ static int cbs_h266_read_nal_unit(CodedBitstreamContext *ctx, pos = get_bits_count(); len = unit->data_size; +if (slice->header.sh_picture_header_in_slice_header_flag) { +err = cbs_h266_replace_ph(ctx, unit, >header.sh_picture_header); +if (err < 0) +return err; +} + slice->data_size = len - pos / 8; slice->data_ref = av_buffer_ref(unit->data_ref); if (!slice->data_ref) @@ -1640,7 +1641,7 @@ static int cbs_h266_write_nal_unit(CodedBitstreamContext *ctx, if (err < 0) return err; -err = cbs_h266_replace_ph(ctx, unit); +err = cbs_h266_replace_ph(ctx, unit, >ph_picture_header); if (err < 0) return err; } @@ -1661,6 +1662,12 @@ static int cbs_h266_write_nal_unit(CodedBitstreamContext *ctx, if (err < 0) return err; +if (slice->header.sh_picture_header_in_slice_header_flag) { +err = cbs_h266_replace_ph(ctx, unit, >header.sh_picture_header); +if (err < 0) +return err; +} + if (slice->data) { err = cbs_h2645_write_slice_data(ctx, pbc, slice->data, slice->data_size, @@ -1884,8 +1891,8 @@ static void cbs_h266_flush(CodedBitstreamContext *ctx) av_buffer_unref(>pps_ref[i]); h266->pps[i] = NULL; } -av_buffer_unref(>priv.ph_ref); -h266->priv.ph = NULL; +av_buffer_unref(>ph_ref); +h266->ph = NULL; } static void cbs_h266_close(CodedBitstreamContext *ctx) diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h index 03dfd4a954..54590748c3 100644 --- a/libavcodec/cbs_h266.h +++ b/libavcodec/cbs_h266.h @@ -581,8 +581,7 @@ typedef struct H266RawPredWeightTable { int16_t delta_chroma_offset_l1[15][2]; } H266RawPredWeightTable; -typedef struct H266RawPH { -H266RawNALUnitHeader nal_unit_header; +typedef struct H266RawPictureHeader { uint8_t ph_gdr_or_irap_pic_flag; uint8_t ph_non_ref_pic_flag; uint8_t ph_gdr_pic_flag; @@ -670,12 +669,17 @@ typedef struct H266RawPH { uint8_t ph_extension_length; uint8_t ph_extension_data_byte[256]; +} H266RawPictureHeader; + +typedef struct H266RawPH { +H266RawNALUnitHeader nal_unit_header; +H266RawPictureHeader ph_picture_header; } H266RawPH; typedef struct H266RawSliceHeader { H266RawNALUnitHeader nal_unit_header; uint8_t sh_picture_header_in_slice_header_flag; -H266RawPH sh_picture_header; +H266RawPictureHeader
[FFmpeg-devel] [PATCH] avcodec/evc_ps: Replace av_malloc+memset by av_mallocz
Signed-off-by: Andreas Rheinhardt --- libavcodec/evc_ps.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavcodec/evc_ps.c b/libavcodec/evc_ps.c index ec405345ae..fc2105b352 100644 --- a/libavcodec/evc_ps.c +++ b/libavcodec/evc_ps.c @@ -143,12 +143,10 @@ int ff_evc_parse_sps(GetBitContext *gb, EVCParamSets *ps) if (sps_seq_parameter_set_id >= EVC_MAX_SPS_COUNT) return AVERROR_INVALIDDATA; -sps = av_malloc(sizeof(*sps)); +sps = av_mallocz(sizeof(*sps)); if (!sps) return AVERROR(ENOMEM); -memset(sps, 0, sizeof(*sps)); - sps->sps_seq_parameter_set_id = sps_seq_parameter_set_id; // the Baseline profile is indicated by profile_idc eqal to 0 @@ -318,12 +316,10 @@ int ff_evc_parse_pps(GetBitContext *gb, EVCParamSets *ps) if (pps_pic_parameter_set_id >= EVC_MAX_PPS_COUNT) return AVERROR_INVALIDDATA; -pps = av_malloc(sizeof(*pps)); +pps = av_mallocz(sizeof(*pps)); if (!pps) return AVERROR(ENOMEM); -memset(pps, 0, sizeof(*pps)); - pps->pps_pic_parameter_set_id = pps_pic_parameter_set_id; pps->pps_seq_parameter_set_id = get_ue_golomb(gb); -- 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] avcodec/vvc_parser: Mark close function as av_cold
Signed-off-by: Andreas Rheinhardt --- libavcodec/vvc_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c index 69696eef57..0a8ef9f177 100644 --- a/libavcodec/vvc_parser.c +++ b/libavcodec/vvc_parser.c @@ -496,7 +496,7 @@ static av_cold int vvc_parser_init(AVCodecParserContext *s) return ret; } -static void vvc_parser_close(AVCodecParserContext *s) +static av_cold void vvc_parser_close(AVCodecParserContext *s) { VVCParserContext *ctx = s->priv_data; -- 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".
Re: [FFmpeg-devel] [PATCH] avcodec/vvc_parser: Don't store state unnecessarily
On 6/29/2023 6:53 PM, Andreas Rheinhardt wrote: VVCParserContext.au_info is only used once (and in a read-only manner); but this happens immediately after au_info has been completely overwritten. Therefore one can just the src structure used to overwrite au_info directly and remove au_info. This also means that the whole referencing and unreferncing of au_info (which duplicates AVBufferRefs CodedBitstreamH266Context and is therefore of dubious gain) can be removed, as can the AVBufferRef* contained in PuInfo; this also removes a certain uglyness: Sometimes these AVBufferRef* were ownership pointers and sometimes not. Signed-off-by: Andreas Rheinhardt --- libavcodec/vvc_parser.c | 63 + 1 file changed, 1 insertion(+), 62 deletions(-) diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c index efea833565..69696eef57 100644 --- a/libavcodec/vvc_parser.c +++ b/libavcodec/vvc_parser.c @@ -29,11 +29,6 @@ #define IS_H266_SLICE(nut) (nut <= VVC_RASL_NUT || (nut >= VVC_IDR_W_RADL && nut <= VVC_GDR_NUT)) typedef struct PuInfo { -AVBufferRef *sps_ref; -AVBufferRef *pps_ref; -AVBufferRef *slice_ref; -AVBufferRef *ph_ref; - const H266RawPPS *pps; const H266RawSPS *sps; const H266RawPH *ph; @@ -53,7 +48,6 @@ typedef struct VVCParserContext { CodedBitstreamFragment picture_unit; -PuInfo au_info; AVPacket au; AVPacket last_au; @@ -150,41 +144,6 @@ static int get_pict_type(const CodedBitstreamFragment *pu) return has_p ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; } -static void pu_info_unref(PuInfo *info) -{ -av_buffer_unref(>slice_ref); -av_buffer_unref(>ph_ref); -av_buffer_unref(>pps_ref); -av_buffer_unref(>sps_ref); -info->slice = NULL; -info->ph = NULL; -info->pps = NULL; -info->sps = NULL; -info->pic_type = AV_PICTURE_TYPE_NONE; -} - -static int pu_info_ref(PuInfo *dest, const PuInfo *src) -{ -pu_info_unref(dest); -dest->sps_ref = av_buffer_ref(src->sps_ref); -dest->pps_ref = av_buffer_ref(src->pps_ref); -if (src->ph_ref) -dest->ph_ref = av_buffer_ref(src->ph_ref); -dest->slice_ref = av_buffer_ref(src->slice_ref); -if (!dest->sps_ref || !dest->pps_ref || (src->ph_ref && !dest->ph_ref) -|| !dest->slice_ref) { -pu_info_unref(dest); -return AVERROR(ENOMEM); -} - -dest->sps = src->sps; -dest->pps = src->pps; -dest->ph = src->ph; -dest->slice = src->slice; -dest->pic_type = src->pic_type; -return 0; -} - static void set_parser_ctx(AVCodecParserContext *s, AVCodecContext *avctx, const PuInfo *pu) { @@ -241,20 +200,6 @@ static void set_parser_ctx(AVCodecParserContext *s, AVCodecContext *avctx, } } -static int set_ctx(AVCodecParserContext *s, AVCodecContext *avctx, - const PuInfo *next_pu) -{ -VVCParserContext *ctx = s->priv_data; - -int ret = pu_info_ref(>au_info, next_pu); -if (ret < 0) -return ret; - -set_parser_ctx(s, avctx, >au_info); - -return 0; -} - //8.3.1 Decoding process for picture order count. //VTM did not follow the spec, and it's much simpler than spec. //We follow the VTM. @@ -338,10 +283,8 @@ static int get_pu_info(PuInfo *info, const CodedBitstreamH266Context *h266, continue; if ( nal->nal_unit_type == VVC_PH_NUT ) { info->ph = pu->units[i].content; -info->ph_ref = pu->units[i].content_ref; } else if (IS_H266_SLICE(nal->nal_unit_type)) { info->slice = pu->units[i].content; -info->slice_ref = pu->units[i].content_ref; if (info->slice->header.sh_picture_header_in_slice_header_flag) info->ph = >slice->header.sh_picture_header; if (!info->ph) { @@ -365,7 +308,6 @@ static int get_pu_info(PuInfo *info, const CodedBitstreamH266Context *h266, ret = AVERROR_INVALIDDATA; goto error; } -info->pps_ref = h266->pps_ref[info->ph->ph_pic_parameter_set_id]; info->sps = h266->sps[info->pps->pps_seq_parameter_set_id]; if (!info->sps) { av_log(logctx, AV_LOG_ERROR, "SPS id %d is not avaliable.\n", @@ -373,7 +315,6 @@ static int get_pu_info(PuInfo *info, const CodedBitstreamH266Context *h266, ret = AVERROR_INVALIDDATA; goto error; } -info->sps_ref = h266->sps_ref[info->pps->pps_seq_parameter_set_id]; info->pic_type = get_pict_type(pu); return 0; error: @@ -430,8 +371,7 @@ static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, goto end; } if (is_au_start(ctx, , avctx)) { -if ((ret = set_ctx(s, avctx, )) < 0) -goto end; +set_parser_ctx(s, avctx, ); av_packet_move_ref(>last_au, >au); } else { ret = 1; //not a completed au @@ -560,7 +500,6 @@ static void
[FFmpeg-devel] [PATCH] avcodec/vvc_parser: Don't store state unnecessarily
VVCParserContext.au_info is only used once (and in a read-only manner); but this happens immediately after au_info has been completely overwritten. Therefore one can just the src structure used to overwrite au_info directly and remove au_info. This also means that the whole referencing and unreferncing of au_info (which duplicates AVBufferRefs CodedBitstreamH266Context and is therefore of dubious gain) can be removed, as can the AVBufferRef* contained in PuInfo; this also removes a certain uglyness: Sometimes these AVBufferRef* were ownership pointers and sometimes not. Signed-off-by: Andreas Rheinhardt --- libavcodec/vvc_parser.c | 63 + 1 file changed, 1 insertion(+), 62 deletions(-) diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c index efea833565..69696eef57 100644 --- a/libavcodec/vvc_parser.c +++ b/libavcodec/vvc_parser.c @@ -29,11 +29,6 @@ #define IS_H266_SLICE(nut) (nut <= VVC_RASL_NUT || (nut >= VVC_IDR_W_RADL && nut <= VVC_GDR_NUT)) typedef struct PuInfo { -AVBufferRef *sps_ref; -AVBufferRef *pps_ref; -AVBufferRef *slice_ref; -AVBufferRef *ph_ref; - const H266RawPPS *pps; const H266RawSPS *sps; const H266RawPH *ph; @@ -53,7 +48,6 @@ typedef struct VVCParserContext { CodedBitstreamFragment picture_unit; -PuInfo au_info; AVPacket au; AVPacket last_au; @@ -150,41 +144,6 @@ static int get_pict_type(const CodedBitstreamFragment *pu) return has_p ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; } -static void pu_info_unref(PuInfo *info) -{ -av_buffer_unref(>slice_ref); -av_buffer_unref(>ph_ref); -av_buffer_unref(>pps_ref); -av_buffer_unref(>sps_ref); -info->slice = NULL; -info->ph = NULL; -info->pps = NULL; -info->sps = NULL; -info->pic_type = AV_PICTURE_TYPE_NONE; -} - -static int pu_info_ref(PuInfo *dest, const PuInfo *src) -{ -pu_info_unref(dest); -dest->sps_ref = av_buffer_ref(src->sps_ref); -dest->pps_ref = av_buffer_ref(src->pps_ref); -if (src->ph_ref) -dest->ph_ref = av_buffer_ref(src->ph_ref); -dest->slice_ref = av_buffer_ref(src->slice_ref); -if (!dest->sps_ref || !dest->pps_ref || (src->ph_ref && !dest->ph_ref) -|| !dest->slice_ref) { -pu_info_unref(dest); -return AVERROR(ENOMEM); -} - -dest->sps = src->sps; -dest->pps = src->pps; -dest->ph = src->ph; -dest->slice = src->slice; -dest->pic_type = src->pic_type; -return 0; -} - static void set_parser_ctx(AVCodecParserContext *s, AVCodecContext *avctx, const PuInfo *pu) { @@ -241,20 +200,6 @@ static void set_parser_ctx(AVCodecParserContext *s, AVCodecContext *avctx, } } -static int set_ctx(AVCodecParserContext *s, AVCodecContext *avctx, - const PuInfo *next_pu) -{ -VVCParserContext *ctx = s->priv_data; - -int ret = pu_info_ref(>au_info, next_pu); -if (ret < 0) -return ret; - -set_parser_ctx(s, avctx, >au_info); - -return 0; -} - //8.3.1 Decoding process for picture order count. //VTM did not follow the spec, and it's much simpler than spec. //We follow the VTM. @@ -338,10 +283,8 @@ static int get_pu_info(PuInfo *info, const CodedBitstreamH266Context *h266, continue; if ( nal->nal_unit_type == VVC_PH_NUT ) { info->ph = pu->units[i].content; -info->ph_ref = pu->units[i].content_ref; } else if (IS_H266_SLICE(nal->nal_unit_type)) { info->slice = pu->units[i].content; -info->slice_ref = pu->units[i].content_ref; if (info->slice->header.sh_picture_header_in_slice_header_flag) info->ph = >slice->header.sh_picture_header; if (!info->ph) { @@ -365,7 +308,6 @@ static int get_pu_info(PuInfo *info, const CodedBitstreamH266Context *h266, ret = AVERROR_INVALIDDATA; goto error; } -info->pps_ref = h266->pps_ref[info->ph->ph_pic_parameter_set_id]; info->sps = h266->sps[info->pps->pps_seq_parameter_set_id]; if (!info->sps) { av_log(logctx, AV_LOG_ERROR, "SPS id %d is not avaliable.\n", @@ -373,7 +315,6 @@ static int get_pu_info(PuInfo *info, const CodedBitstreamH266Context *h266, ret = AVERROR_INVALIDDATA; goto error; } -info->sps_ref = h266->sps_ref[info->pps->pps_seq_parameter_set_id]; info->pic_type = get_pict_type(pu); return 0; error: @@ -430,8 +371,7 @@ static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, goto end; } if (is_au_start(ctx, , avctx)) { -if ((ret = set_ctx(s, avctx, )) < 0) -goto end; +set_parser_ctx(s, avctx, ); av_packet_move_ref(>last_au, >au); } else { ret = 1; //not a completed au @@ -560,7 +500,6 @@ static void vvc_parser_close(AVCodecParserContext *s) { VVCParserContext *ctx = s->priv_data; -
[FFmpeg-devel] [PATCH] fftools/ffplay: remove usage of internal AVInputFormat.read_seek field
Signed-off-by: James Almer --- fftools/ffplay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 15fd644974..663f61d8b2 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -2639,7 +2639,7 @@ static int stream_component_open(VideoState *is, int stream_index) if ((ret = decoder_init(>auddec, avctx, >audioq, is->continue_read_thread)) < 0) goto fail; -if ((is->ic->iformat->flags & (AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK)) && !is->ic->iformat->read_seek) { +if (is->ic->iformat->flags & AVFMT_NOTIMESTAMPS) { is->auddec.start_pts = is->audio_st->start_time; is->auddec.start_pts_tb = is->audio_st->time_base; } -- 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] avcodec/vvc_parser: Remove unnecessary headers
On 6/29/2023 5:54 PM, Andreas Rheinhardt wrote: Signed-off-by: Andreas Rheinhardt --- libavcodec/vvc_parser.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c index f350fe70a9..efea833565 100644 --- a/libavcodec/vvc_parser.c +++ b/libavcodec/vvc_parser.c @@ -22,9 +22,7 @@ #include "cbs.h" #include "cbs_h266.h" -#include "internal.h" #include "parser.h" -#include "decode.h" #define START_CODE 0x01 ///< start_code_prefix_one_3bytes #define IS_IDR(nut) (nut == VVC_IDR_W_RADL || nut == VVC_IDR_N_LP) Should be ok. ___ 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 v2] avformat/http: copy only mime type from Content-Type
On 6/28/23 20:12, Leo Izen wrote: On 6/16/23 13:46, Kacper Michajlow wrote: On Thu, 1 Jun 2023 at 21:44, Kacper Michajłow wrote: Content-Type can include charset and boundary which is not a part of mime type and shouldn't be copied as such. Fixes HLS playback when the Content-Type includes additional fields. Signed-off-by: Kacper Michajłow --- libavformat/http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/http.c b/libavformat/http.c index 0817aafb5b..fd931c2d8e 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -1205,7 +1205,7 @@ static int process_line(URLContext *h, char *line, int line_count) } } else if (!av_strcasecmp(tag, "Content-Type")) { av_free(s->mime_type); - s->mime_type = av_strdup(p); + s->mime_type = av_get_token((const char **), ";"); } else if (!av_strcasecmp(tag, "Set-Cookie")) { if (parse_cookie(s, p, >cookie_dict)) av_log(h, AV_LOG_WARNING, "Unable to parse '%s'\n", p); -- 2.34.1 Bump. I would prefer this smal thing to be fixed upstream, than adding workaround. Thanks. LGTM, will push tomorrow if no objections. - Leo Izen Pushed as 0cd2e7dcfbc8. - Leo Izen ___ 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] fate/cbs: add VVC tests
Signed-off-by: James Almer --- tests/fate/cbs.mak | 40 ++ tests/ref/fate/cbs-vvc-AUD_A_3 | 1 + tests/ref/fate/cbs-vvc-BOUNDARY_A_3| 1 + tests/ref/fate/cbs-vvc-BUMP_A_2| 1 + tests/ref/fate/cbs-vvc-CROP_B_4| 1 + tests/ref/fate/cbs-vvc-CodingToolsSets_A_2 | 1 + tests/ref/fate/cbs-vvc-HRD_A_3 | 1 + tests/ref/fate/cbs-vvc-PHSH_B_1| 1 + tests/ref/fate/cbs-vvc-POC_A_1 | 1 + tests/ref/fate/cbs-vvc-PPS_B_1 | 1 + tests/ref/fate/cbs-vvc-RAP_A_1 | 1 + tests/ref/fate/cbs-vvc-SAO_A_3 | 1 + tests/ref/fate/cbs-vvc-SCALING_A_1 | 1 + tests/ref/fate/cbs-vvc-SLICES_A_3 | 1 + tests/ref/fate/cbs-vvc-SPS_B_1 | 1 + tests/ref/fate/cbs-vvc-STILL_B_1 | 1 + tests/ref/fate/cbs-vvc-SUBPIC_A_3 | 1 + tests/ref/fate/cbs-vvc-TILE_A_2| 1 + tests/ref/fate/cbs-vvc-VPS_A_3 | 1 + tests/ref/fate/cbs-vvc-WPP_A_3 | 1 + tests/ref/fate/cbs-vvc-WP_A_3 | 1 + tests/ref/fate/cbs-vvc-WRAP_A_4| 1 + 22 files changed, 61 insertions(+) create mode 100644 tests/ref/fate/cbs-vvc-AUD_A_3 create mode 100644 tests/ref/fate/cbs-vvc-BOUNDARY_A_3 create mode 100644 tests/ref/fate/cbs-vvc-BUMP_A_2 create mode 100644 tests/ref/fate/cbs-vvc-CROP_B_4 create mode 100644 tests/ref/fate/cbs-vvc-CodingToolsSets_A_2 create mode 100644 tests/ref/fate/cbs-vvc-HRD_A_3 create mode 100644 tests/ref/fate/cbs-vvc-PHSH_B_1 create mode 100644 tests/ref/fate/cbs-vvc-POC_A_1 create mode 100644 tests/ref/fate/cbs-vvc-PPS_B_1 create mode 100644 tests/ref/fate/cbs-vvc-RAP_A_1 create mode 100644 tests/ref/fate/cbs-vvc-SAO_A_3 create mode 100644 tests/ref/fate/cbs-vvc-SCALING_A_1 create mode 100644 tests/ref/fate/cbs-vvc-SLICES_A_3 create mode 100644 tests/ref/fate/cbs-vvc-SPS_B_1 create mode 100644 tests/ref/fate/cbs-vvc-STILL_B_1 create mode 100644 tests/ref/fate/cbs-vvc-SUBPIC_A_3 create mode 100644 tests/ref/fate/cbs-vvc-TILE_A_2 create mode 100644 tests/ref/fate/cbs-vvc-VPS_A_3 create mode 100644 tests/ref/fate/cbs-vvc-WPP_A_3 create mode 100644 tests/ref/fate/cbs-vvc-WP_A_3 create mode 100644 tests/ref/fate/cbs-vvc-WRAP_A_4 diff --git a/tests/fate/cbs.mak b/tests/fate/cbs.mak index 0084c3d25c..344515a7fa 100644 --- a/tests/fate/cbs.mak +++ b/tests/fate/cbs.mak @@ -5,6 +5,7 @@ fate-cbs: fate-cbs-av1 fate-cbs-h264 fate-cbs-hevc fate-cbs-mpeg2 fate-cbs-vp9 FATE_CBS_DEPS = $(call ALLYES, $(1)_DEMUXER $(2)_PARSER $(3)_METADATA_BSF $(4)_DECODER $(5)_MUXER) +FATE_CBS_NO_DEC_DEPS = $(call ALLYES, $(1)_DEMUXER $(2)_PARSER $(3)_METADATA_BSF $(4)_MUXER) define FATE_CBS_TEST # (codec, test_name, sample_file, output_format) @@ -12,6 +13,12 @@ FATE_CBS_$(1) += fate-cbs-$(1)-$(2) fate-cbs-$(1)-$(2): CMD = md5 -c:v $(3) -i $(TARGET_SAMPLES)/$(4) -c:v copy -y -bsf:v $(1)_metadata -f $(5) endef +define FATE_CBS_NO_DEC_TEST +# (codec, test_name, sample_file, output_format) +FATE_CBS_$(1) += fate-cbs-$(1)-$(2) +fate-cbs-$(1)-$(2): CMD = md5 -i $(TARGET_SAMPLES)/$(3) -c:v copy -y -bsf:v $(1)_metadata -f $(4) +endef + define FATE_CBS_DISCARD_TEST # (codec, discard_type, sample_file, output_format, dep) FATE_CBS_$(1)_DISCARD += fate-cbs-$(1)-discard-$(2) @@ -163,6 +170,39 @@ FATE_CBS_HEVC-$(call ALLYES, MP4_MUXER, HEVC_PARSER, FILTER_UNITS_BSF, HEVC_MUXE FATE_SAMPLES_AVCONV += $(FATE_CBS_HEVC-yes) fate-cbs-hevc: $(FATE_CBS_HEVC-yes) +# H.266 read/write + +FATE_CBS_VVC_SAMPLES =\ +AUD_A_3.bit \ +BOUNDARY_A_3.bit \ +BUMP_A_2.bit \ +CodingToolsSets_A_2.bit \ +CROP_B_4.bit \ +HRD_A_3.bit \ +PHSH_B_1.bit \ +POC_A_1.bit \ +PPS_B_1.bit \ +RAP_A_1.bit \ +SAO_A_3.bit \ +SCALING_A_1.bit \ +SLICES_A_3.bit\ +SPS_B_1.bit \ +STILL_B_1.bit \ +SUBPIC_A_3.bit\ +TILE_A_2.bit \ +VPS_A_3.bit \ +WP_A_3.bit\ +WPP_A_3.bit \ +WRAP_A_4.bit \ + + +$(foreach N,$(FATE_CBS_VVC_SAMPLES),$(eval $(call FATE_CBS_NO_DEC_TEST,vvc,$(basename $(N)),vvc-conformance/$(N),vvc))) + +FATE_CBS_VVC-$(call FATE_CBS_NO_DEC_DEPS, HEVC, HEVC, HEVC, HEVC) = $(FATE_CBS_vvc) + +FATE_SAMPLES_AVCONV += $(FATE_CBS_VVC-yes) +fate-cbs-vvc: $(FATE_CBS_VVC-yes) + # MPEG-2 read/write FATE_CBS_MPEG2_SAMPLES = \ diff --git a/tests/ref/fate/cbs-vvc-AUD_A_3 b/tests/ref/fate/cbs-vvc-AUD_A_3 new file mode 100644 index 00..91dfc817b7 --- /dev/null +++ b/tests/ref/fate/cbs-vvc-AUD_A_3 @@ -0,0 +1 @@ +5a5bf4ec5e75d38958863ce8aa6c1fad diff --git a/tests/ref/fate/cbs-vvc-BOUNDARY_A_3 b/tests/ref/fate/cbs-vvc-BOUNDARY_A_3 new file mode 100644 index
[FFmpeg-devel] [PATCH] fate/cbs: add VVC tests
Signed-off-by: James Almer --- tests/fate/cbs.mak | 40 ++ tests/ref/fate/cbs-vvc-AUD_A_3 | 1 + tests/ref/fate/cbs-vvc-BOUNDARY_A_3| 1 + tests/ref/fate/cbs-vvc-BUMP_A_2| 1 + tests/ref/fate/cbs-vvc-CROP_B_4| 1 + tests/ref/fate/cbs-vvc-CodingToolsSets_A_2 | 1 + tests/ref/fate/cbs-vvc-HRD_A_3 | 1 + tests/ref/fate/cbs-vvc-PHSH_B_1| 1 + tests/ref/fate/cbs-vvc-POC_A_1 | 1 + tests/ref/fate/cbs-vvc-PPS_B_1 | 1 + tests/ref/fate/cbs-vvc-RAP_A_1 | 1 + tests/ref/fate/cbs-vvc-SAO_A_3 | 1 + tests/ref/fate/cbs-vvc-SCALING_A_1 | 1 + tests/ref/fate/cbs-vvc-SLICES_A_3 | 1 + tests/ref/fate/cbs-vvc-SPS_A_1 | 1 + tests/ref/fate/cbs-vvc-STILL_B_1 | 1 + tests/ref/fate/cbs-vvc-SUBPIC_A_3 | 1 + tests/ref/fate/cbs-vvc-TILE_A_2| 1 + tests/ref/fate/cbs-vvc-VPS_A_3 | 1 + tests/ref/fate/cbs-vvc-WPP_A_3 | 1 + tests/ref/fate/cbs-vvc-WP_A_3 | 1 + tests/ref/fate/cbs-vvc-WRAP_A_4| 1 + 22 files changed, 61 insertions(+) create mode 100644 tests/ref/fate/cbs-vvc-AUD_A_3 create mode 100644 tests/ref/fate/cbs-vvc-BOUNDARY_A_3 create mode 100644 tests/ref/fate/cbs-vvc-BUMP_A_2 create mode 100644 tests/ref/fate/cbs-vvc-CROP_B_4 create mode 100644 tests/ref/fate/cbs-vvc-CodingToolsSets_A_2 create mode 100644 tests/ref/fate/cbs-vvc-HRD_A_3 create mode 100644 tests/ref/fate/cbs-vvc-PHSH_B_1 create mode 100644 tests/ref/fate/cbs-vvc-POC_A_1 create mode 100644 tests/ref/fate/cbs-vvc-PPS_B_1 create mode 100644 tests/ref/fate/cbs-vvc-RAP_A_1 create mode 100644 tests/ref/fate/cbs-vvc-SAO_A_3 create mode 100644 tests/ref/fate/cbs-vvc-SCALING_A_1 create mode 100644 tests/ref/fate/cbs-vvc-SLICES_A_3 create mode 100644 tests/ref/fate/cbs-vvc-SPS_A_1 create mode 100644 tests/ref/fate/cbs-vvc-STILL_B_1 create mode 100644 tests/ref/fate/cbs-vvc-SUBPIC_A_3 create mode 100644 tests/ref/fate/cbs-vvc-TILE_A_2 create mode 100644 tests/ref/fate/cbs-vvc-VPS_A_3 create mode 100644 tests/ref/fate/cbs-vvc-WPP_A_3 create mode 100644 tests/ref/fate/cbs-vvc-WP_A_3 create mode 100644 tests/ref/fate/cbs-vvc-WRAP_A_4 diff --git a/tests/fate/cbs.mak b/tests/fate/cbs.mak index 0084c3d25c..5907a2b7a2 100644 --- a/tests/fate/cbs.mak +++ b/tests/fate/cbs.mak @@ -5,6 +5,7 @@ fate-cbs: fate-cbs-av1 fate-cbs-h264 fate-cbs-hevc fate-cbs-mpeg2 fate-cbs-vp9 FATE_CBS_DEPS = $(call ALLYES, $(1)_DEMUXER $(2)_PARSER $(3)_METADATA_BSF $(4)_DECODER $(5)_MUXER) +FATE_CBS_NO_DEC_DEPS = $(call ALLYES, $(1)_DEMUXER $(2)_PARSER $(3)_METADATA_BSF $(4)_MUXER) define FATE_CBS_TEST # (codec, test_name, sample_file, output_format) @@ -12,6 +13,12 @@ FATE_CBS_$(1) += fate-cbs-$(1)-$(2) fate-cbs-$(1)-$(2): CMD = md5 -c:v $(3) -i $(TARGET_SAMPLES)/$(4) -c:v copy -y -bsf:v $(1)_metadata -f $(5) endef +define FATE_CBS_NO_DEC_TEST +# (codec, test_name, sample_file, output_format) +FATE_CBS_$(1) += fate-cbs-$(1)-$(2) +fate-cbs-$(1)-$(2): CMD = md5 -i $(TARGET_SAMPLES)/$(3) -c:v copy -y -bsf:v $(1)_metadata -f $(4) +endef + define FATE_CBS_DISCARD_TEST # (codec, discard_type, sample_file, output_format, dep) FATE_CBS_$(1)_DISCARD += fate-cbs-$(1)-discard-$(2) @@ -163,6 +170,39 @@ FATE_CBS_HEVC-$(call ALLYES, MP4_MUXER, HEVC_PARSER, FILTER_UNITS_BSF, HEVC_MUXE FATE_SAMPLES_AVCONV += $(FATE_CBS_HEVC-yes) fate-cbs-hevc: $(FATE_CBS_HEVC-yes) +# H.266 read/write + +FATE_CBS_VVC_SAMPLES =\ +AUD_A_3.bit \ +BOUNDARY_A_3.bit \ +BUMP_A_2.bit \ +CodingToolsSets_A_2.bit \ +CROP_B_4.bit \ +HRD_A_3.bit \ +PHSH_B_1.bit \ +POC_A_1.bit \ +PPS_B_1.bit \ +RAP_A_1.bit \ +SAO_A_3.bit \ +SCALING_A_1.bit \ +SLICES_A_3.bit\ +SPS_A_1.bit \ +STILL_B_1.bit \ +SUBPIC_A_3.bit\ +TILE_A_2.bit \ +VPS_A_3.bit \ +WP_A_3.bit\ +WPP_A_3.bit \ +WRAP_A_4.bit \ + + +$(foreach N,$(FATE_CBS_VVC_SAMPLES),$(eval $(call FATE_CBS_NO_DEC_TEST,vvc,$(basename $(N)),vvc-conformance/$(N),vvc))) + +FATE_CBS_VVC-$(call FATE_CBS_NO_DEC_DEPS, HEVC, HEVC, HEVC, HEVC) = $(FATE_CBS_vvc) + +FATE_SAMPLES_AVCONV += $(FATE_CBS_VVC-yes) +fate-cbs-vvc: $(FATE_CBS_VVC-yes) + # MPEG-2 read/write FATE_CBS_MPEG2_SAMPLES = \ diff --git a/tests/ref/fate/cbs-vvc-AUD_A_3 b/tests/ref/fate/cbs-vvc-AUD_A_3 new file mode 100644 index 00..91dfc817b7 --- /dev/null +++ b/tests/ref/fate/cbs-vvc-AUD_A_3 @@ -0,0 +1 @@ +5a5bf4ec5e75d38958863ce8aa6c1fad diff --git a/tests/ref/fate/cbs-vvc-BOUNDARY_A_3 b/tests/ref/fate/cbs-vvc-BOUNDARY_A_3 new file mode 100644 index
[FFmpeg-devel] [PATCH] avcodec/vvc_parser: Remove unnecessary headers
Signed-off-by: Andreas Rheinhardt --- libavcodec/vvc_parser.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c index f350fe70a9..efea833565 100644 --- a/libavcodec/vvc_parser.c +++ b/libavcodec/vvc_parser.c @@ -22,9 +22,7 @@ #include "cbs.h" #include "cbs_h266.h" -#include "internal.h" #include "parser.h" -#include "decode.h" #define START_CODE 0x01 ///< start_code_prefix_one_3bytes #define IS_IDR(nut) (nut == VVC_IDR_W_RADL || nut == VVC_IDR_N_LP) -- 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".
Re: [FFmpeg-devel] [PATCH v7 03/11] avcodec: add bitstream parser for H266/VVC
Thomas Siedel: > From: Nuo Mi > > Add nal parser ff_vvc_parser to parse vvc elementary bitstreams. > > Co-authored-by: Thomas Siedel > --- > configure| 1 + > libavcodec/Makefile | 2 + > libavcodec/h2645_parse.c | 71 - > libavcodec/h266_parser.c | 601 +++ > libavcodec/parsers.c | 1 + > 5 files changed, 675 insertions(+), 1 deletion(-) > create mode 100644 libavcodec/h266_parser.c > > diff --git a/configure b/configure > index 91964edc8f..2fb167c7c3 100755 > --- a/configure > +++ b/configure > @@ -3266,6 +3266,7 @@ av1_amf_encoder_deps="amf" > aac_parser_select="adts_header mpeg4audio" > av1_parser_select="cbs_av1" > h264_parser_select="golomb h264dsp h264parse h264_sei" > +h266_parser_select="cbs_h266" > hevc_parser_select="hevcparse hevc_sei" > mpegaudio_parser_select="mpegaudioheader" > mpeg4video_parser_select="h263dsp mpegvideodec qpeldsp" > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index abae4909d2..79c4363f3d 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -76,6 +76,7 @@ OBJS-$(CONFIG_CBS) += cbs.o cbs_bsf.o > OBJS-$(CONFIG_CBS_AV1) += cbs_av1.o > OBJS-$(CONFIG_CBS_H264)+= cbs_h2645.o cbs_sei.o h2645_parse.o > OBJS-$(CONFIG_CBS_H265)+= cbs_h2645.o cbs_sei.o h2645_parse.o > +OBJS-$(CONFIG_CBS_H266)+= cbs_h2645.o cbs_sei.o h2645_parse.o > OBJS-$(CONFIG_CBS_JPEG)+= cbs_jpeg.o > OBJS-$(CONFIG_CBS_MPEG2) += cbs_mpeg2.o > OBJS-$(CONFIG_CBS_VP9) += cbs_vp9.o > @@ -1166,6 +1167,7 @@ OBJS-$(CONFIG_GSM_PARSER) += gsm_parser.o > OBJS-$(CONFIG_H261_PARSER) += h261_parser.o > OBJS-$(CONFIG_H263_PARSER) += h263_parser.o > OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264data.o > +OBJS-$(CONFIG_H266_PARSER) += h266_parser.o > OBJS-$(CONFIG_HEVC_PARSER) += hevc_parser.o hevc_data.o > OBJS-$(CONFIG_HDR_PARSER) += hdr_parser.o > OBJS-$(CONFIG_IPU_PARSER) += ipu_parser.o > diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c > index 90944177c7..5261c3e568 100644 > --- a/libavcodec/h2645_parse.c > +++ b/libavcodec/h2645_parse.c > @@ -30,6 +30,7 @@ > #include "hevc.h" > #include "h264.h" > #include "h2645_parse.h" > +#include "h266.h" > > int ff_h2645_extract_rbsp(const uint8_t *src, int length, >H2645RBSP *rbsp, H2645NAL *nal, int small_padding) > @@ -145,6 +146,47 @@ nsc: > return si; > } > > +static const char *const h266_nal_type_name[32] = { > +"TRAIL_NUT", // VVC_TRAIL_NUT > +"STSA_NUT", // VVC_STSA_NUT > +"RADL_NUT", // VVC_RADL_NUT > +"RASL_NUT", // VVC_RASL_NUT > +"RSV_VCL_4", // VVC_RSV_VCL_4 > +"RSV_VCL_5", // VVC_RSV_VCL_5 > +"RSV_VCL_6", // VVC_RSV_VCL_6 > +"IDR_W_RADL", // VVC_IDR_W_RADL > +"IDR_N_LP", // VVC_IDR_N_LP > +"CRA_NUT", // VVC_CRA_NUT > +"GDR_NUT", // VVC_GDR_NUT > +"RSV_IRAP_11", // VVC_RSV_IRAP_11 > +"OPI_NUT", // VVC_OPI_NUT > +"DCI_NUT", // VVC_DCI_NUT > +"VPS_NUT", // VVC_VPS_NUT > +"SPS_NUT", // VVC_SPS_NUT > +"PPS_NUT", // VVC_PPS_NUT > +"PREFIX_APS_NUT",// VVC_PREFIX_APS_NUT > +"SUFFIX_APS_NUT",// VVC_SUFFIX_APS_NUT > +"PH_NUT", // VVC_PH_NUT > +"AUD_NUT", // VVC_AUD_NUT > +"EOS_NUT", // VVC_EOS_NUT > +"EOB_NUT", // VVC_EOB_NUT > +"PREFIX_SEI_NUT",// VVC_PREFIX_SEI_NUT > +"SUFFIX_SEI_NUT",// VVC_SUFFIX_SEI_NUT > +"FD_NUT", // VVC_FD_NUT > +"RSV_NVCL_26", // VVC_RSV_NVCL_26 > +"RSV_NVCL_27", // VVC_RSV_NVCL_27 > +"UNSPEC_28", // VVC_UNSPEC_28 > +"UNSPEC_29", // VVC_UNSPEC_29 > +"UNSPEC_30", // VVC_UNSPEC_30 > +"UNSPEC_31", // VVC_UNSPEC_31 > +}; > + > +static const char *h266_nal_unit_name(int nal_type) > +{ > +av_assert0(nal_type >= 0 && nal_type < 32); > +return h266_nal_type_name[nal_type]; > +} > + > static const char *const hevc_nal_type_name[64] = { > "TRAIL_N", // HEVC_NAL_TRAIL_N > "TRAIL_R", // HEVC_NAL_TRAIL_R > @@ -293,6 +335,31 @@ static int get_bit_length(H2645NAL *nal, int min_size, > int skip_trailing_zeros) > * @return AVERROR_INVALIDDATA if the packet is not a valid NAL unit, > * 0 otherwise > */ > +static int h266_parse_nal_header(H2645NAL *nal, void *logctx) > +{ > +GetBitContext *gb = >gb; > + > +if (get_bits1(gb) != 0) //forbidden_zero_bit > +return AVERROR_INVALIDDATA; > + > +skip_bits1(gb); //nuh_reserved_zero_bit > + > +nal->nuh_layer_id = get_bits(gb, 6); > +nal->type = get_bits(gb, 5); > +nal->temporal_id = get_bits(gb, 3) - 1; > +if (nal->temporal_id < 0) > +return AVERROR_INVALIDDATA; > + > +if ((nal->type >= VVC_IDR_W_RADL && nal->type <= VVC_RSV_IRAP_11) && > nal->temporal_id) > +return AVERROR_INVALIDDATA; > + > +
[FFmpeg-devel] [PATCH] avcodec/cbs_h2645: fix storing Picture Header references in the context
Signed-off-by: James Almer --- libavcodec/cbs_h2645.c| 31 +++ libavcodec/cbs_h266.h | 7 ++ libavcodec/cbs_h266_syntax_template.c | 7 +++--- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c index cdd7901518..cf480d71f6 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -525,12 +525,6 @@ static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx, if (frag->data_size == 0) return 0; -if (codec_id == AV_CODEC_ID_VVC) { -//we deactive picture header here to avoid reuse previous au's ph. -CodedBitstreamH266Context *h266 = ctx->priv_data; -h266->priv.ph = NULL; -} - if (header && frag->data[0] && codec_id == AV_CODEC_ID_H264) { // AVCC header. size_t size, start, end; @@ -793,19 +787,20 @@ cbs_h266_replace_ps(6, SPS, sps, sps_seq_parameter_set_id) cbs_h266_replace_ps(6, PPS, pps, pps_pic_parameter_set_id) static int cbs_h266_replace_ph(CodedBitstreamContext *ctx, - CodedBitstreamUnit *unit) + CodedBitstreamUnit *unit, + H266RawPH *ph) { CodedBitstreamH266Context *h266 = ctx->priv_data; int err; -h266->priv.ph = NULL; err = ff_cbs_make_unit_refcounted(ctx, unit); if (err < 0) return err; -err = av_buffer_replace(>priv.ph_ref, unit->content_ref); +av_assert0(unit->content_ref); +err = av_buffer_replace(>ph_ref, unit->content_ref); if (err < 0) return err; -h266->priv.ph = (H266RawPH*)h266->priv.ph_ref->data; +h266->ph = ph; return 0; } @@ -,7 +1106,7 @@ static int cbs_h266_read_nal_unit(CodedBitstreamContext *ctx, err = cbs_h266_read_ph(ctx, , ph); if (err < 0) return err; -err = cbs_h266_replace_ph(ctx, unit); +err = cbs_h266_replace_ph(ctx, unit, ph); if (err < 0) return err; } @@ -1139,6 +1134,10 @@ static int cbs_h266_read_nal_unit(CodedBitstreamContext *ctx, pos = get_bits_count(); len = unit->data_size; +err = cbs_h266_replace_ph(ctx, unit, >header.sh_picture_header); +if (err < 0) +return err; + slice->data_size = len - pos / 8; slice->data_ref = av_buffer_ref(unit->data_ref); if (!slice->data_ref) @@ -1640,7 +1639,7 @@ static int cbs_h266_write_nal_unit(CodedBitstreamContext *ctx, if (err < 0) return err; -err = cbs_h266_replace_ph(ctx, unit); +err = cbs_h266_replace_ph(ctx, unit, ph); if (err < 0) return err; } @@ -1661,6 +1660,10 @@ static int cbs_h266_write_nal_unit(CodedBitstreamContext *ctx, if (err < 0) return err; +err = cbs_h266_replace_ph(ctx, unit, >header.sh_picture_header); +if (err < 0) +return err; + if (slice->data) { err = cbs_h2645_write_slice_data(ctx, pbc, slice->data, slice->data_size, @@ -1884,8 +1887,8 @@ static void cbs_h266_flush(CodedBitstreamContext *ctx) av_buffer_unref(>pps_ref[i]); h266->pps[i] = NULL; } -av_buffer_unref(>priv.ph_ref); -h266->priv.ph = NULL; +av_buffer_unref(>ph_ref); +h266->ph = NULL; } static void cbs_h266_close(CodedBitstreamContext *ctx) diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h index 03dfd4a954..460db7ab62 100644 --- a/libavcodec/cbs_h266.h +++ b/libavcodec/cbs_h266.h @@ -770,14 +770,11 @@ typedef struct CodedBitstreamH266Context { AVBufferRef *vps_ref[VVC_MAX_VPS_COUNT]; AVBufferRef *sps_ref[VVC_MAX_SPS_COUNT]; AVBufferRef *pps_ref[VVC_MAX_PPS_COUNT]; +AVBufferRef *ph_ref; H266RawVPS *vps[VVC_MAX_SPS_COUNT]; H266RawSPS *sps[VVC_MAX_SPS_COUNT]; H266RawPPS *pps[VVC_MAX_PPS_COUNT]; - -struct { -AVBufferRef *ph_ref; -H266RawPH *ph; -} priv; +H266RawPH *ph; } CodedBitstreamH266Context; #endif /* AVCODEC_CBS_H266_H */ diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 06f9f29e08..2861e6f223 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -2675,12 +2675,11 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, flag(sh_picture_header_in_slice_header_flag); if (current->sh_picture_header_in_slice_header_flag) { +//7.4.8 if sh_picture_header_in_slice_header_flag is true, we do not have a PH NAL unit CHECK(FUNC(picture_header) (ctx, rw, >sh_picture_header)); ph = >sh_picture_header; -//7.4.8 if
Re: [FFmpeg-devel] [PATCH 3/4] avfilter/vf_ccrepack: Constify filter
Paul B Mahol: > On Thu, Jun 29, 2023 at 9:35 PM Andreas Rheinhardt < > andreas.rheinha...@outlook.com> wrote: > >> Paul B Mahol: >>> On Thu, Jun 29, 2023 at 8:18 PM Andreas Rheinhardt < >>> andreas.rheinha...@outlook.com> wrote: >>> The discrepancy between the definition and the declaration in allfilters.c is actually UB. >>> >>> I get no such message with ubsan. >>> >> >> UBSan is a runtime UB-detector, not a compile-time UB detector. >> The earlier code is UB because of 6.2.7 (2) of C11: "All declarations >> that refer to the same object or function shall have compatible type; >> otherwise, the behavior is undefined." A type and its const-qualified >> type are not compatible. >> > > This is so minor, that it is fully irrelevant. > The actual advantage of these patches is that the objects can be put into read-only memory (.data.rel.ro in elf). - 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] [PATCH 3/4] avfilter/vf_ccrepack: Constify filter
On 6/29/2023 4:42 PM, Paul B Mahol wrote: On Thu, Jun 29, 2023 at 9:35 PM Andreas Rheinhardt < andreas.rheinha...@outlook.com> wrote: Paul B Mahol: On Thu, Jun 29, 2023 at 8:18 PM Andreas Rheinhardt < andreas.rheinha...@outlook.com> wrote: The discrepancy between the definition and the declaration in allfilters.c is actually UB. I get no such message with ubsan. UBSan is a runtime UB-detector, not a compile-time UB detector. The earlier code is UB because of 6.2.7 (2) of C11: "All declarations that refer to the same object or function shall have compatible type; otherwise, the behavior is undefined." A type and its const-qualified type are not compatible. This is so minor, that it is fully irrelevant. Msvc was pedantic enough to complain about a double colon, so who knows if some compiler would do the same for this. If the spec states both must match, then adding a "const" is hardly a problem. ___ 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 3/4] avfilter/vf_ccrepack: Constify filter
On Thu, Jun 29, 2023 at 9:35 PM Andreas Rheinhardt < andreas.rheinha...@outlook.com> wrote: > Paul B Mahol: > > On Thu, Jun 29, 2023 at 8:18 PM Andreas Rheinhardt < > > andreas.rheinha...@outlook.com> wrote: > > > >> The discrepancy between the definition and the declaration > >> in allfilters.c is actually UB. > >> > > > > I get no such message with ubsan. > > > > UBSan is a runtime UB-detector, not a compile-time UB detector. > The earlier code is UB because of 6.2.7 (2) of C11: "All declarations > that refer to the same object or function shall have compatible type; > otherwise, the behavior is undefined." A type and its const-qualified > type are not compatible. > This is so minor, that it is fully irrelevant. > > - 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] [PATCH 3/4] avfilter/vf_ccrepack: Constify filter
Paul B Mahol: > On Thu, Jun 29, 2023 at 8:18 PM Andreas Rheinhardt < > andreas.rheinha...@outlook.com> wrote: > >> The discrepancy between the definition and the declaration >> in allfilters.c is actually UB. >> > > I get no such message with ubsan. > UBSan is a runtime UB-detector, not a compile-time UB detector. The earlier code is UB because of 6.2.7 (2) of C11: "All declarations that refer to the same object or function shall have compatible type; otherwise, the behavior is undefined." A type and its const-qualified type are not compatible. - 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] [PATCH] avcodec/vlc: auto calculate depth
Paul B Mahol: > On Wed, Jun 28, 2023 at 7:34 PM Andreas Rheinhardt < > andreas.rheinha...@outlook.com> wrote: > >> Paul B Mahol: >>> On Wed, Jun 28, 2023 at 11:57 AM Paul B Mahol wrote: >>> On Wed, Jun 28, 2023 at 11:11 AM Andreas Rheinhardt < andreas.rheinha...@outlook.com> wrote: > Paul B Mahol: >> On Wed, Jun 28, 2023 at 12:26 AM Andreas Rheinhardt < >> andreas.rheinha...@outlook.com> wrote: >> >>> Paul B Mahol: On Tue, Jun 27, 2023 at 11:45 PM Andreas Rheinhardt < andreas.rheinha...@outlook.com> wrote: > Paul B Mahol: >> On Tue, Jun 27, 2023 at 11:05 PM Andreas Rheinhardt < >> andreas.rheinha...@outlook.com> wrote: >> >>> Paul B Mahol: On Tue, Jun 27, 2023 at 9:47 PM Andreas Rheinhardt < andreas.rheinha...@outlook.com> wrote: > Paul B Mahol: >> Patch attached. >> > > Where do you intend to use this? What is the point of it? > After all, using this value in GET_VLC makes no sense; only > compile-time > constants do. > It works when used in ac-4 as get_vlc2. >>> >>> Could you please define "works"? Using a non-compile-time >> constant >>> will >>> not benefit at all; it will only lead to more runtime checks. >>> >> >> I do not follow your worries. >> I can not use compile time constant as its very complicated code. >> > > Let's take a look at GET_VLC: > #define GET_VLC(code, name, gb, table, bits, max_depth) \ > do {\ > int n, nb_bits; \ > unsigned int index; \ > \ > index = SHOW_UBITS(name, gb, bits); \ > code = table[index].sym; \ > n = table[index].len; \ > \ > if (max_depth > 1 && n < 0) { \ > LAST_SKIP_BITS(name, gb, bits); \ > UPDATE_CACHE(name, gb); \ > \ > nb_bits = -n; \ > \ > index = SHOW_UBITS(name, gb, nb_bits) + code; \ > code = table[index].sym; \ > n = table[index].len; \ > if (max_depth > 2 && n < 0) { \ > LAST_SKIP_BITS(name, gb, nb_bits); \ > UPDATE_CACHE(name, gb); \ > \ > nb_bits = -n; \ > \ > index = SHOW_UBITS(name, gb, nb_bits) + code; \ > code = table[index].sym; \ > n = table[index].len; \ > } \ > } \ > SKIP_BITS(name, gb, n); \ > } while (0) > > If max_depth is not a compile-time constant, then the compiler will > have > to perform both of the max_depth > 1 && n < 0 checks; yet, this is > not > useful: If the depth of a particular VLC is (say) 1, then none of >> the > possible bits read will lead to reloading at all, because the n < 0 > condition will never be true; the only reason this condition exists > is > to use a compile-time upper bound, so that one can eliminate the > reload > code (and in particular, avoid the runtime checks). > >> Works means that vlc code is extracted correctly. >> > > If you have no upper bound about max_depth and it works, then use >> 3. > It does not work to use 3 all the time. And that one never worked in > any codec so far. >>> >>> I just ran FATE with the check for max_depth removed from GET_VLC and >>> from read_vlc for the cached API (effectively
Re: [FFmpeg-devel] [PATCH 3/4] avfilter/vf_ccrepack: Constify filter
On Thu, Jun 29, 2023 at 8:18 PM Andreas Rheinhardt < andreas.rheinha...@outlook.com> wrote: > The discrepancy between the definition and the declaration > in allfilters.c is actually UB. > I get no such message with ubsan. > > Signed-off-by: Andreas Rheinhardt > --- > libavfilter/vf_ccrepack.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavfilter/vf_ccrepack.c b/libavfilter/vf_ccrepack.c > index 61eb2128ae..950bb7b528 100644 > --- a/libavfilter/vf_ccrepack.c > +++ b/libavfilter/vf_ccrepack.c > @@ -92,7 +92,7 @@ static const AVFilterPad avfilter_vf_ccrepack_outputs[] > = { > }, > }; > > -AVFilter ff_vf_ccrepack = { > +const AVFilter ff_vf_ccrepack = { > .name= "ccrepack", > .description = NULL_IF_CONFIG_SMALL("Repack CEA-708 closed caption > metadata"), > .uninit = uninit, > -- > 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 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/vlc: auto calculate depth
On Wed, Jun 28, 2023 at 7:34 PM Andreas Rheinhardt < andreas.rheinha...@outlook.com> wrote: > Paul B Mahol: > > On Wed, Jun 28, 2023 at 11:57 AM Paul B Mahol wrote: > > > >> > >> > >> On Wed, Jun 28, 2023 at 11:11 AM Andreas Rheinhardt < > >> andreas.rheinha...@outlook.com> wrote: > >> > >>> Paul B Mahol: > On Wed, Jun 28, 2023 at 12:26 AM Andreas Rheinhardt < > andreas.rheinha...@outlook.com> wrote: > > > Paul B Mahol: > >> On Tue, Jun 27, 2023 at 11:45 PM Andreas Rheinhardt < > >> andreas.rheinha...@outlook.com> wrote: > >> > >>> Paul B Mahol: > On Tue, Jun 27, 2023 at 11:05 PM Andreas Rheinhardt < > andreas.rheinha...@outlook.com> wrote: > > > Paul B Mahol: > >> On Tue, Jun 27, 2023 at 9:47 PM Andreas Rheinhardt < > >> andreas.rheinha...@outlook.com> wrote: > >> > >>> Paul B Mahol: > Patch attached. > > >>> > >>> Where do you intend to use this? What is the point of it? > >>> After all, using this value in GET_VLC makes no sense; only > >>> compile-time > >>> constants do. > >>> > >> > >> It works when used in ac-4 as get_vlc2. > >> > > > > Could you please define "works"? Using a non-compile-time > constant > > will > > not benefit at all; it will only lead to more runtime checks. > > > > I do not follow your worries. > I can not use compile time constant as its very complicated code. > > >>> > >>> Let's take a look at GET_VLC: > >>> #define GET_VLC(code, name, gb, table, bits, max_depth) \ > >>> do {\ > >>> int n, nb_bits; \ > >>> unsigned int index; \ > >>> \ > >>> index = SHOW_UBITS(name, gb, bits); \ > >>> code = table[index].sym; \ > >>> n = table[index].len; \ > >>> \ > >>> if (max_depth > 1 && n < 0) { \ > >>> LAST_SKIP_BITS(name, gb, bits); \ > >>> UPDATE_CACHE(name, gb); \ > >>> \ > >>> nb_bits = -n; \ > >>> \ > >>> index = SHOW_UBITS(name, gb, nb_bits) + code; \ > >>> code = table[index].sym; \ > >>> n = table[index].len; \ > >>> if (max_depth > 2 && n < 0) { \ > >>> LAST_SKIP_BITS(name, gb, nb_bits); \ > >>> UPDATE_CACHE(name, gb); \ > >>> \ > >>> nb_bits = -n; \ > >>> \ > >>> index = SHOW_UBITS(name, gb, nb_bits) + code; \ > >>> code = table[index].sym; \ > >>> n = table[index].len; \ > >>> } \ > >>> } \ > >>> SKIP_BITS(name, gb, n); \ > >>> } while (0) > >>> > >>> If max_depth is not a compile-time constant, then the compiler will > >>> have > >>> to perform both of the max_depth > 1 && n < 0 checks; yet, this is > >>> not > >>> useful: If the depth of a particular VLC is (say) 1, then none of > the > >>> possible bits read will lead to reloading at all, because the n < 0 > >>> condition will never be true; the only reason this condition exists > >>> is > >>> to use a compile-time upper bound, so that one can eliminate the > >>> reload > >>> code (and in particular, avoid the runtime checks). > >>> > Works means that vlc code is extracted correctly. > > >>> > >>> If you have no upper bound about max_depth and it works, then use > 3. > >>> > >> > >> It does not work to use 3 all the time. And that one never worked in > >>> any > >> codec so far. > >> > > > > I just ran FATE with the check for max_depth removed from GET_VLC and > > from read_vlc for the cached API (effectively setting max_depth to 3 >
Re: [FFmpeg-devel] [PATCH 1/4] avcodec/cbs_h266: Remove double ;
James Almer: > On 6/29/2023 3:17 PM, Andreas Rheinhardt wrote: >> Fixes a warning from GCC when in pedantic mode: >> "extra semicolon in struct or union specified" >> >> Signed-off-by: Andreas Rheinhardt >> --- >> libavcodec/cbs_h266.h | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h >> index 8548e501c0..03dfd4a954 100644 >> --- a/libavcodec/cbs_h266.h >> +++ b/libavcodec/cbs_h266.h >> @@ -80,7 +80,7 @@ typedef struct H266GeneralConstraintsInfo { >> /* inter */ >> uint8_t gci_no_ref_pic_resampling_constraint_flag; >> - uint8_t gci_no_res_change_in_clvs_constraint_flag;; >> + uint8_t gci_no_res_change_in_clvs_constraint_flag; >> uint8_t gci_no_weighted_prediction_constraint_flag; >> uint8_t gci_no_ref_wraparound_constraint_flag; >> uint8_t gci_no_temporal_mvp_constraint_flag; >> @@ -211,7 +211,7 @@ typedef struct H266RawVUI { >> uint8_t vui_aspect_ratio_idc; >> uint16_t vui_sar_width; >> - uint16_t vui_sar_height;; >> + uint16_t vui_sar_height; >> uint8_t vui_overscan_info_present_flag; >> uint8_t vui_overscan_appropriate_flag; > > LGTM. This should also fix a compilation failure with msvc, which seems > to be pretty strict about this. > http://fate.ffmpeg.org/report.cgi?time=20230629174305=x86_64-msvc17-windows-native I'll amend the commit message and apply the patchset. - 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] [PATCH 3/4] avfilter/vf_ccrepack: Constify filter
On 6/29/2023 3:19 PM, Andreas Rheinhardt wrote: The discrepancy between the definition and the declaration in allfilters.c is actually UB. Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_ccrepack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_ccrepack.c b/libavfilter/vf_ccrepack.c index 61eb2128ae..950bb7b528 100644 --- a/libavfilter/vf_ccrepack.c +++ b/libavfilter/vf_ccrepack.c @@ -92,7 +92,7 @@ static const AVFilterPad avfilter_vf_ccrepack_outputs[] = { }, }; -AVFilter ff_vf_ccrepack = { +const AVFilter ff_vf_ccrepack = { .name= "ccrepack", .description = NULL_IF_CONFIG_SMALL("Repack CEA-708 closed caption metadata"), .uninit = uninit, LGTM ___ 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 2/4] avcodec/vvc_parser: Constify parser
On 6/29/2023 3:19 PM, Andreas Rheinhardt wrote: The discrepancy between the definition and the declaration in parsers.c is actually UB. Signed-off-by: Andreas Rheinhardt --- libavcodec/vvc_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c index 4f7657f7ab..f350fe70a9 100644 --- a/libavcodec/vvc_parser.c +++ b/libavcodec/vvc_parser.c @@ -571,7 +571,7 @@ static void vvc_parser_close(AVCodecParserContext *s) av_freep(>pc.buffer); } -AVCodecParser ff_vvc_parser = { +const AVCodecParser ff_vvc_parser = { .codec_ids = { AV_CODEC_ID_VVC }, .priv_data_size = sizeof(VVCParserContext), .parser_init= vvc_parser_init, LGTM. ___ 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/4] avformat/ac4dec: Constify demuxer
The discrepancy between the definition and the declaration in allformats.c is actually UB. Signed-off-by: Andreas Rheinhardt --- Will apply this patchset soon. libavformat/ac4dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/ac4dec.c b/libavformat/ac4dec.c index eb7bbaa655..71950f52dc 100644 --- a/libavformat/ac4dec.c +++ b/libavformat/ac4dec.c @@ -93,7 +93,7 @@ static int ac4_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -AVInputFormat ff_ac4_demuxer = { +const AVInputFormat ff_ac4_demuxer = { .name = "ac4", .long_name = NULL_IF_CONFIG_SMALL("raw AC-4"), .read_probe = ac4_probe, -- 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".
Re: [FFmpeg-devel] [PATCH 1/4] avcodec/cbs_h266: Remove double ;
On 6/29/2023 3:17 PM, Andreas Rheinhardt wrote: Fixes a warning from GCC when in pedantic mode: "extra semicolon in struct or union specified" Signed-off-by: Andreas Rheinhardt --- libavcodec/cbs_h266.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h index 8548e501c0..03dfd4a954 100644 --- a/libavcodec/cbs_h266.h +++ b/libavcodec/cbs_h266.h @@ -80,7 +80,7 @@ typedef struct H266GeneralConstraintsInfo { /* inter */ uint8_t gci_no_ref_pic_resampling_constraint_flag; -uint8_t gci_no_res_change_in_clvs_constraint_flag;; +uint8_t gci_no_res_change_in_clvs_constraint_flag; uint8_t gci_no_weighted_prediction_constraint_flag; uint8_t gci_no_ref_wraparound_constraint_flag; uint8_t gci_no_temporal_mvp_constraint_flag; @@ -211,7 +211,7 @@ typedef struct H266RawVUI { uint8_t vui_aspect_ratio_idc; uint16_t vui_sar_width; -uint16_t vui_sar_height;; +uint16_t vui_sar_height; uint8_t vui_overscan_info_present_flag; uint8_t vui_overscan_appropriate_flag; LGTM. This should also fix a compilation failure with msvc, which seems to be pretty strict about this. http://fate.ffmpeg.org/report.cgi?time=20230629174305=x86_64-msvc17-windows-native ___ 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/4] avfilter/vf_ccrepack: Constify filter
The discrepancy between the definition and the declaration in allfilters.c is actually UB. Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_ccrepack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_ccrepack.c b/libavfilter/vf_ccrepack.c index 61eb2128ae..950bb7b528 100644 --- a/libavfilter/vf_ccrepack.c +++ b/libavfilter/vf_ccrepack.c @@ -92,7 +92,7 @@ static const AVFilterPad avfilter_vf_ccrepack_outputs[] = { }, }; -AVFilter ff_vf_ccrepack = { +const AVFilter ff_vf_ccrepack = { .name= "ccrepack", .description = NULL_IF_CONFIG_SMALL("Repack CEA-708 closed caption metadata"), .uninit = uninit, -- 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 2/4] avcodec/vvc_parser: Constify parser
The discrepancy between the definition and the declaration in parsers.c is actually UB. Signed-off-by: Andreas Rheinhardt --- libavcodec/vvc_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c index 4f7657f7ab..f350fe70a9 100644 --- a/libavcodec/vvc_parser.c +++ b/libavcodec/vvc_parser.c @@ -571,7 +571,7 @@ static void vvc_parser_close(AVCodecParserContext *s) av_freep(>pc.buffer); } -AVCodecParser ff_vvc_parser = { +const AVCodecParser ff_vvc_parser = { .codec_ids = { AV_CODEC_ID_VVC }, .priv_data_size = sizeof(VVCParserContext), .parser_init= vvc_parser_init, -- 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 1/4] avcodec/cbs_h266: Remove double ;
Fixes a warning from GCC when in pedantic mode: "extra semicolon in struct or union specified" Signed-off-by: Andreas Rheinhardt --- libavcodec/cbs_h266.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h index 8548e501c0..03dfd4a954 100644 --- a/libavcodec/cbs_h266.h +++ b/libavcodec/cbs_h266.h @@ -80,7 +80,7 @@ typedef struct H266GeneralConstraintsInfo { /* inter */ uint8_t gci_no_ref_pic_resampling_constraint_flag; -uint8_t gci_no_res_change_in_clvs_constraint_flag;; +uint8_t gci_no_res_change_in_clvs_constraint_flag; uint8_t gci_no_weighted_prediction_constraint_flag; uint8_t gci_no_ref_wraparound_constraint_flag; uint8_t gci_no_temporal_mvp_constraint_flag; @@ -211,7 +211,7 @@ typedef struct H266RawVUI { uint8_t vui_aspect_ratio_idc; uint16_t vui_sar_width; -uint16_t vui_sar_height;; +uint16_t vui_sar_height; uint8_t vui_overscan_info_present_flag; uint8_t vui_overscan_appropriate_flag; -- 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 12/15] avfilter/vf_bwdif: Add a filter_line3 method for optimisation
Add an optional filter_line3 to the available optimisations. filter_line3 is equivalent to filter_line, memcpy, filter_line filter_line shares quite a number of loads and some calculations in common with its next iteration and testing shows that using aarch64 neon filter_line3s performance is 30% better than two filter_lines and a memcpy. Signed-off-by: John Cox --- libavfilter/bwdif.h| 7 +++ libavfilter/vf_bwdif.c | 31 +++ 2 files changed, 38 insertions(+) diff --git a/libavfilter/bwdif.h b/libavfilter/bwdif.h index cce99953f3..496cec72ef 100644 --- a/libavfilter/bwdif.h +++ b/libavfilter/bwdif.h @@ -35,6 +35,9 @@ typedef struct BWDIFContext { void (*filter_edge)(void *dst, void *prev, void *cur, void *next, int w, int prefs, int mrefs, int prefs2, int mrefs2, int parity, int clip_max, int spat); +void (*filter_line3)(void *dst, int dstride, + const void *prev, const void *cur, const void *next, int prefs, + int w, int parity, int clip_max); } BWDIFContext; void ff_bwdif_init_filter_line(BWDIFContext *bwdif, int bit_depth); @@ -53,4 +56,8 @@ void ff_bwdif_filter_line_c(void *dst1, void *prev1, void *cur1, void *next1, int prefs3, int mrefs3, int prefs4, int mrefs4, int parity, int clip_max); +void ff_bwdif_filter_line3_c(void * dst1, int d_stride, + const void * prev1, const void * cur1, const void * next1, int s_stride, + int w, int parity, int clip_max); + #endif /* AVFILTER_BWDIF_H */ diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index 26349da1fd..52bc676cf8 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -150,6 +150,31 @@ void ff_bwdif_filter_line_c(void *dst1, void *prev1, void *cur1, void *next1, FILTER2() } +#define NEXT_LINE()\ +dst += d_stride; \ +prev += prefs; \ +cur += prefs; \ +next += prefs; + +void ff_bwdif_filter_line3_c(void * dst1, int d_stride, + const void * prev1, const void * cur1, const void * next1, int s_stride, + int w, int parity, int clip_max) +{ +const int prefs = s_stride; +uint8_t * dst = dst1; +const uint8_t * prev = prev1; +const uint8_t * cur = cur1; +const uint8_t * next = next1; + +ff_bwdif_filter_line_c(dst, (void*)prev, (void*)cur, (void*)next, w, + prefs, -prefs, prefs * 2, - prefs * 2, prefs * 3, -prefs * 3, prefs * 4, -prefs * 4, parity, clip_max); +NEXT_LINE(); +memcpy(dst, cur, w); +NEXT_LINE(); +ff_bwdif_filter_line_c(dst, (void*)prev, (void*)cur, (void*)next, w, + prefs, -prefs, prefs * 2, - prefs * 2, prefs * 3, -prefs * 3, prefs * 4, -prefs * 4, parity, clip_max); +} + void ff_bwdif_filter_edge_c(void *dst1, void *prev1, void *cur1, void *next1, int w, int prefs, int mrefs, int prefs2, int mrefs2, int parity, int clip_max, int spat) @@ -244,6 +269,11 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) refs << 1, -(refs << 1), td->parity ^ td->tff, clip_max, (y < 2) || ((y + 3) > td->h) ? 0 : 1); +} else if (s->filter_line3 && y + 2 < slice_end && y + 6 < td->h) { +s->filter_line3(dst, td->frame->linesize[td->plane], +prev, cur, next, linesize, td->w, +td->parity ^ td->tff, clip_max); +y += 2; } else { s->filter_line(dst, prev, cur, next, td->w, refs, -refs, refs << 1, -(refs << 1), @@ -357,6 +387,7 @@ static int config_props(AVFilterLink *link) av_cold void ff_bwdif_init_filter_line(BWDIFContext *s, int bit_depth) { +s->filter_line3 = 0; if (bit_depth > 8) { s->filter_intra = filter_intra_16bit; s->filter_line = filter_line_c_16bit; -- 2.39.2 ___ 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 11/15] avfilter/vf_bwdif: Add neon for filter_line
Signed-off-by: John Cox --- libavfilter/aarch64/vf_bwdif_init_aarch64.c | 21 ++ libavfilter/aarch64/vf_bwdif_neon.S | 215 2 files changed, 236 insertions(+) diff --git a/libavfilter/aarch64/vf_bwdif_init_aarch64.c b/libavfilter/aarch64/vf_bwdif_init_aarch64.c index e75cf2f204..21e67884ab 100644 --- a/libavfilter/aarch64/vf_bwdif_init_aarch64.c +++ b/libavfilter/aarch64/vf_bwdif_init_aarch64.c @@ -31,6 +31,26 @@ void ff_bwdif_filter_edge_neon(void *dst1, void *prev1, void *cur1, void *next1, void ff_bwdif_filter_intra_neon(void *dst1, void *cur1, int w, int prefs, int mrefs, int prefs3, int mrefs3, int parity, int clip_max); +void ff_bwdif_filter_line_neon(void *dst1, void *prev1, void *cur1, void *next1, + int w, int prefs, int mrefs, int prefs2, int mrefs2, + int prefs3, int mrefs3, int prefs4, int mrefs4, + int parity, int clip_max); + + +static void filter_line_helper(void *dst1, void *prev1, void *cur1, void *next1, + int w, int prefs, int mrefs, int prefs2, int mrefs2, + int prefs3, int mrefs3, int prefs4, int mrefs4, + int parity, int clip_max) +{ +const int w0 = clip_max != 255 ? 0 : w & ~15; + +ff_bwdif_filter_line_neon(dst1, prev1, cur1, next1, + w0, prefs, mrefs, prefs2, mrefs2, prefs3, mrefs3, prefs4, mrefs4, parity, clip_max); + +if (w0 < w) +ff_bwdif_filter_line_c((char *)dst1 + w0, (char *)prev1 + w0, (char *)cur1 + w0, (char *)next1 + w0, + w - w0, prefs, mrefs, prefs2, mrefs2, prefs3, mrefs3, prefs4, mrefs4, parity, clip_max); +} static void filter_edge_helper(void *dst1, void *prev1, void *cur1, void *next1, int w, int prefs, int mrefs, int prefs2, int mrefs2, @@ -71,6 +91,7 @@ ff_bwdif_init_aarch64(BWDIFContext *s, int bit_depth) return; s->filter_intra = filter_intra_helper; +s->filter_line = filter_line_helper; s->filter_edge = filter_edge_helper; } diff --git a/libavfilter/aarch64/vf_bwdif_neon.S b/libavfilter/aarch64/vf_bwdif_neon.S index a33b235882..675e97d966 100644 --- a/libavfilter/aarch64/vf_bwdif_neon.S +++ b/libavfilter/aarch64/vf_bwdif_neon.S @@ -128,6 +128,221 @@ coeffs: .hword 5570, 3801, 1016, -3801 // hf[0] = v0.h[2], -hf[1] = v0.h[5] .hword 5077, 981 // sp[0] = v0.h[6] +// === +// +// void filter_line( +// void *dst1, // x0 +// void *prev1,// x1 +// void *cur1, // x2 +// void *next1,// x3 +// int w, // w4 +// int prefs, // w5 +// int mrefs, // w6 +// int prefs2, // w7 +// int mrefs2, // [sp, #0] +// int prefs3, // [sp, #8] +// int mrefs3, // [sp, #16] +// int prefs4, // [sp, #24] +// int mrefs4, // [sp, #32] +// int parity, // [sp, #40] +// int clip_max) // [sp, #48] + +function ff_bwdif_filter_line_neon, export=1 +// Sanity check w +cmp w4, #0 +ble 99f + +// Rearrange regs to be the same as line3 for ease of debug! +mov w10, w4 // w10 = loop count +mov w9, w6 // w9 = mref +mov w12, w7 // w12 = pref2 +mov w11, w5 // w11 = pref +ldr w8, [sp, #0] // w8 = mref2 +ldr w7, [sp, #16] // w7 = mref3 +ldr w6, [sp, #32] // w6 = mref4 +ldr w13, [sp, #8] // w13 = pref3 +ldr w14, [sp, #24] // w14 = pref4 + +mov x4, x3 +mov x3, x2 +mov x2, x1 + +// #define prev2 cur +//const uint8_t * restrict next2 = parity ? prev : next; +ldr w17, [sp, #40] // parity +cmp w17, #0 +cselx17, x2, x4, ne + +// We want all the V registers - save all the ones we must +stp d14, d15, [sp, #-64]! +stp d8, d9, [sp, #48] +stp d10, d11, [sp, #32] +stp d12, d13, [sp, #16] + +ldr q0, coeffs + +// for (x = 0; x < w; x++) { +// int diff0, diff2; +// int d0, d2; +// int temporal_diff0, temporal_diff2; +// +// int i1, i2; +// int j1, j2; +// int p6, p5, p4, p3, p2, p1, c0, m1, m2, m3, m4; +
[FFmpeg-devel] [PATCH 10/15] avfilter/vf_bwdif: Export C filter_line
Needed for tail fixup of neon code Signed-off-by: John Cox --- libavfilter/bwdif.h| 5 + libavfilter/vf_bwdif.c | 10 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libavfilter/bwdif.h b/libavfilter/bwdif.h index ae1616d366..cce99953f3 100644 --- a/libavfilter/bwdif.h +++ b/libavfilter/bwdif.h @@ -48,4 +48,9 @@ void ff_bwdif_filter_edge_c(void *dst1, void *prev1, void *cur1, void *next1, void ff_bwdif_filter_intra_c(void *dst1, void *cur1, int w, int prefs, int mrefs, int prefs3, int mrefs3, int parity, int clip_max); +void ff_bwdif_filter_line_c(void *dst1, void *prev1, void *cur1, void *next1, +int w, int prefs, int mrefs, int prefs2, int mrefs2, +int prefs3, int mrefs3, int prefs4, int mrefs4, +int parity, int clip_max); + #endif /* AVFILTER_BWDIF_H */ diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index bec83111b4..26349da1fd 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -132,10 +132,10 @@ void ff_bwdif_filter_intra_c(void *dst1, void *cur1, int w, int prefs, int mrefs FILTER_INTRA() } -static void filter_line_c(void *dst1, void *prev1, void *cur1, void *next1, - int w, int prefs, int mrefs, int prefs2, int mrefs2, - int prefs3, int mrefs3, int prefs4, int mrefs4, - int parity, int clip_max) +void ff_bwdif_filter_line_c(void *dst1, void *prev1, void *cur1, void *next1, +int w, int prefs, int mrefs, int prefs2, int mrefs2, +int prefs3, int mrefs3, int prefs4, int mrefs4, +int parity, int clip_max) { uint8_t *dst = dst1; uint8_t *prev = prev1; @@ -363,7 +363,7 @@ av_cold void ff_bwdif_init_filter_line(BWDIFContext *s, int bit_depth) s->filter_edge = filter_edge_16bit; } else { s->filter_intra = ff_bwdif_filter_intra_c; -s->filter_line = filter_line_c; +s->filter_line = ff_bwdif_filter_line_c; s->filter_edge = ff_bwdif_filter_edge_c; } -- 2.39.2 ___ 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 09/15] tests/checkasm: Add test for vf_bwdif filter_edge
Signed-off-by: John Cox --- tests/checkasm/vf_bwdif.c | 54 +++ 1 file changed, 54 insertions(+) diff --git a/tests/checkasm/vf_bwdif.c b/tests/checkasm/vf_bwdif.c index 034bbabb4c..5fdba09fdc 100644 --- a/tests/checkasm/vf_bwdif.c +++ b/tests/checkasm/vf_bwdif.c @@ -83,6 +83,60 @@ void checkasm_check_vf_bwdif(void) report("bwdif10"); } +{ +LOCAL_ALIGNED_16(uint8_t, prev0, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, prev1, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, next0, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, next1, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, cur0, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, cur1, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, dst0, [WIDTH*3]); +LOCAL_ALIGNED_16(uint8_t, dst1, [WIDTH*3]); +const int stride = WIDTH; +const int mask = (1<<8)-1; +int spat; +int parity; + +for (spat = 0; spat != 2; ++spat) { +for (parity = 0; parity != 2; ++parity) { +if (check_func(ctx_8.filter_edge, "bwdif8.edge.s%d.p%d", spat, parity)) { + +declare_func(void, void *dst1, void *prev1, void *cur1, void *next1, +int w, int prefs, int mrefs, int prefs2, int mrefs2, +int parity, int clip_max, int spat); + +randomize_buffers(prev0, prev1, mask, 11*WIDTH); +randomize_buffers(next0, next1, mask, 11*WIDTH); +randomize_buffers( cur0, cur1, mask, 11*WIDTH); +memset(dst0, 0xba, WIDTH * 3); +memset(dst1, 0xba, WIDTH * 3); + +call_ref(dst0 + stride, + prev0 + stride * 4, cur0 + stride * 4, next0 + stride * 4, WIDTH, + stride, -stride, stride * 2, -stride * 2, + parity, mask, spat); +call_new(dst1 + stride, + prev1 + stride * 4, cur1 + stride * 4, next1 + stride * 4, WIDTH, + stride, -stride, stride * 2, -stride * 2, + parity, mask, spat); + +if (memcmp(dst0, dst1, WIDTH*3) +|| memcmp(prev0, prev1, WIDTH*11) +|| memcmp(next0, next1, WIDTH*11) +|| memcmp( cur0, cur1, WIDTH*11)) +fail(); + +bench_new(dst1 + stride, + prev1 + stride * 4, cur1 + stride * 4, next1 + stride * 4, WIDTH, + stride, -stride, stride * 2, -stride * 2, + parity, mask, spat); +} +} +} + +report("bwdif8.edge"); +} + if (check_func(ctx_8.filter_intra, "bwdif8.intra")) { LOCAL_ALIGNED_16(uint8_t, cur0, [11*WIDTH]); LOCAL_ALIGNED_16(uint8_t, cur1, [11*WIDTH]); -- 2.39.2 ___ 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 15/15] avfilter/vf_bwdif: Block filter slices into a multiple of 4 lines
Round job start lines down to a multiple of 4. This means that if filter_line3 exists then filter_line will not sometimes be called once at the end of a slice depending on thread count. The final slice may do up to 3 extra lines but filter_edge is faster than filter_line so it is unlikely to create any noticable thread load variation. Signed-off-by: John Cox --- libavfilter/vf_bwdif.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index 52bc676cf8..6701208efe 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -237,6 +237,13 @@ static void filter_edge_16bit(void *dst1, void *prev1, void *cur1, void *next1, FILTER2() } +// Round job start line down to multiple of 4 so that if filter_line3 exists +// and the frame is a multiple of 4 high then filter_line will never be called +static inline int job_start(const int jobnr, const int nb_jobs, const int h) +{ +return jobnr >= nb_jobs ? h : ((h * jobnr) / nb_jobs) & ~3; +} + static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { BWDIFContext *s = ctx->priv; @@ -246,8 +253,8 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) int clip_max = (1 << (yadif->csp->comp[td->plane].depth)) - 1; int df = (yadif->csp->comp[td->plane].depth + 7) / 8; int refs = linesize / df; -int slice_start = (td->h * jobnr ) / nb_jobs; -int slice_end = (td->h * (jobnr+1)) / nb_jobs; +int slice_start = job_start(jobnr, nb_jobs, td->h); +int slice_end = job_start(jobnr + 1, nb_jobs, td->h); int y; for (y = slice_start; y < slice_end; y++) { @@ -310,7 +317,7 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic, td.plane = i; ff_filter_execute(ctx, filter_slice, , NULL, - FFMIN(h, ff_filter_get_nb_threads(ctx))); + FFMIN((h+3)/4, ff_filter_get_nb_threads(ctx))); } if (yadif->current_field == YADIF_FIELD_END) { yadif->current_field = YADIF_FIELD_NORMAL; -- 2.39.2 ___ 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 08/15] avfilter/vf_bwdif: Add neon for filter_edge
Signed-off-by: John Cox --- libavfilter/aarch64/vf_bwdif_init_aarch64.c | 20 libavfilter/aarch64/vf_bwdif_neon.S | 104 2 files changed, 124 insertions(+) diff --git a/libavfilter/aarch64/vf_bwdif_init_aarch64.c b/libavfilter/aarch64/vf_bwdif_init_aarch64.c index 3ffaa07ab3..e75cf2f204 100644 --- a/libavfilter/aarch64/vf_bwdif_init_aarch64.c +++ b/libavfilter/aarch64/vf_bwdif_init_aarch64.c @@ -24,10 +24,29 @@ #include "libavfilter/bwdif.h" #include "libavutil/aarch64/cpu.h" +void ff_bwdif_filter_edge_neon(void *dst1, void *prev1, void *cur1, void *next1, + int w, int prefs, int mrefs, int prefs2, int mrefs2, + int parity, int clip_max, int spat); + void ff_bwdif_filter_intra_neon(void *dst1, void *cur1, int w, int prefs, int mrefs, int prefs3, int mrefs3, int parity, int clip_max); +static void filter_edge_helper(void *dst1, void *prev1, void *cur1, void *next1, + int w, int prefs, int mrefs, int prefs2, int mrefs2, + int parity, int clip_max, int spat) +{ +const int w0 = clip_max != 255 ? 0 : w & ~15; + +ff_bwdif_filter_edge_neon(dst1, prev1, cur1, next1, w0, prefs, mrefs, prefs2, mrefs2, + parity, clip_max, spat); + +if (w0 < w) +ff_bwdif_filter_edge_c((char *)dst1 + w0, (char *)prev1 + w0, (char *)cur1 + w0, (char *)next1 + w0, + w - w0, prefs, mrefs, prefs2, mrefs2, + parity, clip_max, spat); +} + static void filter_intra_helper(void *dst1, void *cur1, int w, int prefs, int mrefs, int prefs3, int mrefs3, int parity, int clip_max) { @@ -52,5 +71,6 @@ ff_bwdif_init_aarch64(BWDIFContext *s, int bit_depth) return; s->filter_intra = filter_intra_helper; +s->filter_edge = filter_edge_helper; } diff --git a/libavfilter/aarch64/vf_bwdif_neon.S b/libavfilter/aarch64/vf_bwdif_neon.S index 6c5d1598f4..a33b235882 100644 --- a/libavfilter/aarch64/vf_bwdif_neon.S +++ b/libavfilter/aarch64/vf_bwdif_neon.S @@ -128,6 +128,110 @@ coeffs: .hword 5570, 3801, 1016, -3801 // hf[0] = v0.h[2], -hf[1] = v0.h[5] .hword 5077, 981 // sp[0] = v0.h[6] +// +// +// void ff_bwdif_filter_edge_neon( +// void *dst1, // x0 +// void *prev1,// x1 +// void *cur1, // x2 +// void *next1,// x3 +// int w, // w4 +// int prefs, // w5 +// int mrefs, // w6 +// int prefs2, // w7 +// int mrefs2, // [sp, #0] +// int parity, // [sp, #8] +// int clip_max, // [sp, #16] unused +// int spat); // [sp, #24] + +function ff_bwdif_filter_edge_neon, export=1 +// Sanity check w +cmp w4, #0 +ble 99f + +// #define prev2 cur +// const uint8_t * restrict next2 = parity ? prev : next; + +ldr w8, [sp, #0] // mrefs2 + +ldr w17, [sp, #8] // parity +ldr w16, [sp, #24] // spat +cmp w17, #0 +cselx17, x1, x3, ne + +// for (x = 0; x < w; x++) { + +10: +//int m1 = cur[mrefs]; +//int d = (prev2[0] + next2[0]) >> 1; +//int p1 = cur[prefs]; +//int temporal_diff0 = FFABS(prev2[0] - next2[0]); +//int temporal_diff1 =(FFABS(prev[mrefs] - m1) + FFABS(prev[prefs] - p1)) >> 1; +//int temporal_diff2 =(FFABS(next[mrefs] - m1) + FFABS(next[prefs] - p1)) >> 1; +//int diff = FFMAX3(temporal_diff0 >> 1, temporal_diff1, temporal_diff2); +ldr q31, [x2] +ldr q21, [x17] +uhadd v16.16b, v31.16b, v21.16b // d0 = v16 +uabdv17.16b, v31.16b, v21.16b // td0 = v17 +ldr q24, [x2, w6, SXTW] // m1 = v24 +ldr q22, [x2, w5, SXTW] // p1 = v22 + +ldr q0, [x1, w6, SXTW] // prev[mrefs] +ldr q2, [x1, w5, SXTW] // prev[prefs] +ldr q1, [x3, w6, SXTW] // next[mrefs] +ldr q3, [x3, w5, SXTW] // next[prefs] + +ushrv29.16b, v17.16b, #1 + +uabdv31.16b, v0.16b, v24.16b +uabdv30.16b, v2.16b, v22.16b +uhadd v0.16b, v31.16b, v30.16b // td1 = q0 + +uabdv31.16b, v1.16b, v24.16b +uabdv30.16b, v3.16b, v22.16b +uhadd v1.16b, v31.16b, v30.16b // td2 = q1 + +umaxv0.16b, v0.16b,
[FFmpeg-devel] [PATCH 14/15] tests/checkasm: Add test for vf_bwdif filter_line3
Signed-off-by: John Cox --- tests/checkasm/vf_bwdif.c | 81 +++ 1 file changed, 81 insertions(+) diff --git a/tests/checkasm/vf_bwdif.c b/tests/checkasm/vf_bwdif.c index 5fdba09fdc..3399cacdf7 100644 --- a/tests/checkasm/vf_bwdif.c +++ b/tests/checkasm/vf_bwdif.c @@ -28,6 +28,10 @@ for (size_t i = 0; i < count; i++) \ buf0[i] = buf1[i] = rnd() & mask +#define randomize_overflow_check(buf0, buf1, mask, count) \ +for (size_t i = 0; i < count; i++) \ +buf0[i] = buf1[i] = (rnd() & 1) != 0 ? mask : 0; + #define BODY(type, depth) \ do { \ type prev0[9*WIDTH], prev1[9*WIDTH]; \ @@ -83,6 +87,83 @@ void checkasm_check_vf_bwdif(void) report("bwdif10"); } +if (!ctx_8.filter_line3) +ctx_8.filter_line3 = ff_bwdif_filter_line3_c; + +{ +LOCAL_ALIGNED_16(uint8_t, prev0, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, prev1, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, next0, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, next1, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, cur0, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, cur1, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, dst0, [WIDTH*3]); +LOCAL_ALIGNED_16(uint8_t, dst1, [WIDTH*3]); +const int stride = WIDTH; +const int mask = (1<<8)-1; +int parity; + +for (parity = 0; parity != 2; ++parity) { +if (check_func(ctx_8.filter_line3, "bwdif8.line3.rnd.p%d", parity)) { + +declare_func(void, void * dst1, int d_stride, + const void * prev1, const void * cur1, const void * next1, int prefs, + int w, int parity, int clip_max); + +randomize_buffers(prev0, prev1, mask, 11*WIDTH); +randomize_buffers(next0, next1, mask, 11*WIDTH); +randomize_buffers( cur0, cur1, mask, 11*WIDTH); + +call_ref(dst0, stride, + prev0 + stride * 4, cur0 + stride * 4, next0 + stride * 4, stride, + WIDTH, parity, mask); +call_new(dst1, stride, + prev1 + stride * 4, cur1 + stride * 4, next1 + stride * 4, stride, + WIDTH, parity, mask); + +if (memcmp(dst0, dst1, WIDTH*3) +|| memcmp(prev0, prev1, WIDTH*11) +|| memcmp(next0, next1, WIDTH*11) +|| memcmp( cur0, cur1, WIDTH*11)) +fail(); + +bench_new(dst1, stride, + prev1 + stride * 4, cur1 + stride * 4, next1 + stride * 4, stride, + WIDTH, parity, mask); +} +} + +// Use just 0s and ~0s to try to provoke bad cropping or overflow +// Parity makes no difference to this test so just test 0 +if (check_func(ctx_8.filter_line3, "bwdif8.line3.overflow")) { + +declare_func(void, void * dst1, int d_stride, + const void * prev1, const void * cur1, const void * next1, int prefs, + int w, int parity, int clip_max); + +randomize_overflow_check(prev0, prev1, mask, 11*WIDTH); +randomize_overflow_check(next0, next1, mask, 11*WIDTH); +randomize_overflow_check( cur0, cur1, mask, 11*WIDTH); + +call_ref(dst0, stride, + prev0 + stride * 4, cur0 + stride * 4, next0 + stride * 4, stride, + WIDTH, 0, mask); +call_new(dst1, stride, + prev1 + stride * 4, cur1 + stride * 4, next1 + stride * 4, stride, + WIDTH, 0, mask); + +if (memcmp(dst0, dst1, WIDTH*3) +|| memcmp(prev0, prev1, WIDTH*11) +|| memcmp(next0, next1, WIDTH*11) +|| memcmp( cur0, cur1, WIDTH*11)) +fail(); + +// No point to benching +} + +report("bwdif8.line3"); +} + { LOCAL_ALIGNED_16(uint8_t, prev0, [11*WIDTH]); LOCAL_ALIGNED_16(uint8_t, prev1, [11*WIDTH]); -- 2.39.2 ___ 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 07/15] avfilter/vf_bwdif: Export C filter_edge
Needed for tail fixup of neon code Signed-off-by: John Cox --- libavfilter/bwdif.h| 4 libavfilter/vf_bwdif.c | 8 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libavfilter/bwdif.h b/libavfilter/bwdif.h index ae6f6ce223..ae1616d366 100644 --- a/libavfilter/bwdif.h +++ b/libavfilter/bwdif.h @@ -41,6 +41,10 @@ void ff_bwdif_init_filter_line(BWDIFContext *bwdif, int bit_depth); void ff_bwdif_init_x86(BWDIFContext *bwdif, int bit_depth); void ff_bwdif_init_aarch64(BWDIFContext *bwdif, int bit_depth); +void ff_bwdif_filter_edge_c(void *dst1, void *prev1, void *cur1, void *next1, +int w, int prefs, int mrefs, int prefs2, int mrefs2, +int parity, int clip_max, int spat); + void ff_bwdif_filter_intra_c(void *dst1, void *cur1, int w, int prefs, int mrefs, int prefs3, int mrefs3, int parity, int clip_max); diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index 035fc58670..bec83111b4 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -150,9 +150,9 @@ static void filter_line_c(void *dst1, void *prev1, void *cur1, void *next1, FILTER2() } -static void filter_edge(void *dst1, void *prev1, void *cur1, void *next1, -int w, int prefs, int mrefs, int prefs2, int mrefs2, -int parity, int clip_max, int spat) +void ff_bwdif_filter_edge_c(void *dst1, void *prev1, void *cur1, void *next1, +int w, int prefs, int mrefs, int prefs2, int mrefs2, +int parity, int clip_max, int spat) { uint8_t *dst = dst1; uint8_t *prev = prev1; @@ -364,7 +364,7 @@ av_cold void ff_bwdif_init_filter_line(BWDIFContext *s, int bit_depth) } else { s->filter_intra = ff_bwdif_filter_intra_c; s->filter_line = filter_line_c; -s->filter_edge = filter_edge; +s->filter_edge = ff_bwdif_filter_edge_c; } #if ARCH_X86 -- 2.39.2 ___ 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 13/15] avfilter/vf_bwdif: Add neon for filter_line3
Signed-off-by: John Cox --- libavfilter/aarch64/vf_bwdif_init_aarch64.c | 28 ++ libavfilter/aarch64/vf_bwdif_neon.S | 278 2 files changed, 306 insertions(+) diff --git a/libavfilter/aarch64/vf_bwdif_init_aarch64.c b/libavfilter/aarch64/vf_bwdif_init_aarch64.c index 21e67884ab..f52bc4b9b4 100644 --- a/libavfilter/aarch64/vf_bwdif_init_aarch64.c +++ b/libavfilter/aarch64/vf_bwdif_init_aarch64.c @@ -36,6 +36,33 @@ void ff_bwdif_filter_line_neon(void *dst1, void *prev1, void *cur1, void *next1, int prefs3, int mrefs3, int prefs4, int mrefs4, int parity, int clip_max); +void ff_bwdif_filter_line3_neon(void * dst1, int d_stride, +const void * prev1, const void * cur1, const void * next1, int s_stride, +int w, int parity, int clip_max); + + +static void filter_line3_helper(void * dst1, int d_stride, +const void * prev1, const void * cur1, const void * next1, int s_stride, +int w, int parity, int clip_max) +{ +// Asm works on 16 byte chunks +// If w is a multiple of 16 then all is good - if not then if width rounded +// up to nearest 16 will fit in both src & dst strides then allow the asm +// to write over the padding bytes as that is almost certainly faster than +// having to invoke the C version to clean up the tail. +const int w1 = FFALIGN(w, 16); +const int w0 = clip_max != 255 ? 0 : + d_stride <= w1 && s_stride <= w1 ? w : w & ~15; + +ff_bwdif_filter_line3_neon(dst1, d_stride, + prev1, cur1, next1, s_stride, + w0, parity, clip_max); + +if (w0 < w) +ff_bwdif_filter_line3_c((char *)dst1 + w0, d_stride, +(const char *)prev1 + w0, (const char *)cur1 + w0, (const char *)next1 + w0, s_stride, +w - w0, parity, clip_max); +} static void filter_line_helper(void *dst1, void *prev1, void *cur1, void *next1, int w, int prefs, int mrefs, int prefs2, int mrefs2, @@ -93,5 +120,6 @@ ff_bwdif_init_aarch64(BWDIFContext *s, int bit_depth) s->filter_intra = filter_intra_helper; s->filter_line = filter_line_helper; s->filter_edge = filter_edge_helper; +s->filter_line3 = filter_line3_helper; } diff --git a/libavfilter/aarch64/vf_bwdif_neon.S b/libavfilter/aarch64/vf_bwdif_neon.S index 675e97d966..bcffbe5793 100644 --- a/libavfilter/aarch64/vf_bwdif_neon.S +++ b/libavfilter/aarch64/vf_bwdif_neon.S @@ -128,6 +128,284 @@ coeffs: .hword 5570, 3801, 1016, -3801 // hf[0] = v0.h[2], -hf[1] = v0.h[5] .hword 5077, 981 // sp[0] = v0.h[6] +// === +// +// void ff_bwdif_filter_line3_neon( +// void * dst1, // x0 +// int d_stride,// w1 +// const void * prev1, // x2 +// const void * cur1, // x3 +// const void * next1, // x4 +// int s_stride,// w5 +// int w, // w6 +// int parity, // w7 +// int clip_max); // [sp, #0] (Ignored) + +function ff_bwdif_filter_line3_neon, export=1 +// Sanity check w +cmp w6, #0 +ble 99f + +// #define prev2 cur +//const uint8_t * restrict next2 = parity ? prev : next; +cmp w7, #0 +cselx17, x2, x4, ne + +// We want all the V registers - save all the ones we must +stp d14, d15, [sp, #-64]! +stp d8, d9, [sp, #48] +stp d10, d11, [sp, #32] +stp d12, d13, [sp, #16] + +ldr q0, coeffs + +// Some rearrangement of initial values for nice layout of refs in regs +mov w10, w6 // w10 = loop count +neg w9, w5 // w9 = mref +lsl w8, w9, #1// w8 = mref2 +add w7, w9, w9, LSL #1// w7 = mref3 +lsl w6, w9, #2// w6 = mref4 +mov w11, w5 // w11 = pref +lsl w12, w5, #1// w12 = pref2 +add w13, w5, w5, LSL #1// w13 = pref3 +lsl w14, w5, #2// w14 = pref4 +add w15, w5, w5, LSL #2// w15 = pref5 +add w16, w14, w12 // w16 = pref6 + +lsl w5, w1, #1// w5 = d_stride * 2 + +// for (x = 0; x < w; x++) { +// int
[FFmpeg-devel] [PATCH 06/15] avfilter/vf_bwdif: Add clip and spatial macros for aarch64 neon
Signed-off-by: John Cox --- libavfilter/aarch64/vf_bwdif_neon.S | 59 + 1 file changed, 59 insertions(+) diff --git a/libavfilter/aarch64/vf_bwdif_neon.S b/libavfilter/aarch64/vf_bwdif_neon.S index b863b3447d..6c5d1598f4 100644 --- a/libavfilter/aarch64/vf_bwdif_neon.S +++ b/libavfilter/aarch64/vf_bwdif_neon.S @@ -59,6 +59,65 @@ umlsl2 \a3\().4s, \s1\().8h, \k .endm +// int b = m2s1 - m1; +// int f = p2s1 - p1; +// int dc = c0s1 - m1; +// int de = c0s1 - p1; +// int sp_max = FFMIN(p1 - c0s1, m1 - c0s1); +// sp_max = FFMIN(sp_max, FFMAX(-b,-f)); +// int sp_min = FFMIN(c0s1 - p1, c0s1 - m1); +// sp_min = FFMIN(sp_min, FFMAX(b,f)); +// diff = diff == 0 ? 0 : FFMAX3(diff, sp_min, sp_max); +.macro SPAT_CHECK diff, m2s1, m1, c0s1, p1, p2s1, t0, t1, t2, t3 +uqsub \t0\().16b, \p1\().16b, \c0s1\().16b +uqsub \t2\().16b, \m1\().16b, \c0s1\().16b +umin\t2\().16b, \t0\().16b, \t2\().16b + +uqsub \t1\().16b, \m1\().16b, \m2s1\().16b +uqsub \t3\().16b, \p1\().16b, \p2s1\().16b +umax\t3\().16b, \t3\().16b, \t1\().16b +umin\t3\().16b, \t3\().16b, \t2\().16b + +uqsub \t0\().16b, \c0s1\().16b, \p1\().16b +uqsub \t2\().16b, \c0s1\().16b, \m1\().16b +umin\t2\().16b, \t0\().16b, \t2\().16b + +uqsub \t1\().16b, \m2s1\().16b, \m1\().16b +uqsub \t0\().16b, \p2s1\().16b, \p1\().16b +umax\t0\().16b, \t0\().16b, \t1\().16b +umin\t2\().16b, \t2\().16b, \t0\().16b + +cmeq\t1\().16b, \diff\().16b, #0 +umax\diff\().16b, \diff\().16b, \t3\().16b +umax\diff\().16b, \diff\().16b, \t2\().16b +bic \diff\().16b, \diff\().16b, \t1\().16b +.endm + +// i0 = s0; +// if (i0 > d0 + diff0) +// i0 = d0 + diff0; +// else if (i0 < d0 - diff0) +// i0 = d0 - diff0; +// +// i0 = s0 is safe +.macro DIFF_CLIP i0, s0, d0, diff, t0, t1 +uqadd \t0\().16b, \d0\().16b, \diff\().16b +uqsub \t1\().16b, \d0\().16b, \diff\().16b +umin\i0\().16b, \s0\().16b, \t0\().16b +umax\i0\().16b, \i0\().16b, \t1\().16b +.endm + +// i0 = FFABS(m1 - p1) > td0 ? i1 : i2; +// DIFF_CLIP +// +// i0 = i1 is safe +.macro INTERPOL i0, i1, i2, m1, d0, p1, td0, diff, t0, t1, t2 +uabd\t0\().16b, \m1\().16b, \p1\().16b +cmhi\t0\().16b, \t0\().16b, \td0\().16b +bsl \t0\().16b, \i1\().16b, \i2\().16b +DIFF_CLIP \i0, \t0, \d0, \diff, \t1, \t2 +.endm + // static const uint16_t coef_lf[2] = { 4309, 213 }; // static const uint16_t coef_hf[3] = { 5570, 3801, 1016 }; // static const uint16_t coef_sp[2] = { 5077, 981 }; -- 2.39.2 ___ 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 05/15] tests/checkasm: Add test for vf_bwdif filter_intra
Signed-off-by: John Cox --- tests/checkasm/vf_bwdif.c | 37 + 1 file changed, 37 insertions(+) diff --git a/tests/checkasm/vf_bwdif.c b/tests/checkasm/vf_bwdif.c index 46224bb575..034bbabb4c 100644 --- a/tests/checkasm/vf_bwdif.c +++ b/tests/checkasm/vf_bwdif.c @@ -20,6 +20,7 @@ #include "checkasm.h" #include "libavcodec/internal.h" #include "libavfilter/bwdif.h" +#include "libavutil/mem_internal.h" #define WIDTH 256 @@ -81,4 +82,40 @@ void checkasm_check_vf_bwdif(void) BODY(uint16_t, 10); report("bwdif10"); } + +if (check_func(ctx_8.filter_intra, "bwdif8.intra")) { +LOCAL_ALIGNED_16(uint8_t, cur0, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, cur1, [11*WIDTH]); +LOCAL_ALIGNED_16(uint8_t, dst0, [WIDTH*3]); +LOCAL_ALIGNED_16(uint8_t, dst1, [WIDTH*3]); +const int stride = WIDTH; +const int mask = (1<<8)-1; + +declare_func(void, void *dst1, void *cur1, int w, int prefs, int mrefs, + int prefs3, int mrefs3, int parity, int clip_max); + +randomize_buffers( cur0, cur1, mask, 11*WIDTH); +memset(dst0, 0xba, WIDTH * 3); +memset(dst1, 0xba, WIDTH * 3); + +call_ref(dst0 + stride, + cur0 + stride * 4, WIDTH, + stride, -stride, stride * 3, -stride * 3, + 0, mask); +call_new(dst1 + stride, + cur0 + stride * 4, WIDTH, + stride, -stride, stride * 3, -stride * 3, + 0, mask); + +if (memcmp(dst0, dst1, WIDTH*3) +|| memcmp( cur0, cur1, WIDTH*11)) +fail(); + +bench_new(dst1 + stride, + cur0 + stride * 4, WIDTH, + stride, -stride, stride * 3, -stride * 3, + 0, mask); + +report("bwdif8.intra"); +} } -- 2.39.2 ___ 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 04/15] avfilter/vf_bwdif: Add neon for filter_intra
Signed-off-by: John Cox --- libavfilter/aarch64/vf_bwdif_init_aarch64.c | 17 +++ libavfilter/aarch64/vf_bwdif_neon.S | 53 + 2 files changed, 70 insertions(+) diff --git a/libavfilter/aarch64/vf_bwdif_init_aarch64.c b/libavfilter/aarch64/vf_bwdif_init_aarch64.c index 86d53b2ca1..3ffaa07ab3 100644 --- a/libavfilter/aarch64/vf_bwdif_init_aarch64.c +++ b/libavfilter/aarch64/vf_bwdif_init_aarch64.c @@ -24,6 +24,22 @@ #include "libavfilter/bwdif.h" #include "libavutil/aarch64/cpu.h" +void ff_bwdif_filter_intra_neon(void *dst1, void *cur1, int w, int prefs, int mrefs, +int prefs3, int mrefs3, int parity, int clip_max); + + +static void filter_intra_helper(void *dst1, void *cur1, int w, int prefs, int mrefs, +int prefs3, int mrefs3, int parity, int clip_max) +{ +const int w0 = clip_max != 255 ? 0 : w & ~15; + +ff_bwdif_filter_intra_neon(dst1, cur1, w0, prefs, mrefs, prefs3, mrefs3, parity, clip_max); + +if (w0 < w) +ff_bwdif_filter_intra_c((char *)dst1 + w0, (char *)cur1 + w0, +w - w0, prefs, mrefs, prefs3, mrefs3, parity, clip_max); +} + void ff_bwdif_init_aarch64(BWDIFContext *s, int bit_depth) { @@ -35,5 +51,6 @@ ff_bwdif_init_aarch64(BWDIFContext *s, int bit_depth) if (!have_neon(cpu_flags)) return; +s->filter_intra = filter_intra_helper; } diff --git a/libavfilter/aarch64/vf_bwdif_neon.S b/libavfilter/aarch64/vf_bwdif_neon.S index a8f0ed525a..b863b3447d 100644 --- a/libavfilter/aarch64/vf_bwdif_neon.S +++ b/libavfilter/aarch64/vf_bwdif_neon.S @@ -69,3 +69,56 @@ coeffs: .hword 5570, 3801, 1016, -3801 // hf[0] = v0.h[2], -hf[1] = v0.h[5] .hword 5077, 981 // sp[0] = v0.h[6] +// +// +// void ff_bwdif_filter_intra_neon( +// void *dst1, // x0 +// void *cur1, // x1 +// int w, // w2 +// int prefs, // w3 +// int mrefs, // w4 +// int prefs3, // w5 +// int mrefs3, // w6 +// int parity, // w7 unused +// int clip_max) // [sp, #0] unused + +function ff_bwdif_filter_intra_neon, export=1 +cmp w2, #0 +ble 99f + +ldr q0, coeffs + +//for (x = 0; x < w; x++) { +10: + +//interpol = (coef_sp[0] * (cur[mrefs] + cur[prefs]) - coef_sp[1] * (cur[mrefs3] + cur[prefs3])) >> 13; +ldr q31, [x1, w4, SXTW] +ldr q30, [x1, w3, SXTW] +ldr q29, [x1, w6, SXTW] +ldr q28, [x1, w5, SXTW] + +uaddl v20.8h, v31.8b, v30.8b +uaddl2 v21.8h, v31.16b, v30.16b + +UMULL4K v2, v3, v4, v5, v20, v21, v0.h[6] + +uaddl v20.8h, v29.8b, v28.8b +uaddl2 v21.8h, v29.16b, v28.16b + +UMLSL4K v2, v3, v4, v5, v20, v21, v0.h[7] + +//dst[0] = av_clip(interpol, 0, clip_max); +SQSHRUNNv2, v2, v3, v4, v5, 13 +str q2, [x0], #16 + +//dst++; +//cur++; +//} + +subsw2, w2, #16 +add x1, x1, #16 +bgt 10b + +99: +ret +endfunc -- 2.39.2 ___ 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 03/15] avfilter/vf_bwdif: Export C filter_intra
Needed for tail fixup of neon code Signed-off-by: John Cox --- libavfilter/bwdif.h| 3 +++ libavfilter/vf_bwdif.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libavfilter/bwdif.h b/libavfilter/bwdif.h index 6a0f70487a..ae6f6ce223 100644 --- a/libavfilter/bwdif.h +++ b/libavfilter/bwdif.h @@ -41,4 +41,7 @@ void ff_bwdif_init_filter_line(BWDIFContext *bwdif, int bit_depth); void ff_bwdif_init_x86(BWDIFContext *bwdif, int bit_depth); void ff_bwdif_init_aarch64(BWDIFContext *bwdif, int bit_depth); +void ff_bwdif_filter_intra_c(void *dst1, void *cur1, int w, int prefs, int mrefs, + int prefs3, int mrefs3, int parity, int clip_max); + #endif /* AVFILTER_BWDIF_H */ diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index 39a51429ac..035fc58670 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -122,8 +122,8 @@ typedef struct ThreadData { next2++; \ } -static void filter_intra(void *dst1, void *cur1, int w, int prefs, int mrefs, - int prefs3, int mrefs3, int parity, int clip_max) +void ff_bwdif_filter_intra_c(void *dst1, void *cur1, int w, int prefs, int mrefs, + int prefs3, int mrefs3, int parity, int clip_max) { uint8_t *dst = dst1; uint8_t *cur = cur1; @@ -362,7 +362,7 @@ av_cold void ff_bwdif_init_filter_line(BWDIFContext *s, int bit_depth) s->filter_line = filter_line_c_16bit; s->filter_edge = filter_edge_16bit; } else { -s->filter_intra = filter_intra; +s->filter_intra = ff_bwdif_filter_intra_c; s->filter_line = filter_line_c; s->filter_edge = filter_edge; } -- 2.39.2 ___ 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 02/15] avfilter/vf_bwdif: Add common macros and consts for aarch64 neon
Add macros for dual scalar half->single multiply and accumulate Add macro for shift, saturate and shorten single to byte Add filter constants Signed-off-by: John Cox --- libavfilter/aarch64/vf_bwdif_neon.S | 46 + 1 file changed, 46 insertions(+) diff --git a/libavfilter/aarch64/vf_bwdif_neon.S b/libavfilter/aarch64/vf_bwdif_neon.S index 639ab22998..a8f0ed525a 100644 --- a/libavfilter/aarch64/vf_bwdif_neon.S +++ b/libavfilter/aarch64/vf_bwdif_neon.S @@ -23,3 +23,49 @@ #include "libavutil/aarch64/asm.S" +.macro SQSHRUNN b, s0, s1, s2, s3, n +sqshrun \s0\().4h, \s0\().4s, #\n - 8 +sqshrun2\s0\().8h, \s1\().4s, #\n - 8 +sqshrun \s1\().4h, \s2\().4s, #\n - 8 +sqshrun2\s1\().8h, \s3\().4s, #\n - 8 +uzp2\b\().16b, \s0\().16b, \s1\().16b +.endm + +.macro SMULL4K a0, a1, a2, a3, s0, s1, k +smull \a0\().4s, \s0\().4h, \k +smull2 \a1\().4s, \s0\().8h, \k +smull \a2\().4s, \s1\().4h, \k +smull2 \a3\().4s, \s1\().8h, \k +.endm + +.macro UMULL4K a0, a1, a2, a3, s0, s1, k +umull \a0\().4s, \s0\().4h, \k +umull2 \a1\().4s, \s0\().8h, \k +umull \a2\().4s, \s1\().4h, \k +umull2 \a3\().4s, \s1\().8h, \k +.endm + +.macro UMLAL4K a0, a1, a2, a3, s0, s1, k +umlal \a0\().4s, \s0\().4h, \k +umlal2 \a1\().4s, \s0\().8h, \k +umlal \a2\().4s, \s1\().4h, \k +umlal2 \a3\().4s, \s1\().8h, \k +.endm + +.macro UMLSL4K a0, a1, a2, a3, s0, s1, k +umlsl \a0\().4s, \s0\().4h, \k +umlsl2 \a1\().4s, \s0\().8h, \k +umlsl \a2\().4s, \s1\().4h, \k +umlsl2 \a3\().4s, \s1\().8h, \k +.endm + +// static const uint16_t coef_lf[2] = { 4309, 213 }; +// static const uint16_t coef_hf[3] = { 5570, 3801, 1016 }; +// static const uint16_t coef_sp[2] = { 5077, 981 }; + +.align 16 +coeffs: +.hword 4309 * 4, 213 * 4 // lf[0]*4 = v0.h[0] +.hword 5570, 3801, 1016, -3801 // hf[0] = v0.h[2], -hf[1] = v0.h[5] +.hword 5077, 981 // sp[0] = v0.h[6] + -- 2.39.2 ___ 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 01/15] avfilter/vf_bwdif: Add outline for aarch neon functions
Outline but no actual functions. Signed-off-by: John Cox --- libavfilter/aarch64/Makefile| 2 ++ libavfilter/aarch64/vf_bwdif_init_aarch64.c | 39 + libavfilter/aarch64/vf_bwdif_neon.S | 25 + libavfilter/bwdif.h | 1 + libavfilter/vf_bwdif.c | 2 ++ 5 files changed, 69 insertions(+) create mode 100644 libavfilter/aarch64/vf_bwdif_init_aarch64.c create mode 100644 libavfilter/aarch64/vf_bwdif_neon.S diff --git a/libavfilter/aarch64/Makefile b/libavfilter/aarch64/Makefile index b58daa3a3f..b68209bc94 100644 --- a/libavfilter/aarch64/Makefile +++ b/libavfilter/aarch64/Makefile @@ -1,3 +1,5 @@ +OBJS-$(CONFIG_BWDIF_FILTER) += aarch64/vf_bwdif_init_aarch64.o OBJS-$(CONFIG_NLMEANS_FILTER)+= aarch64/vf_nlmeans_init.o +NEON-OBJS-$(CONFIG_BWDIF_FILTER) += aarch64/vf_bwdif_neon.o NEON-OBJS-$(CONFIG_NLMEANS_FILTER) += aarch64/vf_nlmeans_neon.o diff --git a/libavfilter/aarch64/vf_bwdif_init_aarch64.c b/libavfilter/aarch64/vf_bwdif_init_aarch64.c new file mode 100644 index 00..86d53b2ca1 --- /dev/null +++ b/libavfilter/aarch64/vf_bwdif_init_aarch64.c @@ -0,0 +1,39 @@ +/* + * bwdif aarch64 NEON optimisations + * + * Copyright (c) 2023 John Cox + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/common.h" +#include "libavfilter/bwdif.h" +#include "libavutil/aarch64/cpu.h" + +void +ff_bwdif_init_aarch64(BWDIFContext *s, int bit_depth) +{ +const int cpu_flags = av_get_cpu_flags(); + +if (bit_depth != 8) +return; + +if (!have_neon(cpu_flags)) +return; + +} + diff --git a/libavfilter/aarch64/vf_bwdif_neon.S b/libavfilter/aarch64/vf_bwdif_neon.S new file mode 100644 index 00..639ab22998 --- /dev/null +++ b/libavfilter/aarch64/vf_bwdif_neon.S @@ -0,0 +1,25 @@ +/* + * bwdif aarch64 NEON optimisations + * + * Copyright (c) 2023 John Cox + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "libavutil/aarch64/asm.S" + diff --git a/libavfilter/bwdif.h b/libavfilter/bwdif.h index 5749345f78..6a0f70487a 100644 --- a/libavfilter/bwdif.h +++ b/libavfilter/bwdif.h @@ -39,5 +39,6 @@ typedef struct BWDIFContext { void ff_bwdif_init_filter_line(BWDIFContext *bwdif, int bit_depth); void ff_bwdif_init_x86(BWDIFContext *bwdif, int bit_depth); +void ff_bwdif_init_aarch64(BWDIFContext *bwdif, int bit_depth); #endif /* AVFILTER_BWDIF_H */ diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index e278cf1217..39a51429ac 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -369,6 +369,8 @@ av_cold void ff_bwdif_init_filter_line(BWDIFContext *s, int bit_depth) #if ARCH_X86 ff_bwdif_init_x86(s, bit_depth); +#elif ARCH_AARCH64 +ff_bwdif_init_aarch64(s, bit_depth); #endif } -- 2.39.2 ___ 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 00/15] avfilter/vf_bwdif: Add aarch64 neon functions
Also adds a filter_line3 method which on aarch64 neon yields approx 30% speedup over 2xfilter_line and a memcpy John Cox (15): avfilter/vf_bwdif: Add outline for aarch neon functions avfilter/vf_bwdif: Add common macros and consts for aarch64 neon avfilter/vf_bwdif: Export C filter_intra avfilter/vf_bwdif: Add neon for filter_intra tests/checkasm: Add test for vf_bwdif filter_intra avfilter/vf_bwdif: Add clip and spatial macros for aarch64 neon avfilter/vf_bwdif: Export C filter_edge avfilter/vf_bwdif: Add neon for filter_edge tests/checkasm: Add test for vf_bwdif filter_edge avfilter/vf_bwdif: Export C filter_line avfilter/vf_bwdif: Add neon for filter_line avfilter/vf_bwdif: Add a filter_line3 method for optimisation avfilter/vf_bwdif: Add neon for filter_line3 tests/checkasm: Add test for vf_bwdif filter_line3 avfilter/vf_bwdif: Block filter slices into a multiple of 4 lines libavfilter/aarch64/Makefile| 2 + libavfilter/aarch64/vf_bwdif_init_aarch64.c | 125 libavfilter/aarch64/vf_bwdif_neon.S | 780 libavfilter/bwdif.h | 20 + libavfilter/vf_bwdif.c | 70 +- tests/checkasm/vf_bwdif.c | 172 + 6 files changed, 1154 insertions(+), 15 deletions(-) create mode 100644 libavfilter/aarch64/vf_bwdif_init_aarch64.c create mode 100644 libavfilter/aarch64/vf_bwdif_neon.S -- 2.39.2 ___ 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 00/11] Add support for H266/VVC
On 3/21/2023 12:01 PM, Thomas Siedel wrote: This patch set adds H266/VVC support. This includes parsing, muxing, demuxing, decoding and encoding. Decoding is done using the external library VVdeC (https://github.com/fraunhoferhhi/vvdec.git) and can be enabled with --enable-libvvdec. Encoding is done using the external library VVenC (https://github.com/fraunhoferhhi/vvenc.git) and can be enabled with --enable-libvvenc. For conformance testing, the following JVET bitstreams can be used: https://www.itu.int/wftp3/av-arch/jvet-site/bitstream_exchange/VVC/draft_conformance/draft6/ DVB test streams can be found here: https://dvb.org/specifications/verification-validation/vvc-test-content/ All JVET conformance bitstreams that are supported by VVdeC can be decoded. Pallete mode and multi-layer streams are unsupported. The DVB MP4 and TS reference files can be decoded as well. I have pushed patches 1 to 6, and the raw muxer part of 7. Will look at the ISOBMFF and ts stuff better later, as well as the encoder wrapper. ___ 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] avformat/ivfenc: Set the "number of frames" in IVF header
Hi, On Thu, Jun 29, 2023 at 8:54 AM Dai, Jianhui J < jianhui.j.dai-at-intel@ffmpeg.org> wrote: > Should set "number of frames" to bytes 24-27 of IVF header, not > duration. > It is described by [1], and confirmed by parsing all IVF files in [2]. > > This commit also updates the md5sum of refs to pass fate-cbs. > > [1] Duck IVF - MultimediaWiki > https://wiki.multimedia.cx/index.php/Duck_IVF > > [2] webm/vp8-test-vectors > https://chromium.googlesource.com/webm/vp8-test-vectors > > Signed-off-by: Jianhui Dai > --- > libavformat/ivfdec.c| 6 +++--- > libavformat/ivfenc.c| 13 + > tests/ref/fate/cbs-vp9-vp90-2-03-deltaq | 2 +- > tests/ref/fate/cbs-vp9-vp90-2-06-bilinear | 2 +- > tests/ref/fate/cbs-vp9-vp90-2-09-lf_deltas | 2 +- > .../ref/fate/cbs-vp9-vp90-2-10-show-existing-frame | 2 +- > .../ref/fate/cbs-vp9-vp90-2-10-show-existing-frame2 | 2 +- > tests/ref/fate/cbs-vp9-vp90-2-segmentation-aq-akiyo | 2 +- > tests/ref/fate/cbs-vp9-vp90-2-segmentation-sf-akiyo | 2 +- > tests/ref/fate/cbs-vp9-vp90-2-tiling-pedestrian | 2 +- > tests/ref/fate/cbs-vp9-vp91-2-04-yuv440 | 2 +- > tests/ref/fate/cbs-vp9-vp91-2-04-yuv444 | 2 +- > tests/ref/fate/cbs-vp9-vp92-2-20-10bit-yuv420 | 2 +- > tests/ref/fate/cbs-vp9-vp93-2-20-10bit-yuv422 | 2 +- > tests/ref/fate/cbs-vp9-vp93-2-20-12bit-yuv444 | 2 +- > 15 files changed, 21 insertions(+), 24 deletions(-) > > diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c > index 511f2387ed..c71a28e0d3 100644 > --- a/libavformat/ivfdec.c > +++ b/libavformat/ivfdec.c > @@ -51,9 +51,9 @@ static int read_header(AVFormatContext *s) > st->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags, > st->codecpar->codec_tag); > st->codecpar->width = avio_rl16(s->pb); > st->codecpar->height = avio_rl16(s->pb); > -time_base.den = avio_rl32(s->pb); > -time_base.num = avio_rl32(s->pb); > -st->duration = avio_rl32(s->pb); > +time_base.den= avio_rl32(s->pb); > +time_base.num= avio_rl32(s->pb); > +st->nb_frames= avio_rl32(s->pb); > avio_skip(s->pb, 4); // unused > > ffstream(st)->need_parsing = AVSTREAM_PARSE_HEADERS; > Is the removal of the st->duration assignment necessary? Applications using this field will now see a regression. Ronald ___ 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 v6 0/1] avformat: add Software Defined Radio support
If you apply this I will apply my pending libswresample commits and also remove sonic decoder from libavcodec. ___ 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/2, v3] amfenc: Update the min version to 1.4.29.0 for AMF SDK.
On 5/17/2023 9:59 AM, Dmitrii Ovchinnikov wrote: --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index bb7be67676..937be943a4 100755 --- a/configure +++ b/configure @@ -7082,7 +7082,7 @@ fi enabled amf && check_cpp_condition amf "AMF/core/Version.h" \ -"(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x00010004001c" +"(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x00010004001d" # Funny iconv installations are not unusual, so check it after all flags have been set if enabled libc_iconv; then Patchset 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".
[FFmpeg-devel] [PATCH v3] avformat/ivfenc: Set the "number of frames" in IVF header
Should set "number of frames" to bytes 24-27 of IVF header, not duration. It is described by [1], and confirmed by parsing all IVF files in [2]. This commit also updates the md5sum of refs to pass fate-cbs. [1] Duck IVF - MultimediaWiki https://wiki.multimedia.cx/index.php/Duck_IVF [2] webm/vp8-test-vectors https://chromium.googlesource.com/webm/vp8-test-vectors Signed-off-by: Jianhui Dai --- libavformat/ivfdec.c| 6 +++--- libavformat/ivfenc.c| 13 + tests/ref/fate/cbs-vp9-vp90-2-03-deltaq | 2 +- tests/ref/fate/cbs-vp9-vp90-2-06-bilinear | 2 +- tests/ref/fate/cbs-vp9-vp90-2-09-lf_deltas | 2 +- .../ref/fate/cbs-vp9-vp90-2-10-show-existing-frame | 2 +- .../ref/fate/cbs-vp9-vp90-2-10-show-existing-frame2 | 2 +- tests/ref/fate/cbs-vp9-vp90-2-segmentation-aq-akiyo | 2 +- tests/ref/fate/cbs-vp9-vp90-2-segmentation-sf-akiyo | 2 +- tests/ref/fate/cbs-vp9-vp90-2-tiling-pedestrian | 2 +- tests/ref/fate/cbs-vp9-vp91-2-04-yuv440 | 2 +- tests/ref/fate/cbs-vp9-vp91-2-04-yuv444 | 2 +- tests/ref/fate/cbs-vp9-vp92-2-20-10bit-yuv420 | 2 +- tests/ref/fate/cbs-vp9-vp93-2-20-10bit-yuv422 | 2 +- tests/ref/fate/cbs-vp9-vp93-2-20-12bit-yuv444 | 2 +- 15 files changed, 21 insertions(+), 24 deletions(-) diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c index 511f2387ed..c71a28e0d3 100644 --- a/libavformat/ivfdec.c +++ b/libavformat/ivfdec.c @@ -51,9 +51,9 @@ static int read_header(AVFormatContext *s) st->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags, st->codecpar->codec_tag); st->codecpar->width = avio_rl16(s->pb); st->codecpar->height = avio_rl16(s->pb); -time_base.den = avio_rl32(s->pb); -time_base.num = avio_rl32(s->pb); -st->duration = avio_rl32(s->pb); +time_base.den= avio_rl32(s->pb); +time_base.num= avio_rl32(s->pb); +st->nb_frames= avio_rl32(s->pb); avio_skip(s->pb, 4); // unused ffstream(st)->need_parsing = AVSTREAM_PARSE_HEADERS; diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c index 47b4efbcd1..88399099d4 100644 --- a/libavformat/ivfenc.c +++ b/libavformat/ivfenc.c @@ -72,7 +72,8 @@ static int ivf_write_header(AVFormatContext *s) avio_wl16(pb, par->height); avio_wl32(pb, s->streams[0]->time_base.den); avio_wl32(pb, s->streams[0]->time_base.num); -avio_wl64(pb, 0xULL); // length is overwritten at the end of muxing +avio_wl32(pb, 0x); // "number of frames" is overwritten at the end of muxing +avio_wl32(pb, 0); // unused return 0; } @@ -99,16 +100,12 @@ static int ivf_write_trailer(AVFormatContext *s) AVIOContext *pb = s->pb; IVFEncContext *ctx = s->priv_data; -if ((pb->seekable & AVIO_SEEKABLE_NORMAL) && -(ctx->frame_cnt > 1 || (ctx->frame_cnt == 1 && ctx->last_pkt_duration))) { +// overwrite the "number of frames" +if ((pb->seekable & AVIO_SEEKABLE_NORMAL)) { int64_t end = avio_tell(pb); avio_seek(pb, 24, SEEK_SET); -// overwrite the "length" field (duration) -avio_wl32(pb, ctx->last_pkt_duration ? - ctx->sum_delta_pts + ctx->last_pkt_duration : - ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 1)); -avio_wl32(pb, 0); // zero out unused bytes +avio_wl32(pb, ctx->frame_cnt); avio_seek(pb, end, SEEK_SET); } diff --git a/tests/ref/fate/cbs-vp9-vp90-2-03-deltaq b/tests/ref/fate/cbs-vp9-vp90-2-03-deltaq index db09cfd5e0..f621d7a480 100644 --- a/tests/ref/fate/cbs-vp9-vp90-2-03-deltaq +++ b/tests/ref/fate/cbs-vp9-vp90-2-03-deltaq @@ -1 +1 @@ -bb630ef560f83951fa6547a664fdb636 +fe62460fe28202e0666e628afd8602ca diff --git a/tests/ref/fate/cbs-vp9-vp90-2-06-bilinear b/tests/ref/fate/cbs-vp9-vp90-2-06-bilinear index f579459179..9359e21e40 100644 --- a/tests/ref/fate/cbs-vp9-vp90-2-06-bilinear +++ b/tests/ref/fate/cbs-vp9-vp90-2-06-bilinear @@ -1 +1 @@ -2ca9d012c7212e38f5e2727ac66ec6c5 +179e228004c396a301c89f34b6c72f68 diff --git a/tests/ref/fate/cbs-vp9-vp90-2-09-lf_deltas b/tests/ref/fate/cbs-vp9-vp90-2-09-lf_deltas index e0b5686d0b..5b21675c76 100644 --- a/tests/ref/fate/cbs-vp9-vp90-2-09-lf_deltas +++ b/tests/ref/fate/cbs-vp9-vp90-2-09-lf_deltas @@ -1 +1 @@ -78f5e46bfaecbcd62b9126697a0d97b7 +1d1f0768c547461ae2abef57f0aabc24 diff --git a/tests/ref/fate/cbs-vp9-vp90-2-10-show-existing-frame b/tests/ref/fate/cbs-vp9-vp90-2-10-show-existing-frame index 4a4d752428..19b7a78dd8 100644 --- a/tests/ref/fate/cbs-vp9-vp90-2-10-show-existing-frame +++ b/tests/ref/fate/cbs-vp9-vp90-2-10-show-existing-frame @@ -1 +1 @@ -eea9d10a696c6ed971e4fae9fb619b10 +13fa042ee1b4079c227a5c5c96e2db38 diff --git a/tests/ref/fate/cbs-vp9-vp90-2-10-show-existing-frame2 b/tests/ref/fate/cbs-vp9-vp90-2-10-show-existing-frame2
Re: [FFmpeg-devel] [PATCH v2] avformat: add Software Defined Radio support
Hello, On Thu, 29 Jun 2023, at 09:14, Nicolas George wrote: >>The reason why XML parsing shouldn't be >> implemented in FFmpeg isn't just because it is difficult but because: >> >> * it is out of scope > > It is necessary. Says you. This is not an opinion that seems to be the majority. > Precisely. Nothing is “important” in absolute?. Things are only > important with regard to a goal. > > My goal is to have fun, and for that goal, API and ABI stability are not > important. To have fun, I still need the project to exist, so I will > spend time on these issues, that is all. Again YOUR goal. It might not be the majority of the community. We can do an AG vote, if you want. > go fork yourself. This is out of line, IMHO. 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] [PATCH v2] avformat/ivfenc: Set the "number of frames" in IVF header
Quoting Dai, Jianhui J (2023-06-29 08:03:18) > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of > > Anton Khirnov > > Sent: Wednesday, June 28, 2023 11:25 PM > > To: ffmpeg-devel@ffmpeg.org > > Subject: Re: [FFmpeg-devel] [PATCH v2] avformat/ivfenc: Set the "number of > > frames" in IVF header > > > > Quoting Dai, Jianhui J (2023-06-05 02:53:35) > > > diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c index > > > 511f2387ed..01012db948 100644 > > > --- a/libavformat/ivfdec.c > > > +++ b/libavformat/ivfdec.c > > > @@ -53,6 +53,7 @@ static int read_header(AVFormatContext *s) > > > st->codecpar->height = avio_rl16(s->pb); > > > time_base.den = avio_rl32(s->pb); > > > time_base.num = avio_rl32(s->pb); > > > +// Infer duration from "number of frames". > > > st->duration = avio_rl32(s->pb); > > > > This should be setting st->nb_frames then rather than duration. > > And the muxer should be using that field as well instead of its custom > > version. > > ACK. > Do you suggest letting `duration` unset? > It is interesting that the 'duration' is often right in this way, if > the time_base.den/time_base.num == fps which is the popular > configuration. Yes, but AFAIU there is no way to tell whether the file is CFR, so then the value would be unreliable. So I'd prefer to leave it unset. -- Anton Khirnov ___ 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 v2] avformat: add Software Defined Radio support
Tomas Härdin (12023-06-29): > This is very revealing. Indeed. > The reason why XML parsing shouldn't be > implemented in FFmpeg isn't just because it is difficult but because: > > * it is out of scope It is necessary. > * it is technical debt > * shitty parsing is the cause of the vast majority of CVEs > > It speaks of an inability to make sane architectural decisions, of not > seperating concerns and of preferring cowboy coding over sane decisions > with respect to the entire free software ecosystem. Thank you for illustrating my words with your inability to consider that (1) we do not need a complete parser (2) the things that make parsing XML hard are precisely the things we do not need and (3) if you consider writing such a XML parser is way too hard, it speaks more of your skills in that area than anything else. > Are you implying that API and ABI stability are not important? Precisely. Nothing is “important” in absolute?. Things are only important with regard to a goal. My goal is to have fun, and for that goal, API and ABI stability are not important. To have fun, I still need the project to exist, so I will spend time on these issues, that is all. API and ABI stability are important if you want to be of service. I do not want to be of service. Maybe you want FFmpeg to be of service, you seem to. Well, let me tell you this: if you want to force me to not have fun and spend effort on things you think are important instead, go fork yourself. -- Nicolas George ___ 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 v2] avformat/ivfenc: Set the "number of frames" in IVF header
> -Original Message- > From: ffmpeg-devel On Behalf Of > Anton Khirnov > Sent: Wednesday, June 28, 2023 11:25 PM > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH v2] avformat/ivfenc: Set the "number of > frames" in IVF header > > Quoting Dai, Jianhui J (2023-06-05 02:53:35) > > diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c index > > 511f2387ed..01012db948 100644 > > --- a/libavformat/ivfdec.c > > +++ b/libavformat/ivfdec.c > > @@ -53,6 +53,7 @@ static int read_header(AVFormatContext *s) > > st->codecpar->height = avio_rl16(s->pb); > > time_base.den = avio_rl32(s->pb); > > time_base.num = avio_rl32(s->pb); > > +// Infer duration from "number of frames". > > st->duration = avio_rl32(s->pb); > > This should be setting st->nb_frames then rather than duration. > And the muxer should be using that field as well instead of its custom > version. ACK. Do you suggest letting `duration` unset? It is interesting that the 'duration' is often right in this way, if the time_base.den/time_base.num == fps which is the popular configuration. > > > -- > Anton Khirnov > ___ > 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".