]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/asvenc: Simplify flushing and padding packet
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 12 Oct 2020 22:01:29 +0000 (00:01 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 18 Oct 2020 12:46:28 +0000 (14:46 +0200)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/asvenc.c

index 054ec8ee65ae83ec4ed3b0c6920a8cb612ea7738..49df3ffbe1cc18e67c63544f6a735d28f13543f1 100644 (file)
@@ -291,12 +291,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     }
     emms_c();
 
-    avpriv_align_put_bits(&a->pb);
-    while (put_bits_count(&a->pb) & 31)
-        put_bits(&a->pb, 8, 0);
-
     flush_put_bits(&a->pb);
-    size = put_bits_count(&a->pb) / 32;
+    AV_WN32(put_bits_ptr(&a->pb), 0);
+    size = (put_bits_count(&a->pb) + 31) / 32;
 
     if (avctx->codec_id == AV_CODEC_ID_ASV1) {
         a->bbdsp.bswap_buf((uint32_t *) pkt->data,