History

avcodec/mpegaudioenc: Don't pad one bit at a time

Andreas Rheinhardt committed 1 year ago

Commit 62e1abc1 parent 87f3e201 file · +5 −5Browse files

Unified · Split

libavcodec/mpegaudioenc.c+5−5
@@ -743,9 +743,12 @@ static void encode_frame(MpegAudioContext *s, · 742 unmodified lines
743743
744744 av_assert1(put_bits_left(p) == padding);
745745
746+ /* flush */
747+ flush_put_bits(p);
748+
746749 /* padding */
747− for(i=0;i<padding;i++)
748− put_bits(p, 1, 0);
750+ if (put_bytes_left(p, 0))
751+ memset(put_bits_ptr(p), 0, put_bytes_left(p, 0));
749752 }
750753
751754 static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
@@ -778,9 +781,6 @@ static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 26 unmodified lines
778781
779782 encode_frame(s, bit_alloc, padding);
780783
781− /* flush */
782− flush_put_bits(&s->pb);
783−
784784 if (frame->pts != AV_NOPTS_VALUE)
785785 avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding);
786786

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