From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 126E1431CE for ; Tue, 24 May 2022 22:20:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A47FD68B536; Wed, 25 May 2022 01:20:46 +0300 (EEST) Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B157468B352 for ; Wed, 25 May 2022 01:20:40 +0300 (EEST) Received: by mail-qt1-f181.google.com with SMTP id q20so6045558qtw.1 for ; Tue, 24 May 2022 15:20:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rcombs.me; s=google; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=s5GNh6J88opTyTjxZbBV82Pdng/PQD7X+oaFO5l/3r8=; b=nl9Gopr/B2l9iXyOQ0xY0kMXfFItH805JcYWMfbEV7D2u8LLunMp1X+FYVEgDTcvvb HK/duwU70cfefFHa9gvCGeKfm7MqJf+4gjErrPTNr7ODi3Q9QIEkN/BekkPz0oOihmBq x4lifQWtDoLQLibSMpcEbkKqiA0fassukjX5I3RHjcQOP9RFIDPfEpwvZiqFRm7xgY/u O7Earq2ivzpxvWsT7oIEFNYQQpRPTn5pdLUf2gAP5tZZ8ML75O84Tv89pyXthn9wS4JB 8pUJ0BCQ+j5JT48SpK+4fAnLgLCDvD0x+qL5LSJz7p4ZZeFZKMh9PBToioQFnjfOUqsq TiQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=s5GNh6J88opTyTjxZbBV82Pdng/PQD7X+oaFO5l/3r8=; b=cdhfsoUFAtpdiNyNIRHm5/6x8GDbcXDuSgZgVzyzzrXY4PccCSFXi435GqaTNDb7bo KNMp/IzNZedUFnZshcXSVPaeXJX+1E9DLyyvwQnhC48O6jmGH8h6Zbkz7pVGj4IXXKsF 0vTzVtgUqH+VuvGp+H6TejxzYQbNuksQS6NXE8e7JA8gTMVqt90brx+pbkS7+gleh21w SMkOkZfkTjprEMOwHsGJqdl6hS5Nn2p+i5QZH5b2AAPQg1kzPdypcKpTjfDPVsgTYsZM 8FSo3Rr4KSXszdyPGBa2eoC4ahcucw4Reuf61biMDe9MEdKL7+8PpGonUa8668/c4R1R gcLQ== X-Gm-Message-State: AOAM53381ygJvt+p2PCn0QcWSP9fhOwGn57jLmR2gEeRYTpKekisEYSw dul4Gh+umoR/ICe2zXMw+vpKuDL7Ew77 X-Google-Smtp-Source: ABdhPJxDMbqTkcazO+9mb4WhXaxhHqo8BAA2u++4SrE7Os0SPUj/oO0vJH6Eg8jjXEM8uS5Gz8oQfw== X-Received: by 2002:ac8:7f43:0:b0:2f3:d55d:7296 with SMTP id g3-20020ac87f43000000b002f3d55d7296mr22223180qtk.635.1653430839159; Tue, 24 May 2022 15:20:39 -0700 (PDT) Received: from smtpclient.apple ([12.187.214.130]) by smtp.gmail.com with ESMTPSA id b14-20020ac84f0e000000b002f96db4519csm345743qte.37.2022.05.24.15.20.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 May 2022 15:20:38 -0700 (PDT) From: Ridley Combs Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) Date: Tue, 24 May 2022 17:20:38 -0500 References: To: ffmpeg-devel , andreas.rheinhardt@outlook.com In-Reply-To: Message-Id: <18937033-4BDB-4C94-86D3-08FA4B83B77D@rcombs.me> X-Mailer: Apple Mail (2.3696.80.82.1.1) X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH 6/6] lavc/h264_ps: always include the stop bit in [s|p]ps->data X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: > On May 9, 2022, at 23:26, Andreas Rheinhardt wrote: > > rcombs: >> From: rcombs >> >> 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 >> --- >> 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 > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > 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".