From 8129c32e488645db325263a6bee01311b83e7ed9 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Thu, 30 Jul 2020 21:44:51 +0200 Subject: [PATCH] avcodec, avfilter, avformat: Remove redundant avpriv_align_put_bits flush_put_bits() already fills the bitstream with zeroes, so it is unnecessary to align the bitstream before. Reviewed-by: Paul B Mahol Signed-off-by: Andreas Rheinhardt --- libavcodec/hevc_ps_enc.c | 3 +-- libavcodec/mpegvideo_enc.c | 1 - libavcodec/vc2enc.c | 1 - libavcodec/xsubenc.c | 1 - libavfilter/vf_signature.c | 1 - libavformat/latmenc.c | 1 - 6 files changed, 1 insertion(+), 7 deletions(-) diff --git a/libavcodec/hevc_ps_enc.c b/libavcodec/hevc_ps_enc.c index 78a73a5c0a..5449f81c82 100644 --- a/libavcodec/hevc_ps_enc.c +++ b/libavcodec/hevc_ps_enc.c @@ -113,10 +113,9 @@ int ff_hevc_encode_nal_vps(HEVCVPS *vps, unsigned int id, put_bits(&pb, 1, 0); // extension flag put_bits(&pb, 1, 1); // stop bit - avpriv_align_put_bits(&pb); + flush_put_bits(&pb); data_size = put_bits_count(&pb) / 8; - flush_put_bits(&pb); return data_size; } diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 21c30a9f8a..09697d89c8 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -2818,7 +2818,6 @@ static void write_slice_end(MpegEncContext *s){ ff_mjpeg_encode_stuffing(s); } - avpriv_align_put_bits(&s->pb); flush_put_bits(&s->pb); if ((s->avctx->flags & AV_CODEC_FLAG_PASS1) && !s->partitioned_frame) diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c index ba5a03e4ec..2efb0f70ad 100644 --- a/libavcodec/vc2enc.c +++ b/libavcodec/vc2enc.c @@ -780,7 +780,6 @@ static int encode_slices(VC2EncContext *s) int slice_x, slice_y, skip = 0; SliceArgs *enc_args = s->slice_args; - avpriv_align_put_bits(&s->pb); flush_put_bits(&s->pb); buf = put_bits_ptr(&s->pb); diff --git a/libavcodec/xsubenc.c b/libavcodec/xsubenc.c index 4d58e0f3b5..349c1bca3c 100644 --- a/libavcodec/xsubenc.c +++ b/libavcodec/xsubenc.c @@ -206,7 +206,6 @@ FF_ENABLE_DEPRECATION_WARNINGS // Enforce total height to be a multiple of 2 if (h->rects[0]->h & 1) { put_xsub_rle(&pb, h->rects[0]->w, PADDING_COLOR); - avpriv_align_put_bits(&pb); } flush_put_bits(&pb); diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index d07b213f31..5ea55d5247 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -559,7 +559,6 @@ static int binary_export(AVFilterContext *ctx, StreamContext *sc, const char* fi } } - avpriv_align_put_bits(&buf); flush_put_bits(&buf); fwrite(buffer, 1, put_bits_count(&buf)/8, f); fclose(f); diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c index 72b7f72f22..5458ce2596 100644 --- a/libavformat/latmenc.c +++ b/libavformat/latmenc.c @@ -211,7 +211,6 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt) } else avpriv_copy_bits(&bs, pkt->data, 8*pkt->size); - avpriv_align_put_bits(&bs); flush_put_bits(&bs); len = put_bits_count(&bs) >> 3;