diff mbox series

[FFmpeg-devel,5/5] avcodec/mobiclip: Use smaller type for codes

Message ID 20201024110500.5424-5-andreas.rheinhardt@gmail.com
State Accepted
Commit 307a1b8e54841c7924aaa24ca400ce8129d64855
Headers show
Series [FFmpeg-devel,1/5] avcodec/mobiclip: Reduce size of VLCs, inline constants
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Oct. 24, 2020, 11:05 a.m. UTC
Even though the length of these codes is > 8, only the lowest seven bits
are ever set (because the long codes are on the left of the tree), so
one can use an uint8_t for them, saving space.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/mobiclip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Oct. 24, 2020, 12:32 p.m. UTC | #1
On Sat, Oct 24, 2020 at 01:05:00PM +0200, Andreas Rheinhardt wrote:
> Even though the length of these codes is > 8, only the lowest seven bits
> are ever set (because the long codes are on the left of the tree), so
> one can use an uint8_t for them, saving space.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/mobiclip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

should be ok

[...]
diff mbox series

Patch

diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
index 4e74033498..9fa88e84a0 100644
--- a/libavcodec/mobiclip.c
+++ b/libavcodec/mobiclip.c
@@ -128,7 +128,7 @@  static const uint8_t bits0[] = {
      6,  6,  6,  6,  6,  6,  5,  5,  5,  4,  2,  3,  4,  4,
 };
 
-static const uint16_t codes0[] = {
+static const uint8_t codes0[] = {
     0x0, 0x4, 0x5, 0x6, 0x7, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA,
     0xB, 0xC, 0xD, 0xE, 0xF, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
     0x26, 0x27, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,