diff mbox series

[FFmpeg-devel,6/9] avcodec/wmavoice: Avoid code table

Message ID AS8P250MB074445A3E7C5E47555F9DEF98F7C9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit af847fe000f9eb78e3aa013ee64ab2274bfd5e68
Headers show
Series [FFmpeg-devel,1/9] avcodec/dvdata: Order code table by codes | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 4, 2022, 9:58 p.m. UTC
These codes are already ordered from left-to-right in the tree,
so one can just use ff_init_vlc_static_from_lengths().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/wmavoice.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index 8fa9db63ee..4438089e51 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -320,18 +320,10 @@  static av_cold void wmavoice_init_static_data(void)
         10, 10, 10, 12, 12, 12,
         14, 14, 14, 14
     };
-    static const uint16_t codes[] = {
-          0x0000, 0x0001, 0x0002,        //              00/01/10
-          0x000c, 0x000d, 0x000e,        //           11+00/01/10
-          0x003c, 0x003d, 0x003e,        //         1111+00/01/10
-          0x00fc, 0x00fd, 0x00fe,        //       111111+00/01/10
-          0x03fc, 0x03fd, 0x03fe,        //     11111111+00/01/10
-          0x0ffc, 0x0ffd, 0x0ffe,        //   1111111111+00/01/10
-          0x3ffc, 0x3ffd, 0x3ffe, 0x3fff // 111111111111+xx
-    };
 
-    INIT_VLC_STATIC(&frame_type_vlc, VLC_NBITS, sizeof(bits),
-                    bits, 1, 1, codes, 2, 2, 132);
+    INIT_VLC_STATIC_FROM_LENGTHS(&frame_type_vlc, VLC_NBITS,
+                                 FF_ARRAY_ELEMS(bits), bits,
+                                 1, NULL, 0, 0, 0, 0, 132);
 }
 
 static av_cold void wmavoice_flush(AVCodecContext *ctx)