avcodec/mpeg4videoenc: Avoid branch for writing stuffing

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2024-04-22 02:29:51 +02:00
parent 9ce56f91c0
commit 4ef98a43ee
1 changed files with 3 additions and 5 deletions

View File

@ -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 */