aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-04-22 02:29:51 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-06-12 11:52:32 +0200
commit4ef98a43ee0e3e107943deb8177f47f916d67d8c (patch)
tree1cc636db57c0dffbe0a15e4e5776cc0ed37590ec
parent9ce56f91c0e74b7cc34985fdb15050aa98aeded6 (diff)
downloadffmpeg-4ef98a43ee0e3e107943deb8177f47f916d67d8c.tar.gz
avcodec/mpeg4videoenc: Avoid branch for writing stuffing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/mpeg4videoenc.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index 2f4b1a1d52..76960c2ced 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -862,11 +862,9 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64],
*/
void ff_mpeg4_stuffing(PutBitContext *pbc)
{
- int length;
- put_bits(pbc, 1, 0);
- length = (-put_bits_count(pbc)) & 7;
- if (length)
- put_bits(pbc, length, (1 << length) - 1);
+ int length = 8 - (put_bits_count(pbc) & 7);
+
+ put_bits(pbc, length, (1 << (length - 1)) - 1);
}
/* must be called before writing the header */