This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 79293e8e95e792581badba8201e6dd2d68df3661
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Wed Aug 26 04:59:35 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Wed Sep 16 18:56:45 2026 +0000

    avformat/aviobuf: generate the multi-byte readers from one macro
    
    avio_rl16() through avio_rb64() are eight copies of the same two-step
    read differing only in the partial reads and shifts, so generate them
    from a macro taking those as parameters.
    
    The generated machine code is identical to the open-coded functions.
---
 libavformat/aviobuf.c | 75 ++++++++++-----------------------------------------
 1 file changed, 14 insertions(+), 61 deletions(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 60a5d33304..7012b182f6 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -714,61 +714,22 @@ int avio_read_partial(AVIOContext *s, unsigned char *buf, 
int size)
     return len;
 }
 
-unsigned int avio_rl16(AVIOContext *s)
-{
-    unsigned int val;
-    val = avio_r8(s);
-    val |= avio_r8(s) << 8;
-    return val;
-}
-
-unsigned int avio_rl24(AVIOContext *s)
-{
-    unsigned int val;
-    val = avio_rl16(s);
-    val |= avio_r8(s) << 16;
-    return val;
-}
-
-unsigned int avio_rl32(AVIOContext *s)
-{
-    unsigned int val;
-    val = avio_rl16(s);
-    val |= avio_rl16(s) << 16;
-    return val;
-}
-
-uint64_t avio_rl64(AVIOContext *s)
-{
-    uint64_t val;
-    val = (uint64_t)avio_rl32(s);
-    val |= (uint64_t)avio_rl32(s) << 32;
-    return val;
-}
-
-unsigned int avio_rb16(AVIOContext *s)
-{
-    unsigned int val;
-    val = avio_r8(s) << 8;
-    val |= avio_r8(s);
-    return val;
-}
-
-unsigned int avio_rb24(AVIOContext *s)
-{
-    unsigned int val;
-    val = avio_rb16(s) << 8;
-    val |= avio_r8(s);
-    return val;
-}
-unsigned int avio_rb32(AVIOContext *s)
-{
-    unsigned int val;
-    val = avio_rb16(s) << 16;
-    val |= avio_rb16(s);
-    return val;
+#define AVIO_READER(name, type, read1, shift1, read2, shift2)  \
+type name(AVIOContext *s)                                       \
+{                                                               \
+    type val = (type)read1(s) << shift1;                        \
+    val     |= (type)read2(s) << shift2;                        \
+    return val;                                                 \
 }
 
+AVIO_READER(avio_rl16, unsigned int, avio_r8,    0, avio_r8,    8)
+AVIO_READER(avio_rl24, unsigned int, avio_rl16,  0, avio_r8,   16)
+AVIO_READER(avio_rl32, unsigned int, avio_rl16,  0, avio_rl16, 16)
+AVIO_READER(avio_rl64, uint64_t,     avio_rl32,  0, avio_rl32, 32)
+AVIO_READER(avio_rb16, unsigned int, avio_r8,    8, avio_r8,    0)
+AVIO_READER(avio_rb24, unsigned int, avio_rb16,  8, avio_r8,    0)
+AVIO_READER(avio_rb32, unsigned int, avio_rb16, 16, avio_rb16,  0)
+AVIO_READER(avio_rb64, uint64_t,     avio_rb32, 32, avio_rb32,  0)
 int ff_get_line(AVIOContext *s, char *buf, int maxlen)
 {
     int i = 0;
@@ -908,14 +869,6 @@ GET_STR16(be, avio_rb16)
 
 #undef GET_STR16
 
-uint64_t avio_rb64(AVIOContext *s)
-{
-    uint64_t val;
-    val = (uint64_t)avio_rb32(s) << 32;
-    val |= (uint64_t)avio_rb32(s);
-    return val;
-}
-
 uint64_t ffio_read_varlen(AVIOContext *bc){
     uint64_t val = 0;
     int tmp;

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to