From: Ridley Combs <rcombs@rcombs.me> To: ffmpeg-devel <ffmpeg-devel@ffmpeg.org>, andreas.rheinhardt@outlook.com Subject: Re: [FFmpeg-devel] [PATCH 6/6] lavc/h264_ps: always include the stop bit in [s|p]ps->data Date: Tue, 24 May 2022 17:20:38 -0500 Message-ID: <18937033-4BDB-4C94-86D3-08FA4B83B77D@rcombs.me> (raw) In-Reply-To: <DB6PR0101MB2214AB6F191F818D97C20A8D8FC99@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> > On May 9, 2022, at 23:26, Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote: > > rcombs: >> From: rcombs <rcombs@rcombs.me> >> >> The VideoToolbox hwaccel needs the entire NAL (including the stop bit), >> but ff_h2645_packet_split may remove it. Detect this case by looking for >> bit counts divisible by 8 and insert a stop-bit-only 0x80 byte. >> >> Signed-off-by: rcombs <rcombs@rcombs.me> >> --- >> libavcodec/h264_ps.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c >> index 051f06692c..e16da68dec 100644 >> --- a/libavcodec/h264_ps.c >> +++ b/libavcodec/h264_ps.c >> @@ -351,6 +351,10 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, >> } >> memcpy(sps->data, gb->buffer, sps->data_size); >> >> + // Re-add the removed stop bit (may be used by hwaccels). >> + if (!(gb->size_in_bits & 7) && sps->data_size < sizeof(sps->data)) >> + sps->data[sps->data_size++] = 0x80; >> + >> profile_idc = get_bits(gb, 8); >> constraint_set_flags |= get_bits1(gb) << 0; // constraint_set0_flag >> constraint_set_flags |= get_bits1(gb) << 1; // constraint_set1_flag >> @@ -775,6 +779,10 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct >> } >> memcpy(pps->data, gb->buffer, pps->data_size); >> >> + // Re-add the removed stop bit (may be used by hwaccels). >> + if (!(bit_length & 7) && pps->data_size < sizeof(pps->data)) >> + pps->data[pps->data_size++] = 0x80; >> + >> pps->sps_id = get_ue_golomb_31(gb); >> if ((unsigned)pps->sps_id >= MAX_SPS_COUNT || >> !ps->sps_list[pps->sps_id]) { > > Modifying these functions affects more than just VideoToolbox. Are you > sure that the other users of this file are ok with this change? > > - Andreas It passes FATE, and only adds a byte containing the stop bit (which would be present prior to this commit in 7 of 8 possible cases), so I believe it should be fine (and conceptually including the stop bit makes more sense IMO; being inconsistent about it like this is wacky). > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel> > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org <mailto:ffmpeg-devel-request@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-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2022-05-24 22:20 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-09 18:16 [FFmpeg-devel] [PATCH 0/6] lavc/videotoolboxdec: improve HEVC stream compatibility ffmpegagent 2022-05-09 18:16 ` [FFmpeg-devel] [PATCH 1/6] lavc/videotoolboxdec: warn on nonzero status in the callback rcombs 2022-05-09 18:16 ` [FFmpeg-devel] [PATCH 2/6] lavc/videotoolboxdec: fix escaping sequential zero sequences rcombs 2022-05-09 18:16 ` [FFmpeg-devel] [PATCH 3/6] lavc/videotoolboxdec: fix generating HEVC general_profile_compatibility_flags rcombs 2022-05-09 18:16 ` [FFmpeg-devel] [PATCH 4/6] lavc/videotoolboxdec: fix writing too many 1 bits for the reserved fields rcombs 2022-05-09 18:16 ` [FFmpeg-devel] [PATCH 5/6] lavc/videotoolboxdec: insert emu-prevention bytes for HEVC as well rcombs 2022-05-09 18:16 ` [FFmpeg-devel] [PATCH 6/6] lavc/h264_ps: always include the stop bit in [s|p]ps->data rcombs 2022-05-10 4:26 ` Andreas Rheinhardt 2022-05-24 22:20 ` Ridley Combs [this message]
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=18937033-4BDB-4C94-86D3-08FA4B83B77D@rcombs.me \ --to=rcombs@rcombs.me \ --cc=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