1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/flvenc: Combine writing bits

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-05-25 22:07:05 +02:00
parent 7643269ec2
commit 61d34c2b8e

View File

@ -70,20 +70,23 @@ int ff_flv_encode_picture_header(MPVMainEncContext *const m)
void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level,
int run, int last)
{
unsigned code;
int bits;
if (level < 64) { // 7-bit level
put_bits(pb, 1, 0);
put_bits(pb, 1, last);
put_bits(pb, 6, run);
put_sbits(pb, 7, slevel);
bits = 1 + 1 + 6 + 7;
code = (0 << (1 + 6 + 7)) |
(last << (6 + 7)) |
(run << 7) |
(slevel & 0x7f);
} else {
/* 11-bit level */
put_bits(pb, 1, 1);
put_bits(pb, 1, last);
put_bits(pb, 6, run);
put_sbits(pb, 11, slevel);
bits = 1 + 1 + 6 + 11;
code = (1 << (1 + 6 + 11)) |
(last << (6 + 11)) |
(run << 11) |
(slevel & 0x7ff);
}
put_bits(pb, bits, code);
}
const FFCodec ff_flv_encoder = {