Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 11/12] avcodec/e?ac3enc: Inform compiler about PutBitContext being blank
Date: Sat, 25 May 2024 00:04:54 +0200
Message-ID: <AS8P250MB074430BAC1A1E98C935A81048FF52@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB0744D0CB066E751A0A393A368FF52@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>

This turned out to be very beneficial: For GCC 13, the codesize
of ac3_output_frame_header went down from 4522B to 1247B and
from 10762B to 9298B for eac3_output_frame_header. For Clang 17,
the numbers went down from 3923B to 2477B and from 8338B to 6548B
(always with -O3).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/ac3enc.c  | 2 ++
 libavcodec/eac3enc.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index 3649289865..a1783577c5 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -1638,6 +1638,8 @@ static void ac3_output_frame_header(AC3EncodeContext *s, PutBitContext *pb)
 {
     AC3EncOptions *opt = &s->options;
 
+    put_bits_assume_flushed(pb);
+
     put_bits(pb, 16, 0x0b77);   /* frame header */
     put_bits(pb, 16, 0);        /* crc1: will be filled later */
     put_bits(pb, 2,  s->bit_alloc.sr_code);
diff --git a/libavcodec/eac3enc.c b/libavcodec/eac3enc.c
index 8ef3e7e773..1c522dae2e 100644
--- a/libavcodec/eac3enc.c
+++ b/libavcodec/eac3enc.c
@@ -135,6 +135,8 @@ static void eac3_output_frame_header(AC3EncodeContext *s, PutBitContext *pb)
     int blk, ch;
     AC3EncOptions *opt = &s->options;
 
+    put_bits_assume_flushed(pb);
+
     put_bits(pb, 16, 0x0b77);                   /* sync word */
 
     /* BSI header */
-- 
2.40.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-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2024-05-24 22:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24 21:58 [FFmpeg-devel] [PATCH 01/12] avutil/avassert: Add av_unreachable and av_assume() macros Andreas Rheinhardt
2024-05-24 22:04 ` [FFmpeg-devel] [PATCH 02/12] avcodec/amrwbdec: Mark default switch as unreachable Andreas Rheinhardt
2024-05-24 22:04 ` [FFmpeg-devel] [PATCH 03/12] avcodec/proresenc_anatoliy: Mark impossible case " Andreas Rheinhardt
2024-05-24 22:04 ` [FFmpeg-devel] [PATCH 04/12] all: Use put_bytes_output() instead of put_bits_ptr - pb->buf Andreas Rheinhardt
2024-05-24 22:04 ` [FFmpeg-devel] [PATCH 05/12] avcodec/mpeg4videodec: Mark impossible switch case as unreachable Andreas Rheinhardt
2024-05-24 22:04 ` [FFmpeg-devel] [PATCH 06/12] avcodec/pcm-dvdenc: Mark unreachable default cases " Andreas Rheinhardt
2024-05-24 22:04 ` [FFmpeg-devel] [PATCH 07/12] avcodec/vlc: Make code more readable with av_unreachable Andreas Rheinhardt
2024-05-24 22:04 ` [FFmpeg-devel] [PATCH 08/12] avcodec/utvideoenc: Remove always-false pixel format check Andreas Rheinhardt
2024-05-24 22:04 ` [FFmpeg-devel] [PATCH 09/12] avcodec/dolby_e_parse: Use av_unreachable instead of av_assert0(0) Andreas Rheinhardt
2024-05-24 22:04 ` [FFmpeg-devel] [PATCH 10/12] avcodec/put_bits: Allow to mark places where PutBitContext is flushed Andreas Rheinhardt
2024-05-24 22:04 ` Andreas Rheinhardt [this message]
2024-05-24 22:04 ` [FFmpeg-devel] [PATCH 12/12] avcodec/speedhqenc: Use av_unreachable for unreachable condition Andreas Rheinhardt
2024-05-25  0:48 ` [FFmpeg-devel] [PATCH 13/16] avcodec/wmaenc: Move transient PutBitContext from Context to stack Andreas Rheinhardt
2024-05-25  0:48 ` [FFmpeg-devel] [PATCH 14/16] avcodec/wma: Mark ff_wma_end() as av_cold Andreas Rheinhardt
2024-05-25  0:48 ` [FFmpeg-devel] [PATCH 15/16] avcodec/wmaenc: Use av_unreachable to mark unreachable codepath Andreas Rheinhardt
2024-05-25  0:48 ` [FFmpeg-devel] [PATCH 16/16] avcodec/wmaenc: Don't unnecessarily reset AVPacket.size Andreas Rheinhardt
2024-05-26  0:22 ` [FFmpeg-devel] [PATCH 01/12] avutil/avassert: Add av_unreachable and av_assume() macros Michael Niedermayer
2024-05-26  0:59   ` Andreas Rheinhardt
2024-05-26 17:55     ` Michael Niedermayer

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=AS8P250MB074430BAC1A1E98C935A81048FF52@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