diff mbox series

[FFmpeg-devel,13/46] avcodec/dcaenc: Don't write one bit at a time

Message ID HE1PR0301MB2154628DE42EC4273F020C098F5F9@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit 72c521e80af9ff9b8ab7145e4af973c5e2969840
Headers show
Series [FFmpeg-devel,01/46] avcodec/a64multienc: Avoid intermediate buffer
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt April 29, 2021, 11:56 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/dcaenc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index bd08ccd331..76f1f141d1 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -1206,14 +1206,10 @@  static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     for (i = 0; i < SUBFRAMES; i++)
         put_subframe(c, i);
 
-
-    for (i = put_bits_count(&c->pb); i < 8*c->frame_size; i++)
-        put_bits(&c->pb, 1, 0);
-
     flush_put_bits(&c->pb);
+    memset(put_bits_ptr(&c->pb), 0, put_bytes_left(&c->pb, 0));
 
     avpkt->pts      = frame->pts;
-    avpkt->size     = put_bytes_output(&c->pb);
     avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples);
     *got_packet_ptr = 1;
     return 0;