ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | Sun May 25 22:07:05 2025 +0200| [61d34c2b8eac104230f1eb914ebe2a5d45965b66] | committer: Andreas Rheinhardt
avcodec/flvenc: Combine writing bits Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61d34c2b8eac104230f1eb914ebe2a5d45965b66 --- libavcodec/flvenc.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/libavcodec/flvenc.c b/libavcodec/flvenc.c index 8f07c3c778..184e688ebd 100644 --- a/libavcodec/flvenc.c +++ b/libavcodec/flvenc.c @@ -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 = { _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".