From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 6/7] avcodec/put_bits: add put_leb()
Date: Tue, 30 Jan 2024 14:32:17 -0300
Message-ID: <20240130173218.63297-6-jamrial@gmail.com> (raw)
In-Reply-To: <20240130173218.63297-1-jamrial@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavcodec/put_bits.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
index 4561dc131a..04dedd3342 100644
--- a/libavcodec/put_bits.h
+++ b/libavcodec/put_bits.h
@@ -370,6 +370,22 @@ static inline void put_sbits63(PutBitContext *pb, int n, int64_t value)
put_bits64(pb, n, (uint64_t)(value) & (~(UINT64_MAX << n)));
}
+static inline void put_leb(PutBitContext *s, unsigned value)
+{
+ int len;
+ uint8_t byte;
+
+ len = (av_log2(value) + 7) / 7;
+
+ for (int i = 0; i < len; i++) {
+ byte = value >> (7 * i) & 0x7f;
+ if (i < len - 1)
+ byte |= 0x80;
+
+ put_bits_no_assert(s, 8, byte);
+ }
+}
+
/**
* Return the pointer to the byte where the bitstream writer will put
* the next bit.
--
2.43.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-01-30 17:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 17:32 [FFmpeg-devel] [PATCH 1/7 v2] avcodec: add an Immersive Audio Model and Formats frame split bsf James Almer
2024-01-30 17:32 ` [FFmpeg-devel] [PATCH 2/7 v2] avformat/demux: support inserting bitstream filters in demuxing scenarios James Almer
2024-01-30 17:32 ` [FFmpeg-devel] [PATCH 3/7 v2] avformat/mov: make MOVStreamContext refcounted James Almer
2024-01-30 22:31 ` Andreas Rheinhardt
2024-01-31 1:58 ` Michael Niedermayer
2024-01-31 2:01 ` James Almer
2024-01-30 17:32 ` [FFmpeg-devel] [PATCH 4/7 v2] avformat/mov: add support for Immersive Audio Model and Formats in ISOBMFF James Almer
2024-01-30 17:32 ` [FFmpeg-devel] [PATCH 5/7] avcodec: add an Immersive Audio Model and Formats frame merge bsf James Almer
2024-01-30 17:32 ` James Almer [this message]
2024-01-30 21:53 ` [FFmpeg-devel] [PATCH 6/7] avcodec/put_bits: add put_leb() Andreas Rheinhardt
2024-01-30 21:59 ` James Almer
2024-01-30 22:10 ` Andreas Rheinhardt
2024-01-30 22:14 ` James Almer
2024-01-30 17:32 ` [FFmpeg-devel] [PATCH 7/7] avformat/movenc: add support for Immersive Audio Model and Formats in ISOBMFF James Almer
2024-01-30 21:47 ` [FFmpeg-devel] [PATCH 1/7 v2] avcodec: add an Immersive Audio Model and Formats frame split bsf Andreas Rheinhardt
2024-01-30 22:07 ` James Almer
2024-01-30 22:11 ` Andreas Rheinhardt
2024-01-30 22:12 ` James Almer
2024-02-03 15:04 ` Andreas Rheinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240130173218.63297-6-jamrial@gmail.com \
--to=jamrial@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git