From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] [PATCH 6/7] avcodec/put_bits: add put_leb() Date: Tue, 30 Jan 2024 23:10:09 +0100 Message-ID: <AS8P250MB074466EC1D896FC07D3AB26A8F7D2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <8a5e6efa-9be1-4247-8330-eab641e5da0b@gmail.com> James Almer: > On 1/30/2024 6:53 PM, Andreas Rheinhardt wrote: >> James Almer: >>> 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. >> >> This function does use any internals of PutBitContext and should >> therefore be in user-code. In fact, get_leb() should not exist in >> get_bits.h. > > You could say the same about skip_1stop_8data_bits(), decode210(), > decode012() and get_vlc_multi(). Old errors do not justify new errors. (skip_1stop_8data_bits() is mostly mpegvideodec and if it were not for SVQ3 it would have been moved there already.) > > And the idea is to have these be reusable. leb is evidently going to be > used by anything AOMedia will make. Then it should be in some AOMedia header. If it should exist at all: Byte-aligned lebs should not use a GetBitContext at all. And all current users are byte-aligned. - Andreas _______________________________________________ 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 22:08 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 ` [FFmpeg-devel] [PATCH 6/7] avcodec/put_bits: add put_leb() James Almer 2024-01-30 21:53 ` Andreas Rheinhardt 2024-01-30 21:59 ` James Almer 2024-01-30 22:10 ` Andreas Rheinhardt [this message] 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=AS8P250MB074466EC1D896FC07D3AB26A8F7D2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \ --to=andreas.rheinhardt@outlook.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