From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v2 1/4] avcodec/h264_redundant_pps_bsf: Don't remove PPS
Date: Thu, 22 Sep 2022 17:29:39 +0200
Message-ID: <AS8P250MB0744BE416A08E0366DDF6F928F4E9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <GV1P250MB0737575554F114CCDEDBD6618F4C9@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>
Andreas Rheinhardt:
> There is no check for whether these supposedly redundant PPS
> are actually redundant. One could check via memcmp which would
> work in practice* (because all content buffers are initially
> zero-allocated), but this is not portable as compilers may
> trash padding inside structures as they wish.
>
> In case the PPS is not really redundant the output is garbage.
> This happens with several files from the FATE-suite. E.g.
> h264-conformance/CVCANLMA2_Sony_C.jsv doesn't decode correctly
> any more, whereas h264-conformance/CABA3_TOSHIBA_E.264 even
> fails in ff_cbs_write_packet(), because the inferred value
> of num_ref_idx_l0_active_minus1 mismatches with the value set
> in the slice (this happens when num_ref_idx_l0_default_active_minus1
> changes in the PPS; the value in the slice header is inferred from
> the original PPS's num_ref_idx_l0_default_active_minus1).
>
> *: Unless slice_group_id is used, i.e. unless slice_group_map_type
> is six.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavcodec/h264_redundant_pps_bsf.c | 11 -----------
> 1 file changed, 11 deletions(-)
>
> diff --git a/libavcodec/h264_redundant_pps_bsf.c b/libavcodec/h264_redundant_pps_bsf.c
> index f8bab1f109..df9a88a705 100644
> --- a/libavcodec/h264_redundant_pps_bsf.c
> +++ b/libavcodec/h264_redundant_pps_bsf.c
> @@ -80,26 +80,15 @@ static int h264_redundant_pps_update_fragment(AVBSFContext *bsf,
> CodedBitstreamFragment *au)
> {
> H264RedundantPPSContext *ctx = bsf->priv_data;
> - int au_has_sps;
> int err, i;
>
> - au_has_sps = 0;
> for (i = 0; i < au->nb_units; i++) {
> CodedBitstreamUnit *nal = &au->units[i];
>
> - if (nal->type == H264_NAL_SPS)
> - au_has_sps = 1;
> if (nal->type == H264_NAL_PPS) {
> err = h264_redundant_pps_fixup_pps(ctx, nal);
> if (err < 0)
> return err;
> - if (!au_has_sps) {
> - av_log(bsf, AV_LOG_VERBOSE, "Deleting redundant PPS "
> - "at %"PRId64".\n", pkt->pts);
> - ff_cbs_delete_unit(au, i);
> - i--;
> - continue;
> - }
> }
> if (nal->type == H264_NAL_SLICE ||
> nal->type == H264_NAL_IDR_SLICE) {
I just noticed that the documentation contains the sentence "A new
single global PPS is created, and all of the redundant PPSs within the
stream are removed". As the observations in the commit message show,
this is just not true because every PPS in an access unit without SPS is
considered redundant, making this filter dangerous. So I would simply
delete this sentence from the documentation. Is everyone ok with this?
- 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-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-09-22 15:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 16:42 Andreas Rheinhardt
2022-09-20 16:46 ` [FFmpeg-devel] [PATCH v2 2/4] avcodec/cbs: Only write extradata if there is something to write Andreas Rheinhardt
2022-09-20 16:46 ` [FFmpeg-devel] [PATCH v2 3/4] avformat/nutdec: Don't shrink packet size manually Andreas Rheinhardt
2022-09-20 16:46 ` [FFmpeg-devel] [PATCH v2 4/4] fate/cbs: Add tests for h264_redundant_pps BSF Andreas Rheinhardt
2022-09-22 15:29 ` Andreas Rheinhardt [this message]
2022-09-24 14:11 ` [FFmpeg-devel] [PATCH v2 1/4] avcodec/h264_redundant_pps_bsf: Don't remove PPS Andreas Rheinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AS8P250MB0744BE416A08E0366DDF6F928F4E9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git