History

avcodec/e?ac3enc: Inform compiler about PutBitContext being blank

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).

Andreas Rheinhardt committed 2 years ago

Commit 2df9c8d1 parent 4484e9b2 files · +4 −0Browse files

Showing the changes to libavcodec (2 of 2 files). Show all

Unified · Split

2 files
  1. libavcodec/ac3enc.c +2 −0
  2. libavcodec/eac3enc.c +2 −0
libavcodec/ac3enc.c+2−0
@@ -1638,6 +1638,8 @@ static void ac3_output_frame_header(AC3EncodeContext *s, PutBitContext *pb) · 1637 unmodified lines
16381638 {
16391639 AC3EncOptions *opt = &s->options;
16401640
1641+ put_bits_assume_flushed(pb);
1642+
16411643 put_bits(pb, 16, 0x0b77); /* frame header */
16421644 put_bits(pb, 16, 0); /* crc1: will be filled later */
16431645 put_bits(pb, 2, s->bit_alloc.sr_code);
libavcodec/eac3enc.c+2−0
@@ -135,6 +135,8 @@ static void eac3_output_frame_header(AC3EncodeContext *s, PutBitContext *pb) · 134 unmodified lines
135135 int blk, ch;
136136 AC3EncOptions *opt = &s->options;
137137
138+ put_bits_assume_flushed(pb);
139+
138140 put_bits(pb, 16, 0x0b77); /* sync word */
139141
140142 /* BSI header */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t