diff mbox series

[FFmpeg-devel,10/12] avcodec/dvenc: Avoid using PutBitContext fields directly

Message ID 20210325154956.2405162-10-andreas.rheinhardt@gmail.com
State Accepted
Commit 73fb1b8a9bd6a563a6b58ce8aa215f2f07e91f57
Headers show
Series [FFmpeg-devel,01/12] avcodec/vorbisenc: Remove always-false check | expand

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 March 25, 2021, 3:49 p.m. UTC
Also avoid using bitcounts in case one is actually byte-aligned.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/dvenc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c
index 134315a834..e0679c538c 100644
--- a/libavcodec/dvenc.c
+++ b/libavcodec/dvenc.c
@@ -976,11 +976,8 @@  static int dv_encode_video_segment(AVCodecContext *avctx, void *arg)
     }
 
     for (j = 0; j < 5 * s->sys->bpm; j++) {
-        int pos;
-        int size = pbs[j].size_in_bits >> 3;
         flush_put_bits(&pbs[j]);
-        pos = put_bits_count(&pbs[j]) >> 3;
-        memset(pbs[j].buf + pos, 0xff, size - pos);
+        memset(put_bits_ptr(&pbs[j]), 0xff, put_bytes_left(&pbs[j], 0));
     }
 
     if (DV_PROFILE_IS_HD(s->sys))