ffmpeg | branch: master | Andreas Rheinhardt <[email protected]> | 
Thu Jul 30 09:06:44 2020 +0200| [61669b7c40b8dc3a0841768fb39c7567513b7cfc] | 
committer: Andreas Rheinhardt

avcodec/vlc: Add macro for ff_init_vlc_sparse()

ff_init_vlc_sparse() supports arrays of uint8_t, uint16_t and uint32_t
as input (and it also supports padding/other elements in between the
elements). This makes the typical case in which the input is a simple
array more cumbersome. E.g. for an array of uint8_t one would either
need to call the function with arguments like "array, sizeof(array[0]),
sizeof(array[0])" or with "array, 1, 1". The former is nicer, but
longer, so that the latter is mostly used. Therefore this commit adds a
macro that expands to the sizeof() construct.

Reviewed-by: Michael Niedermayer <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61669b7c40b8dc3a0841768fb39c7567513b7cfc
---

 libavcodec/vlc.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vlc.h b/libavcodec/vlc.h
index 42ccddf3fc..7cb323b62c 100644
--- a/libavcodec/vlc.h
+++ b/libavcodec/vlc.h
@@ -35,7 +35,12 @@ typedef struct RL_VLC_ELEM {
     uint8_t run;
 } RL_VLC_ELEM;
 
-#define init_vlc(vlc, nb_bits, nb_codes,                \
+#define INIT_VLC_DEFAULT_SIZES(ptr) \
+    (ptr), sizeof((ptr)[0]), sizeof((ptr)[0])
+
+#define init_vlc(...) init_vlc2(__VA_ARGS__)
+
+#define init_vlc2(vlc, nb_bits, nb_codes,               \
                  bits, bits_wrap, bits_size,            \
                  codes, codes_wrap, codes_size,         \
                  flags)                                 \

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to