diff mbox series

[FFmpeg-devel,17/21] avcodec/smacker: Use smaller types

Message ID 20200801134704.3647-9-andreas.rheinhardt@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/8] avcodec/smacker: Remove write-only and unused variables
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 1, 2020, 1:47 p.m. UTC
This will mean that we will need less stack space lateron when these
arrays are no longer heap-allocated.

No discernible speed impact.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/smacker.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Paul B Mahol Aug. 1, 2020, 2:07 p.m. UTC | #1
LGTM

On 8/1/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> This will mean that we will need less stack space lateron when these
> arrays are no longer heap-allocated.
>
> No discernible speed impact.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/smacker.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
> index f5193e1278..c1928e3908 100644
> --- a/libavcodec/smacker.c
> +++ b/libavcodec/smacker.c
> @@ -69,8 +69,8 @@ typedef struct HuffContext {
>      int length;
>      int current;
>      uint32_t *bits;
> -    int *lengths;
> -    int *values;
> +    uint8_t *lengths;
> +    uint8_t *values;
>  } HuffContext;
>
>  /* common parameters used for decode_bigtree */
> @@ -78,7 +78,7 @@ typedef struct DBCtx {
>      int current, length;
>      int *values;
>      VLC *v1, *v2;
> -    int *recode1, *recode2;
> +    const uint8_t *recode1, *recode2;
>      int escapes[3];
>      int *last;
>  } DBCtx;
> @@ -671,7 +671,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void
> *data,
>          skip_bits1(&gb);
>          if(h[i].current > 1) {
>              ret = init_vlc(&vlc[i], SMKTREE_BITS, h[i].current,
> -                    h[i].lengths, sizeof(int), sizeof(int),
> +                           INIT_VLC_DEFAULT_SIZES(h[i].lengths),
>                      h[i].bits, sizeof(uint32_t), sizeof(uint32_t),
> INIT_VLC_LE);
>              if (ret < 0) {
>                  av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
> --
> 2.20.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-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index f5193e1278..c1928e3908 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -69,8 +69,8 @@  typedef struct HuffContext {
     int length;
     int current;
     uint32_t *bits;
-    int *lengths;
-    int *values;
+    uint8_t *lengths;
+    uint8_t *values;
 } HuffContext;
 
 /* common parameters used for decode_bigtree */
@@ -78,7 +78,7 @@  typedef struct DBCtx {
     int current, length;
     int *values;
     VLC *v1, *v2;
-    int *recode1, *recode2;
+    const uint8_t *recode1, *recode2;
     int escapes[3];
     int *last;
 } DBCtx;
@@ -671,7 +671,7 @@  static int smka_decode_frame(AVCodecContext *avctx, void *data,
         skip_bits1(&gb);
         if(h[i].current > 1) {
             ret = init_vlc(&vlc[i], SMKTREE_BITS, h[i].current,
-                    h[i].lengths, sizeof(int), sizeof(int),
+                           INIT_VLC_DEFAULT_SIZES(h[i].lengths),
                     h[i].bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);
             if (ret < 0) {
                 av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n");