Re: [FFmpeg-devel] [PATCH 07/39] avcodec/rl: Allow to create only a few VLC tables

2021-01-23 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> It is not uncommon that only the first one is used; this is similar to
> ff_init_2d_vlc_rl().
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/rl.c | 3 +++
>  libavcodec/rl.h | 8 
>  2 files changed, 11 insertions(+)
> 
> diff --git a/libavcodec/rl.c b/libavcodec/rl.c
> index c532b5bf56..93153ff723 100644
> --- a/libavcodec/rl.c
> +++ b/libavcodec/rl.c
> @@ -80,6 +80,9 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned 
> static_size)
>  int qmul = q * 2;
>  int qadd = (q - 1) | 1;
>  
> +if (!rl->rl_vlc[q])
> +return;
> +
>  if (q == 0) {
>  qmul = 1;
>  qadd = 0;
> diff --git a/libavcodec/rl.h b/libavcodec/rl.h
> index a83debccf7..26e0b32a90 100644
> --- a/libavcodec/rl.h
> +++ b/libavcodec/rl.h
> @@ -68,6 +68,14 @@ void ff_rl_init_vlc(RLTable *rl, unsigned static_size);
>  }\
>  }
>  
> +#define INIT_FIRST_VLC_RL(rl, static_size)  \
> +do {\
> +static RL_VLC_ELEM rl_vlc_table[static_size];   \
> +\
> +rl.rl_vlc[0] = rl_vlc_table;\
> +ff_rl_init_vlc(, static_size);   \
> +} while (0)
> +
>  static inline int get_rl_index(const RLTable *rl, int last, int run, int 
> level)
>  {
>  int index;
> 
Will apply all the patches up until #26 tomorrow unless there are
objections.

- 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-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 07/39] avcodec/rl: Allow to create only a few VLC tables

2020-12-10 Thread Andreas Rheinhardt
It is not uncommon that only the first one is used; this is similar to
ff_init_2d_vlc_rl().

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/rl.c | 3 +++
 libavcodec/rl.h | 8 
 2 files changed, 11 insertions(+)

diff --git a/libavcodec/rl.c b/libavcodec/rl.c
index c532b5bf56..93153ff723 100644
--- a/libavcodec/rl.c
+++ b/libavcodec/rl.c
@@ -80,6 +80,9 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
 int qmul = q * 2;
 int qadd = (q - 1) | 1;
 
+if (!rl->rl_vlc[q])
+return;
+
 if (q == 0) {
 qmul = 1;
 qadd = 0;
diff --git a/libavcodec/rl.h b/libavcodec/rl.h
index a83debccf7..26e0b32a90 100644
--- a/libavcodec/rl.h
+++ b/libavcodec/rl.h
@@ -68,6 +68,14 @@ void ff_rl_init_vlc(RLTable *rl, unsigned static_size);
 }\
 }
 
+#define INIT_FIRST_VLC_RL(rl, static_size)  \
+do {\
+static RL_VLC_ELEM rl_vlc_table[static_size];   \
+\
+rl.rl_vlc[0] = rl_vlc_table;\
+ff_rl_init_vlc(, static_size);   \
+} while (0)
+
 static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
 {
 int index;
-- 
2.25.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".